From c38f066ac66f90e5da16593c9bc09a495b2cabfb Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Tue, 09 Mar 2021 15:16:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 blade-service/blade-jfpts/pom.xml                                                                               |    8 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/service/impl/AttendanceServiceImpl.java |   60 ++++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/dto/AttendanceDTO.java                  |   34 ++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/service/IAttendanceService.java         |   51 +++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/excel/AttendanceExcel.java              |   78 ++++++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/controller/AttendanceController.java    |  169 +++++++++++++
 blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictBizEnum.java                    |    5 
 blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictEnum.java                       |    1 
 blade-service/blade-jfpts/src/main/java/sql/attendance.menu.mysql                                               |   10 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/mapper/AttendanceMapper.java            |   56 ++++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/vo/AttendanceVO.java                    |   46 +++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/mapper/AttendanceMapper.xml             |   59 ++++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/entity/Attendance.java                  |   98 +++++++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/wrapper/AttendanceWrapper.java          |   54 ++++
 14 files changed, 727 insertions(+), 2 deletions(-)

diff --git a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictBizEnum.java b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictBizEnum.java
index 999201a..ed605ff 100644
--- a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictBizEnum.java
+++ b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictBizEnum.java
@@ -31,9 +31,12 @@
 	/**
 	 * 测试
 	 */
-	TEST("test"),
+	TEST("attendanceType"),
+
+	CLOCKTYPE("clockType")
 	;
 
+
 	final String name;
 
 }
diff --git a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictEnum.java b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictEnum.java
index 609b7cc..afbcc56 100644
--- a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictEnum.java
+++ b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/enums/DictEnum.java
@@ -89,7 +89,6 @@
 	 */
 	USER_TYPE("user_type"),
 	;
-
 	final String name;
 
 }
diff --git a/blade-service/blade-jfpts/pom.xml b/blade-service/blade-jfpts/pom.xml
index 6bd268e..4f29751 100644
--- a/blade-service/blade-jfpts/pom.xml
+++ b/blade-service/blade-jfpts/pom.xml
@@ -42,6 +42,14 @@
             <artifactId>blade-jfpts-api</artifactId>
             <version>${bladex.project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-starter-excel</artifactId>
+        </dependency>
 
     </dependencies>
 
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/controller/AttendanceController.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/controller/AttendanceController.java
new file mode 100644
index 0000000..ffb0254
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/controller/AttendanceController.java
@@ -0,0 +1,169 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.attendance.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import io.swagger.annotations.*;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+
+import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.constant.BladeConstant;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringPool;
+import org.springblade.jfpt.attendance.excel.AttendanceExcel;
+import org.springblade.jfpt.attendance.wrapper.AttendanceWrapper;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.vo.UserVO;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.jfpt.attendance.entity.Attendance;
+import org.springblade.jfpt.attendance.vo.AttendanceVO;
+import org.springblade.jfpt.attendance.service.IAttendanceService;
+import org.springblade.core.boot.ctrl.BladeController;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 控制器
+ *
+ * @author BladeX
+ * @since 2021-03-03
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/attendance")
+@Api(value = "", tags = "接口")
+public class AttendanceController extends BladeController {
+
+	private final IAttendanceService attendanceService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入attendance")
+	public R<Attendance> detail(Attendance attendance) {
+		Attendance detail = attendanceService.getOne(Condition.getQueryWrapper(attendance));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入attendance")
+	public R<IPage<AttendanceVO>> list(Attendance attendance, Query query) {
+		IPage<Attendance> pages = attendanceService.page(Condition.getPage(query), Condition.getQueryWrapper(attendance));
+		return R.data(AttendanceWrapper.build().pageVO(pages));
+	}
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入attendance")
+	public R<IPage<AttendanceVO>> page(AttendanceVO attendance, Query query, Long department) {
+		IPage<Attendance> pages = attendanceService.selectAttendancePage(Condition.getPage(query), department, attendance);
+		return R.data(AttendanceWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入attendance")
+	public R save(@Valid @RequestBody Attendance attendance) {
+		return R.status(attendanceService.save(attendance));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入attendance")
+	public R update(@Valid @RequestBody Attendance attendance) {
+		return R.status(attendanceService.updateById(attendance));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入attendance")
+	public R submit(@Valid @RequestBody Attendance attendance) {
+		return R.status(attendanceService.saveOrUpdate(attendance));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(attendanceService.removeByIds(Func.toLongList(ids)));
+	}
+
+	/**
+	 * 导出用户
+	 */
+	@GetMapping("/export-Attendance")
+	public void exportAttendane(String name, String beginTime, String endTime, String attendancetype, HttpServletResponse response) {
+		String beginTimes = null;
+		String endTimes = null;
+		String attendancetypes = null;
+		if (beginTime.equals("undefined        ") && endTime.equals("undefined")) {
+			beginTimes=null;
+			endTimes=null;
+			attendancetypes=attendancetype;
+		}
+		else if (attendancetype.equals("undefined")){
+			attendancetypes=null;
+		}
+		else {
+			beginTimes=beginTime;
+			endTimes=endTime;
+			attendancetypes=attendancetype;
+		}
+
+		List<AttendanceExcel> list = attendanceService.exportAttendane(name, beginTimes, endTimes, attendancetypes);
+		ExcelUtil.export(response, "考勤数据" + DateUtil.time(), "考勤数据表", list, AttendanceExcel.class);
+
+
+}
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/dto/AttendanceDTO.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/dto/AttendanceDTO.java
new file mode 100644
index 0000000..7a46c88
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/dto/AttendanceDTO.java
@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.attendance.dto;
+
+import org.springblade.jfpt.attendance.entity.Attendance;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-03-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AttendanceDTO extends Attendance {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/entity/Attendance.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/entity/Attendance.java
new file mode 100644
index 0000000..2575727
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/entity/Attendance.java
@@ -0,0 +1,98 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.attendance.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2021-03-03
+ */
+@Data
+@TableName("sys_attendance")
+@ApiModel(value = "Attendance对象", description = "Attendance对象")
+public class Attendance implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+	/**
+	* 姓名
+	*/
+		@ApiModelProperty(value = "姓名")
+		private String name;
+	/**
+	* 编号
+	*/
+		@ApiModelProperty(value = "编号")
+		private String number;
+	/**
+	* 部门
+	*/
+		@ApiModelProperty(value = "部门")
+		private String department;
+	/**
+	* 天气
+	*/
+		@ApiModelProperty(value = "天气")
+		private String weather;
+	/**
+	* 打卡时间
+	*/
+		@ApiModelProperty(value = "打卡时间")
+		@TableField("clockTime")
+	private String clocktime;
+	/**
+	* 经度
+	*/
+		@ApiModelProperty(value = "经度")
+		private String jd;
+	/**
+	* 纬度
+	*/
+		@ApiModelProperty(value = "纬度")
+		private String wd;
+	/**
+	* 打卡类型 0:上班 1:下班
+	*/
+		@ApiModelProperty(value = "打卡类型 0:上班 1:下班")
+		@TableField("clockType")
+	private String clocktype;
+	/**
+	* 考勤类型 0:正常 1:迟到 2:早退 3:外勤
+	*/
+		@ApiModelProperty(value = "考勤类型 0:正常 1:迟到 2:早退 3:外勤")
+		@TableField("attendanceType")
+	private String attendancetype;
+	private String tenantId;
+	private String week;
+	private String address;
+
+	@TableLogic
+	private Integer isDeleted;
+
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/excel/AttendanceExcel.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/excel/AttendanceExcel.java
new file mode 100644
index 0000000..50697bb
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/excel/AttendanceExcel.java
@@ -0,0 +1,78 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.attendance.excel;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * UserExcel
+ *
+ * @author Chill
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class AttendanceExcel implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@ColumnWidth(10)
+	@ExcelProperty("姓名")
+	private String name;
+
+	@ColumnWidth(20)
+	@ExcelProperty("编号")
+	private String number;
+
+	@ColumnWidth(15)
+	@ExcelProperty("部门")
+	private String department;
+
+	@ColumnWidth(10)
+	@ExcelProperty("天气")
+	private String weather;
+
+	@ColumnWidth(20)
+	@ExcelProperty("打卡时间")
+	private String clockTime;
+
+	@ColumnWidth(15)
+	@ExcelProperty("打卡类型")
+	private String clockType;
+
+	@ColumnWidth(15)
+	@ExcelProperty("考勤类型")
+	private String attendanceType;
+
+	@ColumnWidth(15)
+	@ExcelProperty("星期")
+	private String week;
+
+	@ColumnWidth(40)
+	@ExcelProperty("地址")
+	private String address;
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/mapper/AttendanceMapper.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/mapper/AttendanceMapper.java
new file mode 100644
index 0000000..ad26212
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/mapper/AttendanceMapper.java
@@ -0,0 +1,56 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.attendance.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.jfpt.attendance.entity.Attendance;
+import org.springblade.jfpt.attendance.excel.AttendanceExcel;
+import org.springblade.jfpt.attendance.vo.AttendanceVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.system.user.entity.User;
+
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-03-03
+ */
+public interface AttendanceMapper extends BaseMapper<Attendance> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param attendance
+	 * @return
+	 */
+	List<Attendance> selectAttendancePage(IPage page, Long department, AttendanceVO attendance);
+
+
+	/**
+	 * 获取导出用户数据
+	 *
+	 * @param
+	 * @return
+	 */
+	List<AttendanceExcel> exportAttendane(String name,String beginTimes,String endTimes,String attendancetypes);
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/mapper/AttendanceMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/mapper/AttendanceMapper.xml
new file mode 100644
index 0000000..5fb8e57
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/mapper/AttendanceMapper.xml
@@ -0,0 +1,59 @@
+<?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.springblade.jfpt.attendance.mapper.AttendanceMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="attendanceResultMap" type="org.springblade.jfpt.attendance.entity.Attendance">
+        <id column="id" property="id"/>
+        <result column="name" property="name"/>
+        <result column="number" property="number"/>
+        <result column="department" property="department"/>
+        <result column="weather" property="weather"/>
+        <result column="clockTime" property="clocktime"/>
+        <result column="jd" property="jd"/>
+        <result column="wd" property="wd"/>
+        <result column="clockType" property="clocktype"/>
+        <result column="attendanceType" property="attendancetype"/>
+        <result column="tenant_id" property="tenantId"/>
+        <result column="week" property="week"/>
+        <result column="address" property="address"/>
+    </resultMap>
+
+
+    <select id="selectAttendancePage" resultMap="attendanceResultMap">
+        select * from sys_attendance where is_deleted = 0
+        <if test="attendance.name!=null and attendance.name != ''">
+            and name = #{attendance.name}
+        </if>
+        <if test="attendance.department!=null and attendance.department != ''">
+            and department = #{department}
+        </if>
+        <if test="attendance.attendancetype!=null and attendance.attendancetype != ''">
+            and attendancetype = #{attendance.attendancetype}
+        </if>
+        <if test="attendance.beginTime!=null and attendance.beginTime!=''">
+            and clockTime&gt;=#{attendance.beginTime}
+        </if>
+        <if test="attendance.endTime!=null and attendance.endTime!=''">
+            and clockTime&lt;=#{attendance.endTime}
+        </if>
+    </select>
+
+    <select id="exportAttendane" resultType="org.springblade.jfpt.attendance.excel.AttendanceExcel">
+        SELECT id, name, number, department, weather, clockTime, clockType, attendanceType,week,address FROM sys_attendance where is_deleted = 0
+        <if test="name!=null and name != ''">
+            and name = #{name}
+        </if>
+        <if test="beginTimes!=null and beginTimes!=''">
+            and clockTime&gt;=#{beginTimes}
+        </if>
+        <if test="endTimes!=null and endTimes!=''">
+            and clockTime&lt;=#{endTimes}
+        </if>
+        <if test="attendancetypes!=null and attendancetypes!=''">
+            and attendancetype=#{attendancetypes}
+        </if>
+    </select>
+
+
+</mapper>
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/service/IAttendanceService.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/service/IAttendanceService.java
new file mode 100644
index 0000000..e255b6b
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/service/IAttendanceService.java
@@ -0,0 +1,51 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.attendance.service;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import org.springblade.jfpt.attendance.entity.Attendance;
+import org.springblade.jfpt.attendance.excel.AttendanceExcel;
+import org.springblade.jfpt.attendance.vo.AttendanceVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.system.user.entity.User;
+
+import java.util.List;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2021-03-03
+ */
+public interface IAttendanceService extends IService<Attendance> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param attendance
+	 * @return
+	 */
+	IPage<Attendance> selectAttendancePage(IPage<Attendance> page, Long department, AttendanceVO attendance);
+	/**
+	 * 导出用户数据
+	 *
+	 * @return
+	 */
+	List<AttendanceExcel> exportAttendane(String name,String beginTimes,String endTimes,String attendancetypes);
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/service/impl/AttendanceServiceImpl.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/service/impl/AttendanceServiceImpl.java
new file mode 100644
index 0000000..5943108
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/service/impl/AttendanceServiceImpl.java
@@ -0,0 +1,60 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.attendance.service.impl;
+
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.jfpt.attendance.entity.Attendance;
+import org.springblade.jfpt.attendance.excel.AttendanceExcel;
+import org.springblade.jfpt.attendance.vo.AttendanceVO;
+import org.springblade.jfpt.attendance.mapper.AttendanceMapper;
+import org.springblade.jfpt.attendance.service.IAttendanceService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.system.cache.DictBizCache;
+import org.springblade.system.cache.SysCache;
+import org.springblade.system.enums.DictBizEnum;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2021-03-03
+ */
+@Service
+public class AttendanceServiceImpl extends ServiceImpl<AttendanceMapper, Attendance> implements IAttendanceService {
+
+	@Override
+	public IPage<Attendance> selectAttendancePage(IPage<Attendance> page,  Long department,AttendanceVO attendance) {
+		return page.setRecords(baseMapper.selectAttendancePage(page,department, attendance));
+	}
+
+	@Override
+	public List<AttendanceExcel> exportAttendane(String name,String beginTimes,String endTimes,String attendancetypes) {
+		List<AttendanceExcel> userList = baseMapper.exportAttendane(name, beginTimes, endTimes,attendancetypes);
+		userList.forEach(user -> {
+			user.setAttendanceType(DictBizCache.getValue(DictBizEnum.TEST,user.getAttendanceType()));
+			user.setClockType(DictBizCache.getValue(DictBizEnum.CLOCKTYPE,user.getClockType()));
+			user.setDepartment(StringUtil.join(SysCache.getDeptNames(user.getDepartment())));
+		});
+		return userList;
+	}
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/vo/AttendanceVO.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/vo/AttendanceVO.java
new file mode 100644
index 0000000..5ec0126
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/vo/AttendanceVO.java
@@ -0,0 +1,46 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.attendance.vo;
+
+import org.springblade.jfpt.attendance.entity.Attendance;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2021-03-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AttendanceVO对象", description = "AttendanceVO对象")
+public class AttendanceVO extends Attendance {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 部门名
+	 */
+	private String deptName;
+
+	private  String beginTime;
+	private  String endTime;
+
+
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/wrapper/AttendanceWrapper.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/wrapper/AttendanceWrapper.java
new file mode 100644
index 0000000..ed06d1f
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/attendance/wrapper/AttendanceWrapper.java
@@ -0,0 +1,54 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.attendance.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.jfpt.attendance.entity.Attendance;
+import org.springblade.jfpt.attendance.vo.AttendanceVO;
+import org.springblade.system.cache.DictCache;
+import org.springblade.system.cache.SysCache;
+import org.springblade.system.entity.Tenant;
+import org.springblade.system.enums.DictEnum;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.vo.UserVO;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author Chill
+ */
+public class AttendanceWrapper extends BaseEntityWrapper<Attendance, AttendanceVO> {
+
+	public static AttendanceWrapper build() {
+		return new AttendanceWrapper();
+	}
+
+	@Override
+	public AttendanceVO entityVO(Attendance attendance) {
+		AttendanceVO attendanceVO = Objects.requireNonNull(BeanUtil.copy(attendance, AttendanceVO.class));
+		Tenant tenant = SysCache.getTenant(attendance.getTenantId());
+		List<String> deptName = SysCache.getDeptNames(attendance.getDepartment());
+		attendanceVO.setDeptName(Func.join(deptName));
+		return attendanceVO;
+	}
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/sql/attendance.menu.mysql b/blade-service/blade-jfpts/src/main/java/sql/attendance.menu.mysql
new file mode 100644
index 0000000..12a53a3
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/sql/attendance.menu.mysql
@@ -0,0 +1,10 @@
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1367006439005184006', 1123598815738675201, 'attendance', '考勤打卡', 'menu', '/jfpts/attendance', NULL, 1, 1, 0, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1367006439005184007', '1367006439005184006', 'attendance_add', '新增', 'add', '/jfpts/attendance/add', 'plus', 1, 2, 1, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1367006439005184008', '1367006439005184006', 'attendance_edit', '修改', 'edit', '/jfpts/attendance/edit', 'form', 2, 2, 2, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1367006439005184009', '1367006439005184006', 'attendance_delete', '删除', 'delete', '/api/blade-jfpts/attendance/remove', 'delete', 3, 2, 3, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1367006439005184010', '1367006439005184006', 'attendance_view', '查看', 'view', '/jfpts/attendance/view', 'file-text', 4, 2, 2, 1, NULL, 0);

--
Gitblit v1.9.3