OvertimeStatsServiceImpl.java 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package cn.com.lzt.overtimestats.service.impl;
  2. import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
  3. import org.jeecgframework.core.constant.Globals;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Service;
  6. import org.springframework.transaction.annotation.Transactional;
  7. import java.util.HashMap;
  8. import java.util.List;
  9. import java.util.Map;
  10. import java.util.UUID;
  11. import java.io.Serializable;
  12. import org.jeecgframework.core.util.ApplicationContextUtil;
  13. import org.jeecgframework.core.util.JeecgDataAutorUtils;
  14. import org.jeecgframework.core.util.LogUtil;
  15. import org.jeecgframework.core.util.MyClassLoader;
  16. import org.jeecgframework.core.util.StringUtil;
  17. import org.jeecgframework.minidao.pojo.MiniDaoPage;
  18. import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter;
  19. import cn.com.lzt.common.util.DataUtil;
  20. import cn.com.lzt.distributionstats.entity.ProjDistributionStatsEntity;
  21. import cn.com.lzt.overtimestats.dao.OvertimeStatsMinidaoDao;
  22. import cn.com.lzt.overtimestats.entity.DeptOvertimeStatsEntity;
  23. import cn.com.lzt.overtimestats.entity.ProjOvertimeStatsEntity;
  24. import cn.com.lzt.overtimestats.entity.UserOvertimeStatsEntity;
  25. import cn.com.lzt.overtimestats.service.OvertimeStatsServiceI;
  26. import cn.com.lzt.wageStats.service.WageStatsServiceI;
  27. @Service("overtimeStatsService")
  28. @Transactional
  29. public class OvertimeStatsServiceImpl extends CommonServiceImpl implements OvertimeStatsServiceI {
  30. @Autowired
  31. private OvertimeStatsMinidaoDao overtimeStatsMinidaoDao;
  32. @Override
  33. public void overtimeStatsTaskData() {
  34. overtimeStatsTaskData(null);
  35. }
  36. @Override
  37. public void overtimeStatsTaskData(String attmonth) {
  38. LogUtil.info("===============人员统计定时任务开始=================");
  39. //String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
  40. String beforeMonth = DataUtil.getBeforeMonth();
  41. if(StringUtil.isNotEmpty(attmonth)){
  42. beforeMonth = attmonth;
  43. }
  44. Map<String,Object> params = new HashMap<String, Object>();
  45. params.put("yearmonth", beforeMonth);
  46. params.put("basepay", Globals.BASE_PAY);
  47. //查询上个月的员工月度考勤
  48. MiniDaoPage<UserOvertimeStatsEntity> userOvertimelist = new MiniDaoPage<UserOvertimeStatsEntity>();
  49. userOvertimelist = overtimeStatsMinidaoDao.userOvertimeStatsData(params,null);
  50. List<UserOvertimeStatsEntity> userOverList = findByProperty(UserOvertimeStatsEntity.class, "yearmonth", beforeMonth);
  51. try {
  52. deleteAllEntitie(userOverList);
  53. super.batchSave(userOvertimelist.getResults());
  54. LogUtil.info("===============员工加班统计表保存成功=================");
  55. } catch (Exception e) {
  56. LogUtil.info("===============员工加班统计表保存失败=================");
  57. }
  58. //查询上个月的部门月度考勤
  59. MiniDaoPage<DeptOvertimeStatsEntity> deptOvertimelist = new MiniDaoPage<DeptOvertimeStatsEntity>();
  60. deptOvertimelist = overtimeStatsMinidaoDao.deptOvertimeStatsData(params,null);
  61. List<DeptOvertimeStatsEntity> deptOverList = findByProperty(DeptOvertimeStatsEntity.class, "yearmonth",beforeMonth);
  62. try {
  63. deleteAllEntitie(deptOverList);
  64. super.batchSave(deptOvertimelist.getResults());
  65. LogUtil.info("===============部门加班统计表保存成功=================");
  66. } catch (Exception e) {
  67. LogUtil.info("===============部门加班统计表保存失败=================");
  68. }
  69. //查询上个月的项目月度考勤
  70. MiniDaoPage<ProjOvertimeStatsEntity> projOvertimelist = new MiniDaoPage<ProjOvertimeStatsEntity>();
  71. projOvertimelist = overtimeStatsMinidaoDao.projOvertimeStatsData(params,null);
  72. List<ProjOvertimeStatsEntity> projOverList = findByProperty(ProjOvertimeStatsEntity.class, "yearmonth",beforeMonth);
  73. try {
  74. deleteAllEntitie(projOverList);
  75. super.batchSave(projOvertimelist.getResults());
  76. LogUtil.info("===============项目加班统计表保存成功=================");
  77. } catch (Exception e) {
  78. LogUtil.info("===============项目加班统计表保存失败=================");
  79. }
  80. LogUtil.info("===============加班统计定时任务开始=================");
  81. }
  82. }