浏览代码

增加考勤特殊日期表
特殊日期判断
fix bugs

shudonghui 1 年之前
父节点
当前提交
f0b08e47a7

+ 100 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/SysDingDate.java

@@ -0,0 +1,100 @@
+package com.qmth.sop.business.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.sop.common.enums.DingDateTypeEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * 考勤特殊日期 模型.
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-10 13:52:06
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+@ApiModel(value = "sys_ding_date对象", description = "考勤特殊日期")
+public class SysDingDate implements Serializable {
+
+	@JsonSerialize(using = ToStringSerializer.class)
+	@ApiModelProperty(value = "主键")
+	@TableId(value = "id")
+	private Long id;
+
+	private static final long serialVersionUID = 1L;
+  	@ApiModelProperty(value = "年")
+	@JsonSerialize(using = ToStringSerializer.class)
+  	private Long year;
+  	@ApiModelProperty(value = "月")
+	@JsonSerialize(using = ToStringSerializer.class)
+  	private Long month;
+  	@ApiModelProperty(value = "日")
+	@JsonSerialize(using = ToStringSerializer.class)
+  	private Long day;
+	@ApiModelProperty(value = "日期类型:WEEKDAY(工作日),WEEKEND(周末),LEGAL_HOLIDAYS(法定节假日)")
+	private DingDateTypeEnum type;
+
+	/**
+	 * 年
+	 */	
+  	public void setYear(Long year) {
+		this.year = year;
+  	}
+ 	/**
+	 * 年
+	 */	 	
+  	public Long getYear() {
+		return year;
+  	}
+	/**
+	 * 月
+	 */	
+  	public void setMonth(Long month) {
+		this.month = month;
+  	}
+ 	/**
+	 * 月
+	 */	 	
+  	public Long getMonth() {
+		return month;
+  	}
+	/**
+	 * 日
+	 */	
+  	public void setDay(Long day) {
+		this.day = day;
+  	}
+ 	/**
+	 * 日
+	 */	 	
+  	public Long getDay() {
+		return day;
+  	}
+	/**
+	 * 日期类型:WEEKDAY("工作日"),WEEKEND("周末"),LEGAL_HOLIDAYS("法定节假日");
+
+	 */	
+  	public void setType(DingDateTypeEnum type) {
+		this.type = type;
+  	}
+ 	/**
+	 * 日期类型:WEEKDAY("工作日"),WEEKEND("周末"),LEGAL_HOLIDAYS("法定节假日");
+
+	 */	 	
+  	public DingDateTypeEnum getType() {
+		return type;
+  	}
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+}

+ 12 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/TBDing.java

@@ -3,6 +3,7 @@ package com.qmth.sop.business.entity;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.base.BaseEntity;
+import com.qmth.sop.common.enums.DingDateTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -46,6 +47,9 @@ public class TBDing extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "签到日期")
     private String signDate;
 
+    @ApiModelProperty(value = "日期类型:WEEKDAY(工作日),WEEKEND(周末),LEGAL_HOLIDAYS(法定节假日)")
+    private DingDateTypeEnum dateType;
+
     @ApiModelProperty(value = "签到时间")
     private Long signInTime;
 
@@ -189,4 +193,12 @@ public class TBDing extends BaseEntity implements Serializable {
     public void setFaceOutError(Boolean faceOutError) {
         this.faceOutError = faceOutError;
     }
+
+    public DingDateTypeEnum getDateType() {
+        return dateType;
+    }
+
+    public void setDateType(DingDateTypeEnum dateType) {
+        this.dateType = dateType;
+    }
 }

+ 23 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/SysDingDateMapper.java

@@ -0,0 +1,23 @@
+package com.qmth.sop.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.entity.SysDingDate;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Param;
+import java.util.Map;
+
+/**
+ * 考勤特殊日期 Mapper 接口.
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-10 13:52:06
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+public interface SysDingDateMapper extends BaseMapper<SysDingDate> {
+
+
+
+}

+ 27 - 0
sop-business/src/main/java/com/qmth/sop/business/service/SysDingDateService.java

@@ -0,0 +1,27 @@
+package com.qmth.sop.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.entity.SysDingDate;
+import com.qmth.sop.common.enums.DingDateTypeEnum;
+
+import java.time.LocalDate;
+
+/**
+ * 考勤特殊日期 服务类
+ *
+ * @author: shudonghui
+ * @date: 2023-08-10 13:52:06
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+public interface SysDingDateService extends IService<SysDingDate>{
+
+
+    /**
+     * 是否为工作日,周末,法定节假日
+     */
+    DingDateTypeEnum getDingDateType(LocalDate date);
+
+
+}

+ 38 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysDingDateServiceImpl.java

@@ -0,0 +1,38 @@
+package com.qmth.sop.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.business.entity.SysDingDate;
+import com.qmth.sop.business.mapper.SysDingDateMapper;
+import com.qmth.sop.business.service.SysDingDateService;
+import com.qmth.sop.common.enums.DingDateTypeEnum;
+import org.springframework.stereotype.Service;
+
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+
+/**
+ * 考勤特殊日期 服务实现.
+ *
+ * @author: shudonghui
+ * @date: 2023-08-10 13:52:06
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+@Service
+public class SysDingDateServiceImpl extends ServiceImpl<SysDingDateMapper, SysDingDate> implements SysDingDateService {
+
+
+    @Override
+    public DingDateTypeEnum getDingDateType(LocalDate date) {
+        SysDingDate sysDingDate = this.getOne(new QueryWrapper<SysDingDate>().lambda().eq(SysDingDate::getYear, date.getYear()).eq(SysDingDate::getMonth, date.getMonthValue()).eq(SysDingDate::getDay, date.getDayOfMonth()));
+        if (sysDingDate != null) {
+            return sysDingDate.getType();
+        } else if (date.getDayOfWeek() != DayOfWeek.SATURDAY && date.getDayOfWeek() != DayOfWeek.SUNDAY) {
+            return DingDateTypeEnum.WEEKDAY;
+        } else {
+            return DingDateTypeEnum.WEEKEND;
+        }
+    }
+}

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/templete/execute/AsyncSysMessageExportService.java

@@ -58,7 +58,7 @@ public class AsyncSysMessageExportService extends AsyncExportTaskTemplete {
             BasicAttachment basicAttachment = (BasicAttachment) result.get(SystemConstant.EXCEL_ATTACHMENT);
             stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), FINISH_TITLE, !CollectionUtils.isEmpty(archivesImportDtoList) ? archivesImportDtoList.size() : 0, FINISH_SIZE));
 
-            tbTask.setImportFileName(TaskTypeEnum.MESSAGE_IMPORT.getTitle());
+            tbTask.setImportFileName(TaskTypeEnum.MESSAGE_EXPORT.getTitle());
             tbTask.setResultFilePath(basicAttachment.getPath());
             tbTask.setResult(TaskResultEnum.SUCCESS);
         } catch (Exception e) {

+ 23 - 1
sop-business/src/main/resources/db/log/shudonghui_update_log.sql

@@ -145,4 +145,26 @@ CREATE TABLE `sys_custom_role` (
                                    `quota` bigint NOT NULL COMMENT '配额',
                                    PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户角色配置表';
--------------------------------
+-------------------------------
+---2023.8.10 考勤统计
+CREATE TABLE `sys_ding_date` (
+                                 `id` bigint NOT NULL COMMENT '主键',
+                                 `year` bigint NOT NULL COMMENT '年',
+                                 `month` bigint NOT NULL COMMENT '月',
+                                 `day` bigint NOT NULL COMMENT '日',
+                                 `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '日期类型:WEEKDAY("工作日"),WEEKEND("周末"),LEGAL_HOLIDAYS("法定节假日")',
+                                 PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4 COMMENT='考勤特殊日期';
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (1, 2023, 9, 29, 'LEGAL_HOLIDAYS');
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (2, 2023, 9, 30, 'LEGAL_HOLIDAYS');
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (3, 2023, 10, 1, 'LEGAL_HOLIDAYS');
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (4, 2023, 10, 2, 'LEGAL_HOLIDAYS');
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (5, 2023, 10, 3, 'LEGAL_HOLIDAYS');
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (6, 2023, 10, 4, 'LEGAL_HOLIDAYS');
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (7, 2023, 10, 5, 'LEGAL_HOLIDAYS');
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (8, 2023, 10, 6, 'LEGAL_HOLIDAYS');
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (9, 2023, 10, 7, 'WEEKDAY');
+INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (10, 2023, 10, 8, 'WEEKDAY');
+ALTER TABLE `t_b_ding`
+    ADD COLUMN `date_type` varchar(20) NULL COMMENT '日期类型:WEEKDAY("工作日"),WEEKEND("周末"),LEGAL_HOLIDAYS("法定节假日")' AFTER `sign_date`;
+-------------------------------

+ 6 - 0
sop-business/src/main/resources/mapper/SysDingDateMapper.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="com.qmth.sop.business.mapper.SysDingDateMapper">
+
+
+</mapper>

+ 27 - 0
sop-common/src/main/java/com/qmth/sop/common/enums/DingDateTypeEnum.java

@@ -0,0 +1,27 @@
+package com.qmth.sop.common.enums;
+
+/**
+ * @Description: 考勤日期类型enum
+ * @Param:
+ * @return:
+ * @Author: dhshu
+ * @Date: 2023/8/10
+ */
+public enum DingDateTypeEnum {
+
+    WEEKDAY("工作日"),
+
+    WEEKEND("周末"),
+
+    LEGAL_HOLIDAYS("法定节假日");
+
+    private String title;
+
+    private DingDateTypeEnum(String title) {
+        this.title = title;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+}

+ 3 - 1
sop-common/src/main/java/com/qmth/sop/common/enums/TaskTypeEnum.java

@@ -17,7 +17,9 @@ public enum TaskTypeEnum {
 
     CUSTOM_IMPORT("客户导入"),
 
-    MESSAGE_IMPORT("回执明细导出");
+    MESSAGE_EXPORT("回执明细导出"),
+
+    DING_COUNT_EXPORT("考勤打卡统计导出");
 
     private String title;
 

+ 1 - 1
sop-server/src/main/java/com/qmth/sop/server/api/SysMessageController.java

@@ -75,7 +75,7 @@ public class SysMessageController {
                          @ApiParam(value = "区域城市", required = false) @RequestParam(required = false) String city,
                          @ApiParam(value = "供应商", required = false) @RequestParam(required = false) Long supplierId,
                          @ApiParam(value = "回执状态", required = false) @RequestParam(required = false) Boolean status) throws Exception {
-        Map<String, Object> map = tbTaskService.saveTask(TaskTypeEnum.MESSAGE_IMPORT);
+        Map<String, Object> map = tbTaskService.saveTask(TaskTypeEnum.MESSAGE_EXPORT);
         map.put("noticeId", noticeId);
         map.put("city", Objects.nonNull(city) ?city: null);
         map.put("supplierId", Objects.nonNull(supplierId) ?supplierId: null);