Commit fe2c9cb6 by leialin

Merge branch 'lal' into 'develop'

Lal

See merge request 8timerv2/8timerapiv200!287
parents 051144d0 f70602a8
...@@ -60,7 +60,7 @@ public class KqglAssoDkjl extends Model<KqglAssoDkjl> { ...@@ -60,7 +60,7 @@ public class KqglAssoDkjl extends Model<KqglAssoDkjl> {
@ApiModelProperty(value = "类型(0:无排班打卡 1:上班 2:下班)", example = "101") @ApiModelProperty(value = "类型(0:无排班打卡 1:上班 2:下班)", example = "101")
private Integer type; private Integer type;
@ApiModelProperty(value = "(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)", example = "101") @ApiModelProperty(value = "(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休 9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退)", example = "101")
private Integer status; private Integer status;
@ApiModelProperty(value = "序号(0:打卡无效:此记录已被更新) 序号(0:打卡无效:此记录已被更新)", example = "101") @ApiModelProperty(value = "序号(0:打卡无效:此记录已被更新) 序号(0:打卡无效:此记录已被更新)", example = "101")
......
...@@ -19,9 +19,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -19,9 +19,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.timer.api.bean.kqgl.AttConditions;
import cn.timer.api.bean.kqgl.AttGroupBinPunchMode;
import cn.timer.api.bean.kqgl.AttendanceGroup; import cn.timer.api.bean.kqgl.AttendanceGroup;
import cn.timer.api.bean.kqgl.AttendanceMachine;
import cn.timer.api.bean.kqgl.PunchCardAddress;
import cn.timer.api.bean.kqgl.PunchCardDetails; import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqgl.PunchRecord; import cn.timer.api.bean.kqgl.PunchCardWiFi;
import cn.timer.api.dto.kqmk.PunchRecord;
import cn.timer.api.bean.kqgl.ShiftManagement; import cn.timer.api.bean.kqgl.ShiftManagement;
import cn.timer.api.bean.kqmk.KqglAssoBcsz; import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoDkjl; import cn.timer.api.bean.kqmk.KqglAssoDkjl;
...@@ -35,8 +40,12 @@ import cn.timer.api.bean.yggl.YgglMainEmp; ...@@ -35,8 +40,12 @@ import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.exception.CustomException; import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dao.kqgl.AttGroupBinPunchModeMapper;
import cn.timer.api.dao.kqgl.AttendanceGroupMapper; import cn.timer.api.dao.kqgl.AttendanceGroupMapper;
import cn.timer.api.dao.kqgl.AttendanceMachineMapper;
import cn.timer.api.dao.kqgl.PunchCardAddressMapper;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper; import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
import cn.timer.api.dao.kqgl.PunchCardWiFiMapper;
import cn.timer.api.dao.kqgl.PunchRecordMapper; import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqgl.ShiftManagementMapper; import cn.timer.api.dao.kqgl.ShiftManagementMapper;
import cn.timer.api.dao.kqmk.KqglAssoBcszMapper; import cn.timer.api.dao.kqmk.KqglAssoBcszMapper;
...@@ -44,6 +53,7 @@ import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper; ...@@ -44,6 +53,7 @@ import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper; import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper; import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper; import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AttClockMethod;
import cn.timer.api.dto.kqmk.AttLateLate; import cn.timer.api.dto.kqmk.AttLateLate;
import cn.timer.api.dto.kqmk.AttSchedule; import cn.timer.api.dto.kqmk.AttSchedule;
import cn.timer.api.dto.kqmk.AttendanceCardListDto; import cn.timer.api.dto.kqmk.AttendanceCardListDto;
...@@ -53,7 +63,6 @@ import cn.timer.api.utils.DateUtil; ...@@ -53,7 +63,6 @@ import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@Api(tags = "3.0[3]考勤打卡") @Api(tags = "3.0[3]考勤打卡")
...@@ -466,13 +475,9 @@ public class ClockInController { ...@@ -466,13 +475,9 @@ public class ClockInController {
int dkcs_ = shif.getSxbcs();//上下班打卡次数 int dkcs_ = shif.getSxbcs();//上下班打卡次数
int iswzwd = shif.getIsWzwd();//是否开启晚走晚到(0:否;1:是) int iswzwd = shif.getIsWzwd();//是否开启晚走晚到(0:否;1:是)
//统一分钟数 double xbwz1 = 0,xbwz2=0,xbwz3=0;
double xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1 int sbwd1=0,sbwd2=0,sbwd3=0;
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;//晚到时间 int arrive_late = 0;//晚到时间
String clock_date = "";//应打卡时间 String clock_date = "";//应打卡时间
Long latetime = 0l;//前天晚走时长(分钟) Long latetime = 0l;//前天晚走时长(分钟)
...@@ -482,6 +487,14 @@ public class ClockInController { ...@@ -482,6 +487,14 @@ public class ClockInController {
long yesendtime1=0,yesendtime2=0,yesendtime3=0; long yesendtime1=0,yesendtime2=0,yesendtime3=0;
//存在晚走玩到 //存在晚走玩到
if(iswzwd > 0) { if(iswzwd > 0) {
//统一分钟数
xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1
sbwd1 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd1()) * 60));//上班晚到1
xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2
sbwd2 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd2()) * 60));//上班晚到2
xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3
sbwd3 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd3()) * 60));//上班晚到3
//获取前一天最后下班的时间 //获取前一天最后下班的时间
yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid) yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
.ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday)); .ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday));
...@@ -541,6 +554,7 @@ public class ClockInController { ...@@ -541,6 +554,7 @@ public class ClockInController {
clock_date = ClockInTool.stampToDate(String.valueOf(punchcardtime)); clock_date = ClockInTool.stampToDate(String.valueOf(punchcardtime));
Long changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(clock_date, "+"+arrive_late)));//晚到后应打卡时间 Long changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(clock_date, "+"+arrive_late)));//晚到后应打卡时间
punchcardtime = changed_time;//更换当天打卡时间 punchcardtime = changed_time;//更换当天打卡时间
Long timeyes = (time_ - changed_time)/1000/60;// Long timeyes = (time_ - changed_time)/1000/60;//
if((atttype)%2 > 0){//上班 if((atttype)%2 > 0){//上班
...@@ -578,11 +592,11 @@ public class ClockInController { ...@@ -578,11 +592,11 @@ public class ClockInController {
} }
int ydkcs = 0; int ydkcs = 0;
if(shif != null){ydkcs = shif.getSxbcs()*2;}//应打卡次数 if(shif != null){ydkcs = shif.getSxbcs()*2;}//应打卡次数
if(sbdkjg > yzcd) { if(sbdkjg > yzcd && yzcd>0) {
yzcdcs++; yzcdcs++;
yzcdsc = sbdkjg - yzcd; yzcdsc = sbdkjg - yzcd;
} }
if(sbdkjg > kgcdfzs) {kgcdcs++;} if(sbdkjg > kgcdfzs && kgcdfzs>0) {kgcdcs++;}
pcd.setYdkcs(ydkcs); pcd.setYdkcs(ydkcs);
pcd.setYzcdcs(yzcdcs); pcd.setYzcdcs(yzcdcs);
pcd.setYzcdsc(Double.valueOf(yzcdsc)); pcd.setYzcdsc(Double.valueOf(yzcdsc));
...@@ -618,11 +632,11 @@ public class ClockInController { ...@@ -618,11 +632,11 @@ public class ClockInController {
Long time = (time_ - punchcardtime)/1000/60; Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){sbdk2jg = Math.abs(Integer.valueOf(time.toString()));} if(time > 0){sbdk2jg = Math.abs(Integer.valueOf(time.toString()));}
} }
if(sbdk2jg > yzcd) { if(sbdk2jg > yzcd&& yzcd>0) {
yzcdcs = dkmc.getYzcdcs()+1; yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk2jg - yzcd; yzcdsc = sbdk2jg - yzcd;
} }
if(sbdk2jg > kgcdfzs) {kgcdcs++;} if(sbdk2jg > kgcdfzs&& kgcdfzs>0) {kgcdcs++;}
pcd.setId(dkmc.getId()); pcd.setId(dkmc.getId());
pcd.setSbdk2(time_);//上班1打卡时间 pcd.setSbdk2(time_);//上班1打卡时间
...@@ -657,11 +671,11 @@ public class ClockInController { ...@@ -657,11 +671,11 @@ public class ClockInController {
Long time = (time_ - punchcardtime)/1000/60; Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){sbdk3jg = Math.abs(Integer.valueOf(time.toString()));} if(time > 0){sbdk3jg = Math.abs(Integer.valueOf(time.toString()));}
} }
if(sbdk3jg > yzcd) { if(sbdk3jg > yzcd&& yzcd>0) {
yzcdcs = dkmc.getYzcdcs()+1; yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk3jg - yzcd; yzcdsc = sbdk3jg - yzcd;
} }
if(sbdk3jg > kgcdfzs) {kgcdcs++;} if(sbdk3jg > kgcdfzs&& kgcdfzs>0) {kgcdcs++;}
pcd.setId(dkmc.getId()); pcd.setId(dkmc.getId());
pcd.setSbdk3(time_);//上班1打卡时间 pcd.setSbdk3(time_);//上班1打卡时间
pcd.setSbdk3jg(sbdk3jg); pcd.setSbdk3jg(sbdk3jg);
...@@ -691,7 +705,7 @@ public class ClockInController { ...@@ -691,7 +705,7 @@ public class ClockInController {
} }
pcd.setId(dkmc.getId()); pcd.setId(dkmc.getId());
if(atttype <= 6 && atttype > 0 && !sbdkkd){ if(atttype <= 6 && atttype > 0 && !sbdkkd){
int update = kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录 kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
} }
} }
}else { }else {
...@@ -1027,11 +1041,11 @@ public class ClockInController { ...@@ -1027,11 +1041,11 @@ public class ClockInController {
} }
}else if(attgro.getPbfs() == 2){//自由排班 }else if(attgro.getPbfs() == 2){//自由排班
//未排班时,员工可选择班次打卡 //未排班时,员工可选择班次打卡
if(attgro.getIsXzbcdk() == 1){ // if(attgro.getIsXzbcdk() == 1){
attcar.setOptscheduling(true); // attcar.setOptscheduling(true);
}else{ // }else{
attcar.setOptscheduling(false); // attcar.setOptscheduling(false);
} // }
if(jrpb != null){ if(jrpb != null){
if(jrpb.getBcid() != 0){//有班次时("Bcid"不为0时) if(jrpb.getBcid() != 0){//有班次时("Bcid"不为0时)
KqglAssoBcsz tsrq = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, jrpb.getBcid())); KqglAssoBcsz tsrq = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, jrpb.getBcid()));
...@@ -1106,6 +1120,9 @@ public class ClockInController { ...@@ -1106,6 +1120,9 @@ public class ClockInController {
}else{ }else{
attcar.setAttgrouptype(0);//1:固定排班;2:自由排班;3:自由工时 attcar.setAttgrouptype(0);//1:固定排班;2:自由排班;3:自由工时
} }
return attcar; return attcar;
} }
...@@ -1252,7 +1269,7 @@ public class ClockInController { ...@@ -1252,7 +1269,7 @@ public class ClockInController {
*/ */
@PostMapping(value = "/AttendanceCard") @PostMapping(value = "/AttendanceCard")
@ApiOperation(value = "考勤打卡------APP打卡", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "考勤打卡------APP打卡", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 53) @ApiOperationSupport(order = 2)
public Result<Void> AttendanceCard(@CurrentUser UserBean userBean,@RequestBody ClockCollectData clock) { public Result<Void> AttendanceCard(@CurrentUser UserBean userBean,@RequestBody ClockCollectData clock) {
int qyid = userBean.getOrgCode();//坏小孩【企业id】 int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id int userid = userBean.getEmpNum();//用户id
...@@ -1572,19 +1589,19 @@ public class ClockInController { ...@@ -1572,19 +1589,19 @@ public class ClockInController {
//打卡记录 // //打卡记录
if(clock.getDiffer() == 2){//更新打卡 // if(clock.getDiffer() == 2){//更新打卡
PunchRecord punch = punchrecordmapper.selectPunchResults(startDate,endDate,userid,clock.getType()); // PunchRecord punch = punchrecordmapper.selectPunchResults(startDate,endDate,userid,clock.getType());
if(punch != null){ // if(punch != null){
PunchRecord pr = new PunchRecord(); // PunchRecord pr = new PunchRecord();
pr.setId(punch.getId()); // pr.setId(punch.getId());
pr.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:补卡 4:请假) // pr.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:补卡 4:请假)
pr.setSort(0);//序号(0:打卡无效:此记录已被更新) // pr.setSort(0);//序号(0:打卡无效:此记录已被更新)
punchrecordmapper.updateByPrimaryKeySelective(pr); // punchrecordmapper.updateByPrimaryKeySelective(pr);
}else{ // }else{
return ResultUtil.error("打卡失败"); // return ResultUtil.error("打卡失败");
} // }
} // }
PunchRecord pre = new PunchRecord(); PunchRecord pre = new PunchRecord();
pre.setDktime(Long.valueOf(clock.getPunchtime()));// 打卡时间 pre.setDktime(Long.valueOf(clock.getPunchtime()));// 打卡时间
...@@ -1659,11 +1676,204 @@ public class ClockInController { ...@@ -1659,11 +1676,204 @@ public class ClockInController {
pre.setDkmxid(dkmx);// 打卡明细id pre.setDkmxid(dkmx);// 打卡明细id
pre.setBcid(clock.getShifid());// 班次id pre.setBcid(clock.getShifid());// 班次id
punchrecordmapper.insertSelective(pre);//新增打卡记录 // punchrecordmapper.insertSelective(pre);//新增打卡记录
return ResultUtil.data(null,"打卡成功"); return ResultUtil.data(null,"打卡成功");
} }
//考勤组绑定的打卡方式
@Autowired
private AttGroupBinPunchModeMapper attgroupbinpunchmodemapper;
//考勤机
@Autowired
private AttendanceMachineMapper attendancemachinemapper;
//考勤地址
@Autowired
private PunchCardAddressMapper punchcardaddressmapper;
//考勤WIFI
@Autowired
private PunchCardWiFiMapper punchcardwifimapper;
/**
* 获取考勤打卡数据------APP打卡
* @throws ParseException
*/
@PostMapping(value = "/ClockData")
@ApiOperation(value = "获取考勤打卡数据------APP打卡", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 3)
public Result<Object> getAttClockData(@CurrentUser UserBean userBean,@RequestBody AttConditions attconditions) throws ParseException {
String str = null;
if(!("").equals(attconditions.getDate())){
str = attconditions.getDate();
}else{
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
str = sdf.format(d);
}
//前一天时间
String yesterday = ClockInTool.requires_extra_times(str,-1,3,1);//前一天
Long startDateyesterday = DateUtil.getStartTime(0,DateUtil.getStringTime(yesterday,"yyyy-MM-dd")).getTime();
Long endDateyesterday = DateUtil.getnowEndTime(23,DateUtil.getStringTime(yesterday,"yyyy-MM-dd")).getTime();
Long startDate = 0l;
Long endDate = 0l;
try {
startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息
//APP获取当前天的考勤信息
AttendanceCardListDto attdate = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),attconditions.getDate());
//外勤 true:开 false:关
if(attgro.getIsWq() == 1) {
attdate.setFieldpersonnel(true);
}else {
attdate.setFieldpersonnel(false);
}
//打卡方式
List<AttGroupBinPunchMode> attmetlist = attgroupbinpunchmodemapper.selectByPrimaryByKqzId(attgro.getId());
for(AttGroupBinPunchMode agbp:attmetlist){
//类型(1:考勤机;2:地址;3:WIFI)
if(agbp.getType() == 1){
attdate.setAttmachine(true);
}else if(agbp.getType() == 2){
attdate.setAttaddress(true);
}else{
attdate.setAttwifi(true);
}
}
//详细打卡方式
List<AttClockMethod> akms = new ArrayList<AttClockMethod>();
for(AttGroupBinPunchMode abp:attmetlist){
if(abp.getType() == 1){
AttendanceMachine kqjs = attendancemachinemapper.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 = punchcardaddressmapper.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 = punchcardwifimapper.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);
}
}
attdate.setMachine(akms);
//打卡记录
List<KqglAssoDkjl> dajllist = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum());
attdate.setAttpr(dajllist);
//当天第一次打卡 前一天晚走小时**************************************************
double latetime_ = 0;//前天晚走时长(分钟)
Long changed_time = 0l;//晚到后应打卡时间
List<AttSchedule> ash = attdate.getAttsch();
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.get(0).getId()));
int dkcs_ = shif.getSxbcs();//上下班打卡次数
int iswzwd = shif.getIsWzwd();//是否开启晚走晚到(0:否;1:是)
//统一分钟数
double xbwz1 = 0,xbwz2=0,xbwz3=0;
int sbwd1=0,sbwd2=0,sbwd3=0;
int arrive_late = 0;//晚到时间
String clock_date = "";//应打卡时间
Long latetime = 0l;//前天晚走时长(分钟)
KqglAssoDkmx yesterdaymx = KqglAssoDkmx.builder().build();
AttendanceCardListDto attdateyesterday;
long yesendtime1=0,yesendtime2=0,yesendtime3=0;
//存在晚走玩到
if(iswzwd > 0) {
//统一分钟数
xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1
sbwd1 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd1()) * 60));//上班晚到1
xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2
sbwd2 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd2()) * 60));//上班晚到2
xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3
sbwd3 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd3()) * 60));//上班晚到3
//获取前一天最后下班的时间
yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum())
.ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday));
attdateyesterday = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),yesterday);
List<AttSchedule> ashyes = attdateyesterday.getAttsch();
if(attdateyesterday.getAttsch().size() == 2 || attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) {
yesendtime1 = ashyes.get(1).getTime();
}
if(attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) {
yesendtime2 = ashyes.get(3).getTime();
}
if(attdateyesterday.getAttsch().size() == 6) {
yesendtime3 = ashyes.get(5).getTime();
}
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) {
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;
}
//ash.get(0).getTime():当天第一次应打卡时间
clock_date = ClockInTool.stampToDate(String.valueOf(ash.get(0).getTime()));
changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(clock_date, "+"+arrive_late)));//晚到后应打卡时间
}
}
attdate.setLatetime(latetime_);
attdate.setChanged_time(changed_time);
return ResultUtil.data(attdate);
}
} }
...@@ -5,7 +5,6 @@ import java.text.ParseException; ...@@ -5,7 +5,6 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -39,7 +38,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; ...@@ -39,7 +38,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.timer.api.bean.kqgl.KqglAssoKqjgly; import cn.timer.api.bean.kqgl.KqglAssoKqjgly;
import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqgl.PunchRecord; import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqgl.UserAttendanceRel; import cn.timer.api.bean.kqgl.UserAttendanceRel;
import cn.timer.api.bean.kqgl.UserEquiRelation; import cn.timer.api.bean.kqgl.UserEquiRelation;
...@@ -70,20 +68,17 @@ import cn.timer.api.bean.yggl.YgglMainEmp; ...@@ -70,20 +68,17 @@ import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.exception.CustomException; import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
import cn.timer.api.dao.kqgl.PunchRecordMapper; import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqgl.UserAttendanceRelMapper; import cn.timer.api.dao.kqgl.UserAttendanceRelMapper;
import cn.timer.api.dao.kqgl.UserEquiRelationMapper; import cn.timer.api.dao.kqgl.UserEquiRelationMapper;
import cn.timer.api.dao.kqmk.KqglAssOvertimeViceMapper; import cn.timer.api.dao.kqmk.KqglAssOvertimeViceMapper;
import cn.timer.api.dao.kqmk.KqglAssoBcszMapper; import cn.timer.api.dao.kqmk.KqglAssoBcszMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkdzMapper; import cn.timer.api.dao.kqmk.KqglAssoDkdzMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper; import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkwxMapper; import cn.timer.api.dao.kqmk.KqglAssoDkwxMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqjMapper; import cn.timer.api.dao.kqmk.KqglAssoKqjMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper; import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper; import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveEmployeeBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper; import cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper;
import cn.timer.api.dao.kqmk.KqglAssoMonthPunchSummaryMapper; import cn.timer.api.dao.kqmk.KqglAssoMonthPunchSummaryMapper;
import cn.timer.api.dao.kqmk.KqglAssoOvertimeRangeMapper; import cn.timer.api.dao.kqmk.KqglAssoOvertimeRangeMapper;
...@@ -472,8 +467,6 @@ public class TimeCardController { ...@@ -472,8 +467,6 @@ public class TimeCardController {
@Autowired @Autowired
private KqglAssoRulesViceMapper kqglassorulesvicemapper; private KqglAssoRulesViceMapper kqglassorulesvicemapper;
@Autowired
private KqglAssoLeaveEmployeeBalanceMapper kqglassoleaveemployeebalancemapper;
/** /**
* 新增/修改--假期规则 * 新增/修改--假期规则
*/ */
...@@ -579,6 +572,7 @@ public class TimeCardController { ...@@ -579,6 +572,7 @@ public class TimeCardController {
return ResultUtil.data(attendanList,"操作成功!"); return ResultUtil.data(attendanList,"操作成功!");
} }
@SuppressWarnings("all")
@GetMapping(value="/synchrotime/{code}") @GetMapping(value="/synchrotime/{code}")
@ApiOperation(value = "考勤机一键同步", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "考勤机一键同步", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> SynchronizationTime(@CurrentUser UserBean userBean,@PathVariable("code") String code) { public Result<Object> SynchronizationTime(@CurrentUser UserBean userBean,@PathVariable("code") String code) {
...@@ -602,6 +596,7 @@ public class TimeCardController { ...@@ -602,6 +596,7 @@ public class TimeCardController {
/** /**
* 移除考勤机管理员 * 移除考勤机管理员
*/ */
@SuppressWarnings("all")
@PostMapping(value = "/removeadministrator/{kqjid}/{id}") @PostMapping(value = "/removeadministrator/{kqjid}/{id}")
@ApiOperation(value = "移除考勤机管理员", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "移除考勤机管理员", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> RemoveAdministrator(@PathVariable int kqjid,@PathVariable int id, @RequestBody Map<String,String> mmd) { public Result<Object> RemoveAdministrator(@PathVariable int kqjid,@PathVariable int id, @RequestBody Map<String,String> mmd) {
...@@ -630,7 +625,8 @@ public class TimeCardController { ...@@ -630,7 +625,8 @@ public class TimeCardController {
} }
return ResultUtil.success("成功"); return ResultUtil.success("成功");
} }
@SuppressWarnings("all")
@PostMapping(value = "/modifyauthority/{kqjid}/{id}") @PostMapping(value = "/modifyauthority/{kqjid}/{id}")
@ApiOperation(value = "添加考勤机管理员", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "添加考勤机管理员", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> ModifyAuthority(@CurrentUser UserBean userBean,@PathVariable int kqjid,@PathVariable int id, @RequestBody Map<String,String> mmd) { public Result<Object> ModifyAuthority(@CurrentUser UserBean userBean,@PathVariable int kqjid,@PathVariable int id, @RequestBody Map<String,String> mmd) {
...@@ -671,6 +667,7 @@ public class TimeCardController { ...@@ -671,6 +667,7 @@ public class TimeCardController {
/** /**
* 新增考勤机 * 新增考勤机
*/ */
@SuppressWarnings("all")
@PostMapping(value = "/Attendance_machine") @PostMapping(value = "/Attendance_machine")
@ApiOperation(value = "16:新增考勤机", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "16:新增考勤机", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 16) @ApiOperationSupport(order = 16)
...@@ -1134,6 +1131,7 @@ public class TimeCardController { ...@@ -1134,6 +1131,7 @@ public class TimeCardController {
/** /**
* 删除考勤组 * 删除考勤组
*/ */
@SuppressWarnings("all")
@DeleteMapping(value = "/AttendanceGroup/{id}") @DeleteMapping(value = "/AttendanceGroup/{id}")
@ApiOperation(value = "39:删除考勤组", httpMethod = "DELETE", notes = "接口发布说明") @ApiOperation(value = "39:删除考勤组", httpMethod = "DELETE", notes = "接口发布说明")
@ApiOperationSupport(order = 39) @ApiOperationSupport(order = 39)
...@@ -1208,6 +1206,7 @@ public class TimeCardController { ...@@ -1208,6 +1206,7 @@ public class TimeCardController {
/** /**
* 新建考勤组 * 新建考勤组
*/ */
@SuppressWarnings("all")
@PostMapping(value = "/AttendanceGroup") @PostMapping(value = "/AttendanceGroup")
@ApiOperation(value = "40:新增考勤组数据", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "40:新增考勤组数据", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 40) @ApiOperationSupport(order = 40)
...@@ -1382,6 +1381,7 @@ public class TimeCardController { ...@@ -1382,6 +1381,7 @@ public class TimeCardController {
return ResultUtil.data(usatt); return ResultUtil.data(usatt);
} }
@SuppressWarnings("all")
@PostMapping(value = "/setmembers") @PostMapping(value = "/setmembers")
@ApiOperation(value = "考勤设置成员", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "考勤设置成员", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> Attsetmembers(@CurrentUser UserBean userBean,@RequestBody AttMemberSettings attsetuser) { public Result<Object> Attsetmembers(@CurrentUser UserBean userBean,@RequestBody AttMemberSettings attsetuser) {
...@@ -1487,656 +1487,11 @@ public class TimeCardController { ...@@ -1487,656 +1487,11 @@ public class TimeCardController {
private SimpleDateFormat mat = new SimpleDateFormat("yyyy-MM-dd"); private SimpleDateFormat mat = new SimpleDateFormat("yyyy-MM-dd");
@Autowired
private KqglAssoDkjlMapper kqglassodkjlmapper;
//打卡记录 //打卡记录
@Autowired @Autowired
private PunchRecordMapper punchrecordmapper; private PunchRecordMapper punchrecordmapper;
//打卡明细表
@Autowired
private PunchCardDetailsMapper punchcarddetailsservice;
/**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
* @throws ParseException
*/
@PutMapping(value = "/attscheduling")
@ApiOperation(value = "44:修改考勤组排班", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 44)
public Result<Object> updateAttscheduling(@CurrentUser UserBean userBean,@RequestBody AttendanceAssistantDto attass) throws ParseException {
int id = Integer.valueOf(attass.getAttgroupid());//修改数据id
List<KqglAssoPbmxDto> schlist = new ArrayList<KqglAssoPbmxDto>();
KqglAssoPbmxDto[] schedules = attass.getSchedules();// 排班日期【排班制】--班次id、日期
if(schedules.length>0 && attass.getAtttype() == 2){
for(int p=0;p<schedules.length;p++){
KqglAssoPbmxDto sch = KqglAssoPbmxDto.builder().userid(schedules[p].getUserid()).data(schedules[p].getData()).bcid(schedules[p].getBcid()).kqzid(Integer.valueOf(attass.getAttgroupid())).build();
schlist.add(sch);
String data = mat.format(new Date(schedules[p].getData().toString()));
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
KqglAssoBcsz banci = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, schedules[p].getBcid()));
Long sbdk1 = 0l,xbdk1 = 0l,sbdk2 = 0l,xbdk2 = 0l,sbdk3 = 0l,xbdk3 = 0l;
if(banci != null){
if(banci.getSxbcs()== 1 || banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getSbdk1(),2)+":00"));
xbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getXbdk1(),2)+":00"));
}
if(banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getSbdk2(),2)+":00"));
xbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getXbdk2(),2)+":00"));
}
if(banci.getSxbcs()== 3){
sbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getSbdk3(),2)+":00"));
xbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getXbdk3(),2)+":00"));
}
}
KqglAssoDkjl mapuca = KqglAssoDkjl.builder().build().selectOne(new QueryWrapper<KqglAssoDkjl>().lambda().gt(KqglAssoDkjl::getAttime, startDate).lt(KqglAssoDkjl::getAttime, endDate).eq(KqglAssoDkjl::getUserId, schedules[p].getUserid()).last("LIMIT 1"));
List<KqglAssoDkjl> mapucalist = kqglassodkjlmapper.selectList(new QueryWrapper<KqglAssoDkjl>().lambda().gt(KqglAssoDkjl::getAttime, startDate).lt(KqglAssoDkjl::getAttime, endDate).eq(KqglAssoDkjl::getUserId, schedules[p].getUserid()).orderByAsc(KqglAssoDkjl::getId));
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
// List<KqglAssoDkjl> initial = kqglassodkjlmapper.selectList(new QueryWrapper<KqglAssoDkjl>().lambda().gt(KqglAssoDkjl::getAttime, startDate).lt(KqglAssoDkjl::getAttime, endDate).eq(KqglAssoDkjl::getUserId, schedules[p].getUserid()).orderByAsc(KqglAssoDkjl::getId));
if(mapucalist.size() > 0){
RestMethod(mapucalist,mapucalist.get(0).getDkmxid());
}
}
KqglAssoDkjl minAttid = null,maxAttid = null;
int dkmxid = 0;
if(mapucalist.size() > 0){
//最小值
minAttid = mapucalist.stream().min(Comparator.comparing(KqglAssoDkjl::getId)).get();
//最大值
maxAttid = mapucalist.stream().max(Comparator.comparing(KqglAssoDkjl::getId)).get();
//对应打卡明细表id
dkmxid = maxAttid.getDkmxid();
}
//当天有打卡记录且当天打卡班次和当前修改后的班次不匹配再进行重新维护
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
if(banci != null){//修改后有班次打卡
if(banci.getSxbcs() == 1){//修改后一天打两次
if(mapucalist.size() > 2){/////当天打卡多条的话 取最开始打的卡和最后打的卡 作为新一轮的上下班考勤
for(KqglAssoDkjl pre : mapucalist){
if(pre.getId() != minAttid.getId() && pre.getId() != maxAttid.getId()){//去除最大和最小 其他均改为“打卡无效:此记录已被更新”
int results=0;long attime;
if((pre.getSort())%2 > 0){
Long time = (pre.getDktime() - sbdk1)/1000/60;
if(time > 0){ results= Integer.valueOf(time.toString());}
attime= sbdk1;//上班应打卡时间
}else{
Long time = (pre.getDktime() - xbdk1)/1000/60;
if(time > 0){}else{results = Math.abs(Integer.valueOf(time.toString()));}
attime = xbdk1;//下班应打卡时间
}
KqglAssoDkjl.builder().id(pre.getId()).status(0).sort(0).results(results).attime(attime).bcid(banci.getId()).build().updateById();
}else {
if(pre.getId() == minAttid.getId()){//上班
Long time = (pre.getDktime() - sbdk1)/1000/60;
int status=0,results=0;//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if(time > 0){ status=3; results=Integer.valueOf(time.toString());}else{ status = 1; results = 0;}
KqglAssoDkjl.builder().id(pre.getId()).type(1).status(status).results(results).attime(sbdk1).bcid(banci.getId()).build().updateById();
}else if(pre.getId() == maxAttid.getId()){//下班
Long time = (pre.getDktime() - xbdk1)/1000/60;
int status=0,results=0;
if(time > 0){ status = 1; results = 0;}else{ status = 4; results = Math.abs(Integer.valueOf(time.toString()));}
KqglAssoDkjl.builder().id(pre.getId()).type(2).status(status).results(results).attime(xbdk1).bcid(banci.getId()).sort(2).build().updateById();
}
}
}
KqglAssoDkjl mindata = KqglAssoDkjl.builder().id(minAttid.getId()).build().selectById();
KqglAssoDkmx.builder().id(dkmxid).sbdk1(mindata.getDktime()).sbdk1jg(mindata.getResults()).xbdk1(null).xbdk1jg(0).sbdk2(null).sbdk2jg(0).xbdk2(null)
.xbdk2jg(0).sbdk3(null).sbdk3jg(0).ydkcs(banci.getSxbcs()*2).gzsc(Double.valueOf("0")).build().updateById();
KqglAssoDkjl maxdata = KqglAssoDkjl.builder().id(maxAttid.getId()).build().selectById();
Long woktimes = (maxdata.getDktime() - mindata.getDktime())/1000/60;
KqglAssoDkmx.builder().id(dkmxid).xbdk1(maxdata.getDktime()).xbdk1jg(maxdata.getResults()).gzsc(Double.valueOf(woktimes)).build().updateById();
}else {
KqglAssoDkjl mindataone = null;
if(minAttid != null || maxAttid != null){
int status=0,results=0;
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){ status = 3; results = Integer.valueOf(time.toString()); }else{ status = 1; results=0; }
KqglAssoDkjl.builder().id(mapucalist.get(0).getId()).type(1).status(status).results(results).attime(sbdk1).bcid(banci.getId()).build().updateById();
mindataone = KqglAssoDkjl.builder().id(minAttid.getId()).build().selectById();
KqglAssoDkmx.builder().id(dkmxid).sbdk1(mindataone.getDktime()).sbdk1jg(mindataone.getResults()).ydkcs(banci.getSxbcs()*2).gzsc(Double.valueOf("0")).build().updateById();
}
if(maxAttid != null && minAttid.getId() != maxAttid.getId()){
int status=0,results=0;
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){ status = 1; results=0; }else{ status = 4; results = Math.abs(Integer.valueOf(time.toString())); }
KqglAssoDkjl.builder().id(mapucalist.get(1).getId()).type(2).status(status).results(results).attime(xbdk1).bcid(banci.getId()).sort(2).build().updateById();
KqglAssoDkjl maxdata = KqglAssoDkjl.builder().id(maxAttid.getId()).build().selectById();
Long woktimes = (maxdata.getDktime() - mindataone.getDktime())/1000/60;
KqglAssoDkmx.builder().id(dkmxid).xbdk1(maxdata.getDktime()).xbdk1jg(maxdata.getResults()).gzsc(Double.valueOf(woktimes)).build().updateById();
}
}
}else if(banci.getSxbcs() == 2){//修改后一天打四次
if(mapucalist.size() > 4){//当天打卡多次
String[] str= new String[3];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordmapper.selectByPrimaryKey(minAttid.getId());//上班
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
Long time = (mindata.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
}
if(y == 1 || y == 2){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
if((mapucalist.get(y).getSort())%2 == 0){//下班
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
str[0] = String.valueOf(mapucalist.get(y).getId());
}else{//上班
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
str[1] = String.valueOf(mapucalist.get(y).getId());
}
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
}
PunchRecord maxdata = punchrecordmapper.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (maxdata.getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setSort(4);
record.setAttime(xbdk2);
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
str[2] = String.valueOf(maxdata.getId());
}
if(y == 3 || y > 3 && mapucalist.get(y).getId() != maxdata.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord mindata = punchrecordmapper.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else{
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}else{//打卡小于4次
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
mindataone = punchrecordmapper.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 3){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 4){
PunchRecord record = new PunchRecord();
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
}
}else if(banci.getSxbcs() == 3){//修改后一天打六次
if(mapucalist.size() > 6){//当天打卡多次
String[] str= new String[5];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordmapper.selectByPrimaryKey(minAttid.getId());//上班
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
Long time = (mindata.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
}
if(y == 1 || y == 2 || y == 3 || y == 4){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
if((mapucalist.get(y).getSort())%2 == 0){//下班
if(y == 1){
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
str[0] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 3){
Long time = (mapucalist.get(y).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//下班应打卡时间
str[2] = String.valueOf(mapucalist.get(y).getId());
}
}else{//上班
if(y == 2){
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
str[1] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 4){
Long time = (mapucalist.get(y).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//上班应打卡时间
str[3] = String.valueOf(mapucalist.get(y).getId());
}
}
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
}
PunchRecord maxdata = punchrecordmapper.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (maxdata.getDktime() - xbdk3)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setSort(6);
record.setAttime(xbdk3);
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
str[4] = String.valueOf(maxdata.getId());
}
if(y == 5 || y > 5 && mapucalist.get(y).getId() != maxdata.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord mindata = punchrecordmapper.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else if(t == 2){
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}else if(t == 3){
dkmx.setSbdk3(dtdkmx.getDktime());
dkmx.setSbdk3jg(dtdkmx.getResults());// 上班3打卡结果
}else{
dkmx.setXbdk3(dtdkmx.getDktime());
dkmx.setXbdk3jg(dtdkmx.getResults());// 下班3打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}else{
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
mindataone = punchrecordmapper.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 3){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 4){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(3).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(3).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(mapucalist.get(3).getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 5){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(4).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(4).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(mapucalist.get(4).getId());//单条打卡明细
pcd.setSbdk3(dtdkmx.getDktime());
pcd.setSbdk3jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 6){
PunchRecord record = new PunchRecord();
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk3)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordmapper.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordmapper.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk3(dtdkmx.getDktime());
pcd.setXbdk3jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
}
}
}else{////修改后班次为休息的
RestMethod(mapucalist,dkmxid);
}
}
}
}
if(schlist.size()>0){
//删除排班明细表(自由排班)
KqglAssoPbmx.builder().build().delete(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getKqzid, id));
kqglassopbmxmapper.insertKqglAssoPbmxList(schlist);
return ResultUtil.data(schlist,"修改考勤组排班成功");
}
return ResultUtil.error("修改考勤组排班失败");
}
/**
* 班次修改调用方法
*/
public void RestMethod(List<KqglAssoDkjl> mapucalist,int dkmxid){
int q = 1;
for(KqglAssoDkjl pres : mapucalist){
int type = 0;
if(q%2 > 0){type= 1;}else{type = 2;}
KqglAssoDkjl.builder().id(pres.getId()).results(0).type(type).status(1).sort(q).attime(pres.getDktime()).bcid(0).build().updateById();
q++;
}
if(mapucalist.size() > 0){/*******修改打卡明细数据****/
KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
if(mapucalist.size() >= 1){ pcd.setSbdk1(mapucalist.get(0).getDktime());pcd.setSbdk1jg(0);}
if(mapucalist.size() >= 2){ pcd.setXbdk1(mapucalist.get(1).getDktime());pcd.setXbdk1jg(0);}
if(mapucalist.size() >= 3){ pcd.setSbdk2(mapucalist.get(2).getDktime());pcd.setSbdk2jg(0);}
if(mapucalist.size() >= 4){ pcd.setXbdk2(mapucalist.get(3).getDktime()); pcd.setXbdk2jg(0);}
if(mapucalist.size() >= 5){ pcd.setSbdk3(mapucalist.get(4).getDktime()); pcd.setSbdk3jg(0);}
if(mapucalist.size() >= 6){ pcd.setXbdk3(mapucalist.get(5).getDktime()); pcd.setXbdk3jg(0);}
pcd.setId(dkmxid);
pcd.updateById();
}
}
@PostMapping(value = "/leave_balance_list") @PostMapping(value = "/leave_balance_list")
...@@ -2531,13 +1886,28 @@ public class TimeCardController { ...@@ -2531,13 +1886,28 @@ public class TimeCardController {
int type = 0; int type = 0;
//0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休
//9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退
int status = 2;
if((chpunchr.getClocktype())%2 > 0){ if((chpunchr.getClocktype())%2 > 0){
type = 1; type = 1;
if(results == 0) {
status = 9;
}else {
status = 10;
}
}else { }else {
type = 2; type = 2;
if(results == 0) {
status = 9;
}else {
status = 11;
}
} }
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(changed_time).results(results).userId(chpunchr.getNum()).type(type).status(9).sort(chpunchr.getClocktype()) KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(changed_time).results(results).userId(chpunchr.getNum()).type(type).status(status).sort(chpunchr.getClocktype())
.cardType(0).qyid(userBean.getOrgCode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(data)).attime(clock_time_).dkmxid(dkmxid).bcid(chpunchr.getBcszid()).remarks("管理员更改操作").punchmode(0) .cardType(0).qyid(userBean.getOrgCode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(data)).attime(clock_time_).dkmxid(dkmxid).bcid(chpunchr.getBcszid()).remarks("管理员更改操作").punchmode(0)
.punchequipment("").build(); .punchequipment("").build();
if (!pre.insert()) { if (!pre.insert()) {
...@@ -2776,11 +2146,11 @@ public class TimeCardController { ...@@ -2776,11 +2146,11 @@ public class TimeCardController {
} }
}else if(attgro.getPbfs() == 2){//自由排班 }else if(attgro.getPbfs() == 2){//自由排班
//未排班时,员工可选择班次打卡 //未排班时,员工可选择班次打卡
if(attgro.getIsXzbcdk() == 1){ // if(attgro.getIsXzbcdk() == 1){
attcar.setOptscheduling(true); // attcar.setOptscheduling(true);
}else{ // }else{
attcar.setOptscheduling(false); // attcar.setOptscheduling(false);
} // }
if(jrpb != null){ if(jrpb != null){
if(jrpb.getBcid() != 0){//有班次时("Bcid"不为0时) if(jrpb.getBcid() != 0){//有班次时("Bcid"不为0时)
KqglAssoBcsz tsrq = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, jrpb.getBcid())); KqglAssoBcsz tsrq = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, jrpb.getBcid()));
...@@ -2986,6 +2356,7 @@ public class TimeCardController { ...@@ -2986,6 +2356,7 @@ public class TimeCardController {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
String current = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); String current = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
String yue = new SimpleDateFormat("yyyy-MM").format(new Date());
Long startMonth = 0l; Long startMonth = 0l;
Long endMonth = 0l; Long endMonth = 0l;
...@@ -2995,20 +2366,30 @@ public class TimeCardController { ...@@ -2995,20 +2366,30 @@ public class TimeCardController {
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天 c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
String first = mat.format(c.getTime()); String first = mat.format(c.getTime());
startMonth = DateUtil.getStartTime(0,DateUtil.getStringTime(first,"yyyy-MM-dd")).getTime(); startMonth = DateUtil.getStartTime(0,DateUtil.getStringTime(first,"yyyy-MM-dd")).getTime();
//获取当前月最后一天 endMonth = new Date().getTime();
Calendar ca = Calendar.getInstance();
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH)); // //获取当前月最后一天
String last = mat.format(ca.getTime()); // Calendar ca = Calendar.getInstance();
endMonth = DateUtil.getnowEndTime(23,DateUtil.getStringTime(last,"yyyy-MM-dd")).getTime(); // ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
// String last = mat.format(ca.getTime());
// endMonth = DateUtil.getnowEndTime(23,DateUtil.getStringTime(last,"yyyy-MM-dd")).getTime();
}else { }else {
String time = date+"-01"; String time = date+"-01";
String sdaet = ClockInTool.getMinMonthDate(time); String sdaet = ClockInTool.getMinMonthDate(time);
startMonth = ClockInTool.getStartTime(0,ClockInTool.getStringTime(sdaet,"yyyy-MM-dd")).getTime(); startMonth = ClockInTool.getStartTime(0,ClockInTool.getStringTime(sdaet,"yyyy-MM-dd")).getTime();
String edate = ClockInTool.getMaxMonthDate(time); String edate = ClockInTool.getMaxMonthDate(time);
endMonth = ClockInTool.getnowEndTime(23,ClockInTool.getStringTime(edate,"yyyy-MM-dd")).getTime(); endMonth = ClockInTool.getnowEndTime(23,ClockInTool.getStringTime(edate,"yyyy-MM-dd")).getTime();
if(date.equals(yue)) {
endMonth = new Date().getTime();
}
} }
String[] rangeArray=ClockInTool.listToString(ClockInTool.getDays(df.format(startMonth),df.format(endMonth))).split(";");//目前为止所有日期 String[] rangeArray=ClockInTool.listToString(ClockInTool.getDays(df.format(startMonth),df.format(endMonth))).split(";");//目前为止所有日期
String[] range=rangeArray[0].split(","); String[] range=rangeArray[0].split(",");
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息 KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息
...@@ -3028,9 +2409,22 @@ public class TimeCardController { ...@@ -3028,9 +2409,22 @@ public class TimeCardController {
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空 if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
if(current.equals(num)) { if(date == null || ("").equals(date)) {//未输入 当月
bcid = ashss.get(0).getId();//班次id if(current.equals(num)) {
} bcid = ashss.get(0).getId();//班次id
}
}else {//输入
if(date.equals(yue)) {//输入为当月
if(current.equals(num)) {
bcid = ashss.get(0).getId();//班次id
}
}else {//输入不是当月
String time = date+"-01";
if(time.equals(num)) {
bcid = ashss.get(0).getId();//班次id
}
}
}
if(ashss.get(0).getId() != 0) { if(ashss.get(0).getId() != 0) {
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode()) KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode())
...@@ -3082,16 +2476,38 @@ public class TimeCardController { ...@@ -3082,16 +2476,38 @@ public class TimeCardController {
List<CalendarPunchDetailsDto> detailed = new ArrayList<CalendarPunchDetailsDto>(); List<CalendarPunchDetailsDto> detailed = new ArrayList<CalendarPunchDetailsDto>();
CalendarPunchDetailsDto dets = CalendarPunchDetailsDto.builder().build(); CalendarPunchDetailsDto dets = CalendarPunchDetailsDto.builder().build();
dets.setDate(current); // dets.setDate(current);
// detailed.add(dets1); // detailed.add(dets1);
Long starttime = DateUtil.getStartTime(0,DateUtil.getStringTime(current,"yyyy-MM-dd")).getTime(); Long starttime = DateUtil.getStartTime(0,DateUtil.getStringTime(current,"yyyy-MM-dd")).getTime();
Long endtime = DateUtil.getnowEndTime(23,DateUtil.getStringTime(current,"yyyy-MM-dd")).getTime(); Long endtime = DateUtil.getnowEndTime(23,DateUtil.getStringTime(current,"yyyy-MM-dd")).getTime();
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode()) KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build();
.ge(KqglAssoDkmx::getDksj, starttime).le(KqglAssoDkmx::getDksj, endtime)); if(date == null || ("").equals(date)) {//未输入 当月
dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode())
.ge(KqglAssoDkmx::getDksj, starttime).le(KqglAssoDkmx::getDksj, endtime));
dets.setDate(current);
}else {//输入
if(date.equals(yue)) {//输入为当月
dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode())
.ge(KqglAssoDkmx::getDksj, starttime).le(KqglAssoDkmx::getDksj, endtime));
dets.setDate(current);
}else {//输入不是当月
String time = date+"-01";
Long starttime_ = DateUtil.getStartTime(0,DateUtil.getStringTime(time,"yyyy-MM-dd")).getTime();
Long endtime_ = DateUtil.getnowEndTime(23,DateUtil.getStringTime(time,"yyyy-MM-dd")).getTime();
dets.setDate(time);
dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode())
.ge(KqglAssoDkmx::getDksj, starttime_).le(KqglAssoDkmx::getDksj, endtime_));
}
}
// KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode())
// .ge(KqglAssoDkmx::getDksj, starttime).le(KqglAssoDkmx::getDksj, endtime));
if(dkmc!=null) { if(dkmc!=null && dkmc.getData() != null) {
// CalendarPunchDetailsDto dets = CalendarPunchDetailsDto.builder().build(); // CalendarPunchDetailsDto dets = CalendarPunchDetailsDto.builder().build();
dets.setSbdksj1(dkmc.getSbdk1() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getSbdk1()))); dets.setSbdksj1(dkmc.getSbdk1() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getSbdk1())));
dets.setSbdksj1jg(dkmc.getSbdk1jg()); dets.setSbdksj1jg(dkmc.getSbdk1jg());
......
...@@ -716,10 +716,26 @@ public class KqglServiceImpl implements KqglService { ...@@ -716,10 +716,26 @@ public class KqglServiceImpl implements KqglService {
dkmxid = pcd.getId(); dkmxid = pcd.getId();
} }
//0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休
//9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退
int status = 2;
if((atttype)%2 > 0){ if((atttype)%2 > 0){
type = 1; type = 1;
if(results == 0) {
status = 12;
}else {
status = 13;
}
}else { }else {
type = 2; type = 2;
if(results == 0) {
status = 12;
}else {
status = 14;
}
} }
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(cardrepltime,"yyyy-MM-dd")).getTime(); Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(cardrepltime,"yyyy-MM-dd")).getTime();
...@@ -727,7 +743,7 @@ public class KqglServiceImpl implements KqglService { ...@@ -727,7 +743,7 @@ public class KqglServiceImpl implements KqglService {
//attime 应打卡时间 //attime 应打卡时间
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(repaappr.getCardrepltime()).results(results).userId(repaappr.getUserid()).type(type).status(5).sort(atttype) KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(repaappr.getCardrepltime()).results(results).userId(repaappr.getUserid()).type(type).status(status).sort(atttype)
.cardType(0).qyid(repaappr.getOrgcode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(cardrepltime)).attime(attime).dkmxid(dkmxid).bcid(shifid).remarks("审批补卡通过打卡").punchmode(0) .cardType(0).qyid(repaappr.getOrgcode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(cardrepltime)).attime(attime).dkmxid(dkmxid).bcid(shifid).remarks("审批补卡通过打卡").punchmode(0)
.punchequipment("").commentary("成功打卡").build(); .punchequipment("").commentary("成功打卡").build();
......
package cn.timer.api.dao.kqmk; package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoDkjl; import cn.timer.api.bean.kqmk.KqglAssoDkjl;
/** /**
...@@ -12,5 +15,5 @@ import cn.timer.api.bean.kqmk.KqglAssoDkjl; ...@@ -12,5 +15,5 @@ import cn.timer.api.bean.kqmk.KqglAssoDkjl;
*/ */
@Repository @Repository
public interface KqglAssoDkjlMapper extends BaseMapper<KqglAssoDkjl> { public interface KqglAssoDkjlMapper extends BaseMapper<KqglAssoDkjl> {
List<KqglAssoDkjl> getDetailedRecordClock(Long start,Long end,Integer userId);
} }
...@@ -3,6 +3,8 @@ package cn.timer.api.dto.kqmk; ...@@ -3,6 +3,8 @@ package cn.timer.api.dto.kqmk;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import cn.timer.api.bean.kqmk.KqglAssoDkjl;
import cn.timer.api.bean.kqmk.KqglAssoDkjl.KqglAssoDkjlBuilder;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
...@@ -21,9 +23,9 @@ public class AttendanceCardListDto implements Serializable { ...@@ -21,9 +23,9 @@ public class AttendanceCardListDto implements Serializable {
private boolean attaddress;// 考勤地址 private boolean attaddress;// 考勤地址
private boolean attwifi;// 考勤WIFI private boolean attwifi;// 考勤WIFI
private List<AttClockMethod> machine;// 详细打卡方式 private List<AttClockMethod> machine;// 详细打卡方式
private List<PunchRecord> attpr;// 打卡记录 private List<KqglAssoDkjl> attpr;// 打卡记录
private boolean optscheduling;// 未排班时,员工可选择班次打卡 // private boolean optscheduling;// 未排班时,员工可选择班次打卡
private boolean fieldpersonnel;// 外勤 true:开 false:关 private boolean fieldpersonnel;// 外勤 true:开 false:关
...@@ -37,8 +39,9 @@ public class AttendanceCardListDto implements Serializable { ...@@ -37,8 +39,9 @@ public class AttendanceCardListDto implements Serializable {
private boolean islatelate;// 晚走晚到 private boolean islatelate;// 晚走晚到
private List<AttLateLate> attlat;// 晚走晚到时间 private List<AttLateLate> attlat;// 晚走晚到时间
private String latetime;// 前一天晚走小时**** private double latetime;// 前天晚走时长(分钟)
private Long changed_time;// 根据班次规则计算出的 应晚到的打卡时间
private List<SystemShift> ssfh;// 无排班时获取的系统班次 // private List<SystemShift> ssfh;// 无排班时获取的系统班次
private Integer attgrouptype;// 1:固定排班;2:自由排班;3:自由工时 private Integer attgrouptype;// 1:固定排班;2:自由排班;3:自由工时
} }
...@@ -39,6 +39,7 @@ public class DailyDetailsDto { ...@@ -39,6 +39,7 @@ public class DailyDetailsDto {
private String bcxbdk2; private String bcxbdk2;
private String bcsbdk3; private String bcsbdk3;
private String bcxbdk3; private String bcxbdk3;
private Integer isxbdk;
private Integer dktj1; private Integer dktj1;
private Integer dktj2; private Integer dktj2;
......
...@@ -78,6 +78,13 @@ ...@@ -78,6 +78,13 @@
commentary KqglAssoDkjl_explain commentary KqglAssoDkjl_explain
</sql> </sql>
<select id="getDetailedRecordClock" resultMap="BaseResultMap">
select * from kqgl_asso_dkjl dkjl
where dkjl.attime &gt;= #{start}
and dkjl.attime &lt;= #{end}
and dkjl.user_id = #{userId,jdbcType=INTEGER}
and dkjl.status != 0
</select>
<!-- <!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkjl"> <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkjl">
......
...@@ -167,6 +167,7 @@ ...@@ -167,6 +167,7 @@
<result column="bcxbdk2" property="bcxbdk2" /> <result column="bcxbdk2" property="bcxbdk2" />
<result column="bcsbdk3" property="bcsbdk3" /> <result column="bcsbdk3" property="bcsbdk3" />
<result column="bcxbdk3" property="bcxbdk3" /> <result column="bcxbdk3" property="bcxbdk3" />
<result column="isxbdk" property="isxbdk" />
<result column="dktj1" property="dktj1" /> <result column="dktj1" property="dktj1" />
<result column="dktj2" property="dktj2" /> <result column="dktj2" property="dktj2" />
...@@ -349,7 +350,20 @@ ...@@ -349,7 +350,20 @@
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times}))) WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)),(select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2 WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as ydkcs, and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as ydkcs,
IFNULL((select bc.is_xbdk from kqgl_asso_bcsz bc where bc.id = ((CASE WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 1
THEN (IFNULL((select zh.bcid from kqgl_asso_zhoupaiban zh where zh.kqzid = sum.att_group
and zh.type = (select CASE WHEN DAYNAME(#{param.times}) = 'Monday' THEN '1'
WHEN DAYNAME(#{param.times}) = 'Tuesday' THEN '2'
WHEN DAYNAME(#{param.times}) = 'Wednesday' THEN '3'
WHEN DAYNAME(#{param.times}) = 'Thursday' THEN '4'
WHEN DAYNAME(#{param.times}) = 'Friday' THEN '5'
WHEN DAYNAME(#{param.times}) = 'Saturday' THEN '6' ELSE '7' END)), (select te.bcid from kqgl_asso_teshu te where te.kqzid = sum.att_group and te.tsrq = #{param.times})))
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as isxbdk,
'' address,'' remarks,'' cardtype,'' macaddress,'' macname, '' address,'' remarks,'' cardtype,'' macaddress,'' macname,
IFNULL(rtj.attdate, '') attdate,IFNULL(rtj.userid,'') userid, IFNULL(rtj.attdate, '') attdate,IFNULL(rtj.userid,'') userid,
#{param.times} data, #{param.times} data,
......
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