Commit ed44fc92 by lal

提交

parent fb78b8b1
...@@ -66,4 +66,6 @@ public class KqglAssoRelationSummary extends Model<KqglAssoRelationSummary> { ...@@ -66,4 +66,6 @@ public class KqglAssoRelationSummary extends Model<KqglAssoRelationSummary> {
@ApiModelProperty(value = "结束时间 ", example = "结束时间") @ApiModelProperty(value = "结束时间 ", example = "结束时间")
private String endTime; private String endTime;
@ApiModelProperty(value = "企业组织代码 ", example = "企业组织代码")
private Integer orgCode;
} }
\ No newline at end of file
...@@ -273,7 +273,17 @@ public class ClockInController { ...@@ -273,7 +273,17 @@ public class ClockInController {
kskd = false; kskd = false;
if(attdate.getAttsch().size() == 2) {//一套上下班 上班1 if(attdate.getAttsch().size() == 2) {//一套上下班 上班1
atttype = 1; Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(starttime1)));//应打卡时间
Date sd2=df1.parse(sStdIoTime);//打卡时间
Date sd3=df1.parse(ClockInTool.stampToDate(String.valueOf(endtime1)));//应打卡时间
if(sd2.before(sd3)) {
atttype = 1;
}
if(sd2.after(sd1) && sd2.after(sd3)) {
atttype = 2;
}
}else { }else {
//打卡时间 对比班次 接近哪个时间就打哪个时间的卡 //打卡时间 对比班次 接近哪个时间就打哪个时间的卡
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) { if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
......
package cn.timer.api.controller.kqgl; package cn.timer.api.controller.kqgl;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.Format;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -22,6 +23,96 @@ public class ClockInTool { ...@@ -22,6 +23,96 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd"); static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
/**
* 将String时间转换为时间戳
*
* @param time
* @return
* @throws ParseException
*/
public static long getStringTime(String time, String format)
throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
Date date = simpleDateFormat.parse(time);
return date.getTime();
}
/**
* 根据时间戳获取23点
*
* @return
*/
public static Date getnowEndTime(int day, long time) {
Calendar todayEnd = Calendar.getInstance();
todayEnd.setTimeInMillis(time);
todayEnd.set(Calendar.HOUR_OF_DAY, day);
todayEnd.set(Calendar.MINUTE, 59);
todayEnd.set(Calendar.SECOND, 59);
todayEnd.set(Calendar.MILLISECOND, 999);
return todayEnd.getTime();
}
/**
* 根据时间戳获取0点
*
* @return
*/
public static Date getStartTime(int day, long time) {
Calendar todayStart = Calendar.getInstance();
todayStart.setTimeInMillis(time);
todayStart.set(Calendar.HOUR_OF_DAY, day);
todayStart.set(Calendar.MINUTE, 0);
todayStart.set(Calendar.SECOND, 0);
todayStart.set(Calendar.MILLISECOND, 0);
return todayStart.getTime();
}
// 根据传入的日期获取所在月份所有日期
public static List<String> getAllDaysMonthByDate(Date d){
List<String> lst = new ArrayList<String>();
Date date = getMonthStart(d);
Date monthEnd = getMonthEnd(d);
while (!date.after(monthEnd)) {
lst.add(famt.format(date));
date = getNext(date);
}
return lst;
}
private static Date getMonthStart(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int index = calendar.get(Calendar.DAY_OF_MONTH);
calendar.add(Calendar.DATE, (1 - index));
return calendar.getTime();
}
private static Date getMonthEnd(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MONTH, 1);
int index = calendar.get(Calendar.DAY_OF_MONTH);
calendar.add(Calendar.DATE, (-index));
return calendar.getTime();
}
private static Date getNext(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DATE, 1);
return calendar.getTime();
}
// 将字符串转化为日期
public static Date paraseStringToDate(String timestr){
Date date = null;
Format f = new SimpleDateFormat("yyyy-MM-dd");
try {
date = (Date) f.parseObject(timestr);
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
/*** /***
* 去除String数组中的空值 * 去除String数组中的空值
...@@ -505,6 +596,30 @@ public class ClockInTool { ...@@ -505,6 +596,30 @@ public class ClockInTool {
res = simpleDateFormat.format(date); res = simpleDateFormat.format(date);
return res; return res;
} }
/**
* 时间戳转换时间
*/
public static String stampToDate2(String s){
String res;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
long lt = new Long(s);
Date date = new Date(lt);
res = simpleDateFormat.format(date);
return res;
}
/**
* 时间戳转换时间
*/
public static String stampToDate3(String s){
String res;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
long lt = new Long(s);
Date date = new Date(lt);
res = simpleDateFormat.format(date);
return res;
}
} }
...@@ -57,6 +57,7 @@ import cn.timer.api.bean.kqmk.KqglAssoOvertimeBasics; ...@@ -57,6 +57,7 @@ import cn.timer.api.bean.kqmk.KqglAssoOvertimeBasics;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeRange; import cn.timer.api.bean.kqmk.KqglAssoOvertimeRange;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeRules; import cn.timer.api.bean.kqmk.KqglAssoOvertimeRules;
import cn.timer.api.bean.kqmk.KqglAssoPbmx; import cn.timer.api.bean.kqmk.KqglAssoPbmx;
import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
import cn.timer.api.bean.kqmk.KqglAssoRulesVice; import cn.timer.api.bean.kqmk.KqglAssoRulesVice;
import cn.timer.api.bean.kqmk.KqglAssoTeshu; import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoYhkqz; import cn.timer.api.bean.kqmk.KqglAssoYhkqz;
...@@ -91,14 +92,20 @@ import cn.timer.api.dao.kqmk.KqglAssoYhkqzMapper; ...@@ -91,14 +92,20 @@ import cn.timer.api.dao.kqmk.KqglAssoYhkqzMapper;
import cn.timer.api.dao.kqmk.KqglAssoYhsbMapper; import cn.timer.api.dao.kqmk.KqglAssoYhsbMapper;
import cn.timer.api.dao.kqmk.KqglAssoZhoupaibanMapper; import cn.timer.api.dao.kqmk.KqglAssoZhoupaibanMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper; import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AttLateLate;
import cn.timer.api.dto.kqmk.AttMemberSettings; import cn.timer.api.dto.kqmk.AttMemberSettings;
import cn.timer.api.dto.kqmk.AttSchedule;
import cn.timer.api.dto.kqmk.AttSchedulingDto; import cn.timer.api.dto.kqmk.AttSchedulingDto;
import cn.timer.api.dto.kqmk.AttendanceAssistantDto; import cn.timer.api.dto.kqmk.AttendanceAssistantDto;
import cn.timer.api.dto.kqmk.AttendanceCardListDto;
import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto; import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto; import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.CalendarDetailsDto;
import cn.timer.api.dto.kqmk.CalendarPunchDetailsDto;
import cn.timer.api.dto.kqmk.ChangePunchResultsDto; import cn.timer.api.dto.kqmk.ChangePunchResultsDto;
import cn.timer.api.dto.kqmk.CompensateDto; import cn.timer.api.dto.kqmk.CompensateDto;
import cn.timer.api.dto.kqmk.DailyDetailsDto; 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.EmployeeLeaveBalanceDto;
import cn.timer.api.dto.kqmk.IndividualOvertimeRuleDto; import cn.timer.api.dto.kqmk.IndividualOvertimeRuleDto;
import cn.timer.api.dto.kqmk.KqglAssoLeaveRulesDto; import cn.timer.api.dto.kqmk.KqglAssoLeaveRulesDto;
...@@ -116,6 +123,7 @@ import cn.timer.api.dto.kqmk.SetConditionsDto; ...@@ -116,6 +123,7 @@ import cn.timer.api.dto.kqmk.SetConditionsDto;
import cn.timer.api.dto.kqmk.StartTimeRestDto; import cn.timer.api.dto.kqmk.StartTimeRestDto;
import cn.timer.api.dto.kqmk.UserAttendanceRelDto; import cn.timer.api.dto.kqmk.UserAttendanceRelDto;
import cn.timer.api.dto.kqmk.VacationInformationDto; import cn.timer.api.dto.kqmk.VacationInformationDto;
import cn.timer.api.dto.kqmk.WorkbenchCalendarDto;
import cn.timer.api.utils.DateUtil; import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.ResponseResult; import cn.timer.api.utils.ResponseResult;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -2325,24 +2333,675 @@ public class TimeCardController { ...@@ -2325,24 +2333,675 @@ public class TimeCardController {
// return ResultUtil.data(map); // return ResultUtil.data(map);
// } // }
/**************************/
/** /**
* 查询列表-加班补偿方式 * 查询列表-加班补偿方式
*/ */
@GetMapping(value = "/list_compensate") @GetMapping(value = "/overtime_type")
@ApiOperation(value = "222: 查询列表-加班补偿方式", httpMethod = "GET", notes = " 查询列表-加班补偿方式") @ApiOperation(value = "222: 加班类型", httpMethod = "GET", notes = " 查询列表-加班补偿方式")
public Result<Object> selectListCompensate() { public Result<Object> overtimetypelist(@CurrentUser UserBean userBean) {
List<CompensateDto> coms = new ArrayList<CompensateDto>(); List<CompensateDto> coms = new ArrayList<CompensateDto>();
CompensateDto com = CompensateDto.builder().build();
com.setId(1); KqglAssoYhkqz yhd = KqglAssoYhkqz.builder().build().selectOne(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, userBean.getEmpNum()).eq(KqglAssoYhkqz::getQyid, userBean.getOrgCode()));
com.setValue("加班费"); if(yhd != null) {
coms.add(com); KqglAssoOvertimeRange timeran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, yhd.getKqzid()));
CompensateDto coms2 = CompensateDto.builder().build(); if(timeran != null) {
coms2.setId(2); KqglAssoOvertimeRules rul = KqglAssoOvertimeRules.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRules>().lambda().eq(KqglAssoOvertimeRules::getId, timeran.getOvertimeRulesId()));
coms2.setValue("调休"); if(rul != null) {
coms.add(coms2); if(rul.getIsWorkovertime() == 1) {
CompensateDto com = CompensateDto.builder().build();
com.setId(1);
com.setValue("工作日加班");
coms.add(com);
}
if(rul.getIsRestovertime() == 1) {
CompensateDto com2 = CompensateDto.builder().build();
com2.setId(2);
com2.setValue("休息日加班");
coms.add(com2);
}
if(rul.getIsHolidays() == 1) {
CompensateDto com3 = CompensateDto.builder().build();
com3.setId(3);
com3.setValue("节假日加班");
coms.add(com3);
}
}
}
}
return ResultUtil.data(coms, "操作成功!"); return ResultUtil.data(coms, "操作成功!");
} }
/**************************/
/**
* 查询列表-加班补偿方式 id:
*/
@GetMapping(value = "/list_compensate/{id}")
@ApiOperation(value = "222: 查询列表-加班补偿方式", httpMethod = "GET", notes = " 查询列表-加班补偿方式")
public Result<Object> selectListCompensate(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) {
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息
if(attgro != null) {
List<CompensateDto> coms = new ArrayList<CompensateDto>();
KqglAssoYhkqz yhd = KqglAssoYhkqz.builder().build().selectOne(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, userBean.getEmpNum()).eq(KqglAssoYhkqz::getQyid, userBean.getOrgCode()));
if(yhd != null) {
KqglAssoOvertimeRange timeran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, yhd.getKqzid()));
if(timeran != null) {
KqglAssoOvertimeRules rul = KqglAssoOvertimeRules.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRules>().lambda().eq(KqglAssoOvertimeRules::getId, timeran.getOvertimeRulesId()));
if(rul != null) {
if(id == 1) {
if(rul.getIsWorkovertime() == 1 && rul.getWorkSwitch() == 1) {
if(rul.getWorkOne() != "0") {
CompensateDto com = CompensateDto.builder().build();
com.setId(1);
com.setValue("调休");
coms.add(com);
}
if(rul.getWorkTwo() != 0) {
CompensateDto com2 = CompensateDto.builder().build();
com2.setId(2);
com2.setValue("加班费");
coms.add(com2);
}
if(rul.getWorkThree() != "0") {
CompensateDto com3 = CompensateDto.builder().build();
com3.setId(3);
com3.setValue("调休/加班费");
coms.add(com3);
}
}
}else if(id == 2) {
if(rul.getIsRestovertime() == 1 && rul.getRestSwitch() == 1) {
if(rul.getRestOne() != "0") {
CompensateDto com = CompensateDto.builder().build();
com.setId(1);
com.setValue("调休");
coms.add(com);
}
if(rul.getRestTwo() != 0) {
CompensateDto com2 = CompensateDto.builder().build();
com2.setId(2);
com2.setValue("加班费");
coms.add(com2);
}
if(rul.getRestThree() != "0") {
CompensateDto com3 = CompensateDto.builder().build();
com3.setId(3);
com3.setValue("调休/加班费");
coms.add(com3);
}
}
}else {
if(rul.getIsHolidays() == 1 && rul.getHolidaysSwitch() == 1) {
if(rul.getHolidaysOne() != "0") {
CompensateDto com = CompensateDto.builder().build();
com.setId(1);
com.setValue("调休");
coms.add(com);
}
if(rul.getHolidaysTwo() != 0) {
CompensateDto com2 = CompensateDto.builder().build();
com2.setId(2);
com2.setValue("加班费");
coms.add(com2);
}
if(rul.getHolidaysThree() != "0") {
CompensateDto com3 = CompensateDto.builder().build();
com3.setId(3);
com3.setValue("调休/加班费");
coms.add(com3);
}
}
}
}
}
}
return ResultUtil.data(coms, "操作成功!");
}else {
return ResultUtil.error("操作失败,请先加入考勤组");
}
}
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);
}
}
/**
* 工作台日历数据
* @param userBean
* @return
* @throws ParseException
*/
@GetMapping(value = "/workbench_calendar/{date}")
@ApiOperation(value = "999: 工作台日历数据", httpMethod = "GET", notes = "查询数据")
public Result<Object> Workbench_calendar(@CurrentUser UserBean userBean,@PathVariable("date") String date) throws ParseException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
String current = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
Long startMonth = 0l;
Long endMonth = 0l;
if(date == null || ("").equals(date)) {
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
String first = mat.format(c.getTime());
startMonth = DateUtil.getStartTime(0,DateUtil.getStringTime(first,"yyyy-MM-dd")).getTime();
//获取当前月最后一天
Calendar ca = Calendar.getInstance();
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 {
String time = date+"-01";
String sdaet = ClockInTool.getMinMonthDate(time);
startMonth = ClockInTool.getStartTime(0,ClockInTool.getStringTime(sdaet,"yyyy-MM-dd")).getTime();
String edate = ClockInTool.getMaxMonthDate(time);
endMonth = ClockInTool.getnowEndTime(23,ClockInTool.getStringTime(edate,"yyyy-MM-dd")).getTime();
}
String[] rangeArray=ClockInTool.listToString(ClockInTool.getDays(df.format(startMonth),df.format(endMonth))).split(";");//目前为止所有日期
String[] range=rangeArray[0].split(",");
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息
int bcid = 0;
List<WorkbenchCalendarDto> workcal = new ArrayList<WorkbenchCalendarDto>();
for(String num : range) {
Long start_time = DateUtil.getStartTime(0,DateUtil.getStringTime(num,"yyyy-MM-dd")).getTime();
Long end_time = DateUtil.getnowEndTime(23,DateUtil.getStringTime(num,"yyyy-MM-dd")).getTime();
WorkbenchCalendarDto wocal = WorkbenchCalendarDto.builder().build();
wocal.setDate(num);
if(attgro != null) {//有无考勤组
AttendanceCardListDto attdate = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),num);//获取当天所打卡班次
List<AttSchedule> ashss = attdate.getAttsch();//获取今天应打卡时间
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
if(current.equals(num)) {
bcid = ashss.get(0).getId();//班次id
}
if(ashss.get(0).getId() != 0) {
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum())
.ge(KqglAssoDkmx::getDksj, start_time).le(KqglAssoDkmx::getDksj, end_time));
if(dkmc != null) {
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(dkmc.getSbdk1() != null && dkmc.getSbdk1jg() == 0 && dkmc.getXbdk1() != null && dkmc.getXbdk1jg() == 0) {
wocal.setCalendar_status(1);//打卡正常
}else {
wocal.setCalendar_status(3);//打卡异常
}
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(dkmc.getSbdk2() != null && dkmc.getSbdk2jg() == 0 && dkmc.getXbdk2() != null && dkmc.getXbdk2jg() == 0) {
wocal.setCalendar_status(1);//打卡正常
}else {
wocal.setCalendar_status(3);//打卡异常
}
}
if(attdate.getAttsch().size() == 6) {
if(dkmc.getSbdk3() != null && dkmc.getSbdk3jg() == 0 && dkmc.getXbdk3() != null && dkmc.getXbdk3jg() == 0) {
wocal.setCalendar_status(1);//打卡正常
}else {
wocal.setCalendar_status(3);//打卡异常
}
}
KqglAssoRelationSummary asssum = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, userBean.getEmpNum())
.eq(KqglAssoRelationSummary::getAppTime, num).last("LIMIT 1"));
if(asssum != null) {
wocal.setCalendar_status(2);//事务(请假,加班,调休,出差)
}
}else {
wocal.setCalendar_status(3);//打卡异常
}
}else {
wocal.setCalendar_status(4);//休息
}
}else {
wocal.setCalendar_status(0);//无排班
}
}else {
wocal.setCalendar_status(0);//无排班
}
workcal.add(wocal);
}
List<CalendarPunchDetailsDto> detailed = new ArrayList<CalendarPunchDetailsDto>();
CalendarPunchDetailsDto dets = CalendarPunchDetailsDto.builder().build();
dets.setDate(current);
// detailed.add(dets1);
Long starttime = DateUtil.getStartTime(0,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())
.ge(KqglAssoDkmx::getDksj, starttime).le(KqglAssoDkmx::getDksj, endtime));
if(dkmc!=null) {
// CalendarPunchDetailsDto dets = CalendarPunchDetailsDto.builder().build();
dets.setSbdksj1(dkmc.getSbdk1() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getSbdk1())));
dets.setSbdksj1jg(dkmc.getSbdk1jg());
dets.setXbdksj1(dkmc.getXbdk1() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getXbdk1())));
dets.setXbdksj1jg(dkmc.getXbdk1jg());
dets.setSbdksj2(dkmc.getSbdk2() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getSbdk2())));
dets.setSbdksj2jg(dkmc.getSbdk2jg());
dets.setXbdksj2(dkmc.getXbdk2() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getXbdk2())));
dets.setXbdksj2jg(dkmc.getXbdk2jg());
dets.setSbdksj3(dkmc.getSbdk3() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getSbdk3())));
dets.setSbdksj3jg(dkmc.getSbdk3jg());
dets.setXbdksj3(dkmc.getXbdk3() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getXbdk3())));
dets.setXbdksj3jg(dkmc.getXbdk3jg());
// detailed.add(dets);
}
if(bcid > 0) {
KqglAssoBcsz bcs = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, bcid));
if(bcs != null) {
// CalendarPunchDetailsDto dets = CalendarPunchDetailsDto.builder().build();
dets.setClock_num(bcs.getSxbcs()*2);
dets.setBcsbdk1(("").equals(bcs.getSbdk1()) ? "" : bcs.getSbdk1().replaceAll("\r|\n", ""));
dets.setBcxbdk1(("").equals(bcs.getXbdk1()) ? "" : bcs.getXbdk1().replaceAll("\r|\n", ""));
dets.setBcsbdk2(("").equals(bcs.getSbdk2()) ? "" : bcs.getSbdk2().replaceAll("\r|\n", ""));
dets.setBcxbdk2(("").equals(bcs.getXbdk2()) ? "" : bcs.getXbdk2().replaceAll("\r|\n", ""));
dets.setBcsbdk3(("").equals(bcs.getSbdk3()) ? "" : bcs.getSbdk3().replaceAll("\r|\n", ""));
dets.setBcxbdk3(("").equals(bcs.getXbdk3()) ? "" : bcs.getXbdk3().replaceAll("\r|\n", ""));
// detailed.add(dets);
}
}
detailed.add(dets);
WorkbenchCalendarDto wocal1 = WorkbenchCalendarDto.builder().build();
wocal1.setDetailed(detailed);
workcal.add(wocal1);
return ResultUtil.data(workcal, "操作成功!");
}
/**
* @param userBean
* @param date 日历年月日
* @return
* @throws ParseException
*/
@GetMapping(value = "/Calendar_punch_details/{date}")
@ApiOperation(value = "999: 日历打卡详情", httpMethod = "GET", notes = "查询数据")
public Result<Object> Calendar_punch_details(@CurrentUser UserBean userBean,@PathVariable("date") String date) throws ParseException {
AttendanceCardListDto attdate = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),date);//获取当天所打卡班次
List<AttSchedule> ashss = attdate.getAttsch();//获取今天应打卡时间
int bcid = 0;
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
bcid = ashss.get(0).getId();//班次id
}
List<DetailsofbusinessDto> ils = new ArrayList<DetailsofbusinessDto>();
DetailsofbusinessDto iness = DetailsofbusinessDto.builder().build();
List<CalendarPunchDetailsDto> detslist = new ArrayList<CalendarPunchDetailsDto>();
CalendarPunchDetailsDto dets = CalendarPunchDetailsDto.builder().build();
dets.setDate(date);
Long starttime = DateUtil.getStartTime(0,DateUtil.getStringTime(date,"yyyy-MM-dd")).getTime();
Long endtime = DateUtil.getnowEndTime(23,DateUtil.getStringTime(date,"yyyy-MM-dd")).getTime();
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum())
.ge(KqglAssoDkmx::getDksj, starttime).le(KqglAssoDkmx::getDksj, endtime));
if(dkmc!=null) {
dets.setSbdksj1(dkmc.getSbdk1() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getSbdk1())));
dets.setSbdksj1jg(dkmc.getSbdk1jg());
dets.setXbdksj1(dkmc.getXbdk1() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getXbdk1())));
dets.setXbdksj1jg(dkmc.getXbdk1jg());
dets.setSbdksj2(dkmc.getSbdk2() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getSbdk2())));
dets.setSbdksj2jg(dkmc.getSbdk2jg());
dets.setXbdksj2(dkmc.getXbdk2() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getXbdk2())));
dets.setXbdksj2jg(dkmc.getXbdk2jg());
dets.setSbdksj3(dkmc.getSbdk3() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getSbdk3())));
dets.setSbdksj3jg(dkmc.getSbdk3jg());
dets.setXbdksj3(dkmc.getXbdk3() == null ? "" : ClockInTool.stampToDate3(String.valueOf(dkmc.getXbdk3())));
dets.setXbdksj3jg(dkmc.getXbdk3jg());
}
if(bcid > 0) {
KqglAssoBcsz bcs = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, bcid));
if(bcs != null) {
dets.setClock_num(bcs.getSxbcs()*2);
dets.setBcsbdk1(("").equals(bcs.getSbdk1()) ? "" : bcs.getSbdk1().replaceAll("\r|\n", ""));
dets.setBcxbdk1(("").equals(bcs.getXbdk1()) ? "" : bcs.getXbdk1().replaceAll("\r|\n", ""));
dets.setBcsbdk2(("").equals(bcs.getSbdk2()) ? "" : bcs.getSbdk2().replaceAll("\r|\n", ""));
dets.setBcxbdk2(("").equals(bcs.getXbdk2()) ? "" : bcs.getXbdk2().replaceAll("\r|\n", ""));
dets.setBcsbdk3(("").equals(bcs.getSbdk3()) ? "" : bcs.getSbdk3().replaceAll("\r|\n", ""));
dets.setBcxbdk3(("").equals(bcs.getXbdk3()) ? "" : bcs.getXbdk3().replaceAll("\r|\n", ""));
}
}
detslist.add(dets);
iness.setCaldet(detslist);//当天打卡详情
KqglAssoOvertimeBasics bais = KqglAssoOvertimeBasics.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeBasics>().lambda().eq(KqglAssoOvertimeBasics::getOrgCode, userBean.getOrgCode()));
String company = "";
if(bais != null) {
if(bais.getMinimumUnit() == 1) {
company = "分钟";
}else if(bais.getMinimumUnit() == 2) {
company = "半小时";
}else if(bais.getMinimumUnit() == 3) {
company = "小时";
}else if(bais.getMinimumUnit() == 4) {
company = "半天";
}else if(bais.getMinimumUnit() == 5) {
company = "天";
}
}
List<CalendarDetailsDto> tais = new ArrayList<CalendarDetailsDto>();
List<KqglAssoRelationSummary> sums = KqglAssoRelationSummary.builder().build().selectList(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, userBean.getEmpNum())
.eq(KqglAssoRelationSummary::getAppTime, date).eq(KqglAssoRelationSummary::getOrgCode, userBean.getOrgCode()));
if(sums.size() > 0) {
for(KqglAssoRelationSummary suu : sums) {
CalendarDetailsDto ta = CalendarDetailsDto.builder().build();
String content = "";
if(suu.getApprovalType() == 1) {//加班
ta.setAffair_type(1);
content = suu.getStartTime()+"-"+suu.getEndTime()+"加班"+suu.getDuration()+company;
}else if(suu.getApprovalType() == 2) {//请假
ta.setAffair_type(2);
content = suu.getStartTime()+"-"+suu.getEndTime()+"请假"+suu.getDuration()+"天";
}else if(suu.getApprovalType() == 3) {//出差
ta.setAffair_type(3);
content = suu.getStartTime()+"-"+suu.getEndTime()+"出差"+suu.getDuration()+"天";
}else if(suu.getApprovalType() == 4) {//外出
ta.setAffair_type(4);
content = suu.getStartTime()+"-"+suu.getEndTime()+"外出"+suu.getDuration()+"天";
}else if(suu.getApprovalType() == 5) {//补卡
ta.setAffair_type(5);
ta.setStart_time(suu.getStartTime());
content = suu.getStartTime()+"已补卡";
}
ta.setDuration(String.valueOf(suu.getDuration()));
if(suu.getApprovalType() != 5) {
ta.setStart_time(suu.getStartTime());
ta.setEnd_time(suu.getEndTime());
}
ta.setContent(content);
tais.add(ta);
}
}
iness.setCalils(tais);
ils.add(iness);
return ResultUtil.data(ils, "操作成功!");
}
} }
...@@ -41,7 +41,7 @@ public class KqglServiceImpl implements KqglService { ...@@ -41,7 +41,7 @@ public class KqglServiceImpl implements KqglService {
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(leaveappr.getUserid()).appTime(num).approvalId(leaveappr.getLeaveid()).approvalType(2).duration(leaveappr.getDuration()) KqglAssoRelationSummary.builder().userId(leaveappr.getUserid()).appTime(num).approvalId(leaveappr.getLeaveid()).approvalType(2).duration(leaveappr.getDuration())
.leaveTypeId(leaveappr.getLeavetype()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getStarttime())) .leaveTypeId(leaveappr.getLeavetype()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getEndtime())).build().insert(); .endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getEndtime())).orgCode(leaveappr.getOrgcode()).build().insert();
} }
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid())); YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid()));
...@@ -69,7 +69,7 @@ public class KqglServiceImpl implements KqglService { ...@@ -69,7 +69,7 @@ public class KqglServiceImpl implements KqglService {
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(overappr.getUserid()).appTime(num).approvalId(overappr.getOvertimeid()).approvalType(1).duration(overappr.getDuration()) KqglAssoRelationSummary.builder().userId(overappr.getUserid()).appTime(num).approvalId(overappr.getOvertimeid()).approvalType(1).duration(overappr.getDuration())
.overtimeTypeId(overappr.getOvertimetype()).compensateId(overappr.getCompensate()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getStarttime())) .overtimeTypeId(overappr.getOvertimetype()).compensateId(overappr.getCompensate()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getEndtime())).build().insert(); .endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getEndtime())).orgCode(overappr.getOrgcode()).build().insert();
} }
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, overappr.getUserid()).eq(YgglMainEmp::getOrgCode, overappr.getOrgcode())); YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, overappr.getUserid()).eq(YgglMainEmp::getOrgCode, overappr.getOrgcode()));
...@@ -105,7 +105,8 @@ public class KqglServiceImpl implements KqglService { ...@@ -105,7 +105,8 @@ public class KqglServiceImpl implements KqglService {
for(String num : days) { for(String num : days) {
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3) KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3)
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime())).build().insert(); .startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).build().insert();
} }
}else { //外出 }else { //外出
String startdate = new SimpleDateFormat("yyyy-MM-dd").format(evecappr.getStarttime()); String startdate = new SimpleDateFormat("yyyy-MM-dd").format(evecappr.getStarttime());
...@@ -114,7 +115,8 @@ public class KqglServiceImpl implements KqglService { ...@@ -114,7 +115,8 @@ public class KqglServiceImpl implements KqglService {
for(String num : days) { for(String num : days) {
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4) KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4)
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime())).build().insert(); .startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).build().insert();
} }
} }
return true; return true;
...@@ -127,7 +129,12 @@ public class KqglServiceImpl implements KqglService { ...@@ -127,7 +129,12 @@ public class KqglServiceImpl implements KqglService {
public boolean attrepairapproval(AttRepairApprovalDto repaappr) { public boolean attrepairapproval(AttRepairApprovalDto repaappr) {
String cardrepltime = new SimpleDateFormat("yyyy-MM-dd").format(repaappr.getCardrepltime());//补卡时间 String cardrepltime = new SimpleDateFormat("yyyy-MM-dd").format(repaappr.getCardrepltime());//补卡时间
//记入打卡月汇总关联表 //记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(repaappr.getUserid()).appTime(cardrepltime).approvalId(repaappr.getRepairid()).approvalType(5).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(repaappr.getCardrepltime())).build().insert(); 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();
return true; return true;
} }
......
...@@ -24,7 +24,7 @@ public class AttOvertimeApprovalDto { ...@@ -24,7 +24,7 @@ public class AttOvertimeApprovalDto {
@ApiModelProperty(value = "公司id", example = "") @ApiModelProperty(value = "公司id", example = "")
private int orgcode; private int orgcode;
@ApiModelProperty(value = "加班类型", example = "具体传ID") @ApiModelProperty(value = "加班类型", example = "1:工作日加班;2:休息日加班;3:节假日加班")
private int overtimetype; private int overtimetype;
@ApiModelProperty(value = "开始时间", example = "时间戳") @ApiModelProperty(value = "开始时间", example = "时间戳")
......
package cn.timer.api.dto.kqmk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CalendarDetailsDto {
private String content;//内容
private String duration;//时长
private String start_time;
private String end_time;
private Integer affair_type;//审批类型 1:加班 2:请假 3:出差 4:外出 5:补卡
}
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 CalendarPunchDetailsDto {
@ApiModelProperty(value = "字段说明", example = "0")
private Integer clock_num;// 打卡次数
@ApiModelProperty(value = "字段说明", example = " ")
private String date;
@ApiModelProperty(value = "字段说明", example = " ")
private String bcsbdk1;//班次打卡时间
@ApiModelProperty(value = "字段说明", example = " ")
private String bcxbdk1;
@ApiModelProperty(value = "字段说明", example = " ")
private String bcsbdk2;
@ApiModelProperty(value = "字段说明", example = " ")
private String bcxbdk2;
@ApiModelProperty(value = "字段说明", example = " ")
private String bcsbdk3;
@ApiModelProperty(value = "字段说明", example = " ")
private String bcxbdk3;
private String sbdksj1;//用户打卡时间
private Integer sbdksj1jg;//用户打卡结果
private String xbdksj1;
private Integer xbdksj1jg;
private String sbdksj2;
private Integer sbdksj2jg;
private String xbdksj2;
private Integer xbdksj2jg;
private String sbdksj3;
private Integer sbdksj3jg;
private String xbdksj3;
private Integer xbdksj3jg;
}
package cn.timer.api.dto.kqmk;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DetailsofbusinessDto {
List<CalendarPunchDetailsDto> caldet;
List<CalendarDetailsDto> calils;
}
package cn.timer.api.dto.kqmk;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WorkbenchCalendarDto {
private String date;
private Integer calendar_status;//日历状态 0:无; 1:正常;2:事务(请假,加班,调休,出差);3:异常 4:休息
private List<CalendarPunchDetailsDto> detailed;
}
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<result column="compensate_id" property="compensateId" /> <result column="compensate_id" property="compensateId" />
<result column="start_time" property="startTime" /> <result column="start_time" property="startTime" />
<result column="end_time" property="endTime" /> <result column="end_time" property="endTime" />
<result column="org_code" property="orgCode" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -28,22 +29,10 @@ ...@@ -28,22 +29,10 @@
overtime_type_id, overtime_type_id,
compensate_id, compensate_id,
start_time, start_time,
end_time end_time,
</sql> org_code
<sql id="Base_Column_List_Alias">
id KqglAssoRelationSummary_id,
user_id KqglAssoRelationSummary_user_id,
app_time KqglAssoRelationSummary_app_time,
approval_id KqglAssoRelationSummary_approval_id,
approval_type KqglAssoRelationSummary_approval_type,
duration KqglAssoRelationSummary_duration,
leave_type_id KqglAssoRelationSummary_leave_type_id,
overtime_type_id KqglAssoRelationSummary_overtime_type_id,
compensate_id KqglAssoRelationSummary_compensate_id,
start_time KqglAssoRelationSummary_start_time,
end_time KqglAssoRelationSummary_end_time
</sql> </sql>
<select id="SecondaryValue" resultMap="BaseResultMap"> <select id="SecondaryValue" resultMap="BaseResultMap">
select a.user_id, select a.user_id,
......
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