Quellcode durchsuchen

导出考勤明细表

LiFei vor 4 Jahren
Ursprung
Commit
c54b9942de

+ 22 - 6
happy-job-module-hpjob/src/main/java/com/jeeplus/modules/wspunch/entity/WsPunchClock.java

@@ -56,6 +56,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
     private String bnkflg;		// Y:开户行是招商银行 N:开户行是他行
     private String eacbnk;		// 他行开户行(他行时必填)
     private String rcveaa;		// 他行开户地址(他行时必填)
+    private Date dayTime; //导出所用上班卡日期
 
     public WsPunchClock() {
         super();
@@ -109,6 +110,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @NotNull(message = "上班卡不能为空")
+    @ExcelField(title = "上班卡时间", align = 2, sort = 4)
     public Date getStartPunchClock() {
         return startPunchClock;
     }
@@ -134,6 +136,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
     }
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ExcelField(title = "下班卡时间", align = 2, sort = 5)
     public Date getEndPunchClock() {
         return endPunchClock;
     }
@@ -142,6 +145,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
         this.endPunchClock = endPunchClock;
     }
 
+    @ExcelField(title = "打卡工时", align = 2, sort = 6)
     public Integer getDuration() {
         return duration;
     }
@@ -158,6 +162,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
         this.companyName = companyName;
     }
 
+    @ExcelField(title = "员工名", align = 2, sort = 2)
     public String getUserName() {
         return userName;
     }
@@ -166,6 +171,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
         this.userName = userName;
     }
 
+    @ExcelField(title = "员工手机号", align = 2, sort = 3)
     public String getPhone() {
         return phone;
     }
@@ -190,7 +196,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
         this.wsSetting = wsSetting;
     }
 
-    @ExcelField(title = "身份证", align = 2, sort = 3)
+
     public String getIdcardNumber() {
         return idcardNumber;
     }
@@ -207,7 +213,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
         this.countDuration = countDuration;
     }
 
-    @ExcelField(title = "姓名", align = 2, sort = 2)
+
     public String getRealName() {
         return realName;
     }
@@ -216,7 +222,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
         this.realName = realName;
     }
 
-    @ExcelField(title = "在离职", align = 2, sort = 5, dictType = "out_status")
+
     public Integer getStatus() {
         return status;
     }
@@ -225,7 +231,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
         this.status = status;
     }
 
-    @ExcelField(title = "银行卡号", align = 2, sort = 4)
+
     public String getCardNumber() {
         return cardNumber;
     }
@@ -250,7 +256,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
         this.endDate = endDate;
     }
 
-    @ExcelField(title = "ID", align = 2, sort = 1)
+
     public String getStaffId() {
         return staffId;
     }
@@ -259,7 +265,7 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
         this.staffId = staffId;
     }
 
-    @ExcelField(title = "预支金额", align = 2, sort = 6)
+
     public Double getNextMoney() {
         return nextMoney;
     }
@@ -365,4 +371,14 @@ public class WsPunchClock extends DataEntity<WsPunchClock> {
     public void setRcveaa(String rcveaa) {
         this.rcveaa = rcveaa;
     }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ExcelField(title = "日期", align = 2, sort = 1)
+    public Date getDayTime() {
+        return dayTime;
+    }
+
+    public void setDayTime(Date dayTime) {
+        this.dayTime = dayTime;
+    }
 }

+ 2 - 0
happy-job-module-hpjob/src/main/java/com/jeeplus/modules/wspunch/mapper/WsPunchClockMapper.java

@@ -22,4 +22,6 @@ public interface WsPunchClockMapper extends BaseMapper<WsPunchClock> {
     List<WsPunchClock> getTodayClockByMemberId(String memberId, Integer daySpanStandard);
 
     List<WsPunchClock> getWeekListByMemberId(String memberId);
+
+    List<WsPunchClock> findList1(WsPunchClock wsPunchClock);
 }

+ 54 - 1
happy-job-module-hpjob/src/main/java/com/jeeplus/modules/wspunch/mapper/xml/WsPunchClockMapper.xml

@@ -37,7 +37,8 @@
 		SELECT 
 			<include refid="wsPunchClockColumns"/>,
 		ws.hourly_salary as "wsSetting.hourlySalary",
-		ws.daily_available_max_hour as "wsSetting.dailyAvailableMaxHour"
+		ws.daily_available_max_hour as "wsSetting.dailyAvailableMaxHour",
+		a.start_punch_clock as "dayTime"
 		FROM ws_punch_clock a
 		<include refid="wsPunchClockJoins"/>
 		inner join ws_setting ws
@@ -227,4 +228,56 @@
 			and YEARWEEK(date_format(a.start_punch_clock,'%Y-%m-%d'),1) = YEARWEEK(now(),1);
 		</where>
 	</select>
+
+
+	<select id="findList1" resultType="WsPunchClock" >
+		SELECT
+		<include refid="wsPunchClockColumns"/>,
+		ws.hourly_salary as "wsSetting.hourlySalary",
+		ws.daily_available_max_hour as "wsSetting.dailyAvailableMaxHour",
+		a.start_punch_clock as "dayTime"
+		FROM ws_punch_clock a
+		<include refid="wsPunchClockJoins"/>
+		inner join ws_setting ws
+		<where>
+			${dataScope}
+			<if test="companyName != null and companyName != ''">
+				AND wsc.company_name LIKE
+				<if test="dbName == 'oracle'">'%'||#{companyName}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{companyName}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{companyName},'%')</if>
+			</if>
+			<if test="userName != null and userName != ''">
+				AND hpm.real_name = #{userName}
+			</if>
+			<if test="phone != null and phone != ''">
+				AND hpm.phone = #{phone}
+			</if>
+			<if test="startPunchClock != null and startPunchClock != ''">
+				AND a.start_punch_clock &gt;= #{startPunchClock}
+			</if>
+			<if test="endPunchClock != null and endPunchClock != ''">
+				AND DATE_SUB(a.start_punch_clock, INTERVAL 1 DAY) &lt; date(#{endPunchClock})
+			</if>
+			<if test="memberId != null and memberId != ''">
+				AND a.member_id = #{memberId}
+			</if>
+			<if test="punchStatus != null">
+				<if test="punchStatus == 1">
+					AND a.start_punch_clock is not null and a.end_punch_clock is not null
+				</if>
+				<if test="punchStatus == 2">
+					AND a.start_punch_clock is not null and a.end_punch_clock is null
+				</if>
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.start_punch_clock asc,a.id ASC
+			</otherwise>
+		</choose>
+	</select>
 </mapper>

+ 6 - 0
happy-job-module-hpjob/src/main/java/com/jeeplus/modules/wspunch/service/WsPunchClockService.java

@@ -377,4 +377,10 @@ public class WsPunchClockService extends CrudService<WsPunchClockMapper, WsPunch
 		}
 		return returnMap;
 	}
+
+	public Page<WsPunchClock> findPage1(Page<WsPunchClock> wsPunchClockPage, WsPunchClock wsPunchClock) {
+		wsPunchClock.setPage(wsPunchClockPage);
+		wsPunchClockPage.setList(mapper.findList1(wsPunchClock));
+		return wsPunchClockPage;
+	}
 }

+ 6 - 2
happy-job-module-hpjob/src/main/java/com/jeeplus/modules/wspunch/web/WsPunchClockController.java

@@ -10,6 +10,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.ConstraintViolationException;
 
+import com.jeeplus.modules.wscompany.entity.WsCompany;
+import com.jeeplus.modules.wscompany.service.WsCompanyService;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +48,8 @@ public class WsPunchClockController extends BaseController {
 
 	@Autowired
 	private WsPunchClockService wsPunchClockService;
+	@Autowired
+	private WsCompanyService wsCompanyService;
 	
 	@ModelAttribute
 	public WsPunchClock get(@RequestParam(required=false) String id) {
@@ -170,8 +174,8 @@ public class WsPunchClockController extends BaseController {
 		AjaxJson j = new AjaxJson();
 		try {
             String fileName = "打卡信息表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
-            Page<WsPunchClock> page = wsPunchClockService.findPage(new Page<WsPunchClock>(request, response, -1), wsPunchClock);
-    		new ExportExcel("打卡信息表", WsPunchClock.class).setDataList(page.getList()).write(response, fileName).dispose();
+            Page<WsPunchClock> page = wsPunchClockService.findPage1(new Page<WsPunchClock>(request, response, -1), wsPunchClock);
+    		new ExportExcel("考勤明细表", WsPunchClock.class).setDataList(page.getList()).write(response, fileName).dispose();
     		j.setSuccess(true);
     		j.setMsg("导出成功!");
     		return j;