parent
df41b0f7d9
commit
2c24ba58a8
|
|
@ -43,7 +43,7 @@ public class AttHisPullController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/getAttTempData")
|
||||
@Log(title = "考勤数据拉取->考勤模版数据", businessType = BusinessType.QUERY)
|
||||
public AjaxResult getAttTempData(@RequestBody AttDataDetailsBean bean) {
|
||||
public AjaxResult getAttTempData(AttDataDetailsBean bean) {
|
||||
try{
|
||||
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
|
||||
for (String date : dateList) {
|
||||
|
|
@ -63,7 +63,7 @@ public class AttHisPullController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/getAttDataPull")
|
||||
@Log(title = "考勤数据拉取->数据拉取(考勤)考勤数据更新", businessType = BusinessType.QUERY)
|
||||
public AjaxResult getAttDataPull(@RequestBody AttDataDetailsBean bean) {
|
||||
public AjaxResult getAttDataPull( AttDataDetailsBean bean) {
|
||||
try{
|
||||
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
|
||||
for (String date : dateList) {
|
||||
|
|
@ -83,11 +83,11 @@ public class AttHisPullController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/getAbsenteeismData")
|
||||
@Log(title = "考勤数据拉取->旷工判断", businessType = BusinessType.QUERY)
|
||||
public AjaxResult getAbsenteeismData(@RequestBody AttDataDetailsBean bean) {
|
||||
public AjaxResult getAbsenteeismData( AttDataDetailsBean bean) {
|
||||
try{
|
||||
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
|
||||
for (String date : dateList) {
|
||||
attTask.updateAbsenteeismData(date,1);
|
||||
attTask.updateAbsenteeismData(date,2);
|
||||
}
|
||||
return toAjax(true);
|
||||
}catch (Exception e){
|
||||
|
|
@ -102,7 +102,7 @@ public class AttHisPullController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/getLegalHolidayData")
|
||||
@Log(title = "考勤数据拉取->请假数据应用--法假", businessType = BusinessType.QUERY)
|
||||
public AjaxResult getLegalHolidayData(@RequestBody AttDataDetailsBean bean) {
|
||||
public AjaxResult getLegalHolidayData( AttDataDetailsBean bean) {
|
||||
try{
|
||||
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
|
||||
for (String date : dateList) {
|
||||
|
|
@ -121,7 +121,7 @@ public class AttHisPullController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/getLeaveData")
|
||||
@Log(title = "考勤数据拉取->请假数据应用--请假", businessType = BusinessType.QUERY)
|
||||
public AjaxResult getLeaveData(@RequestBody AttDataDetailsBean bean) {
|
||||
public AjaxResult getLeaveData( AttDataDetailsBean bean) {
|
||||
try{
|
||||
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
|
||||
for (String date : dateList) {
|
||||
|
|
@ -140,11 +140,11 @@ public class AttHisPullController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/insertDayReportData")
|
||||
@Log(title = "考勤数据拉取->报表数据生成(日报表)", businessType = BusinessType.QUERY)
|
||||
public AjaxResult insertDayReportData(@RequestBody AttDataDetailsBean bean) {
|
||||
public AjaxResult insertDayReportData( AttDataDetailsBean bean) {
|
||||
try{
|
||||
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
|
||||
for (String date : dateList) {
|
||||
attTask.updateLeaveData(date);
|
||||
attTask.insertDayReportData(date);
|
||||
}
|
||||
return toAjax(true);
|
||||
}catch (Exception e){
|
||||
|
|
@ -159,7 +159,7 @@ public class AttHisPullController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/insertMonthReportTempData")
|
||||
@Log(title = "考勤数据拉取->报表数据生成(月报表)", businessType = BusinessType.QUERY)
|
||||
public AjaxResult insertMonthReportTempData(@RequestBody AttDataDetailsBean bean) {
|
||||
public AjaxResult insertMonthReportTempData( AttDataDetailsBean bean) {
|
||||
try{
|
||||
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
|
||||
for (String date : dateList) {
|
||||
|
|
@ -178,7 +178,7 @@ public class AttHisPullController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/updateMonthReportData")
|
||||
@Log(title = "考勤数据拉取->报表数据生成--月报表修改", businessType = BusinessType.QUERY)
|
||||
public AjaxResult updateMonthReportData(@RequestBody AttDataDetailsBean bean) {
|
||||
public AjaxResult updateMonthReportData( AttDataDetailsBean bean) {
|
||||
try{
|
||||
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
|
||||
for (String date : dateList) {
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ public interface AttSourceDataDao {
|
|||
* 请假数据更新--修改考勤状态
|
||||
* @param v
|
||||
*/
|
||||
void updateLeaveData(AttDataBean v);
|
||||
void updateLeaveData(@Param("v") AttDataBean v);
|
||||
|
||||
/**
|
||||
* 查询月模版数据
|
||||
|
|
@ -244,6 +244,17 @@ public interface AttSourceDataDao {
|
|||
* @return
|
||||
*/
|
||||
void insertAttMonthReportTemp(List<AttMonthReportBean> monthReportList);
|
||||
|
||||
/**
|
||||
* 修改月计划数据
|
||||
* @param monthReportList
|
||||
* @return
|
||||
*/
|
||||
void updateAttMonthReport(List<AttMonthReportBean> monthReportList);
|
||||
|
||||
/**
|
||||
* 查询已生成月报表人员
|
||||
* @param pushDate
|
||||
* @return
|
||||
*/
|
||||
List<Long> getAttMonthReportPerson(String pushDate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,7 +257,11 @@ public class AttCalServiceImpl implements AttCalService {
|
|||
*/
|
||||
@Override
|
||||
public void insertMonthReportTempData(String pushDate) {
|
||||
//查出本月需生成月计划人员
|
||||
List<AttMonthReportBean> monthReportList = attSourceDataDao.selectAttMonthReportTemp(pushDate);
|
||||
//查出已生成月计划人员
|
||||
List<Long> personList = attSourceDataDao.getAttMonthReportPerson(pushDate);
|
||||
monthReportList.removeIf(c -> personList.contains(c.getUserId()));
|
||||
//查出考勤组
|
||||
List<AttGroupBean> groupList = getGroupData(pushDate);
|
||||
//人员对应出月出勤天数
|
||||
|
|
@ -304,7 +308,9 @@ public class AttCalServiceImpl implements AttCalService {
|
|||
//3.对比增量更新
|
||||
List<Long> personId = attSourceDataDao.getAttDataPerson(pushDate);
|
||||
listPerson.removeIf(c -> personId.contains(c.getUserId()));
|
||||
attSourceDataDao.insertAttDataList(listPerson);
|
||||
if(!listPerson.isEmpty()){
|
||||
attSourceDataDao.insertAttDataList(listPerson);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,59 +155,4 @@ public class MsgTasks {
|
|||
log.info("--------轮休临时外出异常推送定时器开启------");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 考勤设置历史时间消息推送
|
||||
*每天早七晚十一
|
||||
*/
|
||||
// @Scheduled(cron = "0 10 0,7,22 * * ?")
|
||||
@Scheduled(initialDelay = 6000 * 2,fixedDelay = 60000 * 30)
|
||||
@Async
|
||||
public void getAttSettingHistoryTask(){
|
||||
log.info("--------考勤设置历史时间消息推送定时器开启------");
|
||||
String startDate = DateUtil.today();
|
||||
// 解析 startDate 字符串到 LocalDate 对象
|
||||
LocalDate date = LocalDate.parse(startDate, DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
// 向前推30天
|
||||
LocalDate newDate = date.minusDays(60);
|
||||
// 如果需要将结果格式化为特定格式的字符串,可以使用以下代码
|
||||
String formattedNewDate = newDate.format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
//向前推1个月的时间检索,缺少哪一天推送哪一天
|
||||
List<String> dateListOne = noticeService.getAttSettingDate(startDate);
|
||||
List<String> dateList = getStrDateListBetween(formattedNewDate, startDate);
|
||||
// 从 dateList 中移除所有在 dateListOne 中存在的元素
|
||||
dateListOne.removeIf(startDate::contains);
|
||||
dateList.removeIf(dateListOne::contains);
|
||||
for (String s : dateList) {
|
||||
List<AttGroupBean> attList = noticeService.getAttSettingHistoryDate(s);
|
||||
if(!attList.isEmpty()){
|
||||
noticeService.insertAttSettingHistoryData(attList);
|
||||
}
|
||||
}
|
||||
log.info("--------考勤设置历史时间消息推送定时器开启------");
|
||||
}
|
||||
|
||||
public static List<String> getStrDateListBetween(String startDateString, String endDateString) {
|
||||
List<String> dateList = new ArrayList<>();
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
// 解析开始日期和结束日期
|
||||
Date startDate = dateFormat.parse(startDateString);
|
||||
Date endDate = dateFormat.parse(endDateString);
|
||||
// 创建 Calendar 实例并设置为开始日期
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(startDate);
|
||||
// 循环直到当前日期超过结束日期
|
||||
while (!calendar.getTime().after(endDate)) {
|
||||
// 将日期格式化为字符串,并添加到列表中
|
||||
dateList.add(dateFormat.format(calendar.getTime()));
|
||||
// 将日期加一天
|
||||
calendar.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
} catch (ParseException ignored) {
|
||||
}
|
||||
return dateList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -51,7 +51,6 @@ public class NewAttTask {
|
|||
/**
|
||||
* 考勤模版数据定时器 凌晨10分启动一次,一天仅仅一次
|
||||
*/
|
||||
// @Scheduled(cron = "0 0/10 * * * ?")
|
||||
@Scheduled(cron = "0 10 0 * * ?")
|
||||
// @Scheduled(initialDelay = 60000, fixedDelay = 60000 * 10)
|
||||
@Async
|
||||
|
|
@ -65,10 +64,10 @@ public class NewAttTask {
|
|||
|
||||
|
||||
/**
|
||||
* 1.数据拉取(考勤)定时器 每隔1个小时获取一次数据
|
||||
* 1.数据拉取(考勤)定时器 每隔1个小时获取一次数据(从早上 5 点开始,每小时执行一次)
|
||||
* 2.考勤数据应用(步骤一:考勤数据更新)
|
||||
*/
|
||||
@Scheduled(cron = "0 0/50 * * * ?")
|
||||
@Scheduled(cron = "0 0 5-23 * * ?")
|
||||
// @Scheduled(initialDelay = 60000, fixedDelay = 60000 * 10)
|
||||
@Async
|
||||
public void getAttDataPullTask() {
|
||||
|
|
@ -145,15 +144,15 @@ public class NewAttTask {
|
|||
|
||||
/**
|
||||
* 报表数据生成--日报表
|
||||
* 一小时更新一次
|
||||
* 6点10分开始,一小时更新一次
|
||||
*/
|
||||
@Scheduled(cron = "0 0 8,18 * * ?")
|
||||
@Scheduled(cron = "0 10 6-23 * * ?")
|
||||
// @Scheduled(initialDelay = 60000, fixedDelay = 60000 * 10)
|
||||
@Async
|
||||
public void getDayReportDataTask() {
|
||||
log.info("--------报表数据生成--日报表定时器开启------");
|
||||
String today = DateUtil.today();
|
||||
insertDayReportDataTask(today);
|
||||
insertDayReportData(today);
|
||||
log.info("--------报表数据生成--日报表定时器完毕------");
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +268,7 @@ public class NewAttTask {
|
|||
* 每次更新数据都要执行(跟随)
|
||||
* @param pushDate 时间
|
||||
*/
|
||||
public void insertDayReportDataTask(String pushDate) {
|
||||
public void insertDayReportData(String pushDate) {
|
||||
//日报表更新
|
||||
attCalService.insertDayReportData(pushDate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class WechatTasks {
|
|||
* 人员基础数据同步定时器
|
||||
*/
|
||||
// @Scheduled(cron = "0 0/10 * * * ?")
|
||||
// @Scheduled(initialDelay = 60000,fixedDelay = 60000 * 30)
|
||||
@Scheduled(initialDelay = 60000,fixedDelay = 60000 * 30)
|
||||
@Async
|
||||
public void pushPersonTask() {
|
||||
log.info("--------人员基础数据同步定时器开启------");
|
||||
|
|
@ -82,7 +82,7 @@ public class WechatTasks {
|
|||
/**
|
||||
* 休假出差数据同步定时器
|
||||
*/
|
||||
// @Scheduled(initialDelay = 60000 * 2,fixedDelay = 60000 * 30)
|
||||
@Scheduled(initialDelay = 60000 * 2,fixedDelay = 60000 * 30)
|
||||
@Async
|
||||
public void leaveTask() {
|
||||
log.info("--------休假出差数据定时器开启------");
|
||||
|
|
@ -153,7 +153,7 @@ public class WechatTasks {
|
|||
/**
|
||||
* 考勤数据同步定时器
|
||||
*/
|
||||
// @Scheduled(initialDelay = 6000 * 3,fixedDelay = 60000 * 30)
|
||||
@Scheduled(initialDelay = 6000 * 3,fixedDelay = 60000 * 30)
|
||||
@Async
|
||||
public void wechatAttTask() {
|
||||
log.info("--------考勤数据定时器开启------");
|
||||
|
|
|
|||
|
|
@ -26,6 +26,14 @@ public class WorkdayCalculator {
|
|||
System.out.print(1);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param attDays 周打卡日期
|
||||
* @param type 是否有节假日
|
||||
* @param holidays 月法假
|
||||
* @param pushDate 推送日期
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getWorkDay(String attDays, int type, List<Holiday> holidays, String pushDate) {
|
||||
List<Integer> dueWorkDates = getDueWorkDates(attDays);
|
||||
// 定义日期格式
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
att_current_time, att_type, att_address, province, att_lon, att_lat, data_source, remark)
|
||||
values (#{params.name}, #{params.idNumber}, #{params.orgId}, #{params.orgName},
|
||||
#{params.attCurrentDay}, #{params.attCurrentTime}, #{params.attType},
|
||||
#{params.attAddress}, #{province}, #{params.attLon}, #{params.attLat}, #{params.dataSource},
|
||||
#{params.attAddress}, #{params.province}, #{params.attLon}, #{params.attLat}, #{params.dataSource},
|
||||
#{params.remark})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
<insert id="insertAttDayReport">
|
||||
<foreach collection="list" item="params" separator=";">
|
||||
replace into att_day_report(att_current_day, org_id, normal_num, late_num, early_num, skipping_num,
|
||||
replace into att_day_report(att_current_day, normal_num, late_num, early_num, skipping_num,
|
||||
leave_num, address_error_num, ein_error_num, rest_num, out_num)
|
||||
values (#{params.attCurrentDay}, #{params.orgId}, #{params.normalNum}, #{params.lateNum},
|
||||
values (#{params.attCurrentDay}, #{params.normalNum}, #{params.lateNum},
|
||||
#{params.earlyNum}, #{params.skippingNum}, #{params.leaveNum},
|
||||
#{params.addressErrorNum}, #{params.einErrorNum}, #{params.restNum}, #{params.outNum})
|
||||
</foreach>
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
insert into att_month_report(user_id, name, org_id, org_name, att_current_month,
|
||||
required_days)
|
||||
values
|
||||
<foreach collection="list" item="params" separator=";">
|
||||
<foreach collection="list" item="params" separator=",">
|
||||
(#{params.userId}, #{params.userName}, #{params.orgId}, #{params.orgName},
|
||||
#{params.attCurrentMonth}, #{params.requiredDays})
|
||||
</foreach>
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
update att_month_report
|
||||
set org_id = #{v.orgId},
|
||||
org_name = #{v.orgName},
|
||||
nomal_num = #{v.normalNum},
|
||||
normal_num = #{v.normalNum},
|
||||
late_num = #{v.lateNum},
|
||||
early_num = #{v.earlyNum},
|
||||
skipping_num = #{v.skippingNum},
|
||||
|
|
@ -428,9 +428,10 @@
|
|||
WHERE la.is_active = 1
|
||||
AND la.examine_status = 1
|
||||
AND sdd.dict_value IS NOT NULL
|
||||
AND leave_start_date BETWEEN #{pushDate} - INTERVAL 3 DAY
|
||||
AND leave_start_date BETWEEN #{pushDate} - INTERVAL 15 DAY
|
||||
and #{pushDate}
|
||||
ORDER BY
|
||||
leave_start_date
|
||||
</select>
|
||||
|
||||
<select id="getLeaveDataByUserId" resultType="java.lang.Integer">
|
||||
|
|
@ -470,6 +471,7 @@
|
|||
ash.group_id,
|
||||
suo.org_id,
|
||||
'1' AS attType,
|
||||
#{pushDate} AS attCurrentDay,
|
||||
'0' AS attStatus
|
||||
FROM att_setting_history ash
|
||||
LEFT JOIN sys_user su ON ash.user_id = su.user_id
|
||||
|
|
@ -480,6 +482,7 @@
|
|||
ash.group_id,
|
||||
suo.org_id,
|
||||
'2' AS attType,
|
||||
#{pushDate} AS attCurrentDay,
|
||||
'0' AS attStatus
|
||||
FROM att_setting_history ash
|
||||
LEFT JOIN sys_user su ON ash.user_id = su.user_id
|
||||
|
|
@ -499,7 +502,7 @@
|
|||
WHERE
|
||||
att_current_day = #{pushDate}
|
||||
AND att_status = 0
|
||||
<if test='attType != ""'>
|
||||
<if test='attType != ""'>
|
||||
AND att_type = #{attType}
|
||||
</if>
|
||||
</select>
|
||||
|
|
@ -512,7 +515,7 @@
|
|||
att_current_day = #{pushDate}
|
||||
AND att_status = 0
|
||||
And is_update = 0
|
||||
<if test='attType != ""'>
|
||||
<if test='attType != ""'>
|
||||
AND att_type = #{attType}
|
||||
</if>
|
||||
</select>
|
||||
|
|
@ -530,7 +533,8 @@
|
|||
su.user_name,
|
||||
suo.org_id,
|
||||
so.org_name,
|
||||
ash.group_id
|
||||
ash.group_id,
|
||||
DATE_FORMAT( #{pushDate}, '%Y-%m' ) as attCurrentMonth
|
||||
FROM
|
||||
att_setting_history ash
|
||||
LEFT JOIN sys_user su ON su.user_id = ash.user_id
|
||||
|
|
@ -538,9 +542,18 @@
|
|||
LEFT JOIN sys_organization so ON so.id = suo.org_id
|
||||
WHERE
|
||||
DATE_FORMAT( ash.current_day, '%Y-%m' ) = DATE_FORMAT( #{pushDate}, '%Y-%m' )
|
||||
and suo.org_id is not null
|
||||
GROUP BY
|
||||
DATE_FORMAT( #{pushDate}, '%Y-%m' ),
|
||||
su.user_id
|
||||
</select>
|
||||
<select id="getAttMonthReportPerson" resultType="java.lang.Long">
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
att_month_report
|
||||
WHERE
|
||||
att_current_month = DATE_FORMAT( #{pushDate}, '%Y-%m' )
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue