瀏覽代碼

数据导出

ysh 3 年之前
父節點
當前提交
e8e0c5c00d

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

@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import io.netty.util.internal.StringUtil;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.vo.LoginUser;
@@ -28,10 +29,7 @@ import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecg.modules.system.util.DateUtils2;
-import org.jeecg.modules.viewClockIn.entity.BdClose;
-import org.jeecg.modules.viewClockIn.entity.BdErrorInfo;
-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.service.IBdErrorInfoService;
 import org.jeecg.modules.viewClockIn.service.IbdClockinMonthService;
 import org.jeecg.modules.viewClockIn.service.IviewClockInService;
@@ -42,7 +40,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.system.base.controller.JeecgController;
 
 import org.jeecg.modules.workOvertime.mapper.workOvertimeMapper;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 import io.swagger.annotations.Api;
@@ -76,7 +78,8 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 	 @Autowired
 	 private IStatutoryLeaveService statutoryLeaveService;
 
-
+	 @Value("${jeecg.path.upload}")
+	 private String upLoadPath;
 	 /**
 	  * 批量人员考勤页面,1付薪,2累计调休,3忽略
 	  * @param jsonObject
@@ -378,6 +381,11 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 			 if(!bdClockinMonthService.ifClose(nowDate)){
 				 return Result.error("当前月份已关账,无法此操作");
 			 }
+			 DateFormat sdf = new SimpleDateFormat("yyyy-MM");
+
+			 if(new Date().before(sdf.parse(nowDate))){
+				 return Result.error("不能操作未发生的考勤月份");
+			 }
 
 			 String[] date = nowDate.split("-");
 			 String userIds = jsonObject.getString("userIds");
@@ -640,14 +648,48 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 	}
 
 	  /**
-	   * 导出excel
+	   * 导出excel 员工考勤信息
 	   *
 	   * @param request
 	   * @param viewClockIn
 	   */
 	  @RequestMapping(value = "/exportXls")
-	  public ModelAndView exportXls(HttpServletRequest request, ViewClockIn viewClockIn) {
-		  return super.exportXls(request, viewClockIn, ViewClockIn.class, "员工考勤日报");
+	  public ModelAndView exportXls(HttpServletRequest request, ViewClockIn viewClockIn,String userName,String mDate,String userType) {
+	  	  List<ExportClockInfo> list = viewClockInService.exportErrotInfo(userName,mDate,userType);
+		  LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		  ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+		  mv.addObject(NormalExcelConstants.FILE_NAME, "员工考勤信息"); //此处设置的filename无效 ,前端会重更新设置一下
+		  mv.addObject(NormalExcelConstants.CLASS, ExportClockInfo.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, list);
+		  return mv;
+	  }
+
+	  /**
+	   * 导出excel 考勤日报
+	   *
+	   * @param request
+	   * @param viewClockIn
+	   */
+	  @RequestMapping(value = "/exportXlsDay")
+	  public ModelAndView exportXlsDay(HttpServletRequest request, ExportClockDay viewClockIn) {
+
+	  	  List<ExportClockDay> list = viewClockInService.exportXlsDay(viewClockIn);
+		  LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		  ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+		  mv.addObject(NormalExcelConstants.FILE_NAME, "员工考勤信息"); //此处设置的filename无效 ,前端会重更新设置一下
+		  mv.addObject(NormalExcelConstants.CLASS, ExportClockDay.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, list);
+		  return mv;
 	  }
 
 	  /**

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

@@ -0,0 +1,100 @@
+package org.jeecg.modules.viewClockIn.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @Description: 员工考勤日报
+ * @Author: jeecg-boot
+ * @Date:   2021-12-22
+ * @Version: V1.0
+ */
+@Data
+public class ExportClockDay {
+
+	@Excel(name = "日期", width = 15)
+	private String viewDate;
+	@Excel(name = "人员", width = 15)
+	private String realname;
+	@Excel(name = "班次", width = 15)
+	private String name;
+	@Excel(name = "一级部门", width = 15)
+	private String oneDept;
+
+	@Excel(name = "二级部门", width = 15)
+	private String twoDept;
+
+	@Excel(name = "三级部门", width = 15)
+	private String threeDept;
+
+	@Excel(name = "末级部门", width = 15)
+	private String lastDept;
+	@Excel(name = "最早打卡时间", width = 25)
+	private String gotoTime;
+
+	@Excel(name = "最迟打卡时间", width = 25)
+	private String closingTime;
+
+	@Excel(name = "打卡次数", width = 15)
+	private String attendanceCount;
+
+	@Excel(name = "考勤状态", width = 15)
+	private String state;
+
+	@Excel(name = "加班开始时间", width = 15)
+	private String durationBeginDate;
+
+	@Excel(name = "加班结束时间", width = 15)
+	private String durationEndDate;
+
+	@Excel(name = "加班事由", width = 15)
+	private String demo;
+
+	@Excel(name = "加班时长", width = 15)
+	private String duration;
+	@Excel(name = "请假开始时间", width = 15)
+	private String holidayStartDate;
+	@Excel(name = "请假结束时间", width = 15)
+	private String holidayEndDate;
+	@Excel(name = "假期类型", width = 15)
+	private String holidayType;
+
+//	@Excel(name = "工号", width = 15)
+	private String workNo;
+
+	/**
+	 * 部门
+	 */
+	private String departNames;
+
+	/**
+	 * 查询开始时间
+	 */
+	private String beginViewDate;
+
+	/**
+	 * 查询结束时间
+	 */
+	private String endViewDate;
+
+
+
+//	@Dict(dicCode = "valid_category")
+//	@Excel(name = "员工类型", width = 15)
+	private String category;
+
+
+//	@Excel(name = "星期", width = 15)
+	private String weekDate;
+
+
+//	@Excel(name = "班次时间", width = 15)
+	private String shiftTime;
+
+
+
+//	@Excel(name = "校准人", width = 15)
+	private String jzBy;
+}

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

@@ -0,0 +1,70 @@
+package org.jeecg.modules.viewClockIn.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @Description: 员工考勤日报
+ * @Author: jeecg-boot
+ * @Date:   2021-12-22
+ * @Version: V1.0
+ */
+@Data
+public class ExportClockInfo {
+
+	@Excel(name = "姓名", width = 15)
+	private String realname;
+
+	@Excel(name = "一级部门", width = 15)
+	private String oneDept;
+
+	@Excel(name = "二级部门", width = 15)
+	private String twoDept;
+
+	@Excel(name = "三级部门", width = 15)
+	private String threeDept;
+
+	@Excel(name = "末级部门", width = 15)
+	private String lastDept;
+
+	@Dict(dicCode = "valid_category")
+	@Excel(name = "员工类型", width = 15)
+	private String category;
+
+	@Excel(name = "日期", width = 15)
+	private String viewDate;
+
+	@Excel(name = "星期", width = 15)
+	private String weekDate;
+
+	@Excel(name = "班次", width = 15)
+	private String name;
+
+	@Excel(name = "班次时间", width = 15)
+	private String shiftTime;
+
+	@Excel(name = "状态", width = 15)
+	private String state;
+
+	@Excel(name = "最早打卡时间", width = 25)
+	private String gotoTime;
+
+	@Excel(name = "最迟打卡时间", width = 25)
+	private String closingTime;
+
+	@Excel(name = "打卡次数", width = 15)
+	private String attendanceCount;
+
+	@Excel(name = "加班时长", width = 15)
+	private String duration;
+
+	@Excel(name = "校准人", width = 15)
+	private String jzBy;
+}

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

@@ -33,6 +33,7 @@ public class ViewClockIn {
 	private String jzTime;//最后校准时间
 	private String jzBy;//最后校准人
 	private String showState;//前台所展示的异常状态 (1异常,2加感叹号,0正常)
+	private String outState;//外出打卡 (1是 0否)
 
 	private String lastDept;//用户末级部门
 	private String oneDept;//一级

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

@@ -36,15 +36,15 @@ public class bdClockinMonth {
 	private String wagesBase_2;//
 	private String security;//社保基数1
 	private String security_2;//
-	private String workDay;//考勤天数1
+
 	private String workDay_2;//
-	private String workDayReal;//实际考勤天数1
+
 	private String workDayReal_2;//
-	private String duration;//本月加班时长(小时)1
+
 	private String duration_2;//
-	private String holidayTimeBj;//本月请假时长(病假天数)1
+
 	private String holidayTimeBj_2;//
-	private String holidayTimeSj;//本月请假时长(事假小时)1
+
 	private String holidayTimeSj_2;//
 
 	private String isAttendance;//免打卡 (0打卡,1免打卡)
@@ -52,8 +52,6 @@ public class bdClockinMonth {
 	private String syFund;//公积金账号
 	private String category;//人员类别
 
-	private String missingNum;//缺卡天数
-
 	private String years;//年度
 
 	private String months;//月份
@@ -74,7 +72,7 @@ public class bdClockinMonth {
     @ApiModelProperty(value = "主键id考勤月报")
 	private String id;
 	/**月报月份*/
-	@Excel(name = "月报月份", width = 15)
+	@Excel(name = "日期", width = 15)
     @ApiModelProperty(value = "月报月份")
 	private String monthTime;
 	/**人员姓名*/
@@ -82,28 +80,38 @@ public class bdClockinMonth {
     @ApiModelProperty(value = "人员姓名")
 	private String personName;
 	/**人员编码*/
-	@Excel(name = "人员编码", width = 15)
+	@Excel(name = "工号", width = 15)
     @ApiModelProperty(value = "人员编码")
 	private String personCode;
+	@Excel(name = "考勤天数", width = 15)
+	private String workDay;//考勤天数1
+	@Excel(name = "实际考勤天数", width = 15)
+	private String workDayReal;//实际考勤天数1
+	@Excel(name = "旷工天数", width = 15)
+	private String missingNum;//缺卡天数
+	@Excel(name = "加班时长(时)", width = 15)
+	private String duration;//本月加班时长(小时)1
+
+	@Excel(name = "事假时长(天)", width = 15)
+	private String holidayTimeSj;//本月请假时长(事假小时)1
+	@Excel(name = "病假时长(天)", width = 15)
+	private String holidayTimeBj;//本月请假时长(病假天数)1
 	/**人员主键*/
-	@Excel(name = "人员主键", width = 15)
     @ApiModelProperty(value = "人员主键")
 	private String personId;
 	/**本月迟到分钟数*/
-	@Excel(name = "本月迟到分钟数", width = 15)
+//	@Excel(name = "本月迟到分钟数", width = 15)
     @ApiModelProperty(value = "本月迟到分钟数")
 	private Integer latetimeS;
 	/**本月早退分钟数*/
-	@Excel(name = "本月早退分钟数", width = 15)
+//	@Excel(name = "本月早退分钟数", width = 15)
     @ApiModelProperty(value = "本月早退分钟数")
 	private Integer latetimeX;
-
 	/**创建人*/
-	@Excel(name = "创建人", width = 15)
 	@ApiModelProperty(value = "创建人")
 	private String createBy;
 	/**创建时间*/
-	@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+//	@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
 	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
 	@ApiModelProperty(value = "创建时间")

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

@@ -1,7 +1,13 @@
 package org.jeecg.modules.viewClockIn.mapper;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+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.NumEntity;
 import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -26,4 +32,8 @@ public interface viewClockInMapper extends BaseMapper<ViewClockIn> {
     List<Map<String,Object>> selectUserError(@Param("viewDate") String viewDate, @Param("deptCode")String deptCode);
 
     List<ViewClockIn> selectPage(Page<ViewClockIn> page);
+
+    List<ExportClockInfo> exportErrotInfo(@Param("realname") String realname , @Param("headMonth") String headMonth , @Param("userType") String userType);
+
+    List<ExportClockDay> exportXlsDay(ExportClockDay viewClockIn);
 }

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

@@ -2,6 +2,43 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.viewClockIn.mapper.viewClockInMapper">
 
+    <select id="exportErrotInfo" resultType = "org.jeecg.modules.viewClockIn.entity.ExportClockInfo">
+        select CONCAT(shift_real_time_s,'-',shift_real_time_x) shiftTime,#{userType} 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}
+    </select>
+
+    <select id="exportXlsDay" resultType = "org.jeecg.modules.viewClockIn.entity.ExportClockDay">
+        select CONCAT(shift_real_time_s,'-',shift_real_time_x) shiftTime,
+               case a.show_state
+                   when 1 then '异常'
+                   else  '正常'
+                   end as state
+                ,
+               a.*  from view_clock_in_1 a
+        where 1=1
+        <if test="realname != null and realname != ''">
+            and realname = #{realname}
+        </if>
+        <if test="departNames != null and departNames != ''">
+            and depart_Names = #{departNames}
+        </if>
+        <if test="workNo != null and workNo != ''">
+            and work_No = #{workNo}
+        </if>
+        <if test="name != null and name != ''">
+            and name = #{name}
+        </if>
+        <if test="beginViewDate != null and beginViewDate != ''">
+            and view_date between #{beginViewDate} and #{endViewDate}
+        </if>
+
+
+    </select>
   <!--  <select id="selectPage" resultType = "org.jeecg.modules.viewClockIn.entity.ViewClockIn">
 
         select * from

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

@@ -1,9 +1,15 @@
 package org.jeecg.modules.viewClockIn.service;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+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 com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 员工考勤日报
  * @Author: jeecg-boot
@@ -15,4 +21,6 @@ public interface IviewClockInService extends IService<ViewClockIn> {
     public int fuXinInfo(String st, String userId, String viewDate,String username);
     public int updateOvertime(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<ExportClockDay> exportXlsDay(ExportClockDay viewClockIn);
 }

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

@@ -1,6 +1,11 @@
 package org.jeecg.modules.viewClockIn.service.impl;
 
+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.mapper.viewClockInMapper;
 import org.jeecg.modules.viewClockIn.service.IviewClockInService;
@@ -9,6 +14,8 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.List;
+
 /**
  * @Description: 员工考勤日报
  * @Author: jeecg-boot
@@ -33,4 +40,12 @@ public class viewClockInServiceImpl extends ServiceImpl<viewClockInMapper, ViewC
     public Page<ViewClockIn> selectPage(Page<ViewClockIn> page) {
         return page.setRecords(viewClockInMapper1.selectPage(page));
     }
+
+    public List<ExportClockInfo> exportErrotInfo(String realname , String headMonth, String userType) {
+        return viewClockInMapper1.exportErrotInfo(realname , headMonth, userType);
+    }
+
+    public List<ExportClockDay> exportXlsDay(ExportClockDay viewClockIn) {
+        return viewClockInMapper1.exportXlsDay(viewClockIn);
+    }
 }