ysh vor 2 Jahren
Ursprung
Commit
f968104d98

+ 55 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/controller/viewClockInController.java

@@ -28,6 +28,7 @@ import org.jeecg.modules.geke.statutoryleave.service.IStatutoryLeaveService;
 import org.jeecg.modules.quartz.entity.QuartzJob;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysDepartService;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecg.modules.system.util.DateUtils2;
 import org.jeecg.modules.viewClockIn.entity.*;
@@ -62,6 +63,8 @@ import io.swagger.annotations.ApiOperation;
 @RestController
 @RequestMapping("/viewClockIn/viewClockIn")
 public class viewClockInController extends JeecgController<ViewClockIn, IviewClockInService> {
+	 @Autowired
+	 private ISysDepartService sysDepartService;
 	 @Autowired
 	 private IviewClockInService viewClockInService;
 	 @Autowired
@@ -699,10 +702,57 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 	   * @param viewClockIn
 	   */
 	  @RequestMapping(value = "/exportXls")
-	  public ModelAndView exportXls(HttpServletRequest request, ViewClockIn viewClockIn,String userName,String mDate,String userType) {
+	  public ModelAndView exportXls(HttpServletRequest request, ViewClockIn viewClockIn,String userName,String mDate,String userType,
+									String excelType,String par_name,String par_code,String par_departIds,String par_works_type,
+									String par_pay_type,String par_multiple,String par_begin,String par_end) {
+//		  excelType 1 加班导出   其他为正常导出
+//		  par_name:'',//导出加班 姓名
+//		  par_code:'',//导出加班 工号
+//		  par_departIds:'',//导出加班 部门
+//		  par_works_type:'',//导出加班 加班事由
+//		  par_pay_type:'',//导出加班 支付类型
+//		  par_multiple:'',//导出加班 支付倍数
+//		  par_begin:'',//导出加班 开始时间
+//		  par_end:'',//导出加班 结束时间
+
+		  if(!StringUtil.isNullOrEmpty(excelType) && excelType.equals("1")){
+
+			 Map<String,String> map = new HashMap<>();
+			 map.put("par_name",par_name);
+			 map.put("par_code",par_code);
+
+		  	 if(!StringUtil.isNullOrEmpty(par_departIds) && !par_departIds.equals("0")){
+				  SysDepart sysDepart = sysDepartService.getById(par_departIds);
+				  if(sysDepart != null){
+					  map.put("par_departIds",sysDepart.getOrgCode());
+				  }
+		  	 }
+
+			 map.put("par_works_type",par_works_type);
+			 map.put("par_pay_type",par_pay_type);
+			 map.put("par_multiple",par_multiple);
+			 map.put("par_begin",par_begin);
+			 map.put("par_end",par_end);
+
+			 List<ExcelOvertime> lists = viewClockInService.exportAllOvertime(map);
+
+			 LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+			 ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+			 mv.addObject(NormalExcelConstants.FILE_NAME, "员工加班信息"); //此处设置的filename无效 ,前端会重更新设置一下
+			 mv.addObject(NormalExcelConstants.CLASS, ExcelOvertime.class);
+			  //update-begin--Author:liusq  Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
+			 ExportParams exportParams=new ExportParams("员工加班信息", "导出人:" + sysUser.getRealname(), "员工加班信息");
+			 exportParams.setImageBasePath(upLoadPath);
+			  //update-end--Author:liusq  Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
+			 mv.addObject(NormalExcelConstants.PARAMS,exportParams);
+			 mv.addObject(NormalExcelConstants.DATA_LIST, lists);
+			 return mv;
+
+		  }
+
+
 	  	  List<ExportClockInfo> list = viewClockInService.exportErrotInfo(userName,mDate,userType);
-		  List<ExportClockInfo> list2 = new ArrayList<>();
-//
+		  /*List<ExportClockInfo> list2 = new ArrayList<>();
 		  String realname = null;
 		  String oneDept = null;
 		  String twoDept = null;
@@ -725,7 +775,7 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 				l.setAttendanceCount("0");
 			}
 			list2.add(l);
-		}
+		}*/
 
 		  LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 		  ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
@@ -736,7 +786,7 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 		  exportParams.setImageBasePath(upLoadPath);
 		  //update-end--Author:liusq  Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
 		  mv.addObject(NormalExcelConstants.PARAMS,exportParams);
-		  mv.addObject(NormalExcelConstants.DATA_LIST, list2);
+		  mv.addObject(NormalExcelConstants.DATA_LIST, list);
 		  return mv;
 	  }
 

+ 30 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/entity/ExcelOvertime.java

@@ -0,0 +1,30 @@
+package org.jeecg.modules.viewClockIn.entity;
+
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+@Data
+public class ExcelOvertime {
+    @Excel(name = "工号", width = 15)
+    private String username;
+    @Excel(name = "姓名", width = 15)
+    private String realname;
+//    @Excel(name = "姓名", width = 15)
+    private String orgCode;
+    @Excel(name = "一级部门", width = 15)
+    private String oneDept;
+    @Excel(name = "二级部门", width = 15)
+    private String twoDept;
+    @Excel(name = "加班事由", width = 15)
+    private String demo;
+    @Excel(name = "开始时间", width = 25)
+    private String beginDate;
+    @Excel(name = "结束时间", width = 25)
+    private String endDate;
+    @Excel(name = "加班时长", width = 15)
+    private String duration;
+    @Excel(name = "支付类型", width = 15)
+    private String setInfo;
+    @Excel(name = "支付倍数", width = 15)
+    private String multiple;
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/entity/bdClockinMonth.java

@@ -58,6 +58,11 @@ public class bdClockinMonth {
 	@TableField(exist = false)
 	private String type;//打卡类型 上班类型(1,固定时间上下班,2,按班次上下班,3,自由上下班)
 
+	@TableField(exist = false)
+	private Date termDate;//离职时间
+	@TableField(exist = false)
+	private Date entryDate;//入职时间
+
 	private String years;//年度
 
 	private String months;//月份

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/viewClockInMapper.java

@@ -38,4 +38,6 @@ public interface viewClockInMapper extends BaseMapper<ViewClockIn> {
     List<ExportClockInfo> exportErrotInfo(@Param("realname") String realname , @Param("headMonth") String headMonth , @Param("userType") String userType);
 
     List<ExportClockDay> exportXlsDay(ExportClockDay viewClockIn);
+
+    List<ExcelOvertime> exportAllOvertime(@Param("map")Map<String,String> map);
 }

+ 5 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/xml/bdClockinMonthMapper.xml

@@ -49,7 +49,11 @@
     </select>
 
     <select id="selectUserBy" parameterType="java.util.List" resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
-        select b.type,a.id personId,a.username person_code,a.realname person_name,
+        select
+            b.type, -- 上班类型(1,固定时间上下班,2,按班次上下班,3,自由上下班)
+            a.term_date, -- 离职日期
+            a.entry_date, -- 入职日期
+            a.id personId,a.username person_code,a.realname person_name,
             a.category, -- 人员类别 101正式工 102 合同工 103 实习生 104 劳务工
             a.is_attendance,-- 是否考勤(0是 ,1否)
             a.is_salary, -- 是否算薪

+ 68 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/xml/viewClockInMapper.xml

@@ -58,8 +58,46 @@
         order by date asc
     </select>
 
+    <select id="exportAllOvertime"  parameterType="Map" resultType = "org.jeecg.modules.viewClockIn.entity.ExcelOvertime">
+
+        select a.username,a.realname,b.org_code,b.one_dept,b.two_dept,c.demo,
+               c.begin_date,c.end_date,c.duration,c.set_info,
+        case when c.set_info is null or c.set_info = null or c.set_info = ''
+            then ''
+            else c.multiple end multiple
+        from bd_work_overtime c
+                 left join sys_user a on a.id = c.person
+                 left join view_all_dept b on a.id = b.id
+
+        where a.del_flag = 0
+
+        <if test="map.par_name != null and map.par_name != ''">
+            and a.realname = #{map.par_name}
+        </if>
+        <if test="map.par_code != null and map.par_code != ''">
+            and a.username = #{map.par_code}
+        </if>
+        <if test="map.par_departIds != null and map.par_departIds != ''">
+            and b.org_code like concat(#{map.par_departIds},'%')
+        </if>
+        <if test="map.par_works_type != null and map.par_works_type != ''">
+            and c.demo = #{map.par_works_type}
+        </if>
+        <if test="map.par_pay_type != null and map.par_pay_type != ''">
+            and c.set_info = #{map.par_pay_type}
+        </if>
+        <if test="map.par_multiple != null and map.par_multiple != ''">
+            and c.multiple = #{map.par_multiple}
+        </if>
+        <if test="map.par_begin != null and map.par_begin != ''">
+            and DATE_FORMAT(c.begin_date,'%Y-%m-%d') between #{map.par_begin} and #{map.par_end}
+        </if>
+        order by a.username,c.begin_date
+
+    </select>
+
     <select id="exportErrotInfo" resultType = "org.jeecg.modules.viewClockIn.entity.ExportClockInfo">
-        select CONCAT(shift_real_time_s,'-',shift_real_time_x) shiftTime,#{userType} as category,
+       <!-- select CONCAT(shift_real_time_s,'-',shift_real_time_x) shiftTime,#{userType} as category,
                case a.show_state
                    when 1 then '异常'
                    else  '正常'
@@ -81,7 +119,35 @@
         where DATE_FORMAT(date,'%Y-%m') = #{headMonth}
         and date &lt;= date_format(IFNULL(a.term_date,NOW()),'%Y-%m-%d')
         group by date
-        order by date
+        order by date -->
+
+        select
+        case a.category
+            when 101 then '正式工'
+            when 102 then '顾问'
+            when 103 then '实习生'
+            when 104 then '劳务工'
+            when 105 then '外包5+2'
+            when 106 then '外包6+1'
+            when 107 then '退休员工'
+            when 108 then '外籍员工'
+            else  '其他'
+        end as category,
+
+        case a.show_state
+            when 1 then '异常'
+            else  '正常'
+        end as state
+
+        ,a.*
+        FROM
+            view_clock_in_1 a
+        WHERE
+            a.realname = #{realname} AND a.head_month = #{headMonth}
+        ORDER BY
+            a.view_date ASC
+            LIMIT 31
+
     </select>
 
     <select id="exportXlsDay" resultType = "org.jeecg.modules.viewClockIn.entity.ExportClockDay">

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/IviewClockInService.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.viewClockIn.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.viewClockIn.entity.ExcelOvertime;
 import org.jeecg.modules.viewClockIn.entity.ExportClockDay;
 import org.jeecg.modules.viewClockIn.entity.ExportClockInfo;
 import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
@@ -29,6 +30,7 @@ public interface IviewClockInService extends IService<ViewClockIn> {
     public int updateOvertime(String multiple,String st,String id,String username);
     public Page<ViewClockIn> selectPage(Page<ViewClockIn> page);
     public List<ExportClockInfo> exportErrotInfo(String realname , String headMonth, String userType);
+    public List<ExcelOvertime> exportAllOvertime(Map<String,String> map);
     public List<ExportClockDay> exportXlsDay(ExportClockDay viewClockIn);
     //查询当月是否有为处理的加班信息
     public List<Map<String,Object>> selectByOvertime(String monthTime,List<String> userList);

+ 5 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/impl/viewClockInServiceImpl.java

@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.apache.poi.ss.formula.functions.T;
-import org.jeecg.modules.viewClockIn.entity.ExportClockDay;
-import org.jeecg.modules.viewClockIn.entity.ExportClockInfo;
-import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
-import org.jeecg.modules.viewClockIn.entity.bdClockinMonth;
+import org.jeecg.modules.viewClockIn.entity.*;
 import org.jeecg.modules.viewClockIn.mapper.viewClockInMapper;
 import org.jeecg.modules.viewClockIn.service.IviewClockInService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -59,4 +56,8 @@ public class viewClockInServiceImpl extends ServiceImpl<viewClockInMapper, ViewC
     public List<ExportClockDay> exportXlsDay(ExportClockDay viewClockIn) {
         return viewClockInMapper1.exportXlsDay(viewClockIn);
     }
+
+    public List<ExcelOvertime> exportAllOvertime(Map<String,String> map){
+        return viewClockInMapper1.exportAllOvertime(map);
+    }
 }