package cn.com.lzt.attendance.service.impl; import antlr.StringUtils; import cn.com.lzt.attendance.dao.AttendanceStatsMinidaoDao; import cn.com.lzt.attendance.entity.DeptAttendanceEntity; import cn.com.lzt.attendance.entity.ProjAttendanceEntity; import cn.com.lzt.attendance.entity.UserAttendanceEntity; import cn.com.lzt.attendance.service.AttendanceStatsServiceI; import cn.com.lzt.common.util.DataUtil; import org.apache.jsp.webpage.workflow.listener.listener_jsp; import org.jeecgframework.core.common.service.impl.CommonServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import java.io.Serializable; import org.jeecgframework.core.util.ApplicationContextUtil; import org.jeecgframework.core.util.JeecgDataAutorUtils; import org.jeecgframework.core.util.LogUtil; import org.jeecgframework.core.util.MyClassLoader; import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.minidao.pojo.MiniDaoPage; import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter; @Service("attendanceStatsService") @Transactional public class AttendanceStatsServiceImpl extends CommonServiceImpl implements AttendanceStatsServiceI { @Autowired private AttendanceStatsMinidaoDao statsMinidaoDao; @Override @Transactional public void batchSaveUserAttendanceStats() { batchSaveUserAttendanceStats(null); } @Override public void batchSaveUserAttendanceStats(String attmonth) { LogUtil.info("===============考勤定时任务开始================="); //查询上个月的员工月度考勤 MiniDaoPage userAttlist = new MiniDaoPage(); String beforeMonth = DataUtil.getBeforeMonth(); if(StringUtil.isNotEmpty(attmonth)){ beforeMonth = attmonth; } userAttlist = statsMinidaoDao.userAttendanceStatsData(beforeMonth,null); List attList = findByProperty(UserAttendanceEntity.class, "yearmonth",beforeMonth); try { deleteAllEntitie(attList); super.batchSave(userAttlist.getResults()); LogUtil.info("===============员工考勤统计表保存成功================="); } catch (Exception e) { LogUtil.info("===============员工考勤统计表保存失败================="); } //查询上个月的部门月度考勤 MiniDaoPage deptAttlist = new MiniDaoPage(); deptAttlist = statsMinidaoDao.deptAttendanceStatsData(beforeMonth,null); List dattList = findByProperty(DeptAttendanceEntity.class, "yearmonth", beforeMonth); try { deleteAllEntitie(dattList); super.batchSave(deptAttlist.getResults()); LogUtil.info("===============部门考勤统计表保存成功================="); } catch (Exception e) { LogUtil.info("===============部门考勤统计表保存失败================="); } //查询上个月的项目月度考勤 MiniDaoPage pojAttlist = new MiniDaoPage(); pojAttlist = statsMinidaoDao.pojAttendanceStatsData(beforeMonth,null); List pattList = findByProperty(ProjAttendanceEntity.class, "yearmonth", beforeMonth); try { deleteAllEntitie(pattList); super.batchSave(pojAttlist.getResults()); LogUtil.info("===============项目考勤统计表保存成功================="); } catch (Exception e) { LogUtil.info("===============项目考勤统计表保存失败================="); } LogUtil.info("===============考勤定时任务结束================="); } }