Commit d8341893 by leialin

Merge branch 'lal' into 'develop'

提交

See merge request 8timerv2/8timerapiv200!145
parents 644afa0e 20cb7964
...@@ -21,6 +21,50 @@ public class ClockInTool { ...@@ -21,6 +21,50 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd"); static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
/**
* 获取指定年月的第一天
*
* @param year
* @param month
* @return
*/
public static String getFirstDayOfMonth1(int year, int month) {
Calendar cal = Calendar.getInstance();
// 设置年份
cal.set(Calendar.YEAR, year);
// 设置月份
cal.set(Calendar.MONTH, month - 1);
// 获取某月最小天数
int firstDay = cal.getMinimum(Calendar.DATE);
// 设置日历中月份的最小天数
cal.set(Calendar.DAY_OF_MONTH, firstDay);
// 格式化日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(cal.getTime());
}
/**
* 获取指定年月的最后一天
*
* @param year
* @param month
* @return
*/
public static String getLastDayOfMonth1(int year, int month) {
Calendar cal = Calendar.getInstance();
// 设置年份
cal.set(Calendar.YEAR, year);
// 设置月份
cal.set(Calendar.MONTH, month - 1);
// 获取某月最大天数
int lastDay = cal.getActualMaximum(Calendar.DATE);
// 设置日历中月份的最大天数
cal.set(Calendar.DAY_OF_MONTH, lastDay);
// 格式化日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(cal.getTime());
}
// 数组容量的扩容,当空间(.length)不够的时候,增加一 // 数组容量的扩容,当空间(.length)不够的时候,增加一
public static String[] arrycopy(String[] ss) { public static String[] arrycopy(String[] ss) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
...@@ -269,7 +313,7 @@ public class ClockInTool { ...@@ -269,7 +313,7 @@ public class ClockInTool {
* @return true在时间段内,false不在时间段内 * @return true在时间段内,false不在时间段内
* @throws Exception * @throws Exception
*/ */
public static boolean hourMinuteBetween(String nowDate, String startDate, String endDate,String date_format){ public static boolean hourMinuteBetween(String nowDate, String startDate, String endDate, String date_format) {
SimpleDateFormat format = new SimpleDateFormat(date_format); SimpleDateFormat format = new SimpleDateFormat(date_format);
...@@ -341,7 +385,7 @@ public class ClockInTool { ...@@ -341,7 +385,7 @@ public class ClockInTool {
df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss"); df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss");
} else if (num == 2) { } else if (num == 2) {
df2 = new SimpleDateFormat("HH:mm"); df2 = new SimpleDateFormat("HH:mm");
}else if (num == 3) { } else if (num == 3) {
df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm"); df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm");
} }
......
...@@ -4,6 +4,7 @@ import java.lang.reflect.InvocationTargetException; ...@@ -4,6 +4,7 @@ import java.lang.reflect.InvocationTargetException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -78,6 +79,7 @@ import cn.timer.api.dao.kqmk.KqglAssoKqjMapper; ...@@ -78,6 +79,7 @@ import cn.timer.api.dao.kqmk.KqglAssoKqjMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper; import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper; import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper; import cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper;
import cn.timer.api.dao.kqmk.KqglAssoMonthPunchSummaryMapper;
import cn.timer.api.dao.kqmk.KqglAssoOvertimeRangeMapper; import cn.timer.api.dao.kqmk.KqglAssoOvertimeRangeMapper;
import cn.timer.api.dao.kqmk.KqglAssoOvertimeRulesMapper; import cn.timer.api.dao.kqmk.KqglAssoOvertimeRulesMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper; import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
...@@ -90,11 +92,13 @@ import cn.timer.api.dao.kqmk.KqglMainKqzMapper; ...@@ -90,11 +92,13 @@ import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AttMemberSettings; import cn.timer.api.dto.kqmk.AttMemberSettings;
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.AttendanceSummaryQueryDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto; import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.CompensateDto; import cn.timer.api.dto.kqmk.CompensateDto;
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;
import cn.timer.api.dto.kqmk.KqglAssoMonthPunchSummaryDto;
import cn.timer.api.dto.kqmk.KqglAssoOvertimeRulesDto; import cn.timer.api.dto.kqmk.KqglAssoOvertimeRulesDto;
import cn.timer.api.dto.kqmk.KqglAssoPbmxDto; import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
import cn.timer.api.dto.kqmk.KqglAssoRulesViceDto; import cn.timer.api.dto.kqmk.KqglAssoRulesViceDto;
...@@ -926,7 +930,7 @@ public class TimeCardController { ...@@ -926,7 +930,7 @@ public class TimeCardController {
@ApiOperation(value = "38:获取员工数据-根据 组织机构代码", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "38:获取员工数据-根据 组织机构代码", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 38) @ApiOperationSupport(order = 38)
public Result<Object> getEmployeeData(@CurrentUser UserBean userBean) { public Result<Object> getEmployeeData(@CurrentUser UserBean userBean) {
List<YgglMainEmp> yggl = YgglMainEmp.builder().build().selectList(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())); List<YgglMainEmp> yggl = YgglMainEmp.builder().build().selectList(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).eq(YgglMainEmp::getJobStatus, "1"));
return ResultUtil.data(yggl); return ResultUtil.data(yggl);
} }
...@@ -1988,6 +1992,48 @@ public class TimeCardController { ...@@ -1988,6 +1992,48 @@ public class TimeCardController {
return ResultUtil.data(attoverrul,"操作成功!"); return ResultUtil.data(attoverrul,"操作成功!");
} }
@Autowired
private KqglAssoMonthPunchSummaryMapper kqglassomonthpunchsummarymapper;
@PostMapping(value = "/Summary_data")
@ApiOperation(value = "获取考勤报表汇总数据", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> SummarydataList(@CurrentUser UserBean userBean, @Validated @RequestBody AttendanceSummaryQueryDto attesummqueto) throws ParseException {
IPage<KqglAssoMonthPunchSummaryDto> page = new Page<KqglAssoMonthPunchSummaryDto>(
attesummqueto.getCurrentPage() == null ? 1 : attesummqueto.getCurrentPage(),
attesummqueto.getTotalPage() == null ? 10 : attesummqueto.getTotalPage());
attesummqueto.setOrgCode(userBean.getOrgCode());
String year = null,month = null;
String staapptime = null,endapptime = null;
if(attesummqueto.getTimes() != null && !("").equals(attesummqueto.getTimes())) {
year = attesummqueto.getTimes().substring(0, 4);
month = attesummqueto.getTimes().substring(5, 7);
staapptime = ClockInTool.getFirstDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
endapptime = ClockInTool.getLastDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
}else {
year = new SimpleDateFormat("yyyy").format(new Date()).toString();
month = new SimpleDateFormat("MM").format(new Date()).toString();
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);
staapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(c.getTime()),"yyyy-MM-dd"));
Calendar ca = Calendar.getInstance();
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
endapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(ca.getTime()),"yyyy-MM-dd"));
}
attesummqueto.setYear(year);
attesummqueto.setMonth(month);
attesummqueto.setStaapptime(staapptime);
attesummqueto.setEndapptime(endapptime);
// 缺-部门id 搜索
IPage<KqglAssoMonthPunchSummaryDto> pageAs = kqglassomonthpunchsummarymapper.AttendanceSummaryData(page, attesummqueto);
List<KqglAssoMonthPunchSummaryDto> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
}
// @GetMapping(value = "/summary_report") // @GetMapping(value = "/summary_report")
// @ApiOperation(value = "考勤汇总报表(暂时不用)", httpMethod = "GET", notes = "接口发布说明") // @ApiOperation(value = "考勤汇总报表(暂时不用)", httpMethod = "GET", notes = "接口发布说明")
// public Result<Object> attendance_summary_report() { // public Result<Object> attendance_summary_report() {
......
...@@ -11,11 +11,10 @@ import java.util.List; ...@@ -11,11 +11,10 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -32,8 +31,6 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary; ...@@ -32,8 +31,6 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
import cn.timer.api.bean.kqmk.KqglAssoTeshu; import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban; import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz; import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.kqmk.KqglTaskTiming;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.controller.kqgl.ClockInTool; import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper; import cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper; import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
...@@ -53,9 +50,11 @@ import cn.timer.api.utils.DateUtil; ...@@ -53,9 +50,11 @@ import cn.timer.api.utils.DateUtil;
* @author lal * @author lal
* 考勤报表汇总数据 * 考勤报表汇总数据
*/ */
@Component //@Component
@Lazy //@Lazy
public class AttendanceTaskTiming implements SchedulingConfigurer { @Configuration //1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling // 2.开启定时任务
public class AttendanceTaskTiming{
// private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); // private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
static String tablename = null; static String tablename = null;
...@@ -79,20 +78,20 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -79,20 +78,20 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
/** /**
* 数据库动态更改定时配置(attendance_socks) * 数据库动态更改定时配置(attendance_socks)
*/ */
@Override // @Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { // public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.addTriggerTask(() -> { // taskRegistrar.addTriggerTask(() -> {
// 任务逻辑 // // 任务逻辑
try { // try {
tablename = AttendanceTask(); // tablename = AttendanceTask();
} catch (ParseException e) { // } catch (ParseException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
}, triggerContext -> { // }, triggerContext -> {
CronTrigger cron = new CronTrigger(AttendanceUtil.getCron(tablename)); // cron配置 // CronTrigger cron = new CronTrigger(AttendanceUtil.getCron(tablename)); // cron配置
return cron.nextExecutionTime(triggerContext); // 下次执行任务的时间 // return cron.nextExecutionTime(triggerContext); // 下次执行任务的时间
}); // });
} // }
@Autowired @Autowired
private KqglAssoRelationSummaryMapper kqglassorelationsummarymapper; private KqglAssoRelationSummaryMapper kqglassorelationsummarymapper;
...@@ -104,24 +103,31 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -104,24 +103,31 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
* @return * @return
* @throws ParseException * @throws ParseException
*/ */
// @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次
public String AttendanceTask() throws ParseException {
boolean implement = false; //3.添加定时任务
int sockid = 0; @Scheduled(cron = "0 10 15 * * ?")
KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask")); //或直接指定时间间隔,例如:5秒
if(sock == null) { //@Scheduled(fixedRate=5000)
KqglTaskTiming sock1 = KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build();
sock1.insert(); // @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次 0 0 19 * * ?
sockid = sock1.getId(); public void AttendanceTask() throws ParseException {
implement = true;
}else { // boolean implement = false;
sockid = sock.getId(); // int sockid = 0;
if(sock.getExecutionStatus() == 0) { // KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask"));
KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById(); // if(sock == null) {
implement = true; // KqglTaskTiming sock1 = KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build();
} // sock1.insert();
} // sockid = sock1.getId();
// implement = true;
// }else {
// sockid = sock.getId();
// if(sock.getExecutionStatus() == 0) {
// KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById();
// implement = true;
// }
// }
boolean implement = true;
//逻辑 //逻辑
if(implement) { if(implement) {
...@@ -136,7 +142,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -136,7 +142,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH)); ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(sdf1.format(ca.getTime()),"yyyy-MM-dd")).getTime(); Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(sdf1.format(ca.getTime()),"yyyy-MM-dd")).getTime();
List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>());//系统中的所有公司 所有未到期的公司 // List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>());//系统中的所有公司 所有未到期的公司
String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();// String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
String ttstr = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();// String ttstr = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();//
...@@ -148,8 +154,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -148,8 +154,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
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 = orgcodelist.get(t).getId();//企业组织代码 int org_code = 117;//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;
...@@ -434,7 +440,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -434,7 +440,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
} }
} }
//排查请假是否在最后一次打卡范围内 //排查请假是否在最后一次打卡范围内 查询当月的请假所有日期
List<KqglAssoRelationSummary> leainv = kqglassorelationsummarymapper.LeaveInvestigation(user.getEmpnum(), 2, ttstr); List<KqglAssoRelationSummary> leainv = kqglassorelationsummarymapper.LeaveInvestigation(user.getEmpnum(), 2, ttstr);
KqglAssoBcsz shif = KqglAssoBcsz.builder().build(); KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
String beginTime = sdf1.format(new Date()); String beginTime = sdf1.format(new Date());
...@@ -570,11 +576,11 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -570,11 +576,11 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//最后一次应打卡时间 //最后一次应打卡时间
String latimeclock = ""; String latimeclock = "";
if(answer == 1) { if(answer == 1) {
latimeclock = ClockInTool.dealDateFormat(shif.getXbdk1(),3); latimeclock = num +" "+ shif.getXbdk1();//ClockInTool.dealDateFormat(shif.getXbdk1(),3);
}else if(answer == 2) { }else if(answer == 2) {
latimeclock = ClockInTool.dealDateFormat(shif.getXbdk2(),3); latimeclock = num +" "+ shif.getXbdk2();//ClockInTool.dealDateFormat(shif.getXbdk2(),3);
}else { }else {
latimeclock = ClockInTool.dealDateFormat(shif.getXbdk3(),3); latimeclock = num +" "+ shif.getXbdk3();//ClockInTool.dealDateFormat(shif.getXbdk3(),3);
} }
for(KqglAssoRelationSummary learel:leainv) { for(KqglAssoRelationSummary learel:leainv) {
boolean adopt = ClockInTool.hourMinuteBetween(latimeclock, learel.getStartTime().substring(0, 16), learel.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm"); boolean adopt = ClockInTool.hourMinuteBetween(latimeclock, learel.getStartTime().substring(0, 16), learel.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
...@@ -678,13 +684,14 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -678,13 +684,14 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
summary.setDay31(noticesArray[30]); summary.setDay31(noticesArray[30]);
summary.insert(); summary.insert();
} }
} // }
// KqglTaskTiming.builder().task("AttendanceTask").id(sockid).executionStatus(0).lastExecutionTime(new Date().getTime()).build().updateById(); // KqglTaskTiming.builder().task("AttendanceTask").id(sockid).executionStatus(0).lastExecutionTime(new Date().getTime()).build().updateById();
return new Exception().getStackTrace()[0].getMethodName(); // return new Exception().getStackTrace()[0].getMethodName();
}else {
return null;
} }
// else {
// return null;
// }
} }
......
package cn.timer.api.dao.kqmk; package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary; import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary;
import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto;
import cn.timer.api.dto.kqmk.KqglAssoMonthPunchSummaryDto;
/** /**
* 打卡月汇总 * 打卡月汇总
...@@ -13,4 +18,5 @@ import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary; ...@@ -13,4 +18,5 @@ import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary;
@Repository @Repository
public interface KqglAssoMonthPunchSummaryMapper extends BaseMapper<KqglAssoMonthPunchSummary> { public interface KqglAssoMonthPunchSummaryMapper extends BaseMapper<KqglAssoMonthPunchSummary> {
IPage<KqglAssoMonthPunchSummaryDto> AttendanceSummaryData(IPage<KqglAssoMonthPunchSummaryDto> page,@Param("param") AttendanceSummaryQueryDto attendancesummaryquerydto);
} }
package cn.timer.api.dto.kqmk;
import cn.timer.api.utils.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendanceSummaryQueryDto extends Page {
private Integer orgCode;
@ApiModelProperty(value = "关键字", example = "")
private String query;
private String times;
private Integer attid;
private String year;
private String month;
private String staapptime;
private String endapptime;
}
package cn.timer.api.dto.kqmk;
import java.util.List;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author lal 2020-05-15
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class KqglAssoMonthPunchSummaryDto {
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id id", example = "101")
private Integer id;
@ApiModelProperty(value = "姓名 ", example = "姓名")
private String name;
@ApiModelProperty(value = "工号 工号", example = "101")
private Integer num;
@ApiModelProperty(value = "部门 ", example = "部门")
private String dept;
@ApiModelProperty(value = "职位 ", example = "职位")
private String post;
@ApiModelProperty(value = "考勤组id 考勤组id", example = "101")
private Integer attGroup;
@ApiModelProperty(value = "班次id 班次id", example = "101")
private Integer shift;
@ApiModelProperty(value = "应出勤天数 ", example = "应出勤天数")
private Double daysOnDuty;
@ApiModelProperty(value = "实际出勤天数 ", example = "实际出勤天数")
private Double actualAttDays;
@ApiModelProperty(value = "休息天数 ", example = "休息天数")
private Double daysOff;
@ApiModelProperty(value = "工作时长(分钟) ", example = "工作时长(分钟)")
private Double workingHours;
@ApiModelProperty(value = "迟到次数 ", example = "迟到次数")
private Double lateTimes;
@ApiModelProperty(value = "迟到时长(分钟) ", example = "迟到时长(分钟)")
private Double lateHours;
@ApiModelProperty(value = "严重迟到次数 ", example = "严重迟到次数")
private Double seriousLateTimes;
@ApiModelProperty(value = "严重迟到时长(分钟) ", example = "严重迟到时长(分钟)")
private Double seriousLateHours;
@ApiModelProperty(value = "旷工迟到次数 ", example = "旷工迟到次数")
private Double absenLateTimes;
@ApiModelProperty(value = "早退次数 ", example = "早退次数")
private Double earlyLeaveTimes;
@ApiModelProperty(value = "早退时长(分钟) ", example = "早退时长(分钟)")
private Double lengthEarlyLeave;
@ApiModelProperty(value = "上班缺卡次数 ", example = "上班缺卡次数")
private Double numberWorkCardShortage;
@ApiModelProperty(value = "下班缺卡次数 ", example = "下班缺卡次数")
private Double numberDutyCardShortage;
@ApiModelProperty(value = "旷工天数 ", example = "旷工天数")
private Double absenteeismDays;
@ApiModelProperty(value = "出差时长 ", example = "出差时长")
private Double lengthBusinessTrip;
@ApiModelProperty(value = "外出时长 ", example = "外出时长")
private Double timeOut;
@ApiModelProperty(value = "加班总时长 ", example = "加班总时长")
private Double totalOvertimeHours;
@ApiModelProperty(value = "工作日(转调休) ", example = "工作日(转调休)")
private Double workingTurnCompenLeave;
@ApiModelProperty(value = "休息日(转调休) ", example = "休息日(转调休)")
private Double restTurnCompenLeave;
@ApiModelProperty(value = "节假日(转调休) ", example = "节假日(转调休)")
private Double holidayTurnCompenLeave;
@ApiModelProperty(value = "工作日(转加班费) ", example = "工作日(转加班费)")
private Double workingTransferOvertime;
@ApiModelProperty(value = "休息日(转加班费) ", example = "休息日(转加班费)")
private Double restTransferOvertime;
@ApiModelProperty(value = "节假日(转加班费) ", example = "节假日(转加班费)")
private Double holidayTransferOvertime;
@ApiModelProperty(value = "day1 ", example = "day1")
private String day1;
@ApiModelProperty(value = "day2 ", example = "day2")
private String day2;
@ApiModelProperty(value = "day3 ", example = "day3")
private String day3;
@ApiModelProperty(value = "day4 ", example = "day4")
private String day4;
@ApiModelProperty(value = "day5 ", example = "day5")
private String day5;
@ApiModelProperty(value = "day6 ", example = "day6")
private String day6;
@ApiModelProperty(value = "day7 ", example = "day7")
private String day7;
@ApiModelProperty(value = "day8 ", example = "day8")
private String day8;
@ApiModelProperty(value = "day9 ", example = "day9")
private String day9;
@ApiModelProperty(value = "day10 ", example = "day10")
private String day10;
@ApiModelProperty(value = "day11 ", example = "day11")
private String day11;
@ApiModelProperty(value = "day12 ", example = "day12")
private String day12;
@ApiModelProperty(value = "day13 ", example = "day13")
private String day13;
@ApiModelProperty(value = "day14 ", example = "day14")
private String day14;
@ApiModelProperty(value = "day15 ", example = "day15")
private String day15;
@ApiModelProperty(value = "day16 ", example = "day16")
private String day16;
@ApiModelProperty(value = "day17 ", example = "day17")
private String day17;
@ApiModelProperty(value = "day18 ", example = "day18")
private String day18;
@ApiModelProperty(value = "day19 ", example = "day19")
private String day19;
@ApiModelProperty(value = "day20 ", example = "day20")
private String day20;
@ApiModelProperty(value = "day21 ", example = "day21")
private String day21;
@ApiModelProperty(value = "day22 ", example = "day22")
private String day22;
@ApiModelProperty(value = "day23 ", example = "day23")
private String day23;
@ApiModelProperty(value = "day24 ", example = "day24")
private String day24;
@ApiModelProperty(value = "day25 ", example = "day25")
private String day25;
@ApiModelProperty(value = "day26 ", example = "day26")
private String day26;
@ApiModelProperty(value = "day27 ", example = "day27")
private String day27;
@ApiModelProperty(value = "day28 ", example = "day28")
private String day28;
@ApiModelProperty(value = "day29 ", example = "day29")
private String day29;
@ApiModelProperty(value = "day30 ", example = "day30")
private String day30;
@ApiModelProperty(value = "day31 ", example = "day31")
private String day31;
@ApiModelProperty(value = "年 年", example = "101")
private Integer belongYear;
@ApiModelProperty(value = "月 月", example = "101")
private Integer belongMonth;
@ApiModelProperty(value = "企业组织代码 企业组织代码", example = "101")
private Integer orgCode;
@ApiModelProperty(value = "最后修改时间 最后修改时间", example = "101")
private Long lastModified;
@ApiModelProperty(value = "表数据", example = "字段说明")
List<BalanceSheetDataDto> balanceTo;
}
\ No newline at end of file
...@@ -71,6 +71,81 @@ ...@@ -71,6 +71,81 @@
<result column="last_modified" property="lastModified" /> <result column="last_modified" property="lastModified" />
</resultMap> </resultMap>
<resultMap id="SummarydataMap" type="cn.timer.api.dto.kqmk.KqglAssoMonthPunchSummaryDto" >
<id column="id" property="id" />
<result column="name" property="name" />
<result column="num" property="num" />
<result column="dept" property="dept" />
<result column="post" property="post" />
<result column="att_group" property="attGroup" />
<result column="shift" property="shift" />
<result column="days_on_duty" property="daysOnDuty" />
<result column="actual_att_days" property="actualAttDays" />
<result column="days_off" property="daysOff" />
<result column="working_hours" property="workingHours" />
<result column="late_times" property="lateTimes" />
<result column="late_hours" property="lateHours" />
<result column="serious_late_times" property="seriousLateTimes" />
<result column="serious_late_hours" property="seriousLateHours" />
<result column="absen_late_times" property="absenLateTimes" />
<result column="early_leave_times" property="earlyLeaveTimes" />
<result column="length_early_leave" property="lengthEarlyLeave" />
<result column="number_work_card_shortage" property="numberWorkCardShortage" />
<result column="number_duty_card_shortage" property="numberDutyCardShortage" />
<result column="absenteeism_days" property="absenteeismDays" />
<result column="length_business_trip" property="lengthBusinessTrip" />
<result column="time_out" property="timeOut" />
<result column="total_overtime_hours" property="totalOvertimeHours" />
<result column="working_turn_compen_leave" property="workingTurnCompenLeave" />
<result column="rest_turn_compen_leave" property="restTurnCompenLeave" />
<result column="holiday_turn_compen_leave" property="holidayTurnCompenLeave" />
<result column="working_transfer_overtime" property="workingTransferOvertime" />
<result column="rest_transfer_overtime" property="restTransferOvertime" />
<result column="holiday_transfer_overtime" property="holidayTransferOvertime" />
<result column="day1" property="day1" />
<result column="day2" property="day2" />
<result column="day3" property="day3" />
<result column="day4" property="day4" />
<result column="day5" property="day5" />
<result column="day6" property="day6" />
<result column="day7" property="day7" />
<result column="day8" property="day8" />
<result column="day9" property="day9" />
<result column="day10" property="day10" />
<result column="day11" property="day11" />
<result column="day12" property="day12" />
<result column="day13" property="day13" />
<result column="day14" property="day14" />
<result column="day15" property="day15" />
<result column="day16" property="day16" />
<result column="day17" property="day17" />
<result column="day18" property="day18" />
<result column="day19" property="day19" />
<result column="day20" property="day20" />
<result column="day21" property="day21" />
<result column="day22" property="day22" />
<result column="day23" property="day23" />
<result column="day24" property="day24" />
<result column="day25" property="day25" />
<result column="day26" property="day26" />
<result column="day27" property="day27" />
<result column="day28" property="day28" />
<result column="day29" property="day29" />
<result column="day30" property="day30" />
<result column="day31" property="day31" />
<result column="belong_year" property="belongYear" />
<result column="belong_month" property="belongMonth" />
<result column="org_code" property="orgCode" />
<result column="last_modified" property="lastModified" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
</collection>
</resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, id,
name, name,
...@@ -139,73 +214,37 @@ ...@@ -139,73 +214,37 @@
last_modified last_modified
</sql> </sql>
<sql id="Base_Column_List_Alias"> <select id="AttendanceSummaryData" resultMap="SummarydataMap">
id KqglAssoMonthPunchSummary_id, select sum.*,
name KqglAssoMonthPunchSummary_name, yz.leaverulesid as leaverulesid,
num KqglAssoMonthPunchSummary_num, yz.duration as balancedays
dept KqglAssoMonthPunchSummary_dept, from kqgl_asso_month_punch_summary sum
post KqglAssoMonthPunchSummary_post, LEFT JOIN (SELECT les.id as leaverulesid,
att_group KqglAssoMonthPunchSummary_att_group, hz.user_id,
shift KqglAssoMonthPunchSummary_shift, hz.duration
days_on_duty KqglAssoMonthPunchSummary_days_on_duty, FROM kqgl_asso_leave_rules les
actual_att_days KqglAssoMonthPunchSummary_actual_att_days, LEFT JOIN (select rel.user_id,rel.leave_type_id,SUM(rel.duration) as duration
days_off KqglAssoMonthPunchSummary_days_off, from kqgl_asso_relation_summary rel
working_hours KqglAssoMonthPunchSummary_working_hours, where rel.approval_type = 2
late_times KqglAssoMonthPunchSummary_late_times, and rel.app_time &gt;= #{param.staapptime}
late_hours KqglAssoMonthPunchSummary_late_hours, and rel.app_time &lt;= #{param.endapptime}
serious_late_times KqglAssoMonthPunchSummary_serious_late_times, GROUP BY rel.user_id,rel.leave_type_id
serious_late_hours KqglAssoMonthPunchSummary_serious_late_hours, ) as hz on hz.leave_type_id = les.id
absen_late_times KqglAssoMonthPunchSummary_absen_late_times, WHERE les.org_code = #{param.orgCode}
early_leave_times KqglAssoMonthPunchSummary_early_leave_times, AND (les.leave_type = 2 OR les.is_open = 1)
length_early_leave KqglAssoMonthPunchSummary_length_early_leave, ) as yz on yz.user_id = sum.num
number_work_card_shortage KqglAssoMonthPunchSummary_number_work_card_shortage, where sum.org_code = #{param.orgCode}
number_duty_card_shortage KqglAssoMonthPunchSummary_number_duty_card_shortage, and sum.belong_year = #{param.year}
absenteeism_days KqglAssoMonthPunchSummary_absenteeism_days, and sum.belong_month = #{param.month}
length_business_trip KqglAssoMonthPunchSummary_length_business_trip, <if test="param.query != null and param.query != ''">
time_out KqglAssoMonthPunchSummary_time_out, and ( sum.`name` like CONCAT('%',#{param.query},'%') or
total_overtime_hours KqglAssoMonthPunchSummary_total_overtime_hours, sum.num like CONCAT('%',#{param.query},'%'))
working_turn_compen_leave KqglAssoMonthPunchSummary_working_turn_compen_leave, </if>
rest_turn_compen_leave KqglAssoMonthPunchSummary_rest_turn_compen_leave, <if test="param.attid != null and param.attid != ''">
holiday_turn_compen_leave KqglAssoMonthPunchSummary_holiday_turn_compen_leave, and sum.att_group = #{param.attid}
working_transfer_overtime KqglAssoMonthPunchSummary_working_transfer_overtime, </if>
rest_transfer_overtime KqglAssoMonthPunchSummary_rest_transfer_overtime,
holiday_transfer_overtime KqglAssoMonthPunchSummary_holiday_transfer_overtime, </select>
day1 KqglAssoMonthPunchSummary_day1,
day2 KqglAssoMonthPunchSummary_day2,
day3 KqglAssoMonthPunchSummary_day3,
day4 KqglAssoMonthPunchSummary_day4,
day5 KqglAssoMonthPunchSummary_day5,
day6 KqglAssoMonthPunchSummary_day6,
day7 KqglAssoMonthPunchSummary_day7,
day8 KqglAssoMonthPunchSummary_day8,
day9 KqglAssoMonthPunchSummary_day9,
day10 KqglAssoMonthPunchSummary_day10,
day11 KqglAssoMonthPunchSummary_day11,
day12 KqglAssoMonthPunchSummary_day12,
day13 KqglAssoMonthPunchSummary_day13,
day14 KqglAssoMonthPunchSummary_day14,
day15 KqglAssoMonthPunchSummary_day15,
day16 KqglAssoMonthPunchSummary_day16,
day17 KqglAssoMonthPunchSummary_day17,
day18 KqglAssoMonthPunchSummary_day18,
day19 KqglAssoMonthPunchSummary_day19,
day20 KqglAssoMonthPunchSummary_day20,
day21 KqglAssoMonthPunchSummary_day21,
day22 KqglAssoMonthPunchSummary_day22,
day23 KqglAssoMonthPunchSummary_day23,
day24 KqglAssoMonthPunchSummary_day24,
day25 KqglAssoMonthPunchSummary_day25,
day26 KqglAssoMonthPunchSummary_day26,
day27 KqglAssoMonthPunchSummary_day27,
day28 KqglAssoMonthPunchSummary_day28,
day29 KqglAssoMonthPunchSummary_day29,
day30 KqglAssoMonthPunchSummary_day30,
day31 KqglAssoMonthPunchSummary_day31,
belong_year KqglAssoMonthPunchSummary_belong_year,
belong_month KqglAssoMonthPunchSummary_belong_month,
org_code KqglAssoMonthPunchSummary_org_code,
last_modified KqglAssoMonthPunchSummary_last_modified
</sql>
<!-- <!--
......
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