From 4dd33cbe7be8c0e552962b64d9f323a9cc04db45 Mon Sep 17 00:00:00 2001
From: Houjie <714924425@qq.com>
Date: 星期五, 13 六月 2025 10:54:35 +0800
Subject: [PATCH] 设备打卡率定时任务。设备打卡率列表接口

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentPunchRateService.java         |   19 +
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentPunch.java                      |  104 ++++-
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentPunchRateController.java    |   81 +++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentPunchRateServiceImpl.java |   81 +++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchMapper.xml             |   91 ++++-
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentPunchService.java             |    6 
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentPunchController.java        |   85 ++--
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentPunchRate.java                  |  129 ++++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/DailyPunchRateJob.java                         |  108 ++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentPunchServiceImpl.java     |   63 +++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchRateMapper.xml         |    6 
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentPunchRateMapper.java            |   14 
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentPunchMapper.java                |   18 +
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentPunchExportDTO.java                |   98 ++++++
 14 files changed, 808 insertions(+), 95 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentPunchController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentPunchController.java
index 482612f..f6aa15c 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentPunchController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentPunchController.java
@@ -16,55 +16,56 @@
 /**
  * @Description: mdc_equipment_punch
  * @Author: jeecg-boot
- * @Date:   2025-06-09
+ * @Date: 2025-06-09
  * @Version: V1.0
  */
-@Api(tags="涓婁笅鐝墦鍗¤褰曡〃")
+@Api(tags = "涓婁笅鐝墦鍗¤褰曡〃")
 @RestController
 @RequestMapping("/mdcEquipmentPunch")
 @Slf4j
 public class MdcEquipmentPunchController extends JeecgController<MdcEquipmentPunch, IMdcEquipmentPunchService> {
-	@Autowired
-	private IMdcEquipmentPunchService mdcEquipmentPunchService;
+    @Autowired
+    private IMdcEquipmentPunchService mdcEquipmentPunchService;
 
-	private static final String msg = "鎵撳崱鎴愬姛锛�";
-	
-	/**
-	 * 鏌ヨ褰撳墠鐧诲綍浜烘墍璐熻矗璁惧鎵撳崱鎯呭喌
-	 *
-	 * @return
-	 */
-	@ApiOperation(value="鏌ヨ褰撳墠鐧诲綍浜烘墍璐熻矗璁惧鎵撳崱鎯呭喌", notes="鏌ヨ褰撳墠鐧诲綍浜烘墍璐熻矗璁惧鎵撳崱鎯呭喌")
-	@GetMapping(value = "/list")
-	public Result<List<MdcEquipmentPunch>> queryList() {
-		return Result.OK(mdcEquipmentPunchService.queryList());
-	}
+    private static final String msg = "鎵撳崱鎴愬姛锛�";
 
-	/**
-	 *   涓婄彮鎵撳崱
-	 *
-	 * @param mdcEquipmentPunch
-	 * @return
-	 */
-	@AutoLog(value = "涓婄彮鎵撳崱")
-	@ApiOperation(value="涓婄彮鎵撳崱", notes="涓婄彮鎵撳崱")
-	@PostMapping(value = "/workUp")
-	public Result<String> workUp(@RequestBody MdcEquipmentPunch mdcEquipmentPunch) {
-		mdcEquipmentPunchService.workUp(mdcEquipmentPunch);
-		return Result.OK(msg);
-	}
+    /**
+     * 鏌ヨ褰撳墠鐧诲綍浜烘墍璐熻矗璁惧鎵撳崱鎯呭喌
+     *
+     * @return
+     */
+    @ApiOperation(value = "鏌ヨ褰撳墠鐧诲綍浜烘墍璐熻矗璁惧鎵撳崱鎯呭喌", notes = "鏌ヨ褰撳墠鐧诲綍浜烘墍璐熻矗璁惧鎵撳崱鎯呭喌")
+    @GetMapping(value = "/list")
+    public Result<List<MdcEquipmentPunch>> queryList() {
+        return Result.OK(mdcEquipmentPunchService.queryList());
+    }
 
-	/**
-	 *   涓嬬彮鎵撳崱
-	 *
-	 * @param mdcEquipmentPunch
-	 * @return
-	 */
-	@AutoLog(value = "涓嬬彮鎵撳崱")
-	@ApiOperation(value="涓嬬彮鎵撳崱", notes="涓嬬彮鎵撳崱")
-	@PostMapping(value = "/workDown")
-	public Result<String> workDown(@RequestBody MdcEquipmentPunch mdcEquipmentPunch) {
-		mdcEquipmentPunchService.workDown(mdcEquipmentPunch);
-		return Result.OK(msg);
-	}
+    /**
+     * 涓婄彮鎵撳崱
+     *
+     * @param mdcEquipmentPunch
+     * @return
+     */
+    @AutoLog(value = "涓婄彮鎵撳崱")
+    @ApiOperation(value = "涓婄彮鎵撳崱", notes = "涓婄彮鎵撳崱")
+    @PostMapping(value = "/workUp")
+    public Result<String> workUp(@RequestBody MdcEquipmentPunch mdcEquipmentPunch) {
+        mdcEquipmentPunchService.workUp(mdcEquipmentPunch);
+        return Result.OK(msg);
+    }
+
+    /**
+     * 涓嬬彮鎵撳崱
+     *
+     * @param mdcEquipmentPunch
+     * @return
+     */
+    @AutoLog(value = "涓嬬彮鎵撳崱")
+    @ApiOperation(value = "涓嬬彮鎵撳崱", notes = "涓嬬彮鎵撳崱")
+    @PostMapping(value = "/workDown")
+    public Result<String> workDown(@RequestBody MdcEquipmentPunch mdcEquipmentPunch) {
+        mdcEquipmentPunchService.workDown(mdcEquipmentPunch);
+        return Result.OK(msg);
+    }
+
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentPunchRateController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentPunchRateController.java
new file mode 100644
index 0000000..ac98d6b
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentPunchRateController.java
@@ -0,0 +1,81 @@
+package org.jeecg.modules.mdc.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.mdc.entity.MdcEquipmentPunchRate;
+import org.jeecg.modules.mdc.service.IMdcEquipmentPunchRateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @Description: mdc_equipment_punch_rate
+ * @Author: jeecg-boot
+ * @Date: 2025-06-09
+ * @Version: V1.0
+ */
+@Api(tags = "璁惧鎵撳崱鐜囨姤琛�")
+@RestController
+@RequestMapping("/mdcEquipmentPunchRate")
+@Slf4j
+public class MdcEquipmentPunchRateController extends JeecgController<MdcEquipmentPunchRate, IMdcEquipmentPunchRateService> {
+    @Autowired
+    private IMdcEquipmentPunchRateService mdcEquipmentPunchService;
+
+
+
+
+
+
+    /**
+     * 鍒嗛〉鍒楄〃鏌ヨ
+     *
+     * @param mdEquipmentPunch 鏌ヨ鍙傛暟
+     * @param pageNo           褰撳墠椤电爜
+     * @param pageSize         姣忛〉鏉℃暟
+     * @param req              璇锋眰瀵硅薄
+     * @return
+     */
+    @ApiOperation(value = "璁惧鎵撳崱鐜�-鍒嗛〉鍒楄〃鏌ヨ", notes = "璁惧鎵撳崱鐜�-鍒嗛〉鍒楄〃鏌ヨ")
+    @AutoLog(value = "璁惧鎵撳崱鐜�-鍒嗛〉鍒楄〃鏌ヨ")
+    @GetMapping(value = "/queryPageList")
+    public Result<IPage<MdcEquipmentPunchRate>> queryPageList(MdcEquipmentPunchRate mdEquipmentPunch,
+                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                          HttpServletRequest req) {
+
+        QueryWrapper<MdcEquipmentPunchRate> queryWrapper = QueryGenerator.initQueryWrapper(mdEquipmentPunch, req.getParameterMap());
+        Page<MdcEquipmentPunchRate> page = new Page<MdcEquipmentPunchRate>(pageNo, pageSize);
+        IPage<MdcEquipmentPunchRate> pageList = mdcEquipmentPunchService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+
+    /**
+     * 瀵煎嚭excel
+     *
+     * @param request
+     * @param mdcEquipmentPunchRate
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentPunchRate mdcEquipmentPunchRate) {
+        return super.exportXls(request, mdcEquipmentPunchRate, MdcEquipmentPunchRate.class, "璁惧鎵撳崱鐜囨姤琛�");
+    }
+
+
+
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentPunchExportDTO.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentPunchExportDTO.java
new file mode 100644
index 0000000..e86cad0
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentPunchExportDTO.java
@@ -0,0 +1,98 @@
+package org.jeecg.modules.mdc.dto;
+
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecg.common.aspect.annotation.Dict;
+
+import java.math.BigDecimal;
+import java.util.Date;
+@Data
+public class MdcEquipmentPunchExportDTO {
+
+
+    @ApiModelProperty(value = "璁惧缂栧彿")
+    private String equipmentId;
+
+
+    @ApiModelProperty(value = "鎵撳崱鐢ㄦ埛")
+    @Dict(dicCode = "id", dictTable = "sys_user", dicText = "realname")
+    private String punchUser;
+
+
+    @ApiModelProperty(value = "涓婄彮鏃堕棿")
+    private Date checkInTime;
+    /**
+     * 涓嬬彮鏃堕棿
+     */
+
+    @ApiModelProperty(value = "涓嬬彮鏃堕棿")
+    private Date checkOutTime;
+    /**
+     * 璁板綍鏃ユ湡
+     */
+
+    @ApiModelProperty(value = "璁板綍鏃ユ湡")
+    private String recordDate;
+
+
+    @ApiModelProperty(value = "鐝")
+    @Dict(dicCode = "shift_schedule")
+    private Integer shiftSchedule;
+
+
+    @ApiModelProperty(value = "鏄惁缂哄崱")
+    private Integer isAbsent;
+
+
+    @ApiModelProperty(value = "鏄惁杩熷埌")
+    private Integer isLate;
+
+
+    @ApiModelProperty(value = "鏄惁鏃╅��")
+    private Integer isEarly;
+
+
+    /**
+     * 鏃╃彮涓婄彮鎵撳崱鐜�
+     */
+
+
+    @ApiModelProperty(value = "鏃╃彮涓婄彮鎵撳崱鐜�")
+    private BigDecimal morningShiftInRate;
+
+    /**
+     * 鏅氱彮涓婄彮鎵撳崱鐜�
+     */
+
+    @ApiModelProperty(value = "鏅氱彮涓婄彮鎵撳崱鐜�")
+    private BigDecimal eveningShiftInRate;
+
+
+    @ApiModelProperty(value = "鏃╃彮涓嬬彮鎵撳崱鐜�")
+    private BigDecimal morningShiftOutRate;
+
+
+    @ApiModelProperty(value = "鏅氱彮涓嬬彮鎵撳崱鐜�")
+    private BigDecimal eveningShiftOutRate;
+
+
+    @ApiModelProperty(value = "鐧界彮涓婄彮鎵撳崱璁惧鏁伴噺")
+    private Integer morningShiftInDeviceNum;
+
+
+    @ApiModelProperty(value = "鐧界彮涓嬬彮鎵撳崱璁惧鏁伴噺")
+    private Integer morningShiftOutDeviceNum;
+
+
+    @ApiModelProperty(value = "澶滅彮涓婄彮鎵撳崱璁惧鏁伴噺")
+    private Integer eveningShiftInDeviceNum;
+
+    @ApiModelProperty(value = "澶滅彮涓嬬彮鎵撳崱璁惧鏁伴噺")
+    private Integer eveningShiftOutDeviceNum;
+
+    @ApiModelProperty(value = "璁惧鎬绘暟")
+    private Integer deviceCountNum;
+
+    private String punchUserRealName;
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentPunch.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentPunch.java
index b64bcc4..9ae8010 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentPunch.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentPunch.java
@@ -1,22 +1,24 @@
 package org.jeecg.modules.mdc.entity;
 
-import java.io.Serializable;
-import java.util.Date;
-
 import cn.hutool.core.date.DatePattern;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import org.jeecg.common.aspect.annotation.Dict;
-import org.springframework.format.annotation.DateTimeFormat;
-import org.jeecgframework.poi.excel.annotation.Excel;
 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.jeecg.common.system.base.entity.JeecgEntity;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * @Description: mdc_equipment_punch
@@ -29,7 +31,7 @@
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
 @ApiModel(value = "mdc_equipment_punch瀵硅薄", description = "mdc_equipment_punch")
-public class MdcEquipmentPunch implements Serializable {
+public class MdcEquipmentPunch extends JeecgEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
@@ -49,18 +51,18 @@
      */
     @Excel(name = "鎵撳崱鐢ㄦ埛", width = 15)
     @ApiModelProperty(value = "鎵撳崱鐢ㄦ埛")
+    @Dict(dicCode = "id", dictTable = "sys_user", dicText = "realname")
     private String punchUser;
     /**
      * 鎵撳崱鐢ㄦ埛璐﹀彿
      */
-    @Excel(name = "鎵撳崱鐢ㄦ埛璐﹀彿", width = 15)
+
     @ApiModelProperty(value = "鎵撳崱鐢ㄦ埛璐﹀彿")
     @TableField(exist = false)
     private String punchUserRealName;
     /**
      * 鎵撳崱鐢ㄦ埛鍚嶇О
      */
-    @Excel(name = "鎵撳崱鐢ㄦ埛鍚嶇О", width = 15)
     @ApiModelProperty(value = "鎵撳崱鐢ㄦ埛鍚嶇О")
     @TableField(exist = false)
     private String punchUserUserName;
@@ -87,7 +89,7 @@
     @ApiModelProperty(value = "璁板綍鏃ユ湡")
     private String recordDate;
     /**
-     * 鐝
+     *  鐝
      */
     @Excel(name = "鐝", width = 15)
     @ApiModelProperty(value = "鐝")
@@ -107,7 +109,7 @@
     @ApiModelProperty(value = "鏄惁缂哄崱")
     private Integer isAbsent;
     /**
-     * 鏄惁杩熷埌
+     * 鏄惁杩熷埌锛�0鏈棭閫�锛�1鏃╅��锛�
      */
     @Excel(name = "鏄惁杩熷埌", width = 15)
     @ApiModelProperty(value = "鏄惁杩熷埌")
@@ -118,28 +120,74 @@
     @Excel(name = "鏄惁鏃╅��", width = 15)
     @ApiModelProperty(value = "鏄惁鏃╅��")
     private Integer isEarly;
+
     /**
-     * 鍒涘缓浜�
+     * 鏃╃彮涓婄彮鎵撳崱鐜�
      */
-    @ApiModelProperty(value = "鍒涘缓浜�")
-    private String createBy;
+    @TableField(exist = false)
+    @Excel(name = "鏃╃彮涓婄彮鎵撳崱鐜�", width = 15)
+    @ApiModelProperty(value = "鏃╃彮涓婄彮鎵撳崱鐜�")
+    private BigDecimal morningShiftInRate;
+
     /**
-     * 鍒涘缓鏃堕棿
+     * 鏅氱彮涓婄彮鎵撳崱鐜�
      */
-    @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
-    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
-    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
-    private Date createTime;
+    @TableField(exist = false)
+    @Excel(name = "鏅氱彮涓婄彮鎵撳崱鐜�", width = 15)
+    @ApiModelProperty(value = "鏅氱彮涓婄彮鎵撳崱鐜�")
+    private BigDecimal eveningShiftInRate;
+
     /**
-     * 鏇存柊浜�
+     * 鏃╃彮涓嬬彮鎵撳崱鐜�
      */
-    @ApiModelProperty(value = "鏇存柊浜�")
-    private String updateBy;
+    @TableField(exist = false)
+    @Excel(name = "鏃╃彮涓嬬彮鎵撳崱鐜�", width = 15)
+    @ApiModelProperty(value = "鏃╃彮涓嬬彮鎵撳崱鐜�")
+    private BigDecimal morningShiftOutRate;
+
     /**
-     * 鏇存柊鏃堕棿
+     * 鏅氱彮涓嬬彮鎵撳崱鐜�
      */
-    @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
-    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
-    @ApiModelProperty(value = "鏇存柊鏃堕棿")
-    private Date updateTime;
+    @TableField(exist = false)
+    @Excel(name = "鏅氱彮涓嬬彮鎵撳崱鐜�", width = 15)
+    @ApiModelProperty(value = "鏅氱彮涓嬬彮鎵撳崱鐜�")
+    private BigDecimal eveningShiftOutRate;
+
+    /**
+     * 鐧界彮涓婄彮鎵撳崱璁惧鏁伴噺
+     */
+    @TableField(exist = false)
+    @Excel(name = "鐧界彮涓婄彮鎵撳崱璁惧鏁伴噺", width = 15)
+    @ApiModelProperty(value = "鐧界彮涓婄彮鎵撳崱璁惧鏁伴噺")
+    private Integer morningShiftInDeviceNum;
+
+    /**
+     * 鐧界彮涓嬬彮鎵撳崱璁惧鏁伴噺
+     */
+    @TableField(exist = false)
+    @Excel(name = "鐧界彮涓嬬彮鎵撳崱璁惧鏁伴噺", width = 15)
+    @ApiModelProperty(value = "鐧界彮涓嬬彮鎵撳崱璁惧鏁伴噺")
+    private Integer morningShiftOutDeviceNum;
+    /**
+     * 澶滅彮涓婄彮鎵撳崱璁惧鏁伴噺
+     */
+    @TableField(exist = false)
+    @Excel(name = "澶滅彮涓婄彮鎵撳崱璁惧鏁伴噺", width = 15)
+    @ApiModelProperty(value = "澶滅彮涓婄彮鎵撳崱璁惧鏁伴噺")
+    private Integer eveningShiftInDeviceNum;
+    /**
+     * 澶滅彮涓嬬彮鎵撳崱璁惧鏁伴噺
+     */
+    @TableField(exist = false)
+    @Excel(name = "澶滅彮涓嬬彮鎵撳崱璁惧鏁伴噺", width = 15)
+    @ApiModelProperty(value = "澶滅彮涓嬬彮鎵撳崱璁惧鏁伴噺")
+    private Integer eveningShiftOutDeviceNum;
+    /**
+     * 璁惧鎬绘暟
+     */
+    @TableField(exist = false)
+    @Excel(name = "璁惧鎬绘暟", width = 15)
+    @ApiModelProperty(value = "璁惧鎬绘暟")
+    private Integer deviceCountNum;
+
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentPunchRate.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentPunchRate.java
new file mode 100644
index 0000000..a77b65d
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentPunchRate.java
@@ -0,0 +1,129 @@
+package org.jeecg.modules.mdc.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+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.jeecg.common.system.base.entity.JeecgEntity;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description: mdc_equipment_punch_rate
+ * @Author: jeecg-boot
+ * @Date: 2025-06-09
+ * @Version: V1.0
+ */
+@Data
+@TableName("mdc_equipment_punch_rate")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value = "mdc_equipment_punch_rate瀵硅薄", description = "mdc_equipment_punch_rate")
+public class MdcEquipmentPunchRate extends JeecgEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 璁惧缂栧彿
+     */
+    @Excel(name = "璁惧缂栧彿", width = 15)
+    @ApiModelProperty(value = "璁惧缂栧彿")
+    private String equipmentId;
+
+
+    /**
+     * 璁板綍鏃ユ湡
+     */
+    @Excel(name = "璁板綍鏃ユ湡", width = 15)
+    @ApiModelProperty(value = "璁板綍鏃ユ湡")
+    private String theDate;
+    /**
+     * 鐝
+     */
+    @Excel(name = "鐝", width = 15)
+    @ApiModelProperty(value = "鐝")
+    @Dict(dicCode = "shift_schedule")
+    private Integer shiftSchedule;
+
+    /**
+     * 鏃╃彮涓婄彮鎵撳崱鐜�
+     */
+  
+    @Excel(name = "鏃╃彮涓婄彮鎵撳崱鐜�(%)", width = 15)
+    @ApiModelProperty(value = "鏃╃彮涓婄彮鎵撳崱鐜�")
+    private BigDecimal mornShiftInRate;
+
+    /**
+     * 鏅氱彮涓婄彮鎵撳崱鐜�
+     */
+    
+    @Excel(name = "鏅氱彮涓婄彮鎵撳崱鐜�(%)", width = 15)
+    @ApiModelProperty(value = "鏅氱彮涓婄彮鎵撳崱鐜�")
+    private BigDecimal evenShiftInRate;
+
+    /**
+     * 鏃╃彮涓嬬彮鎵撳崱鐜�
+     */
+    
+    @Excel(name = "鏃╃彮涓嬬彮鎵撳崱鐜�(%)", width = 15)
+    @ApiModelProperty(value = "鏃╃彮涓嬬彮鎵撳崱鐜�")
+    private BigDecimal mornShiftOutRate;
+
+    /**
+     * 鏅氱彮涓嬬彮鎵撳崱鐜�
+     */
+    
+    @Excel(name = "鏅氱彮涓嬬彮鎵撳崱鐜�(%)", width = 15)
+    @ApiModelProperty(value = "鏅氱彮涓嬬彮鎵撳崱鐜�")
+    private BigDecimal evenShiftOutRate;
+
+    /**
+     * 鐧界彮涓婄彮鎵撳崱璁惧鏁伴噺
+     */
+    
+    @Excel(name = "鐧界彮涓婄彮鎵撳崱璁惧鏁伴噺", width = 15)
+    @ApiModelProperty(value = "鐧界彮涓婄彮鎵撳崱璁惧鏁伴噺")
+    private Integer mornShiftInNum;
+
+    /**
+     * 鐧界彮涓嬬彮鎵撳崱璁惧鏁伴噺
+     */
+    
+    @Excel(name = "鐧界彮涓嬬彮鎵撳崱璁惧鏁伴噺", width = 15)
+    @ApiModelProperty(value = "鐧界彮涓嬬彮鎵撳崱璁惧鏁伴噺")
+    private Integer mornShiftOutNum;
+    /**
+     * 澶滅彮涓婄彮鎵撳崱璁惧鏁伴噺
+     */
+    
+    @Excel(name = "澶滅彮涓婄彮鎵撳崱璁惧鏁伴噺", width = 15)
+    @ApiModelProperty(value = "澶滅彮涓婄彮鎵撳崱璁惧鏁伴噺")
+    private Integer evenShiftInNum;
+    /**
+     * 澶滅彮涓嬬彮鎵撳崱璁惧鏁伴噺
+     */
+    
+    @Excel(name = "澶滅彮涓嬬彮鎵撳崱璁惧鏁伴噺", width = 15)
+    @ApiModelProperty(value = "澶滅彮涓嬬彮鎵撳崱璁惧鏁伴噺")
+    private Integer evenShiftOutNum;
+    /**
+     * 璁惧鎬绘暟
+     */
+    
+    @Excel(name = "璁惧鎬绘暟", width = 15)
+    @ApiModelProperty(value = "璁惧鎬绘暟")
+    private Integer deviceCountNum;
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/DailyPunchRateJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/DailyPunchRateJob.java
new file mode 100644
index 0000000..cff7388
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/DailyPunchRateJob.java
@@ -0,0 +1,108 @@
+
+package org.jeecg.modules.mdc.job;
+
+import cn.hutool.core.date.DatePattern;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.mdc.entity.MdcEquipmentPunch;
+import org.jeecg.modules.mdc.service.IMdcEquipmentPunchRateService;
+import org.jeecg.modules.mdc.service.IMdcEquipmentPunchService;
+import org.jeecg.modules.quartz.entity.QuartzJob;
+import org.jeecg.modules.quartz.entity.SysQuartzLog;
+import org.jeecg.modules.quartz.service.IQuartzJobService;
+import org.jeecg.modules.quartz.service.ISysQuartzLogService;
+import org.jeecg.modules.system.service.ISysAnnouncementService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: 姣忔棩鍑屾櫒瀹氭椂璁$畻鍓嶄竴澶╃殑璁惧鎵撳崱鐜囷紝骞跺叆搴�
+ * @Author: Lius
+ * @CreateTime: 2025-06-12
+ */
+@Slf4j
+public class DailyPunchRateJob implements Job {
+
+    private String parameter; // 鍙�夊弬鏁帮細鎸囧畾鏃ユ湡锛堝 "2025-06-11"锛�
+
+    public void setParameter(String parameter) {
+        this.parameter = parameter;
+    }
+
+    @Resource
+    private IQuartzJobService quartzJobService;
+
+    @Resource
+    private ISysQuartzLogService sysQuartzLogService;
+
+    @Resource
+    private ISysAnnouncementService sysAnnouncementService;
+
+    @Resource
+    private IMdcEquipmentPunchService mdcEquipmentPunchService;
+
+
+    @Resource
+    private IMdcEquipmentPunchRateService mdcEquipmentPunchRateService;
+
+
+    @Override
+    public void execute(JobExecutionContext context) throws JobExecutionException {
+        SysQuartzLog quartzLog = new SysQuartzLog();
+        quartzLog.setCreateTime(new Date());
+
+        List<QuartzJob> jobList = this.quartzJobService.findByJobClassName(this.getClass().getName());
+        if (jobList != null && !jobList.isEmpty()) {
+            quartzLog.setJobId(jobList.get(0).getId());
+        }
+
+        log.info("銆愬紑濮嬫墽琛屾瘡鏃ヨ澶囨墦鍗$巼缁熻浠诲姟銆�");
+
+        long startTime = System.currentTimeMillis();
+
+        try {
+            String yesterdayStr;
+
+
+
+            if (parameter != null && !parameter.isEmpty()) {
+                yesterdayStr = parameter; // 鏀寔鎵嬪姩浼犲弬
+            } else {
+                LocalDate yesterday = LocalDate.now().minusDays(1);
+                 yesterdayStr = yesterday.format(DateTimeFormatter.ofPattern(DatePattern.PURE_DATE_PATTERN)); // 鏍煎紡鍖栦负 "yyyy-MM-dd"
+            }
+            log.info("鉁� 鎴愬姛瀹屾垚姣忔棩璁惧鎵撳崱鐜囩粺璁℃暟鎹�", yesterdayStr);
+            // Step 1锛氳幏鍙栨槰鏃ユ墦鍗℃暟鎹�
+            List<MdcEquipmentPunch> punchRecords = mdcEquipmentPunchService.getYesterdayRecords(yesterdayStr);
+            log.info("鉁� 鎴愬姛瀹屾垚姣忔棩璁惧鎵撳崱鐜囩粺璁℃暟鎹�", punchRecords);
+            if (punchRecords == null || punchRecords.isEmpty()) {
+                log.warn("鈿狅笍 娌℃湁鎵惧埌鏄ㄦ棩璁惧鎵撳崱鏁版嵁");
+                quartzLog.setIsSuccess(0);
+                return;
+            }
+
+            // Step 2锛氫繚瀛樺埌鎵撳崱鐜囪〃
+            mdcEquipmentPunchRateService.savePunchRates(yesterdayStr, punchRecords);
+
+            quartzLog.setIsSuccess(0);
+            log.info("鉁� 鎴愬姛瀹屾垚姣忔棩璁惧鎵撳崱鐜囩粺璁★紝鍏卞鐞� {} 鏉¤褰曪紝鏃ユ湡锛歿}", punchRecords.size(), yesterdayStr);
+        } catch (Exception e) {
+            quartzLog.setIsSuccess(-1);
+            quartzLog.setExceptionDetail(e.getMessage());
+            log.error("鉂� 璁惧鎵撳崱鐜囩粺璁′换鍔℃墽琛屽け璐�", e);
+            sysAnnouncementService.jobSendMessage("璁惧鎵撳崱鐜囩粺璁′换鍔�", e.getMessage());
+        }
+
+        // 璁板綍鎵ц鏃堕棿
+        long endTime = System.currentTimeMillis();
+        quartzLog.setExecutionTime((int)(endTime - startTime));
+        sysQuartzLogService.save(quartzLog);
+    }
+
+}
\ No newline at end of file
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentPunchMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentPunchMapper.java
index 3b45151..16091a2 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentPunchMapper.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentPunchMapper.java
@@ -15,4 +15,22 @@
 public interface MdcEquipmentPunchMapper extends BaseMapper<MdcEquipmentPunch> {
 
     List<MdcEquipmentPunch> list(@Param("equipmentIds") List<String> equipmentIds, @Param("date") String date);
+
+
+    // 鏌ヨ鏃╃彮涓婄彮鎵撳崱璁惧鏁�
+    int countMorningShiftIn(@Param("date") String date);
+
+    // 鏌ヨ鏅氱彮涓婄彮鎵撳崱璁惧鏁�
+    int countEveningShiftIn(@Param("date") String date);
+
+    // 鏌ヨ鏃╃彮涓嬬彮鎵撳崱璁惧鏁�
+    int countMorningShiftOut(@Param("date") String date);
+
+    // 鏌ヨ鏅氱彮涓嬬彮鎵撳崱璁惧鏁�
+    int countEveningShiftOut(@Param("date") String date);
+    /**
+     * 鑾峰彇鎵�鏈夎澶囨暟
+     */
+    int getTotalDeviceCount();
+
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentPunchRateMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentPunchRateMapper.java
new file mode 100644
index 0000000..a80d853
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentPunchRateMapper.java
@@ -0,0 +1,14 @@
+package org.jeecg.modules.mdc.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.mdc.entity.MdcEquipmentPunchRate;
+
+/**
+ * @Description: mdc_equipment_punch_rate
+ * @Author: jeecg-boot
+ * @Date:   2025-06-09
+ * @Version: V1.0
+ */
+public interface MdcEquipmentPunchRateMapper extends BaseMapper<MdcEquipmentPunchRate> {
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchMapper.xml
index 48cc0e8..8c27d52 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchMapper.xml
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchMapper.xml
@@ -4,31 +4,31 @@
 
     <select id="list" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentPunch">
         SELECT
-          p.id,
-          p.equipment_id,
-          p.punch_user,
-          p.check_in_time,
-          p.check_out_time,
-          p.record_date,
-          p.is_absent,
-          p.is_late,
-          p.is_early,
-          p.create_by,
-          p.create_time,
-          p.update_by,
-          p.update_time,
-          p.shift_schedule,
-          u.realname punchUserRealName,
-          u.username punchUserUserName,
-          d1.item_text shiftScheduleName
+        p.id,
+        p.equipment_id,
+        p.punch_user,
+        p.check_in_time,
+        p.check_out_time,
+        p.record_date,
+        p.is_absent,
+        p.is_late,
+        p.is_early,
+        p.create_by,
+        p.create_time,
+        p.update_by,
+        p.update_time,
+        p.shift_schedule,
+        u.realname punchUserRealName,
+        u.username punchUserUserName,
+        d1.item_text shiftScheduleName
         FROM
-          mdc_equipment_punch p
-          INNER JOIN sys_user u ON u.id = p.punch_user
-          INNER JOIN (SELECT i1.item_text, i1.item_value
-                      FROM sys_dict_item i1
-                          LEFT JOIN sys_dict i2 ON i2.id = i1.dict_id
-                      WHERE i2.dict_code = 'shift_schedule') d1
-              ON d1.item_value = CAST (p.shift_schedule AS nvarchar)
+        mdc_equipment_punch p
+        INNER JOIN sys_user u ON u.id = p.punch_user
+        INNER JOIN (SELECT i1.item_text, i1.item_value
+        FROM sys_dict_item i1
+        LEFT JOIN sys_dict i2 ON i2.id = i1.dict_id
+        WHERE i2.dict_code = 'shift_schedule') d1
+        ON d1.item_value = CAST (p.shift_schedule AS nvarchar)
         where 1=1
         AND p.equipment_id IN
         <foreach collection="equipmentIds" item="equipmentId" open="(" close=")" separator=",">
@@ -39,4 +39,47 @@
         </if>
         order by p.equipment_id desc, p.shift_schedule asc
     </select>
+
+    <!--鏌ヨ鎵�鏈夎澶囨暟閲�-->
+    <select id="getTotalDeviceCount" resultType="int">
+        SELECT COUNT(*)
+        FROM mdc_equipment
+    </select>
+
+    <!-- 鏃╃彮 涓婄彮鎵撳崱 -->
+    <select id="countMorningShiftIn" resultType="int">
+        SELECT COUNT(DISTINCT equipment_id)
+        FROM mdc_equipment_punch
+        WHERE record_date = #{date, jdbcType=VARCHAR}
+          AND shift_schedule = '1'
+          AND check_in_time IS NOT NULL
+    </select>
+
+    <!-- 鏅氱彮 涓婄彮鎵撳崱 -->
+    <select id="countEveningShiftIn" resultType="int">
+        SELECT COUNT(DISTINCT equipment_id)
+        FROM mdc_equipment_punch
+        WHERE record_date = #{date, jdbcType=VARCHAR}
+          AND shift_schedule = '2'
+          AND check_in_time IS NOT NULL
+    </select>
+
+    <!-- 鏃╃彮 涓嬬彮鎵撳崱 -->
+    <select id="countMorningShiftOut" resultType="int">
+        SELECT COUNT(DISTINCT equipment_id)
+        FROM mdc_equipment_punch
+        WHERE record_date = #{date, jdbcType=VARCHAR}
+          AND shift_schedule = '1'
+          AND check_out_time IS NOT NULL
+    </select>
+
+    <!-- 鏅氱彮 涓嬬彮鎵撳崱 -->
+    <select id="countEveningShiftOut" resultType="int">
+        SELECT COUNT(DISTINCT equipment_id)
+        FROM mdc_equipment_punch
+        WHERE record_date = #{date, jdbcType=VARCHAR}
+          AND shift_schedule = '2'
+          AND check_out_time IS NOT NULL
+    </select>
+
 </mapper>
\ No newline at end of file
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchRateMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchRateMapper.xml
new file mode 100644
index 0000000..e576a6c
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentPunchRateMapper.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.mdc.mapper.MdcEquipmentPunchRateMapper">
+
+
+</mapper>
\ No newline at end of file
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentPunchRateService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentPunchRateService.java
new file mode 100644
index 0000000..b1a371d
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentPunchRateService.java
@@ -0,0 +1,19 @@
+package org.jeecg.modules.mdc.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.mdc.entity.MdcEquipmentPunch;
+import org.jeecg.modules.mdc.entity.MdcEquipmentPunchRate;
+
+import java.util.List;
+
+/**
+ * @Description: mdc_equipment_punch
+ * @Author: jeecg-boot
+ * @Date:   2025-06-09
+ * @Version: V1.0
+ */
+public interface IMdcEquipmentPunchRateService extends IService<MdcEquipmentPunchRate> {
+
+
+    void savePunchRates(String targetDate, List<MdcEquipmentPunch> punchRecords);
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentPunchService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentPunchService.java
index 79be14a..a1e32d7 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentPunchService.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentPunchService.java
@@ -18,4 +18,10 @@
     void workUp(MdcEquipmentPunch mdcEquipmentPunch);
 
     void workDown(MdcEquipmentPunch mdcEquipmentPunch);
+    void fillPunchRates(List<MdcEquipmentPunch> punchList);
+
+    /**
+     * 鏌ヨ鎸囧畾鏃ユ湡鐨勮澶囨墦鍗℃暟鎹紙閫氬父鏄槰澶╋級
+     */
+    List<MdcEquipmentPunch> getYesterdayRecords(String targetDate);
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentPunchRateServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentPunchRateServiceImpl.java
new file mode 100644
index 0000000..00d9379
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentPunchRateServiceImpl.java
@@ -0,0 +1,81 @@
+package org.jeecg.modules.mdc.service.impl;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.mdc.entity.MdcEquipmentPunch;
+import org.jeecg.modules.mdc.entity.MdcEquipmentPunchRate;
+import org.jeecg.modules.mdc.mapper.MdcEquipmentPunchMapper;
+import org.jeecg.modules.mdc.mapper.MdcEquipmentPunchRateMapper;
+import org.jeecg.modules.mdc.service.IMdcEquipmentPunchRateService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * @Description: mdc_equipment_punch
+ * @Author: jeecg-boot
+ * @Date:   2025-06-09
+ * @Version: V1.0
+ */
+@Service
+public class MdcEquipmentPunchRateServiceImpl extends ServiceImpl<MdcEquipmentPunchRateMapper, MdcEquipmentPunchRate> implements IMdcEquipmentPunchRateService {
+    @Resource
+    private MdcEquipmentPunchRateMapper mdcEquipmentPunchRateMapper;
+
+    @Resource
+    private MdcEquipmentPunchMapper mdcEquipmentPunchMapper;
+    @Override
+    public void savePunchRates(String targetDate, List<MdcEquipmentPunch> punchRecords) {
+
+        int morningIn = mdcEquipmentPunchMapper.countMorningShiftIn(targetDate);
+        int eveningIn = mdcEquipmentPunchMapper.countEveningShiftIn(targetDate);
+        int morningOut = mdcEquipmentPunchMapper.countMorningShiftOut(targetDate);
+        int eveningOut = mdcEquipmentPunchMapper.countEveningShiftOut(targetDate);
+        for (MdcEquipmentPunch punch : punchRecords) {
+            MdcEquipmentPunchRate rate = new MdcEquipmentPunchRate();
+
+            rate.setId(UUID.randomUUID().toString()); // 鐢熸垚鍞竴ID
+            rate.setEquipmentId(punch.getEquipmentId());
+            rate.setTheDate(targetDate);
+            rate.setShiftSchedule(punch.getShiftSchedule());
+
+
+
+
+            // 璁剧疆璁惧鏁伴噺
+            rate.setMornShiftInNum(morningIn);
+            rate.setMornShiftOutNum(eveningIn);
+            rate.setEvenShiftInNum(morningOut);
+            rate.setEvenShiftOutNum(eveningOut);
+
+
+
+            // 鑾峰彇鎬昏澶囨暟
+            int totalDevices = mdcEquipmentPunchMapper.getTotalDeviceCount();
+            if (totalDevices == 0) return;
+
+
+            rate.setDeviceCountNum(totalDevices);
+
+            // 璁$畻鎵撳崱鐜囷紙淇濈暀涓や綅灏忔暟锛�
+            rate.setMornShiftInRate(calculateRate(morningIn, totalDevices));
+            rate.setMornShiftOutRate(calculateRate(eveningIn, totalDevices));
+            rate.setEvenShiftInRate(calculateRate(morningOut, totalDevices));
+            rate.setEvenShiftOutRate(calculateRate(eveningOut, totalDevices));
+
+            this.save(rate);
+        }
+    }
+    private BigDecimal calculateRate(int actual, int total) {
+        if (total == 0) return BigDecimal.ZERO;
+        return new BigDecimal(actual)
+                .divide(new BigDecimal(total), 4, RoundingMode.DOWN)
+                .multiply(BigDecimal.valueOf(100))
+                .setScale(2, RoundingMode.DOWN); // 淇濈暀涓や綅灏忔暟锛屼笉杩涜鍥涜垗浜斿叆
+    }
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentPunchServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentPunchServiceImpl.java
index b0733d8..31517e7 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentPunchServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentPunchServiceImpl.java
@@ -3,6 +3,7 @@
 
 import cn.hutool.core.date.DatePattern;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -19,6 +20,10 @@
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -30,7 +35,8 @@
  */
 @Service
 public class MdcEquipmentPunchServiceImpl extends ServiceImpl<MdcEquipmentPunchMapper, MdcEquipmentPunch> implements IMdcEquipmentPunchService {
-
+    @Resource
+    private MdcEquipmentPunchMapper mdcEquipmentPunchMapper;
     @Resource
     private IMdcEquipmentService mdcEquipmentService;
 
@@ -235,4 +241,59 @@
 
         this.saveOrUpdateBatch(list);
     }
+
+    @Override
+    public void fillPunchRates(List<MdcEquipmentPunch> punchList) {
+
+        // 鑾峰彇鏄ㄥぉ鏃ユ湡
+        LocalDate yesterday = LocalDate.now().minusDays(1);
+        String yesterdayStr = yesterday.format(DateTimeFormatter.ofPattern(DatePattern.PURE_DATE_PATTERN)); // 鏍煎紡鍖栦负 "yyyy-MM-dd"
+
+
+        // 鑾峰彇鎬昏澶囨暟
+        int totalDevices = mdcEquipmentPunchMapper.getTotalDeviceCount();
+        if (totalDevices == 0) return;
+
+        // 缁熻鍚勭被鍨嬫墦鍗′汉鏁�
+        int morningIn = mdcEquipmentPunchMapper.countMorningShiftIn(yesterdayStr);
+        int eveningIn = mdcEquipmentPunchMapper.countEveningShiftIn(yesterdayStr);
+        int morningOut = mdcEquipmentPunchMapper.countMorningShiftOut(yesterdayStr);
+        int eveningOut = mdcEquipmentPunchMapper.countEveningShiftOut(yesterdayStr);
+
+
+        // 璁剧疆鎵撳崱鐜囧埌姣忎釜 DTO
+        for (MdcEquipmentPunch dto : punchList) {
+            dto.setMorningShiftInRate(calculateRate(morningIn, totalDevices));
+            dto.setEveningShiftInRate(calculateRate(eveningIn, totalDevices));
+            dto.setMorningShiftOutRate(calculateRate(morningOut, totalDevices));
+            dto.setEveningShiftOutRate(calculateRate(eveningOut, totalDevices));
+
+            // 璁剧疆鎵撳崱璁惧鏁伴噺瀛楁
+            dto.setMorningShiftInDeviceNum(morningIn);
+            dto.setMorningShiftOutDeviceNum(morningOut);
+            dto.setEveningShiftInDeviceNum(eveningIn);
+            dto.setEveningShiftOutDeviceNum(eveningOut);
+            dto.setDeviceCountNum(totalDevices);
+        }
+    }
+
+    // 璁$畻鐧惧垎姣斿苟淇濈暀涓や綅灏忔暟
+    private BigDecimal calculateRate(int actual, int total) {
+        if (total == 0) return BigDecimal.ZERO;
+        return new BigDecimal(actual)
+                .divide(new BigDecimal(total), 4, RoundingMode.HALF_UP)
+                .multiply(BigDecimal.valueOf(100))
+                .setScale(2, RoundingMode.HALF_UP); // 淇濈暀涓や綅灏忔暟
+    }
+
+    @Override
+    public List<MdcEquipmentPunch> getYesterdayRecords(String  targetDate) {
+        // 鏋勯�犳煡璇㈡潯浠讹細record_date = targetDate.toString()
+        QueryWrapper<MdcEquipmentPunch> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("record_date", targetDate);
+
+        // 鎵ц鏌ヨ骞惰繑鍥炵粨鏋�
+        return baseMapper.selectList(queryWrapper);
+    }
+
 }

--
Gitblit v1.9.3