Commit d6d888c6 by lal

提交

parent a5ce3bfb
...@@ -38,6 +38,7 @@ public class PunchRecord implements Serializable { ...@@ -38,6 +38,7 @@ public class PunchRecord implements Serializable {
private String remarks;// 考勤备注 private String remarks;// 考勤备注
private Integer punchmode;// 考勤机打卡方式==>1:指紋;2:人脸;3:密码;4:ID卡 private Integer punchmode;// 考勤机打卡方式==>1:指紋;2:人脸;3:密码;4:ID卡
private String punchequipment;// 打卡设备 private String punchequipment;// 打卡设备
private String commentary;
private String username = ""; private String username = "";
private String dept = ""; private String dept = "";
...@@ -45,6 +46,8 @@ public class PunchRecord implements Serializable { ...@@ -45,6 +46,8 @@ public class PunchRecord implements Serializable {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public Integer getId() { public Integer getId() {
return id; return id;
} }
...@@ -262,4 +265,12 @@ public class PunchRecord implements Serializable { ...@@ -262,4 +265,12 @@ public class PunchRecord implements Serializable {
this.post = post; this.post = post;
} }
public String getCommentary() {
return commentary;
}
public void setCommentary(String commentary) {
this.commentary = commentary;
}
} }
\ No newline at end of file
...@@ -98,5 +98,8 @@ public class KqglAssoDkjl extends Model<KqglAssoDkjl> { ...@@ -98,5 +98,8 @@ public class KqglAssoDkjl extends Model<KqglAssoDkjl> {
@ApiModelProperty(value = "打卡设备 ", example = "打卡设备") @ApiModelProperty(value = "打卡设备 ", example = "打卡设备")
private String punchequipment; private String punchequipment;
@ApiModelProperty(value="解释 ",example="解释")
private String commentary;
} }
\ No newline at end of file
...@@ -68,6 +68,10 @@ public class ClockInController { ...@@ -68,6 +68,10 @@ public class ClockInController {
@ApiOperation(value = "1:考勤机打卡", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "1:考勤机打卡", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public Result<Object> punchclock(@RequestParam String json) throws Exception { public Result<Object> punchclock(@RequestParam String json) throws Exception {
String msg = "未知错误,请联系管理员";
int sbyf = 0;//0:失败;1:成功
JSONObject jsonArray = new JSONObject(json); JSONObject jsonArray = new JSONObject(json);
String asDevId = jsonArray.get("dev_id").toString();//考勤机编码 String asDevId = jsonArray.get("dev_id").toString();//考勤机编码
String asUserId = jsonArray.get("user_id").toString();//打卡用户id String asUserId = jsonArray.get("user_id").toString();//打卡用户id
...@@ -84,26 +88,46 @@ public class ClockInController { ...@@ -84,26 +88,46 @@ public class ClockInController {
int userid = user.getEmpNum(); int userid = user.getEmpNum();
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息 KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息
//pbfs;// 排班方式 1:固定排班;2:自由排班;3:自由工时 //pbfs;// 排班方式 1:固定排班;2:自由排班;3:自由工时
/*******/
long time_ = DateUtil.getStringTime(sStdIoTime, "yyyy-MM-dd HH:mm:ss");
String putime = new SimpleDateFormat("yyyy-MM-dd").format(time_);//转换打卡时间格式
//打卡当天开始时间,打卡当天结束时间
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,punchend = 0;//应打卡时间,应打卡开始时间,应打卡结束时间
boolean isRange = true;
int atttype = 0;
ClockCollectData clockt = new ClockCollectData();
/*******/
if(attgro != null) { if(attgro != null) {
List<KqglAssoKqzdkfs> kqjs = KqglAssoKqzdkfs.builder().build().selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, attgro.getId())); List<KqglAssoKqzdkfs> kqjs = KqglAssoKqzdkfs.builder().build().selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, attgro.getId()));
if(kqjs.size() > 0) { if(kqjs.size() > 0) {
long time_ = DateUtil.getStringTime(sStdIoTime, "yyyy-MM-dd HH:mm:ss"); // long time_ = DateUtil.getStringTime(sStdIoTime, "yyyy-MM-dd HH:mm:ss");
String putime = new SimpleDateFormat("yyyy-MM-dd").format(time_);//转换打卡时间格式 // String putime = new SimpleDateFormat("yyyy-MM-dd").format(time_);//转换打卡时间格式
//打卡当天开始时间,打卡当天结束时间 //打卡当天开始时间,打卡当天结束时间
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime(); // Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime(); // Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
int dkmx = 0;
//查询打卡当天是否有记录 //查询打卡当天是否有记录
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid) KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
.ge(KqglAssoDkmx::getDksj, startDate).le(KqglAssoDkmx::getDksj, endDate)); .ge(KqglAssoDkmx::getDksj, startDate).le(KqglAssoDkmx::getDksj, endDate));
AttendanceCardListDto attdate = MethodCall(qyid,userid,putime); AttendanceCardListDto attdate = MethodCall(qyid,userid,putime);
ClockCollectData clockt = new ClockCollectData();
// ClockCollectData clockt = new ClockCollectData();
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0, 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; endtime3 = 0,endtime3ks = 0,endtime3js = 0;
if(attdate.getAttsch().size() > 0) { if(attdate.getAttsch().size() > 0) {
List<AttSchedule> ash = attdate.getAttsch(); List<AttSchedule> ash = attdate.getAttsch();
int y = 0; int y = 0;
clockt.setShifid(ash.get(y).getId()); clockt.setShifid(ash.get(y).getId());
shifid = ash.get(y).getId();//班次id
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) { if(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(); 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(); endtime1 = ash.get(1).getTime();endtime1ks = ash.get(1).getStarttime();endtime1js = ash.get(1).getEndtime();
...@@ -117,8 +141,8 @@ public class ClockInController { ...@@ -117,8 +141,8 @@ public class ClockInController {
endtime3 = ash.get(5).getTime();endtime3ks = ash.get(5).getStarttime();endtime3js = ash.get(5).getEndtime(); endtime3 = ash.get(5).getTime();endtime3ks = ash.get(5).getStarttime();endtime3js = ash.get(5).getEndtime();
} }
} }
long punchcardtime,punchstart,punchend = 0;//应打卡时间,应打卡开始时间,应打卡结束时间 // long punchcardtime,punchstart,punchend = 0;//应打卡时间,应打卡开始时间,应打卡结束时间
int atttype = 0; // int atttype = 0;
if(dkmc == null) {//上班1 ****新增 if(dkmc == null) {//上班1 ****新增
punchcardtime = starttime1; punchcardtime = starttime1;
punchstart = starttime1ks; punchstart = starttime1ks;
...@@ -145,174 +169,193 @@ public class ClockInController { ...@@ -145,174 +169,193 @@ public class ClockInController {
punchcardtime = 0;punchstart = 0;punchend = 0;atttype = 7; punchcardtime = 0;punchstart = 0;punchend = 0;atttype = 7;
} }
} }
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
if(attdate.getAttsch().size() > 0 && clockt.getShifid() > 0){//有无班次
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, clockt.getShifid()));
}
//打卡记录录入 -- 打卡是否有时间范围限制 if(clockt.getShifid() != 0) {
boolean isRange = true;
if(punchstart>0 && punchend>0) { KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
String staputime = new SimpleDateFormat("HH:mm").format(punchstart);//应打卡开始时间 if(attdate.getAttsch().size() > 0 && clockt.getShifid() > 0){//有无班次
String entputime = new SimpleDateFormat("HH:mm").format(punchend);//应打卡结束时间 shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, clockt.getShifid()));
String DKputime = new SimpleDateFormat("HH:mm").format(time_);//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"HH:mm");
if (!effectiveDate) {
System.out.println("当前打卡时间不在范围内");
// 手动抛出异常
isRange = false;
// throw new Exception();
} }
}
if(isRange) { //打卡记录录入 -- 打卡是否有时间范围限制
int yzcd = shif.getYzcdfzs();//严重迟到分钟数 // boolean isRange = true;
int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数 if(punchstart>0 && punchend>0) {
if(dkmc == null) {//上班1 ****新增 String staputime = new SimpleDateFormat("HH:mm").format(punchstart);//应打卡开始时间
int sbdk1jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0; String entputime = new SimpleDateFormat("HH:mm").format(punchend);//应打卡结束时间
if(punchcardtime != 0){//有应打卡时间时 String DKputime = new SimpleDateFormat("HH:mm").format(time_);//打卡时间
Long time = (time_ - punchcardtime)/1000/60; boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"HH:mm");
if(time > 0){sbdk1jg = Math.abs(Integer.valueOf(time.toString()));}//上班1打卡结果 if (!effectiveDate) {
} System.out.println("当前打卡时间不在范围内");
int ydkcs = 0; // 手动抛出异常
if(shif != null){ydkcs = shif.getSxbcs()*2;}//应打卡次数 isRange = false;
if(sbdk1jg > yzcd) { // throw new Exception();
yzcdcs++; }
yzcdsc = sbdk1jg - yzcd;
}
if(sbdk1jg > kgcdfzs) {kgcdcs++;}
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(userid).data(putime).sbdk1(time_).sbdk1jg(sbdk1jg).ydkcs(ydkcs).qyid(qyid).dksj(startDate).yzcdcs(yzcdcs).yzcdsc(Double.valueOf(yzcdsc)).kgcdfzs(kgcdcs).build();
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
} }
dkmx = pcd.getId(); if(isRange) {
}else { //*****修改 int yzcd = shif.getYzcdfzs();//严重迟到分钟数
dkmx = dkmc.getId(); int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数
KqglAssoDkmx pcd = KqglAssoDkmx.builder().build(); if(dkmc == null) {//上班1 ****新增
int sbdk1jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() == null)){//下班1 if(punchcardtime != 0){//有应打卡时间时
pcd.setId(dkmc.getId()); Long time = (time_ - punchcardtime)/1000/60;
pcd.setXbdk1(time_);//下班1打卡时间 if(time > 0){sbdk1jg = Math.abs(Integer.valueOf(time.toString()));}//上班1打卡结果
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk1jg(0);// 打卡结果
}else{
pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
} }
} int ydkcs = 0;
if(shif != null){ydkcs = shif.getSxbcs()*2;}//应打卡次数
if(dkmc.getSbdk1() != null){ if(sbdk1jg > yzcd) {
Long time = (time_ - dkmc.getSbdk1())/1000/60; yzcdcs++;
pcd.setGzsc(Math.abs(Double.valueOf(time.toString())));//只打一次卡时计算工作时长 yzcdsc = sbdk1jg - yzcd;
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() == null)){//上班2
int sbdk2jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){sbdk2jg = Math.abs(Integer.valueOf(time.toString()));}
}
if(sbdk2jg > yzcd) {
yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk2jg - yzcd;
}
if(sbdk2jg > kgcdfzs) {kgcdcs++;}
pcd.setId(dkmc.getId());
pcd.setSbdk2(time_);//上班1打卡时间
pcd.setSbdk2jg(sbdk2jg);
pcd.setYzcdcs(yzcdcs);
pcd.setYzcdsc(Double.valueOf(yzcdsc));
pcd.setKgcdfzs(kgcdcs);
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() == null)){//下班2
pcd.setId(dkmc.getId());
pcd.setXbdk2(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk2jg(0);// 打卡结果
}else{
pcd.setXbdk2jg(Math.abs(Integer.valueOf(time.toString())));
} }
} if(sbdk1jg > kgcdfzs) {kgcdcs++;}
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(userid).data(putime).sbdk1(time_).sbdk1jg(sbdk1jg).ydkcs(ydkcs).qyid(qyid).dksj(startDate).yzcdcs(yzcdcs).yzcdsc(Double.valueOf(yzcdsc)).kgcdfzs(kgcdcs).build();
//班次为4次时,计算工作时长 if (!pcd.insert()) {
if(dkmc.getSbdk2() != null){ throw new CustomException("打卡明细-新增异常-1");
Long time = (time_ - dkmc.getSbdk2())/1000/60; }
BigDecimal om = new BigDecimal(dkmc.getGzsc()); dkmx = pcd.getId();
BigDecimal on = new BigDecimal(time); }else { //*****修改
double worktime = Math.abs(om.add(on).doubleValue()); dkmx = dkmc.getId();
pcd.setGzsc(worktime); KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录 if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() == null)){//下班1
pcd.setId(dkmc.getId());
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null) pcd.setXbdk1(time_);//下班1打卡时间
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null) if(punchcardtime != 0){//有应打卡时间时
&& (("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() == null)){//上班3 Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
int sbdk3jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0; pcd.setXbdk1jg(0);// 打卡结果
if(punchcardtime != 0){//有应打卡时间时 }else{
Long time = (time_ - punchcardtime)/1000/60; pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
if(time > 0){sbdk3jg = Math.abs(Integer.valueOf(time.toString()));} }
} }
if(sbdk3jg > yzcd) {
yzcdcs = dkmc.getYzcdcs()+1; if(dkmc.getSbdk1() != null){
yzcdsc = sbdk3jg - yzcd; Long time = (time_ - dkmc.getSbdk1())/1000/60;
} pcd.setGzsc(Math.abs(Double.valueOf(time.toString())));//只打一次卡时计算工作时长
if(sbdk3jg > kgcdfzs) {kgcdcs++;} }
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
pcd.setId(dkmc.getId());
pcd.setSbdk3(time_);//上班1打卡时间 }else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
pcd.setSbdk3jg(sbdk3jg); && (("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() == null)){//上班2
pcd.setYzcdcs(yzcdcs);
pcd.setYzcdsc(Double.valueOf(yzcdsc)); int sbdk2jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
pcd.setKgcdfzs(kgcdcs); if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录 if(time > 0){sbdk2jg = Math.abs(Integer.valueOf(time.toString()));}
}
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null) if(sbdk2jg > yzcd) {
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null) yzcdcs = dkmc.getYzcdcs()+1;
&& (!("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() != null) && (("").equals(dkmc.getXbdk3()) || dkmc.getXbdk3() == null)){//下班3 yzcdsc = sbdk2jg - yzcd;
}
pcd.setId(dkmc.getId()); if(sbdk2jg > kgcdfzs) {kgcdcs++;}
pcd.setXbdk3(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时 pcd.setId(dkmc.getId());
Long time = (time_ - punchcardtime)/1000/60; pcd.setSbdk2(time_);//上班1打卡时间
if(time > 0){ pcd.setSbdk2jg(sbdk2jg);
pcd.setXbdk3jg(0);// 打卡结果 pcd.setYzcdcs(yzcdcs);
}else{ pcd.setYzcdsc(Double.valueOf(yzcdsc));
pcd.setXbdk3jg(Math.abs(Integer.valueOf(time.toString()))); pcd.setKgcdfzs(kgcdcs);
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() == null)){//下班2
pcd.setId(dkmc.getId());
pcd.setXbdk2(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk2jg(0);// 打卡结果
}else{
pcd.setXbdk2jg(Math.abs(Integer.valueOf(time.toString())));
}
}
//班次为4次时,计算工作时长
if(dkmc.getSbdk2() != null){
Long time = (time_ - dkmc.getSbdk2())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc());
BigDecimal on = new BigDecimal(time);
double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
}
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() == null)){//上班3
int sbdk3jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){sbdk3jg = Math.abs(Integer.valueOf(time.toString()));}
}
if(sbdk3jg > yzcd) {
yzcdcs = dkmc.getYzcdcs()+1;
yzcdsc = sbdk3jg - yzcd;
}
if(sbdk3jg > kgcdfzs) {kgcdcs++;}
pcd.setId(dkmc.getId());
pcd.setSbdk3(time_);//上班1打卡时间
pcd.setSbdk3jg(sbdk3jg);
pcd.setYzcdcs(yzcdcs);
pcd.setYzcdsc(Double.valueOf(yzcdsc));
pcd.setKgcdfzs(kgcdcs);
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (!("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() != null) && (("").equals(dkmc.getXbdk3()) || dkmc.getXbdk3() == null)){//下班3
pcd.setId(dkmc.getId());
pcd.setXbdk3(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){
pcd.setXbdk3jg(0);// 打卡结果
}else{
pcd.setXbdk3jg(Math.abs(Integer.valueOf(time.toString())));
}
}
//班次为6次时,计算工作时长
if(dkmc.getSbdk3() != null){
Long time = (time_ - dkmc.getSbdk3())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc());//第二次
BigDecimal on = new BigDecimal(time);
double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
}
}
pcd.setId(dkmc.getId());
if(atttype <= 6){
int update = kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
} }
}
//班次为6次时,计算工作时长
if(dkmc.getSbdk3() != null){
Long time = (time_ - dkmc.getSbdk3())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc());//第二次
BigDecimal on = new BigDecimal(time);
double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
} }
} }else {
// System.out.println("当前打卡时间不在范围内");
pcd.setId(dkmc.getId()); msg = "当前打卡时间不在范围内";
if(atttype <= 6){ sbyf = 0;
int update = kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
} }
}
}else { }else {
System.out.println("当前打卡时间不在范围内"); msg = "当前是休息时间";
sbyf = 0;
} }
}else {
// return ResultUtil.error("打卡失败!,未加入考勤组!");
msg="打卡失败!,未加入考勤组!";
sbyf = 0;
}
/*************************************************************************************************************************************************************************************/
/*************************************************************************************************************************************************************************************/
//原始打卡记录数据录入************************************************************************************************************************************** //原始打卡记录数据录入**************************************************************************************************************************************
int results = 0; int results = 0;
Long time = (time_ - punchcardtime)/1000/60; Long time = (time_ - punchcardtime)/1000/60;
...@@ -328,41 +371,84 @@ public class ClockInController { ...@@ -328,41 +371,84 @@ public class ClockInController {
int type,status = 0; int type,status = 0;
if((atttype)%2 > 0){ if((atttype)%2 > 0){
type = 1;// 类型(类型 0:无排班打卡 1:上班 2:下班) punchcardtime == 0:无班次打卡 type = 1;// 类型(类型 0:无排班打卡 1:上班 2:下班) punchcardtime == 0:无班次打卡
if(punchcardtime == 0){status = 1;}else{ if(punchcardtime == 0 && clockt.getShifid() != 0){
status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) {
status = 2;
}else{
if(isRange) {// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休) if(isRange) {// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if(time > 0){status = 3;}else if(results == 0){status = 1;} if(time > 0){
}else {status = 2;} status = 3;
}else if(results == 0){
status = 1;
}
}else {
status = 2;
}
} }
}else{ }else{
type = 2;// 类型(类型 0:无排班打卡 1:上班 2:下班) type = 2;// 类型(类型 0:无排班打卡 1:上班 2:下班)
if(punchcardtime == 0){status = 1;}else{ if(punchcardtime == 0 && clockt.getShifid() != 0){
status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) {
status = 2;
}else{
if(isRange) { if(isRange) {
if(time < 0){status = 4;}else if(results == 0){status = 1;} if(time < 0){
}else {status = 2;} status = 4;
}else if(results == 0){
status = 1;
}
}else {
status = 2;
}
} }
} }
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式 String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
long attime; long attime;
// if(punchcardtime == 0 && !isRange){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间) // if(punchcardtime == 0 && !isRange){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间)
if(punchcardtime == 0){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间) if(punchcardtime == 0){// 考勤时间(应打卡时间)
attime = new Date().getTime();
}else{
attime = punchcardtime;
}
String remarks = ""; String remarks = "";
if(("1").equals(asVerifyMode)) {remarks = "考勤机指纹打卡";}else if(("20").equals(asVerifyMode)) {remarks = "考勤机人脸打卡";}else if(("40").equals(asVerifyMode)) {remarks = "考勤机掌纹打卡";}else if(("60").equals(asVerifyMode)) {remarks = "考勤机密码打卡";} if(("1").equals(asVerifyMode)) {
remarks = "考勤机指纹打卡";
}else if(("20").equals(asVerifyMode)) {
remarks = "考勤机人脸打卡";
}else if(("40").equals(asVerifyMode)) {
remarks = "考勤机掌纹打卡";
}else if(("60").equals(asVerifyMode)) {
remarks = "考勤机密码打卡";
}
String commentary = "未知";
if(sbyf == 1) {
commentary = "打卡成功";
}else {
commentary = msg;
}
//cardtype--1:GPS,2:WIFI,3:考勤机 //cardtype--1:GPS,2:WIFI,3:考勤机
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(time_).results(results).userId(userid).type(type).status(status).sort(atttype) KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(time_).results(results).userId(userid).type(type).status(status).sort(atttype)
.cardType(3).qyid(qyid).attdate(attdate_+" "+ClockInTool.dateToWeek2(putime)).attime(attime).dkmxid(dkmx).bcid(clockt.getShifid()).remarks(remarks).punchmode(Integer.valueOf(asVerifyMode)) .cardType(3).qyid(qyid).attdate(attdate_+" "+ClockInTool.dateToWeek2(putime)).attime(attime).dkmxid(dkmx).bcid(shifid).remarks(remarks).punchmode(Integer.valueOf(asVerifyMode))
.punchequipment(asDevId).build(); .punchequipment(asDevId).commentary(commentary).build();
if (!pre.insert()) { if (!pre.insert()) {
throw new CustomException("打卡记录-新增异常-2"); throw new CustomException("打卡记录-新增异常-2");
} }
} }
}else {
return ResultUtil.error("打卡失败!,未加入考勤组!");
}
}else { }else {
return ResultUtil.error("打卡失败!,用户不存在!"); return ResultUtil.error("打卡失败!,用户不存在!");
} }
return ResultUtil.data(null, "打卡成功");
if(sbyf == 1) {
return ResultUtil.data(null, "打卡成功");
}else {
return ResultUtil.data(msg, "打卡失败");
}
} }
@Autowired @Autowired
......
...@@ -2195,8 +2195,14 @@ public class TimeCardController { ...@@ -2195,8 +2195,14 @@ public class TimeCardController {
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime(); Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式 String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
int type = 0;
if((chpunchr.getClocktype())%2 > 0){
type = 1;
}else {
type = 2;
}
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(changed_time).results(results).userId(chpunchr.getNum()).type(chpunchr.getClocktype()).status(9).sort(chpunchr.getClocktype()) KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(changed_time).results(results).userId(chpunchr.getNum()).type(type).status(9).sort(chpunchr.getClocktype())
.cardType(3).qyid(userBean.getOrgCode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(data)).attime(clock_time_).dkmxid(dkmx.getId()).bcid(chpunchr.getBcszid()).remarks("管理员改为正常").punchmode(0) .cardType(3).qyid(userBean.getOrgCode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(data)).attime(clock_time_).dkmxid(dkmx.getId()).bcid(chpunchr.getBcszid()).remarks("管理员改为正常").punchmode(0)
.punchequipment("").build(); .punchequipment("").build();
if (!pre.insert()) { if (!pre.insert()) {
......
...@@ -105,7 +105,7 @@ public class AttendanceTaskTiming{ ...@@ -105,7 +105,7 @@ public class AttendanceTaskTiming{
*/ */
//3.添加定时任务 //3.添加定时任务
@Scheduled(cron = "0 10 15 * * ?") @Scheduled(cron = "0 55 10 * * ?")
//或直接指定时间间隔,例如:5秒 //或直接指定时间间隔,例如:5秒
//@Scheduled(fixedRate=5000) //@Scheduled(fixedRate=5000)
...@@ -155,7 +155,7 @@ public class AttendanceTaskTiming{ ...@@ -155,7 +155,7 @@ public class AttendanceTaskTiming{
KqglAssoMonthPunchSummary.builder().build().delete(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month)); KqglAssoMonthPunchSummary.builder().build().delete(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month));
// for(int t = 0;t<orgcodelist.size();t++){ // for(int t = 0;t<orgcodelist.size();t++){
int org_code = 117;//orgcodelist.get(t).getId();//企业组织代码 int org_code = 310;//orgcodelist.get(t).getId();//企业组织代码
List<AdditionalDto> userlist = kqglassoleavebalancemapper.selectAdditionalList(org_code); List<AdditionalDto> userlist = kqglassoleavebalancemapper.selectAdditionalList(org_code);
for(AdditionalDto user : userlist) { for(AdditionalDto user : userlist) {
double traveltotal = 0,egresstotal = 0,overtimetotal = 0; double traveltotal = 0,egresstotal = 0,overtimetotal = 0;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<result column="remarks" property="remarks" jdbcType="VARCHAR" /> <result column="remarks" property="remarks" jdbcType="VARCHAR" />
<result column="punchmode" property="punchmode" jdbcType="INTEGER" /> <result column="punchmode" property="punchmode" jdbcType="INTEGER" />
<result column="punchequipment" property="punchequipment" jdbcType="VARCHAR" /> <result column="punchequipment" property="punchequipment" jdbcType="VARCHAR" />
<result column="commentary" property="commentary" />
<result column="username" property="username" jdbcType="VARCHAR" /> <result column="username" property="username" jdbcType="VARCHAR" />
<result column="dept" property="dept" jdbcType="VARCHAR" /> <result column="dept" property="dept" jdbcType="VARCHAR" />
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<result column="remarks" property="remarks" /> <result column="remarks" property="remarks" />
<result column="punchmode" property="punchmode" /> <result column="punchmode" property="punchmode" />
<result column="punchequipment" property="punchequipment" /> <result column="punchequipment" property="punchequipment" />
<result column="commentary" property="commentary" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -48,7 +49,8 @@ ...@@ -48,7 +49,8 @@
bcid, bcid,
remarks, remarks,
punchmode, punchmode,
punchequipment punchequipment,
commentary
</sql> </sql>
<sql id="Base_Column_List_Alias"> <sql id="Base_Column_List_Alias">
...@@ -72,7 +74,8 @@ ...@@ -72,7 +74,8 @@
bcid KqglAssoDkjl_bcid, bcid KqglAssoDkjl_bcid,
remarks KqglAssoDkjl_remarks, remarks KqglAssoDkjl_remarks,
punchmode KqglAssoDkjl_punchmode, punchmode KqglAssoDkjl_punchmode,
punchequipment KqglAssoDkjl_punchequipment punchequipment KqglAssoDkjl_punchequipment,
commentary KqglAssoDkjl_explain
</sql> </sql>
<!-- <!--
...@@ -138,7 +141,10 @@ ...@@ -138,7 +141,10 @@
punchmode, punchmode,
</if> </if>
<if test ='null != punchequipment'> <if test ='null != punchequipment'>
punchequipment punchequipment,
</if>
<if test ='null != commentary'>
commentary
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
...@@ -200,7 +206,10 @@ ...@@ -200,7 +206,10 @@
#{punchmode}, #{punchmode},
</if> </if>
<if test ='null != punchequipment'> <if test ='null != punchequipment'>
#{punchequipment} #{punchequipment},
</if>
<if test ='null != commentary'>
#{commentary}
</if> </if>
</trim> </trim>
</insert> </insert>
...@@ -232,7 +241,8 @@ ...@@ -232,7 +241,8 @@
<if test ='null != bcid'>bcid = #{bcid},</if> <if test ='null != bcid'>bcid = #{bcid},</if>
<if test ='null != remarks'>remarks = #{remarks},</if> <if test ='null != remarks'>remarks = #{remarks},</if>
<if test ='null != punchmode'>punchmode = #{punchmode},</if> <if test ='null != punchmode'>punchmode = #{punchmode},</if>
<if test ='null != punchequipment'>punchequipment = #{punchequipment}</if> <if test ='null != punchequipment'>punchequipment = #{punchequipment},</if>
<if test ='null != commentary'>commentary = #{commentary}</if>
</set> </set>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
......
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