Commit b3158474 by lal Committed by chenzg

提交

parent cd6144c7
......@@ -111,6 +111,7 @@ import cn.timer.api.dto.kqmk.DailyDetailsDto;
import cn.timer.api.dto.kqmk.DetailsofbusinessDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
import cn.timer.api.dto.kqmk.IndividualOvertimeRuleDto;
import cn.timer.api.dto.kqmk.JiaqibalanceDto;
import cn.timer.api.dto.kqmk.KqglAssoLeaveRulesDto;
import cn.timer.api.dto.kqmk.KqglAssoMonthPunchSummaryDto;
import cn.timer.api.dto.kqmk.KqglAssoOvertimeRulesDto;
......@@ -871,9 +872,9 @@ public class TimeCardController {
* 根据考勤余额id获取信息
*/
@GetMapping(value="/hqleavebalance/{id}")
@ApiOperation(value = "获取班次信息-根据班次id", httpMethod = "GET", notes = "接口发布说明")
@ApiOperation(value = "根据考勤余额id获取信息", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> hqleavebalance(@PathVariable("id") Integer id,@CurrentUser UserBean userBean) {
EmployeeLeaveBalanceDto leanemp = kqglassoleavebalancemapper.selectleavebalanceList(id,userBean.getEmpNum());
JiaqibalanceDto leanemp = kqglassoleavebalancemapper.selectleavebalanceList(id,userBean.getEmpNum());
return ResultUtil.data(leanemp, "操作成功!");
}
......
......@@ -105,7 +105,7 @@ public class AttendanceTaskTiming{
*/
//3.添加定时任务 每天下午七点执行一次
// @Scheduled(cron = "0 0 19 * * ?")
@Scheduled(cron = "0 50 8 * * ?")
//或直接指定时间间隔,例如:5秒
//@Scheduled(fixedRate=5000)
......
......@@ -2,6 +2,7 @@ package cn.timer.api.controller.kqgl.service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -10,23 +11,31 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoDkjl;
import cn.timer.api.bean.kqmk.KqglAssoDkmx;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.controller.kqgl.ClockInController;
import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.controller.kqgl.EmptyUtil;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AttEvectionApprovalDto;
import cn.timer.api.dto.kqmk.AttLateLate;
import cn.timer.api.dto.kqmk.AttLeaveApprovalDto;
import cn.timer.api.dto.kqmk.AttOvertimeApprovalDto;
import cn.timer.api.dto.kqmk.AttRepairApprovalDto;
import cn.timer.api.dto.kqmk.AttSchedule;
import cn.timer.api.dto.kqmk.AttendanceCardListDto;
import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
import cn.timer.api.utils.DateUtil;
/**
......@@ -144,6 +153,12 @@ public class KqglServiceImpl implements KqglService {
boolean isRange = true;
int atttype = 0;//类型(0:无排班打卡 1:上班 2:下班)
int results = 0;//打卡结果
int type = 0;
long attime = 0l;//应打卡时间戳
int dkmxid = 0;//打卡明细ID
Long start_time = null;
Long end_time = null;
try {
......@@ -156,16 +171,15 @@ public class KqglServiceImpl implements KqglService {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(repaappr.getUserid()).appTime(cardrepltime).approvalId(repaappr.getRepairid()).approvalType(5).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(repaappr.getCardrepltime())).orgCode(repaappr.getOrgcode()).build().insert();
ClockInController clo = new ClockInController();
int shifid = 0;
try {
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(repaappr.getUserid(),repaappr.getOrgcode()); //考勤组信息
if(attgro != null) {
AttendanceCardListDto attdate = clo.MethodCall(repaappr.getOrgcode(),repaappr.getUserid(),cardrepltime);//获取当天打卡班次信息
AttendanceCardListDto attdate = MethodCall(repaappr.getOrgcode(),repaappr.getUserid(),cardrepltime);//获取当天打卡班次信息
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
List<AttSchedule> ash = attdate.getAttsch();//获取当天应打卡时间
shifid = ash.get(0).getId();//班次id
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
endtime3 = 0,endtime3ks = 0,endtime3js = 0;
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
......@@ -181,12 +195,16 @@ public class KqglServiceImpl implements KqglService {
endtime3 = ash.get(5).getTime();endtime3ks = ash.get(5).getStarttime();endtime3js = ash.get(5).getEndtime();
}
if(ash.get(0).getId() != 0) {//有排班 非休息
if(ash.get(0).getId() != 0) { //有排班 非休息
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, shifid));
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, repaappr.getUserid()).eq(KqglAssoDkmx::getQyid, repaappr.getOrgcode())
.ge(KqglAssoDkmx::getDksj, start_time).le(KqglAssoDkmx::getDksj, end_time));//获取补卡当天是否有打卡记录
if(dkmc != null) {
dkmxid = dkmc.getId();
if(attdate.getAttsch().size() == 2) {//一套班次
if(repaappr.getCardreplperiod() == 1 && dkmc.getSbdk1() != null) {//上班
if(repaappr.getCardreplperiod() == 1 && dkmc.getSbdk1() == null) {//上班
if(starttime1ks > 0 && starttime1js > 0) {
// boolean sb1 = verification_range(starttime1ks,starttime1js,repaappr.getCardrepltime());
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks);//应打卡开始时间
......@@ -198,8 +216,8 @@ public class KqglServiceImpl implements KqglService {
isRange = false;
}
}
int sbdkjg = -2;
if(isRange) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
......@@ -213,7 +231,10 @@ public class KqglServiceImpl implements KqglService {
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk1(repaappr.getCardrepltime()).sbdk1jg(sbdkjg).gzsc(gzsctime).build().updateById();
}
}else if(repaappr.getCardreplperiod() == 2 && dkmc.getXbdk1() != null) {//下班
atttype = 1;
results = sbdkjg;
attime = starttime1;
}else if(repaappr.getCardreplperiod() == 2 && dkmc.getXbdk1() == null) {//下班
if(endtime1ks > 0 && endtime1js > 0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js);//应打卡结束时间
......@@ -224,8 +245,9 @@ public class KqglServiceImpl implements KqglService {
isRange = false;
}
}
int xbdk1jg = -2;
if(isRange) {
int xbdk1jg = 0 ;
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
......@@ -237,12 +259,16 @@ public class KqglServiceImpl implements KqglService {
}
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk1(repaappr.getCardrepltime()).xbdk1jg(xbdk1jg).gzsc(gzsctime).build().updateById();
}
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
}else if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb1 = verification_range(starttime1ks,starttime1js,repaappr.getCardrepltime());
if(sb1 && dkmc.getSbdk1() != null) {
int sbdkjg = 0;
if(sb1 && dkmc.getSbdk1() == null) {
int sbdkjg = -2;
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
......@@ -250,11 +276,15 @@ public class KqglServiceImpl implements KqglService {
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk1(repaappr.getCardrepltime()).sbdk1jg(sbdkjg).gzsc(gzsctime).build().updateById();
atttype = 1;
results = sbdkjg;
attime = starttime1;
}
boolean sb2 = verification_range(starttime2ks,starttime2js,repaappr.getCardrepltime());
if(sb2 && dkmc.getSbdk2() != null) {
int sbdkjg = 0;
if(sb2 && dkmc.getSbdk2() == null) {
int sbdkjg = -2;
Long time = (repaappr.getCardrepltime() - starttime2)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
......@@ -262,12 +292,16 @@ public class KqglServiceImpl implements KqglService {
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk2(repaappr.getCardrepltime()).sbdk2jg(sbdkjg).gzsc(gzsctime).build().updateById();
atttype = 3;
results = sbdkjg;
attime = starttime2;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb1 = verification_range(endtime1ks,endtime1js,repaappr.getCardrepltime());
if(xb1 && dkmc.getXbdk1() != null) {
int xbdk1jg = 0 ;
if(xb1 && dkmc.getXbdk1() == null) {
int xbdk1jg = -2;
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
......@@ -275,11 +309,15 @@ public class KqglServiceImpl implements KqglService {
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk1(repaappr.getCardrepltime()).xbdk1jg(xbdk1jg).gzsc(gzsctime).build().updateById();
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
boolean xb2 = verification_range(endtime2ks,endtime2js,repaappr.getCardrepltime());
if(xb2 && dkmc.getXbdk2() != null) {
int xbdk2jg = 0 ;
if(xb2 && dkmc.getXbdk2() == null) {
int xbdk2jg = -2;
Long time = (repaappr.getCardrepltime() - endtime2)/1000/60;
if(time > 0){}else{
xbdk2jg = Math.abs(Integer.valueOf(time.toString()));
......@@ -287,14 +325,18 @@ public class KqglServiceImpl implements KqglService {
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk2(repaappr.getCardrepltime()).xbdk2jg(xbdk2jg).gzsc(gzsctime).build().updateById();
atttype = 4;
results = xbdk2jg;
attime = endtime2;
}
}
}else if(attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb3 = verification_range(starttime3ks,starttime3js,repaappr.getCardrepltime());
if(sb3 && dkmc.getSbdk3() != null) {
int sbdkjg = 0;
if(sb3 && dkmc.getSbdk3() == null) {
int sbdkjg = -2;
Long time = (repaappr.getCardrepltime() - starttime3)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
......@@ -302,12 +344,15 @@ public class KqglServiceImpl implements KqglService {
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk3(repaappr.getCardrepltime()).sbdk3jg(sbdkjg).gzsc(gzsctime).build().updateById();
atttype = 5;
results = sbdkjg;
attime = starttime3;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb3 = verification_range(endtime3ks,endtime3js,repaappr.getCardrepltime());
if(xb3 && dkmc.getXbdk3() != null) {
int xbdk3jg = 0 ;
if(xb3 && dkmc.getXbdk3() == null) {
int xbdk3jg = -2;
Long time = (repaappr.getCardrepltime() - endtime3)/1000/60;
if(time > 0){}else{
xbdk3jg = Math.abs(Integer.valueOf(time.toString()));
......@@ -315,13 +360,236 @@ public class KqglServiceImpl implements KqglService {
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk3(repaappr.getCardrepltime()).xbdk3jg(xbdk3jg).gzsc(gzsctime).build().updateById();
atttype = 6;
results = xbdk3jg;
attime = endtime3;
}
}
}
}else {//补卡当天无打卡记录时
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(repaappr.getUserid()).data(cardrepltime).qyid(repaappr.getOrgcode()).dksj(start_time).ydkcs(shif.getSxbcs()*2)
.gzsc(0d).build();
// int yzcd = shif.getYzcdfzs();//严重迟到分钟数
// int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数
if(attdate.getAttsch().size() == 2) {//一套班次
if(repaappr.getCardreplperiod() == 1) {//上班
if(starttime1ks > 0 && starttime1js > 0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
System.out.println("当前打卡时间不在范围内");
isRange = false;
}
}
int sbdkjg = -2;
if(isRange) {
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk1(repaappr.getCardrepltime());
pcd.setSbdk1jg(sbdkjg);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 1;
results = sbdkjg;
attime = starttime1;
}else if(repaappr.getCardreplperiod() == 2) {//下班
if(endtime1ks > 0 && endtime1js > 0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
System.out.println("当前打卡时间不在范围内");
isRange = false;
}
}
int xbdk1jg = -2;
if(isRange) {
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk1(repaappr.getCardrepltime());
pcd.setXbdk1jg(xbdk1jg);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
}else if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb1 = verification_range(starttime1ks,starttime1js,repaappr.getCardrepltime());
if(sb1) {
int sbdkjg = -2;
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk1(repaappr.getCardrepltime());
pcd.setSbdk1jg(sbdkjg);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 1;
results = sbdkjg;
attime = starttime1;
}
boolean sb2 = verification_range(starttime2ks,starttime2js,repaappr.getCardrepltime());
if(sb2) {
int sbdkjg = -2;
Long time = (repaappr.getCardrepltime() - starttime2)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk2(repaappr.getCardrepltime());
pcd.setSbdk2jg(sbdkjg);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 3;
results = sbdkjg;
attime = starttime2;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb1 = verification_range(endtime1ks,endtime1js,repaappr.getCardrepltime());
if(xb1) {
int xbdk1jg = -2;
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk1(repaappr.getCardrepltime());
pcd.setXbdk1jg(xbdk1jg);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
boolean xb2 = verification_range(endtime2ks,endtime2js,repaappr.getCardrepltime());
if(xb2) {
int xbdk2jg = -2;
Long time = (repaappr.getCardrepltime() - endtime2)/1000/60;
if(time > 0){}else{
xbdk2jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk2(repaappr.getCardrepltime());
pcd.setXbdk2jg(xbdk2jg);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 4;
results = xbdk2jg;
attime = endtime2;
}
}
}else if(attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb3 = verification_range(starttime3ks,starttime3js,repaappr.getCardrepltime());
if(sb3) {
int sbdkjg = -2;
Long time = (repaappr.getCardrepltime() - starttime3)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk3(repaappr.getCardrepltime());
pcd.setSbdk3jg(sbdkjg);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 5;
results = sbdkjg;
attime = starttime3;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb3 = verification_range(endtime3ks,endtime3js,repaappr.getCardrepltime());
if(xb3) {
int xbdk3jg = -2;
Long time = (repaappr.getCardrepltime() - endtime3)/1000/60;
if(time > 0){}else{
xbdk3jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk3(repaappr.getCardrepltime());
pcd.setXbdk3jg(xbdk3jg);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 6;
results = xbdk3jg;
attime = endtime3;
}
}
}
dkmxid = pcd.getId();
}
if((atttype)%2 > 0){
type = 1;
}else {
type = 2;
}
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(cardrepltime,"yyyy-MM-dd")).getTime();
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
//attime 应打卡时间
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(repaappr.getCardrepltime()).results(results).userId(repaappr.getUserid()).type(type).status(5).sort(atttype)
.cardType(0).qyid(repaappr.getOrgcode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(cardrepltime)).attime(attime).dkmxid(dkmxid).bcid(shifid).remarks("审批补卡通过打卡").punchmode(0)
.punchequipment("").commentary("成功打卡").build();
if (!pre.insert()) {
throw new CustomException("打卡记录-新增异常-2");
}
}
}
}
......@@ -350,4 +618,264 @@ public class KqglServiceImpl implements KqglService {
return isRange;
}
@Autowired
private KqglAssoPbmxMapper kqglassopbmxmapper;
public AttendanceCardListDto MethodCall(int qyid,int userid,String date) throws ParseException {
AttendanceCardListDto attcar = new AttendanceCardListDto();
String str = null;
if(!("").equals(date)){
str = date;
}else{
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
str = sdf.format(d);
}
// Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
// Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if(attgro != null){//判断当前用户是否加入到考勤组
//排班制
KqglAssoPbmxDto jrpb = kqglassopbmxmapper.getScheduleSpecificAttendance(attgro.getId(),userid,str);
//固定排班
int week = Integer.valueOf(ClockInTool.dateToWeek(str));//4
KqglAssoZhoupaiban atwek = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, week).ne(KqglAssoZhoupaiban::getBcid, 0));
if(attgro.getPbfs() == 1){//固定排班
if(atwek != null){//有固定周排班
KqglAssoTeshu rest = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId())
.eq(KqglAssoTeshu::getTsrq, str).eq(KqglAssoTeshu::getBcid, 0));
if(rest != null){//今天休息 Sort返回0【特殊日期--休息】
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = AttSchedule.builder().id(0).sort(0).time(0l).starttime(0l).endtime(0l).build();
atts.add(as);
attcar.setAttsch(atts);
}else{//今天上班
KqglAssoBcsz bcz = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, atwek.getBcid()));
if(bcz != null){
Getshiftinformationbatch(bcz,attcar,str);
}
}
}else{//必须打卡
KqglAssoTeshu tsri = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId())
.eq(KqglAssoTeshu::getTsrq, str).ne(KqglAssoTeshu::getBcid, 0));
if(tsri != null){
KqglAssoBcsz tsrq = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tsri.getBcid()));
if(tsrq!=null){
Getshiftinformationbatch(tsrq,attcar,str);
}
}else{//休息
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = AttSchedule.builder().id(0).sort(0).time(0l).starttime(0l).endtime(0l).build();
atts.add(as);
attcar.setAttsch(atts);
}
}
}else if(attgro.getPbfs() == 2){//自由排班
//未排班时,员工可选择班次打卡
if(attgro.getIsXzbcdk() == 1){
attcar.setOptscheduling(true);
}else{
attcar.setOptscheduling(false);
}
if(jrpb != null){
if(jrpb.getBcid() != 0){//有班次时("Bcid"不为0时)
KqglAssoBcsz tsrq = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, jrpb.getBcid()));
/**已简化**/
Getshiftinformationbatch(tsrq,attcar,str);
}else{//当天排班为休息
List<AttSchedule> atts1 = new ArrayList<AttSchedule>();
AttSchedule as = AttSchedule.builder().id(0).sort(0).time(0l).starttime(0l).endtime(0l).build();
atts1.add(as);
attcar.setAttsch(atts1);
}
}
}else{//自由工时
KqglAssoZhoupaiban wekz = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getBcid, 0).eq(KqglAssoZhoupaiban::getType, week));
if(wekz != null){//
String dada = str+" "+attgro.getKqkssjTime()+":00";
attcar.setStapclotime(Long.valueOf(ClockInTool.dateToStamp(dada)));
}
if(!("").equals(attgro.getJbzdsc())){
attcar.setCanpunchworkdate(Double.valueOf(attgro.getJbzdsc()));//上班打卡后多久大下班卡
}
}
if(jrpb != null || atwek != null){
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
if(attgro.getPbfs() == 1){
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, atwek.getBcid()));
}else if(attgro.getPbfs() == 2){
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, jrpb.getBcid()));
}
if(shif != null){
if(shif.getIsXbdk() == 1){
attcar.setNoclockout(true);// 下班不用打卡
}else{
attcar.setNoclockout(false);// 下班不用打卡
}
attcar.setAllowlate(shif.getYxcdfzs());// 允许迟到分钟数
attcar.setSeriouslate(shif.getYzcdfzs());// 严重迟到分钟数
attcar.setAbsenteeismlate(shif.getKgcdfzs());// 旷工迟到分钟数
if(shif.getIsWzwd() == 1){
attcar.setIslatelate(true);// 晚走晚到
List<AttLateLate> atwzwd = new ArrayList<AttLateLate>();
int p = 0;
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1())){p = 2;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2())){p = 4;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2()) && !("").equals(shif.getXbwz3()) && !("").equals(shif.getSbwd3())){p = 6;}
AttLateLate ala = AttLateLate.builder().build();
ala.setLatewalk(shif.getXbwz1());
ala.setArrivelate(shif.getSbwd1());
atwzwd.add(ala);
if(p == 4 || p == 6){
AttLateLate alat = AttLateLate.builder().build();
alat.setLatewalk(shif.getXbwz2());
alat.setArrivelate(shif.getSbwd2());
atwzwd.add(alat);
}
if(p == 6){
AttLateLate alas = AttLateLate.builder().build();
alas.setLatewalk(shif.getXbwz3());
alas.setArrivelate(shif.getSbwd3());
atwzwd.add(alas);
}
attcar.setAttlat(atwzwd);
}else{
attcar.setIslatelate(false);// 晚走晚到
}
}
}
attcar.setAttgrouptype(attgro.getPbfs());//1:固定排班;2:自由排班;3:自由工时
}else{
attcar.setAttgrouptype(0);//1:固定排班;2:自由排班;3:自由工时
}
return attcar;
}
public void Getshiftinformationbatch(KqglAssoBcsz shiftm,AttendanceCardListDto attcar,String str){
int isXbdk1Cr = shiftm.getIsXbdk1Cr();//下班1是否次日(0:否;1:是)
int isSbdk2Cr = shiftm.getIsSbdk2Cr();//上班2是否次日(0:否;1:是)
int isXbdk2Cr = shiftm.getIsXbdk2Cr();//下班2是否次日(0:否;1:是)
int isSbdk3Cr = shiftm.getIsSbdk3Cr();//上班3是否次日(0:否;1:是)
int isXbdk3Cr = shiftm.getIsXbdk3Cr();//下班3是否次日(0:否;1:是)
//次日专用
String next_day = ClockInTool.requires_extra_times(str,1,2,1);
List<AttSchedule> atts = new ArrayList<AttSchedule>();
if(shiftm.getSxbcs() == 1 || shiftm.getSxbcs() == 2 || shiftm.getSxbcs() == 3){//1次上下班
for(int o=0;o<2;o++){
if(o==0){
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(1).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbdk1()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks1()) || shiftm.getSbqjks1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjks1()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs1()) || shiftm.getSbqjjs1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjjs1()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}else{
//次日
if(isXbdk1Cr > 0) {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(2).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbdk1()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks1()) || shiftm.getXbqjks1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjks1()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs1()) || shiftm.getXbqjjs1() ==null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjjs1()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(2).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbdk1()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks1()) || shiftm.getXbqjks1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjks1()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs1()) || shiftm.getXbqjjs1() ==null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjjs1()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}
}
attcar.setAttsch(atts);
}
if(shiftm.getSxbcs() == 2 || shiftm.getSxbcs() == 3){//2次上下班
for(int o=0;o<2;o++){
if(o==0){
if(isSbdk2Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(3).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks2())|| shiftm.getSbqjks2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs2()) || shiftm.getSbqjjs2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(3).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks2())|| shiftm.getSbqjks2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs2()) || shiftm.getSbqjjs2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}else{
if(isXbdk2Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(4).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks2()) || shiftm.getXbqjks2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs2()) || shiftm.getXbqjjs2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(4).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks2()) || shiftm.getXbqjks2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs2()) || shiftm.getXbqjjs2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}
}
attcar.setAttsch(atts);
}
if(shiftm.getSxbcs() == 3){//3次上下班
for(int o=0;o<2;o++){
if(o==0){
if(isSbdk3Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(5).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks3()) || shiftm.getSbqjks3() == null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs3()) || shiftm.getSbqjjs3() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(5).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks3()) || shiftm.getSbqjks3() == null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs3()) || shiftm.getSbqjjs3() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}else{
if(isXbdk3Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(6).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks3()) || shiftm.getXbqjks3()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs3()) || shiftm.getXbqjjs3() ==null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(6).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks3()) || shiftm.getXbqjks3()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs3()) || shiftm.getXbqjjs3() ==null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}
}
attcar.setAttsch(atts);
}
}
}
......@@ -12,6 +12,7 @@ import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
import cn.timer.api.dto.kqmk.JiaqibalanceDto;
/**
* 员工假期余额
......@@ -27,5 +28,5 @@ public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBala
List<AdditionalDto> selectAdditionalList(int orgcode);
EmployeeLeaveBalanceDto selectleavebalanceList(int leaverulesid,int userid);
JiaqibalanceDto selectleavebalanceList(int leaverulesid,int userid);
}
......@@ -26,10 +26,6 @@ public class EmployeeLeaveBalanceDto {
@ApiModelProperty(value = "入职日期 ", example = "字段说明")
private String rztime;
@ApiModelProperty(value = " ", example = "字段说明")
private String userid;
@ApiModelProperty(value = " ", example = "字段说明")
private String balancedays;
@ApiModelProperty(value = "表数据", example = "字段说明")
List<BalanceSheetDataDto> balanceTo;
......
package cn.timer.api.dto.kqmk;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class JiaqibalanceDto {
@ApiModelProperty(value = " ", example = "字段说明")
private String userid;
@ApiModelProperty(value = " ", example = "字段说明")
private String balancedays;
}
......@@ -22,14 +22,17 @@
<result column="empname" property="empname" />
<result column="department" property="department" />
<result column="rztime" property="rztime" />
<result column="userid" property="userid" />
<result column="balancedays" property="balancedays" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
</collection>
</resultMap>
<resultMap id="JiaqibalanceMap" type="cn.timer.api.dto.kqmk.JiaqibalanceDto" >
<result column="userid" property="userid" />
<result column="balancedays" property="balancedays" />
</resultMap>
<resultMap id="AdditionalMap" type="cn.timer.api.dto.kqmk.AdditionalDto" >
<result column="empnum" property="empnum" />
<result column="empname" property="empname" />
......@@ -117,7 +120,7 @@
</select>
<select id="selectleavebalanceList" resultMap="LeaveBalanceMap">
<select id="selectleavebalanceList" resultMap="JiaqibalanceMap">
select bal.userid,SUM(bal.balance_days) as balancedays
from kqgl_asso_leave_balance bal
where bal.leave_rules_id = #{leaverulesid} and bal.userid = #{userid}
......
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