From 7eb7874266af0886a6441410ae42b50522d64786 Mon Sep 17 00:00:00 2001
From: weicd <weicd@yhzhg.cn>
Date: Mon, 30 Jan 2023 09:16:09 +0000
Subject: [PATCH] 首页,公司管理
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/DateTimeUtil.java | 723 +++++++++++++++++++++
eladmin-web-master/src/views/system/company/index.vue | 104 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingQueryCriteria.java | 32
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SystemSettingServiceImpl.java | 106 +++
eladmin-web-master/src/api/system/user.js | 16
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingDto.java | 42 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SystemSettingService.java | 83 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SystemSettingRepository.java | 28
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SystemSettingMapper.java | 32
eladmin-web-master/src/views/dashboard/PanelGroup.vue | 76 +-
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SystemSettingController.java | 96 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java | 4
eladmin-web-master/src/views/home.vue | 177 ++++-
eladmin-web-master/src/api/system/systemSetting.js | 35 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java | 21
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java | 283 ++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceBusinessTravelRepository.java | 4
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/CalendarVo.java | 16
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java | 17
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java | 11
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SystemSetting.java | 60 +
eladmin-web-master/package.json | 6
22 files changed, 1,904 insertions(+), 68 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceBusinessTravelRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceBusinessTravelRepository.java
index 3ebb061..5caff73 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceBusinessTravelRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceBusinessTravelRepository.java
@@ -46,4 +46,8 @@
// 查询出差记录
@Query(value = "SELECT * from attendance_business_travel where user_id = ?1 and travel_start_time <= ?3 and travel_end_time >= ?2 and approval_status in ('business_approve_status_agree')", nativeQuery = true)
AttendanceBusinessTravel findByUserAndDate(Long userId, LocalDateTime startDate, LocalDateTime endDate);
+
+ // 查询出差记录
+ @Query(value = "SELECT * from attendance_business_travel where user_id = ?1 and travel_start_time <= ?3 and travel_end_time >= ?2 and approval_status in ('business_approve_status_agree')", nativeQuery = true)
+ List<AttendanceBusinessTravel> findByUserAndSEDate(Long userId, LocalDateTime startDate, LocalDateTime endDate);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java
index 4f074d1..9632db8 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java
@@ -37,4 +37,8 @@
/** 根据员工姓名模糊查询 */
@Query(value = "SELECT * from attendance WHERE " , nativeQuery = true)
List<AttendanceDto> findByUserNameLike(String userName);
+
+ /** 根据时间范围查询考勤记录 **/
+ @Query(value = "SELECT * from attendance where user_id = ?1 and attendance_date <= ?3 and attendance_date >= ?2", nativeQuery = true)
+ List<Attendance> findAllByUserAndDate(Long userId, String startDate, String endDate);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/DateTimeUtil.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/DateTimeUtil.java
new file mode 100644
index 0000000..b2419fc
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/DateTimeUtil.java
@@ -0,0 +1,723 @@
+package me.zhengjie.modules.quartz.utils;
+
+import me.zhengjie.utils.StringUtils;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+public class DateTimeUtil {
+
+ public static final String DIVIDE_LINE = "-";
+ public static final String DIVIDE_COLON = ":";
+
+ public static final long SECOND = 1000;
+ public static final long MINUTE = 60 * SECOND;
+ public static final long HOUR = 60 * MINUTE;
+ public static final long DAY = 24 * HOUR;
+ public static final long WEEK = 7 * DAY;
+ public static final String YEARFORMAT = "yyyy";
+ public static final String MONTHFORMAT = "yyyy-MM";
+ public static final String SHORTFORMAT = "yyyy-MM-dd";
+ public static final String SHORTFORMATNOSPIT = "yyyyMMdd";
+ public static final String LONGFORMATNOSPIT = "yyyyMMddHHmmss";
+ public static final String LONGFORMAT = "yyyy-MM-dd HH:mm:ss";
+ public static final String SUPERLONGFORMAT = "yyyy-MM-dd HH:mm:ss sss";
+ private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ public static final int FIELD_YEAR = Calendar.YEAR;
+ public static final int FIELD_MONTH = Calendar.MONTH;
+ public static final int FIELD_DATE = Calendar.DATE;
+
+ /**
+ * 时间戳格式化 yyyy-MM-dd HH:mm:ss
+ */
+ public static String getTimestampString(Date date) {
+ return sdf.format(date).toString();
+ }
+
+ /**
+ * 系统当前时间戳
+ */
+ public static Timestamp getTimestamp(){
+ SimpleDateFormat myFormat = new SimpleDateFormat(LONGFORMAT);
+ long stamp = System.currentTimeMillis();
+ String timestamp = myFormat.format(stamp);
+ return Timestamp.valueOf(timestamp);
+ }
+
+
+ /**
+ * 日期转时间戳
+ */
+ public static Timestamp getTimestamp(Date date) {
+ return Timestamp.valueOf(getTimestampString(date));
+ }
+
+ /**
+ * 字符串转时间戳
+ */
+ public static Timestamp getTimestamp(String timestamp) {
+ if(StringUtils.isEmpty(timestamp)){
+ return null;
+ }
+ return Timestamp.valueOf(timestamp);
+ }
+
+ /**
+ * 时间格式化 yyyy-MM-dd
+ */
+ public static String getDate() {
+ SimpleDateFormat myFormat = new SimpleDateFormat(SHORTFORMAT);
+ return myFormat.format(System.currentTimeMillis());
+ }
+
+ /**
+ * 时间格式化 yyyy-MM-dd
+ */
+ public static String getDate(Date date) {
+ return getDate(date, SHORTFORMAT);
+ }
+
+ /**
+ * 时间格式化 yyyy-MM-dd
+ */
+ public static String getDate(Date date, String format) {
+ String result = null;
+ try {
+ SimpleDateFormat myFormat = new SimpleDateFormat(format);
+ result = myFormat.format(date);
+ } catch (Exception e) {
+ return null;
+ }
+ return result;
+ }
+
+ /**
+ * 时间格式化 yyyy-MM-dd HH:mm:ss
+ * */
+ public static String getDateTime() {
+ return getDateTime(new Date());
+ }
+
+ /**
+ * 时间格式化 yyyy-MM-dd HH:mm:ss
+ * */
+ public static String getDateTime(Date date) {
+ SimpleDateFormat d = new SimpleDateFormat(LONGFORMAT);
+ return d.format(date);
+ }
+
+ /**
+ * 时间格式化 yyyy-MM-dd
+ * */
+ public static String getShortDate(Date date){
+ if(date==null)
+ date = new Date();
+ return getDate(date, SHORTFORMAT);
+ }
+
+ /**
+ * 时间格式化 yyyy-MM-dd HH:mm:ss
+ * */
+ public static String getLongDate(Date date){
+ if(date==null)
+ date = new Date();
+ return getDateTime(date);
+ }
+
+ /**
+ * 时间格式化 yyyy-MM-dd HH:mm:ss
+ * */
+ public static String getTimestampStr(){
+ SimpleDateFormat myFormat = new SimpleDateFormat(LONGFORMAT);
+ return myFormat.format(System.currentTimeMillis());
+ }
+
+ /**
+ * 时间格式化 yyyyMMddHHmmss
+ * */
+ public static String getLongTime(){
+ SimpleDateFormat myFormat = new SimpleDateFormat(LONGFORMATNOSPIT);
+ return myFormat.format(System.currentTimeMillis());
+ }
+
+ /**
+ * 时间格式化 yyyyMMddHHmmss
+ * */
+ public static String getLongTime(long ts){
+ SimpleDateFormat myFormat = new SimpleDateFormat(LONGFORMATNOSPIT);
+ return myFormat.format(ts);
+ }
+
+ /**
+ * 时间戳TS
+ */
+ public static String getTS(){
+ long ts = System.currentTimeMillis();
+ return Long.toString(ts);
+ }
+
+ /**
+ * N年后
+ * */
+ public static Date addYear(Date date, int amount) {
+ return add(date, Calendar.YEAR, amount);
+ }
+
+ /**
+ * N个月后
+ * */
+ public static Date addMonth(Date date, int amount) {
+ return add(date, Calendar.MONTH, amount);
+ }
+
+ /**
+ * 得到某一天的该星期的第一日 00:00:00
+ *
+ * @param date
+ * @param firstDayOfWeek
+ * 一个星期的第一天为星期几
+ *
+ * @return
+ */
+ public static Date getFirstDayOfWeek(Date date, int firstDayOfWeek) {
+ Calendar cal = Calendar.getInstance();
+ if (date != null)
+ cal.setTime(date);
+ cal.setFirstDayOfWeek(firstDayOfWeek);//设置一星期的第一天是哪一天
+ cal.set(Calendar.DAY_OF_WEEK, firstDayOfWeek);//指示一个星期中的某天
+ cal.set(Calendar.HOUR_OF_DAY, 0);//指示一天中的小时。HOUR_OF_DAY 用于 24 小时制时钟。例如,在 10:04:15.250 PM 这一时刻,HOUR_OF_DAY 为 22。
+ cal.set(Calendar.MINUTE, 0);//指示一小时中的分钟。例如,在 10:04:15.250 PM 这一时刻,MINUTE 为 4。
+ cal.set(Calendar.SECOND, 0);
+ cal.set(Calendar.MILLISECOND, 0);
+ return cal.getTime();
+ }
+
+ /**
+ * N天后
+ * */
+ public static Date addDay(Date date, int amount) {
+ return add(date, Calendar.DATE, amount);
+ }
+
+ /**
+ * N(年、月、天)后
+ * */
+ public static Date add(Date date, int field, int amount) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.add(field, amount);
+ return calendar.getTime();
+ }
+
+ /**
+ * N(年、月、天)后
+ * */
+ public static Date add(String datestr, int field, int amount) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(formatDate(datestr));
+ calendar.add(field, amount);
+ return calendar.getTime();
+ }
+
+ /**
+ * N(年、月、天)后(字符串形式)
+ * */
+ public static String add(String datestr, int field, int amount, String format) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(formatDate(datestr,format));
+ calendar.add(field, amount);
+ return getDate(calendar.getTime(), format);
+ }
+
+ /***
+ * 获取当前时间,不含日期
+ * @return
+ */
+ public static String getCurrentTime(){
+ SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss");
+ String time = sdf.format(Calendar.getInstance().getTime());
+ return time;
+ }
+
+ /**
+ * 将字符串转为为日期
+ */
+ public static Date formatDate(String datestr) {
+ if(19==datestr.length()){
+ return formatDate(datestr, LONGFORMAT);
+ }else{
+ return formatDate(datestr, SHORTFORMAT);
+ }
+ }
+
+ /**
+ * 将字符串转为为日期
+ */
+ public static Date formatDate(String datestr, String format) {
+ try {
+ if(StringUtils.isEmpty(datestr)){
+ return null;
+ }
+ SimpleDateFormat myFormat = new SimpleDateFormat(format);
+ Date date = myFormat.parse(datestr);
+ return date;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /***
+ * 月份的开始结束日期
+ * @param year
+ * @param month
+ * @param keys
+ * @return
+ */
+ public static Map<String, String> getMonthStartDateAndEndDate(int year, int month,
+ String... keys) {
+ SimpleDateFormat d = new SimpleDateFormat(LONGFORMAT);
+ Map<String, String> date = new HashMap<String, String>();
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.YEAR, year);
+ calendar.set(Calendar.MONTH, month - 1);
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
+ date.put(keys[0], d.format(calendar.getTime()));
+ calendar.add(Calendar.MONTH, 1);
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
+ date.put(keys[1], d.format(calendar.getTime()));
+ return date;
+ }
+
+ /**
+ * 时间格式化
+ */
+ public static String getTimeString(String time) {
+ String[] ti = time.split(":");
+ if (ti[1].length() == 1) {
+ time = ti[0] + "0" + ti[1];
+ } else {
+ time = ti[0] + ti[1];
+ }
+ return time;
+ }
+
+ /**
+ * <br>描 述: 获取计费模式的年月 2017-06-26 至 2017-07-25 为 2017年07月 以此类推
+ * <br>作 者: shizhenwei
+ * <br>历 史: (版本) 作者 时间 注释
+ * @return
+ */
+ public static String getSicdtYearMonth(String datestr){
+ String[] fileds = datestr.split(DIVIDE_LINE);
+ if(Integer.valueOf(fileds[2])>25){
+ Date date = add(datestr, FIELD_MONTH, 1);
+ return getDate(date, MONTHFORMAT);
+ }
+ return datestr.substring(0, 7);
+ }
+
+ public static String getSicdtYearMonth(){
+ return getSicdtYearMonth(getDate());
+ }
+
+ @SuppressWarnings("deprecation")
+ public static String timeString() {
+ Date date = new Date();
+ return getTimeString(date.getHours() + ":" + date.getMinutes());
+ }
+
+
+ /**
+ * 月-天数
+ * */
+ public static int getDayNum(int year, int month) {
+ if (month == 2) {
+ return year % 400 != 0 && (year % 4 != 0 || year % 100 == 0) ? 28
+ : 29;
+ }
+ String SmallMonth = ",4,6,9,11,";
+ return SmallMonth.indexOf(String.valueOf(String
+ .valueOf((new StringBuffer(",")).append(String.valueOf(month))
+ .append(",")))) < 0 ? 31 : 30;
+ }
+ /***
+ * 两个日期之间的天数
+ * @param date1
+ * @param date2
+ * @return
+ */
+ public static int DateDiff(Date date1, Date date2) {
+ int i = (int) ((date1.getTime() - date2.getTime()) / 3600 / 24 / 1000);
+ return i;
+ }
+ /**
+ * 日期拆分,取年或月或日 Y-年 M-月 D-日
+ * @param strDate
+ * @param style
+ * @return
+ */
+ public static int getYearMonthDate(String strDate, String style) {
+ int year;
+ int month;
+ int day;
+ int firstDash;
+ int secondDash;
+ if (strDate == null) {
+ return 0;
+ }
+ firstDash = strDate.indexOf('-');
+ secondDash = strDate.indexOf('-', firstDash + 1);
+ if ((firstDash > 0) & (secondDash > 0)
+ & (secondDash < strDate.length() - 1)) {
+ year = Integer.parseInt(strDate.substring(0, firstDash));
+ month = Integer.parseInt(strDate.substring(firstDash + 1,
+ secondDash));
+ day = Integer.parseInt(strDate.substring(secondDash + 1));
+ } else {
+ return 0;
+ }
+ if (style.equalsIgnoreCase("Y")) {
+ return year;
+ } else if (style.equalsIgnoreCase("M")) {
+ return month;
+ } else if (style.equalsIgnoreCase("D")) {
+ return day;
+ } else {
+ return 0;
+ }
+ }
+
+ /***
+ * 是否是年份的第一天
+ * @param date
+ * @return
+ */
+ public static boolean isYearFirstDay(java.sql.Date date) {
+ boolean i = false;
+ if ((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 1)
+ && (DateTimeUtil.getYearMonthDate(date.toString(), "D") == 1)) {
+ i = true;
+ }
+ return i;
+ }
+ /**
+ * 是否是半年的第一天
+ * @param date
+ * @return
+ */
+ public static boolean isHalfYearFirstDay(java.sql.Date date) {
+ boolean i = false;
+ if (((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 1) && (DateTimeUtil
+ .getYearMonthDate(date.toString(), "D") == 1))
+ || ((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 7) && (DateTimeUtil
+ .getYearMonthDate(date.toString(), "D") == 1))) {
+ i = true;
+ }
+ return i;
+ }
+ /**
+ * 取半年的第一天
+ * @param date
+ * @return
+ */
+ public static String getHalfYearFirstDay(java.sql.Date date) {
+ String month = "01";
+ if (DateTimeUtil.getYearMonthDate(date.toString(), "M") >= 7) {
+ month = "07";
+ }
+ String day = Integer.toString(DateTimeUtil.getYearMonthDate(
+ date.toString(), "Y")) + "-" + month + "-01";
+ return day;
+ }
+ /**
+ * 是否是半年最后一天
+ * */
+ public static boolean isHalfYearLastDay(java.sql.Date date) {
+ boolean i = false;
+ if (((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 12) && (DateTimeUtil
+ .getYearMonthDate(date.toString(), "D") == 31))
+ || ((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 6) && (DateTimeUtil
+ .getYearMonthDate(date.toString(), "D") == 30))) {
+ i = true;
+ }
+ return i;
+ }
+ /***
+ * 取半年最后一天
+ * @param date
+ * @return
+ */
+ public static String getHalfYearLastDay(java.sql.Date date) {
+ String month = "-06-30";
+ if (DateTimeUtil.getYearMonthDate(date.toString(), "M") >= 7) {
+ month = "-12-31";
+ }
+ String day = Integer.toString(getYearMonthDate(date.toString(), "Y"))
+ + "-" + month;
+ return day;
+ }
+
+ /***
+ *是否是年度最后一天
+ * @param date
+ * @return
+ */
+ public static boolean isYearLastDay(java.sql.Date date) {
+ boolean i = false;
+ if ((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 12)
+ && (DateTimeUtil.getYearMonthDate(date.toString(), "D") == 31)) {
+ i = true;
+ }
+ return i;
+ }
+
+ /**
+ * 是否季度第一天
+ * */
+ public static boolean isQuarterFirstDay(java.sql.Date date) {
+ boolean i = false;
+ if (((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 1)
+ || (DateTimeUtil.getYearMonthDate(date.toString(), "M") == 4)
+ || (DateTimeUtil.getYearMonthDate(date.toString(), "M") == 7) || (DateTimeUtil
+ .getYearMonthDate(date.toString(), "M") == 10))
+ && (DateTimeUtil.getYearMonthDate(date.toString(), "D") == 1)) {
+ i = true;
+ }
+ return i;
+ }
+ /***
+ * 季度第一天
+ * @param date
+ * @return
+ */
+ public static String getQuarterFirstDay(java.sql.Date date) {
+ String month = "01";
+ if (DateTimeUtil.getYearMonthDate(date.toString(), "M") >= 10) {
+ month = "10";
+ } else if (DateTimeUtil.getYearMonthDate(date.toString(), "M") >= 7) {
+ month = "07";
+ } else if (DateTimeUtil.getYearMonthDate(date.toString(), "M") >= 4) {
+ month = "04";
+ } else if (DateTimeUtil.getYearMonthDate(date.toString(), "M") >= 1) {
+ month = "01";
+ }
+
+ String day = Integer.toString(DateTimeUtil.getYearMonthDate(
+ date.toString(), "Y")) + "-" + month + "-01";
+ return day;
+ }
+
+
+ /**
+ * 是否季度最后一天
+ * @param date
+ * @return
+ */
+ public static boolean isQuarterLastDay(java.sql.Date date) {
+ boolean i = false;
+ if ((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 3)
+ && (DateTimeUtil.getYearMonthDate(date.toString(), "D") == 31)) {
+ i = true;
+ }
+ if ((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 6)
+ && (DateTimeUtil.getYearMonthDate(date.toString(), "D") == 30)) {
+ i = true;
+ }
+ if ((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 9)
+ && (DateTimeUtil.getYearMonthDate(date.toString(), "D") == 30)) {
+ i = true;
+ }
+ if ((DateTimeUtil.getYearMonthDate(date.toString(), "M") == 12)
+ && (DateTimeUtil.getYearMonthDate(date.toString(), "D") == 31)) {
+ i = true;
+ }
+ return i;
+ }
+ /**
+ * 季度最后一天
+ * @param date
+ * @return
+ */
+ public static String getQuarterLastDay(java.sql.Date date) {
+ String month = "-03-31";
+ if (DateTimeUtil.getYearMonthDate(date.toString(), "M") >= 10) {
+ month = "-12-31";
+ } else if (DateTimeUtil.getYearMonthDate(date.toString(), "M") >= 7) {
+ month = "-09-30";
+ } else if (DateTimeUtil.getYearMonthDate(date.toString(), "M") >= 4) {
+ month = "-06-30";
+ }
+
+ String day = Integer.toString(DateTimeUtil.getYearMonthDate(
+ date.toString(), "Y")) + "-" + month;
+ return day;
+ }
+
+ /***
+ * 是否月份最后一天
+ * @param date
+ * @return
+ */
+ public static boolean isMonthLastDay(Date date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ return calendar.getActualMaximum(Calendar.DAY_OF_MONTH) == calendar.get(Calendar.DAY_OF_MONTH);
+ }
+
+ /**
+ * 是否月份第一天
+ * @param date
+ * @return
+ */
+ public static boolean isMonthFisrtDay(Date date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ return calendar.getActualMinimum(Calendar.DAY_OF_MONTH) == calendar.get(Calendar.DAY_OF_MONTH);
+ }
+
+ /**
+ * 月份第一天日期
+ * @param date
+ * @return
+ */
+ public static Date getMonthFisrtDay(Date date){
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
+ return calendar.getTime();
+ }
+
+ /**
+ * 星期的第几天
+ * @param strDate yy-mm-dd
+ * @return
+ */
+ public static int getDateInWeek(String strDate) {
+ DateFormat df = DateFormat.getDateInstance();
+ try {
+ df.parse(strDate);
+ Calendar c = df.getCalendar();
+ int day = c.get(Calendar.DAY_OF_WEEK) - Calendar.SUNDAY;
+ return day;
+ } catch (ParseException e) {
+ return -1;
+ }
+ }
+
+
+ public static java.sql.Date getSqlDate(Date date) {
+ java.sql.Date result = null;
+ try {
+ SimpleDateFormat myFormat = new SimpleDateFormat(LONGFORMAT);
+ String mystrdate = myFormat.format(date);
+ result = java.sql.Date.valueOf(mystrdate);
+ } catch (Exception e) {
+ return null;
+ }
+ return result;
+ }
+
+ /**
+ * 获取当前月的月初到今天的日期
+ */
+// public static List<String> getDayofMouth() {
+// List<String> data = new ArrayList<>();
+//
+// }
+
+ /**
+ * 获取当月所有日期
+ * @return
+ */
+ public static List<String> getDayByMonth(){
+ List<String> data = new ArrayList<>();
+ try {
+ Calendar c = Calendar.getInstance();
+ // 获取当前的年份
+ int year = c.get(Calendar.YEAR);
+ // 获取当前的月份(需要加1才是现在的月份)
+ int month = c.get(Calendar.MONTH) + 1;
+ // 获取本月的总天数
+ int dayCount = c.getActualMaximum(Calendar.DAY_OF_MONTH);
+ // 定义时间格式
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ // 开始日期为当前年月拼接1号
+ Date startDate = sdf.parse(year + "-" + month + "-01");
+ // 结束日期为当前年月拼接该月最大天数
+ Date endDate = sdf.parse(year + "-" + month + "-" + dayCount);
+ // 设置calendar的开始日期
+ c.setTime(startDate);
+ // 当前时间小于等于设定的结束时间
+ while(c.getTime().compareTo(endDate) <= 0){
+ String time = sdf.format(c.getTime());
+ data.add(time);
+ // 当前日期加1
+ c.add(Calendar.DATE, 1);
+ }
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+
+ return data;
+}
+
+
+ /**
+ * 上个月
+ * @param dt
+ * @return
+ */
+ @SuppressWarnings("deprecation")
+ public static String getUpMDate(Date dt) {
+ dt.setDate(1);
+ dt.setDate(dt.getDate() - 1);
+ return dt.toLocaleString();
+ }
+
+
+ public static String getShortDate(String dt) {
+ if (dt != null) {
+ SimpleDateFormat myFormat = new SimpleDateFormat(SHORTFORMAT);
+ try {
+ Date date = myFormat.parse(dt);
+ return getDate(date, SHORTFORMATNOSPIT);
+ } catch (ParseException e) {
+ return dt;
+ }
+ } else
+ return dt;
+ }
+
+
+ public static String getLongDate(String dt) {
+ if (dt != null) {
+ SimpleDateFormat myFormat = new SimpleDateFormat(SHORTFORMAT);
+ try {
+ Date date = myFormat.parse(dt);
+ return getDate(date, SHORTFORMAT);
+ } catch (ParseException e) {
+ return dt;
+ }
+ } else
+ return dt;
+ }
+
+
+ public static boolean isSameYearMonth(String date) {
+ try {
+ String currdate = getDate();
+ currdate = getShortDate(currdate).substring(0, 6);
+ String lastdate = getShortDate(date).substring(0, 6);
+ if (lastdate.equals(currdate)) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SystemSetting.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SystemSetting.java
new file mode 100644
index 0000000..00a08cb
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SystemSetting.java
@@ -0,0 +1,60 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.domain;
+
+import lombok.Data;
+import cn.hutool.core.bean.BeanUtil;
+import io.swagger.annotations.ApiModelProperty;
+import cn.hutool.core.bean.copier.CopyOptions;
+import me.zhengjie.base.BaseEntity;
+
+import javax.persistence.*;
+import javax.validation.constraints.*;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author wcd
+* @date 2023-01-30
+**/
+@Entity
+@Data
+@Table(name="system_setting")
+public class SystemSetting extends BaseEntity implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "`id`")
+ @ApiModelProperty(value = "id")
+ private Long id;
+
+ @Column(name = "`description`")
+ @ApiModelProperty(value = "描述")
+ private String description;
+
+ @Column(name = "`label`")
+ @ApiModelProperty(value = "标签")
+ private String label;
+
+ @Column(name = "`value`")
+ @ApiModelProperty(value = "值")
+ private String value;
+
+ public void copy(SystemSetting source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/CalendarVo.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/CalendarVo.java
new file mode 100644
index 0000000..d1a7382
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/CalendarVo.java
@@ -0,0 +1,16 @@
+package me.zhengjie.modules.system.domain.vo;
+
+import lombok.Data;
+
+@Data
+public class CalendarVo {
+
+ private String Date;
+
+ private String Title;
+
+ private Boolean isOk;
+
+ private Integer type;
+
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SystemSettingRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SystemSettingRepository.java
new file mode 100644
index 0000000..29b12f8
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SystemSettingRepository.java
@@ -0,0 +1,28 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.repository;
+
+import me.zhengjie.modules.system.domain.SystemSetting;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-01-30
+**/
+public interface SystemSettingRepository extends JpaRepository<SystemSetting, Long>, JpaSpecificationExecutor<SystemSetting> {
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SystemSettingController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SystemSettingController.java
new file mode 100644
index 0000000..3273486
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SystemSettingController.java
@@ -0,0 +1,96 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.rest;
+
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.system.domain.SystemSetting;
+import me.zhengjie.modules.system.service.SystemSettingService;
+import me.zhengjie.modules.system.service.dto.SysRosteringQueryCriteria;
+import me.zhengjie.modules.system.service.dto.SystemSettingQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.*;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-01-30
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "公司管理管理")
+@RequestMapping("/api/systemSetting")
+public class SystemSettingController {
+
+ private final SystemSettingService systemSettingService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('systemSetting:list')")
+ public void exportSystemSetting(HttpServletResponse response, SystemSettingQueryCriteria criteria) throws IOException {
+ systemSettingService.download(systemSettingService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询公司管理")
+ @ApiOperation("查询公司管理")
+ @PreAuthorize("@el.check('systemSetting:list')")
+ public ResponseEntity<Object> querySystemSetting(SystemSettingQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(systemSettingService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/all")
+ @Log("查询公司管理")
+ @ApiOperation("查询公司管理")
+ @PreAuthorize("@el.check('systemSetting:list')")
+ public ResponseEntity<Object> querySystemSetting(SystemSettingQueryCriteria criteria){
+ return new ResponseEntity<>(systemSettingService.queryAll(criteria),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增公司管理")
+ @ApiOperation("新增公司管理")
+ @PreAuthorize("@el.check('systemSetting:add')")
+ public ResponseEntity<Object> createSystemSetting(@Validated @RequestBody SystemSetting resources){
+ return new ResponseEntity<>(systemSettingService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改公司管理")
+ @ApiOperation("修改公司管理")
+ @PreAuthorize("@el.check('systemSetting:edit')")
+ public ResponseEntity<Object> updateSystemSetting(@Validated @RequestBody SystemSetting resources){
+ systemSettingService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除公司管理")
+ @ApiOperation("删除公司管理")
+ @PreAuthorize("@el.check('systemSetting:del')")
+ public ResponseEntity<Object> deleteSystemSetting(@RequestBody Long[] ids) {
+ systemSettingService.deleteAll(ids);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
index ea7c63f..078fca6 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
@@ -48,6 +48,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
@@ -207,4 +208,24 @@
throw new BadRequestException("角色权限不足");
}
}
+
+ /**
+ * 获取用户日历信息
+ * @param month
+ * @return
+ * @throws Exception
+ */
+ @GetMapping(value = "/getUserCalendarInfo/{month}")
+ @Log("获取用户日历信息")
+ @ApiOperation("获取用户日历信息")
+ public ResponseEntity<Object> getUserCalendarInfo(@PathVariable String month) throws Exception {
+ return new ResponseEntity<>(userService.getUserCalendarInfo(month), HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/getUserBaseInfo")
+ @Log("获取用户基础信息")
+ @ApiOperation("获取用户日历信息")
+ public ResponseEntity<Object> getUserBaseInfo() throws ParseException {
+ return new ResponseEntity<>(userService.getUserBaseInfo(), HttpStatus.OK);
+ }
}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SystemSettingService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SystemSettingService.java
new file mode 100644
index 0000000..829a0e2
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SystemSettingService.java
@@ -0,0 +1,83 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service;
+
+import me.zhengjie.modules.system.domain.SystemSetting;
+import me.zhengjie.modules.system.service.dto.SystemSettingDto;
+import me.zhengjie.modules.system.service.dto.SystemSettingQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import java.util.Map;
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @description 服务接口
+* @author wcd
+* @date 2023-01-30
+**/
+public interface SystemSettingService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(SystemSettingQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<SystemSettingDto>
+ */
+ List<SystemSettingDto> queryAll(SystemSettingQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return SystemSettingDto
+ */
+ SystemSettingDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return SystemSettingDto
+ */
+ SystemSettingDto create(SystemSetting resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(SystemSetting resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<SystemSettingDto> all, HttpServletResponse response) throws IOException;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
index bd431d7..3dc19e9 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
@@ -16,6 +16,7 @@
package me.zhengjie.modules.system.service;
import me.zhengjie.modules.system.domain.User;
+import me.zhengjie.modules.system.domain.vo.CalendarVo;
import me.zhengjie.modules.system.service.dto.UserDto;
import me.zhengjie.modules.system.service.dto.UserLoginDto;
import me.zhengjie.modules.system.service.dto.UserQueryCriteria;
@@ -23,6 +24,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+import java.text.ParseException;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -123,4 +125,19 @@
*/
void updateCenter(User resources);
+ /**
+ * 获取日历信息
+ * @param month
+ * @return
+ * @throws Exception
+ */
+ List<CalendarVo> getUserCalendarInfo(String month) throws Exception;
+
+ /**
+ * 获取用户基本信息
+ * @return
+ * @throws ParseException
+ */
+ Map getUserBaseInfo() throws ParseException;
+
}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingDto.java
new file mode 100644
index 0000000..cc6c007
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingDto.java
@@ -0,0 +1,42 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service.dto;
+
+import lombok.Data;
+import me.zhengjie.base.BaseDTO;
+
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author wcd
+* @date 2023-01-30
+**/
+@Data
+public class SystemSettingDto extends BaseDTO implements Serializable {
+
+ private Long id;
+
+ /** 描述 */
+ private String description;
+
+ /** 标签 */
+ private String label;
+
+ /** 值 */
+ private String value;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingQueryCriteria.java
new file mode 100644
index 0000000..e7e965d
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingQueryCriteria.java
@@ -0,0 +1,32 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service.dto;
+
+import lombok.Data;
+import java.util.List;
+import me.zhengjie.annotation.Query;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-01-30
+**/
+@Data
+public class SystemSettingQueryCriteria{
+
+ @Query(type = Query.Type.INNER_LIKE)
+ private String label;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SystemSettingServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SystemSettingServiceImpl.java
new file mode 100644
index 0000000..1159842
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SystemSettingServiceImpl.java
@@ -0,0 +1,106 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service.impl;
+
+import me.zhengjie.modules.system.domain.SystemSetting;
+import me.zhengjie.utils.ValidationUtil;
+import me.zhengjie.utils.FileUtil;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.system.repository.SystemSettingRepository;
+import me.zhengjie.modules.system.service.SystemSettingService;
+import me.zhengjie.modules.system.service.dto.SystemSettingDto;
+import me.zhengjie.modules.system.service.dto.SystemSettingQueryCriteria;
+import me.zhengjie.modules.system.service.mapstruct.SystemSettingMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import me.zhengjie.utils.PageUtil;
+import me.zhengjie.utils.QueryHelp;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
+/**
+* @website https://eladmin.vip
+* @description 服务实现
+* @author wcd
+* @date 2023-01-30
+**/
+@Service
+@RequiredArgsConstructor
+public class SystemSettingServiceImpl implements SystemSettingService {
+
+ private final SystemSettingRepository systemSettingRepository;
+ private final SystemSettingMapper systemSettingMapper;
+
+ @Override
+ public Map<String,Object> queryAll(SystemSettingQueryCriteria criteria, Pageable pageable){
+ Page<SystemSetting> page = systemSettingRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ return PageUtil.toPage(page.map(systemSettingMapper::toDto));
+ }
+
+ @Override
+ public List<SystemSettingDto> queryAll(SystemSettingQueryCriteria criteria){
+ return systemSettingMapper.toDto(systemSettingRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public SystemSettingDto findById(Long id) {
+ SystemSetting systemSetting = systemSettingRepository.findById(id).orElseGet(SystemSetting::new);
+ ValidationUtil.isNull(systemSetting.getId(),"SystemSetting","id",id);
+ return systemSettingMapper.toDto(systemSetting);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public SystemSettingDto create(SystemSetting resources) {
+ return systemSettingMapper.toDto(systemSettingRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(SystemSetting resources) {
+ SystemSetting systemSetting = systemSettingRepository.findById(resources.getId()).orElseGet(SystemSetting::new);
+ ValidationUtil.isNull( systemSetting.getId(),"SystemSetting","id",resources.getId());
+ systemSetting.copy(resources);
+ systemSettingRepository.save(systemSetting);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ systemSettingRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<SystemSettingDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (SystemSettingDto systemSetting : all) {
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("标签", systemSetting.getLabel());
+ map.put("值", systemSetting.getValue());
+ map.put("描述", systemSetting.getDescription());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
index e24c93b..b3c9d06 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
@@ -18,18 +18,32 @@
import lombok.RequiredArgsConstructor;
import me.zhengjie.config.FileProperties;
import me.zhengjie.exception.BadRequestException;
+import me.zhengjie.modules.attendance.domain.Attendance;
+import me.zhengjie.modules.attendance.domain.AttendanceBusinessTravel;
+import me.zhengjie.modules.attendance.domain.AttendanceGoOut;
+import me.zhengjie.modules.attendance.repository.AttendanceBusinessTravelRepository;
+import me.zhengjie.modules.attendance.repository.AttendanceCardreplacementRepository;
+import me.zhengjie.modules.attendance.repository.AttendanceGoOutRepository;
+import me.zhengjie.modules.attendance.repository.AttendanceRepository;
+import me.zhengjie.modules.attendance.service.impl.AttendanceLeaveServiceImpl;
+import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.modules.quartz.utils.DateTimeUtil;
import me.zhengjie.modules.security.service.OnlineUserService;
import me.zhengjie.modules.security.service.UserCacheManager;
import me.zhengjie.modules.system.domain.*;
import me.zhengjie.exception.EntityExistException;
import me.zhengjie.exception.EntityNotFoundException;
+import me.zhengjie.modules.system.domain.vo.CalendarVo;
import me.zhengjie.modules.system.repository.*;
import me.zhengjie.modules.system.service.UserService;
import me.zhengjie.modules.system.service.dto.*;
import me.zhengjie.modules.system.service.mapstruct.SysUserLevelWageMapper;
import me.zhengjie.modules.system.service.mapstruct.UserLoginMapper;
import me.zhengjie.modules.system.service.mapstruct.UserMapper;
+import me.zhengjie.modules.task.domain.TaskDaliy;
+import me.zhengjie.modules.task.repository.TaskDaliyRepository;
import me.zhengjie.utils.*;
+import org.apache.commons.lang3.ObjectUtils;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
@@ -41,7 +55,15 @@
import javax.validation.constraints.NotBlank;
import java.io.File;
import java.io.IOException;
+import java.math.BigDecimal;
import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.Duration;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.stream.Collectors;
@@ -65,6 +87,14 @@
private final SysUserLevelWageRepository sysUserLevelWageRepository;
private final SysUserLevelInsuranceRepository sysUserLevelInsuranceRepository;
private final SysUserLevelOtherRepository sysUserLevelOtherRepository;
+ private final AttendanceRepository attendanceRepository;
+ private final TaskDaliyRepository taskDaliyRepository;
+ private final AttendanceLeaveServiceImpl attendanceLeaveService;
+ private final AttendanceCardreplacementRepository attendanceCardreplacementRepository;
+ private final SysConfigProportionRepository sysConfigProportionRepository;
+ private final SysConfigHolidayRepository sysConfigHolidayRepository;
+ private final AttendanceGoOutRepository attendanceGoOutRepository;
+ private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository;
@Override
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
@@ -176,6 +206,259 @@
delCaches(user.getId(), user.getUsername());
}
+ /**
+ * 获取日历信息
+ * @param month
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public List<CalendarVo> getUserCalendarInfo(String month) throws Exception {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+ List<CalendarVo> calendarInfo = new ArrayList<>();
+ List<String> dateList = new ArrayList<>();
+
+ //月份第一天,最后一天
+ LocalDate startDate = LocalDate.parse(month).with(TemporalAdjusters.firstDayOfMonth());
+ LocalDate endDate = LocalDate.parse(month).with(TemporalAdjusters.lastDayOfMonth());
+ //当前登录人
+ Long userId = SecurityUtils.getCurrentUserId();
+ //查询这个范围的考勤记录
+ List<Attendance> attendanceList = attendanceRepository.findAllByUserAndDate(userId,startDate.toString(),endDate.toString());
+ for(Attendance attendance : attendanceList){
+ CalendarVo onDuty = new CalendarVo();
+ onDuty.setDate(df.format(attendance.getAttendanceDate()));
+ onDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getStartClockResults()).get("msg")) ? "上班打卡时间:" + attendance.getRosteringWorkStartTime().toString() : "上班:" + formateResult(attendance.getStartClockResults()).get("msg"));
+ onDuty.setIsOk((Boolean) formateResult(attendance.getStartClockResults()).get("status"));
+ onDuty.setType(1);
+ CalendarVo offDuty = new CalendarVo();
+ offDuty.setDate(df.format(attendance.getAttendanceDate()));
+ offDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getEndClockResults()).get("msg")) ? "下班打卡时间:" + attendance.getRosteringWorkEndTime().toString() : "下班:" + formateResult(attendance.getEndClockResults()).get("msg"));
+ offDuty.setIsOk((Boolean) formateResult(attendance.getEndClockResults()).get("status"));
+ offDuty.setType(1);
+ calendarInfo.add(onDuty);
+ calendarInfo.add(offDuty);
+ dateList.add(attendance.getAttendanceDate().toString());
+ }
+
+ //获取应工作时长
+ User user = userRepository.getById(userId);
+ Long duration = (Duration.between(user.getSysRostering().getWorkStartTime(), user.getSysRostering().getWorkEndTime())).toHours();
+
+ //查询日志表
+ List<TaskDaliy> taskDaliyList = taskDaliyRepository.findAllByUserAndDate(userId,startDate,endDate);
+ for (TaskDaliy taskDaliy : taskDaliyList) {
+ CalendarVo daily = new CalendarVo();
+ daily.setDate(taskDaliy.getFillDate().toString());
+ if (dateList.contains(taskDaliy.getFillDate().toString())) {
+ dateList.remove(taskDaliy.getFillDate().toString());
+ }
+ daily.setIsOk(taskDaliy.getConsumedHours().compareTo(new Double(duration - 1)) >= 0 ? true : false);
+ daily.setTitle(taskDaliy.getConsumedHours().compareTo(new Double(duration - 1)) >= 0 ? "工时: " + taskDaliy.getConsumedHours().toString() : "已填工时:" + taskDaliy.getConsumedHours().toString() + " 不满8小时,请补充日报");
+ daily.setType(2);
+ calendarInfo.add(daily);
+ }
+
+ for (String date : dateList) {
+ String type1 = "";
+ String type2 = "";
+ CalendarVo dailyVo = new CalendarVo();
+ dailyVo.setDate(date);
+ for (Attendance attendanceRecord : attendanceList) {
+ type1 = attendanceRecord.getStartClockResults();
+ type2 = attendanceRecord.getEndClockResults();
+ date = date.substring(0,10);
+ if(date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_LEAVE) && type2.equals(Constant.ATTENDANCE_STATE_LEAVE)){
+ dailyVo.setTitle("请假");
+ dailyVo.setIsOk(true);
+ }else if(date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_BUSINESS) && type2.equals(Constant.ATTENDANCE_STATE_BUSINESS)){
+ dailyVo.setTitle("出差");
+ dailyVo.setIsOk(true);
+ }else if(date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_REST) && type2.equals(Constant.ATTENDANCE_STATE_REST)){
+ dailyVo.setTitle("休息");
+ dailyVo.setIsOk(true);
+ }else if(date.equals(df.format(attendanceRecord.getAttendanceDate()))){
+ dailyVo.setTitle("日报未填写,请补充日报");
+ dailyVo.setIsOk(false);
+ }
+ }
+ dailyVo.setType(2);
+ calendarInfo.add(dailyVo);
+ }
+ return calendarInfo;
+ }
+
+ /**
+ * 判断状态
+ * @param result
+ * @return
+ */
+ public Map formateResult(String result) {
+ Map returnData = new HashMap();
+ switch (result) {
+ case Constant.ATTENDANCE_STATE_NOTSIGNED:
+ returnData.put("msg", "缺卡");
+ returnData.put("status", false);
+ break;
+ case Constant.ATTENDANCE_START_EARLY:
+ returnData.put("msg", "早退");
+ returnData.put("status", false);
+ break;
+ case Constant.ATTENDANCE_START_LATE:
+ returnData.put("msg", "迟到");
+ returnData.put("status", false);
+ break;
+ case Constant.ATTENDANCE_STATE_LACK_OF_TIME:
+ returnData.put("msg", "缺时");
+ returnData.put("status", false);
+ break;
+ case Constant.ATTENDANCE_STATE_LEAVE:
+ returnData.put("msg", "请假");
+ returnData.put("status", true);
+ break;
+ case Constant.ATTENDANCE_STATE_GOOUT:
+ returnData.put("msg", "外出");
+ returnData.put("status", true);
+ break;
+ case Constant.ATTENDANCE_STATE_BUSINESS:
+ returnData.put("msg", "出差");
+ returnData.put("status", true);
+ break;
+ case Constant.ATTENDANCE_STATE_WAITFOR:
+ returnData.put("msg", "等待");
+ returnData.put("status", true);
+ break;
+ case Constant.ATTENDANCE_STATE_REST:
+ returnData.put("msg", "休息");
+ returnData.put("status", true);
+ break;
+ default:
+ returnData.put("msg", result);
+ returnData.put("status", true);
+ }
+ return returnData;
+ }
+
+ /**
+ *获取用户基础信息
+ * @return
+ * @throws ParseException
+ */
+ @Override
+ public Map getUserBaseInfo() throws ParseException {
+ Long userId = SecurityUtils.getCurrentUserId();
+ Map returnData = new HashMap();
+ LocalDate startDate = LocalDate.now().with(TemporalAdjusters.firstDayOfMonth());
+ LocalDate endDate = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth());
+ List<Attendance> attendanceRecordList = attendanceRepository.findAllByUserAndDate(userId, startDate.toString(), endDate.toString());
+ // 出勤天数
+ returnData.put("onDutyDays", attendanceRecordList.size());
+ // 剩余年假
+ Double yearTimes = attendanceLeaveService.getYearTimeLength(userId);
+ returnData.put("annualLeave", yearTimes);
+ // 剩余补卡
+ Calendar calendar = Calendar.getInstance();
+ // 获取当前年
+ int year = calendar.get(Calendar.YEAR);
+ // 获取当前月
+ int month = calendar.get(Calendar.MONTH) + 1;
+ String mouths = "";
+ if(month < 10){
+ mouths = "0" + month;
+ }
+ String baseDate = year + "-" + mouths;
+ // 查询当月的补卡记录的条数
+ Integer count = attendanceCardreplacementRepository.count(userId, baseDate);
+ // 查询配置表的每月补卡次数
+ SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findByTitle("每月可补卡次数");
+ if(count >= sysConfigProportion.getProportion()){
+ returnData.put("cardLeft", 0);
+ }else{
+ returnData.put("cardLeft", (sysConfigProportion.getProportion() - count));
+ }
+
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+ // 法定节假日
+ List<String> holiday = new ArrayList<>();
+ // 天数
+ int shouldWordDays = 0;
+ List<SysConfigHoliday> holidayConfigurationList = sysConfigHolidayRepository.findAll();
+ for (SysConfigHoliday holidayConfiguration : holidayConfigurationList) {
+ if (holidayConfiguration.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) {
+ holiday.add(df.format(holidayConfiguration.getHolidayDate()));
+ }
+ }
+ // 获取当月所有日期
+ List<String> dateList = DateTimeUtil.getDayByMonth();
+ Date date1 = new Date();
+ String todayDay = df.format(date1);
+ // 工作日的天数
+ for(String date : dateList){
+ Date isWeekEnd = df.parse(date);
+ calendar.setTime(isWeekEnd);
+ if(isWeekEnd.compareTo(df.parse(todayDay)) <= 0){
+ if(!holiday.contains(date) && calendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && calendar.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY){
+ shouldWordDays += 1;
+ }
+ }
+ }
+ int num = shouldWordDays * 8;
+ // 月初到今天应工作时长
+ returnData.put("Time", num);
+
+ DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ User user = userRepository.getById(userId);
+ // 考勤上午时间
+ Double attCheckOnDuration = 0.0;
+ // 考勤下午时间
+ Double attCheckOffDuration = 0.0;
+ for(Attendance attendance : attendanceRecordList){
+ // 上班打卡时间不为空并且打卡状态不为出差外出的考勤记录
+ if(ObjectUtils.isNotEmpty(attendance.getActualWorkStartTime()) && !attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_GOOUT) && !attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_BUSINESS)){
+ LocalDateTime attCheckOnTime = attendance.getActualWorkStartTime().toLocalDateTime();
+ LocalDateTime scheduleStartTime = LocalDateTime.parse(attendance.getAttendanceDate().toString().substring(0,10) +" " + user.getSysRostering().getLunchStartTime().toString() + ":00",formatter2);
+ if(attCheckOnTime.compareTo(scheduleStartTime) <= 0){
+ // 获得两个时间之间的相差值
+ Duration duration = Duration.between(attCheckOnTime, scheduleStartTime);
+ Long minutes = duration.toMinutes();
+ Double hour = Double.valueOf(String.valueOf(new BigDecimal(Double.valueOf(minutes) / 60).setScale(2, BigDecimal.ROUND_HALF_UP)));
+ attCheckOnDuration = attCheckOnDuration + hour;
+ }
+ }
+ // 下班打卡时间不为空并且打卡状态不为出差外出的考勤记录
+ if(ObjectUtils.isNotEmpty(attendance.getActualWorkEndTime()) && !attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_GOOUT) && !attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_BUSINESS)){
+ LocalDateTime attCheckOffTime = attendance.getActualWorkEndTime().toLocalDateTime();
+ LocalDateTime scheduleEndTime = LocalDateTime.parse(attendance.getAttendanceDate().toString().substring(0,10) +" " + user.getSysRostering().getLunchEndTime().toString() + ":00",formatter2);
+ if(attCheckOffTime.compareTo(scheduleEndTime) > 0){
+ // 获得两个时间之间的相差值
+ Duration duration = Duration.between(scheduleEndTime, attCheckOffTime);
+ Long minutes = duration.toMinutes();
+ Double hour = Double.valueOf(String.valueOf(new BigDecimal(Double.valueOf(minutes) / 60 ).setScale(2, BigDecimal.ROUND_HALF_UP)));
+ attCheckOffDuration = attCheckOffDuration + hour;
+ }
+ }
+ }
+ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
+ String startTime = startDate + " " + dateTimeFormatter.format(user.getSysRostering().getWorkStartTime());
+ String endTime = df.format(new Date()) + " " + dateTimeFormatter.format(user.getSysRostering().getWorkEndTime());
+ // 外出时长
+ Double goOutTimes = 0.0;
+ // 查询外出表
+ List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findByUserAndDate(userId,Timestamp.valueOf(startTime).toLocalDateTime(),Timestamp.valueOf(endTime).toLocalDateTime());
+ for(AttendanceGoOut attendanceGoOut : attendanceGoOutList){
+ goOutTimes = goOutTimes + attendanceGoOut.getOutDuration();
+ }
+ // 出差时长
+ Double bussTimes = 0.0;
+ // 查询出差表
+ List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.findByUserAndSEDate(userId,Timestamp.valueOf(startDate + " " + "00:00:00").toLocalDateTime(),Timestamp.valueOf(df.format(new Date()) + " " + "00:00:00").toLocalDateTime());
+ for(AttendanceBusinessTravel attendanceBusinessTravel : attendanceBusinessTravelList){
+ bussTimes = bussTimes + attendanceBusinessTravel.getTravelDuration();
+ }
+ returnData.put("Times", attCheckOnDuration + attCheckOffDuration + goOutTimes + (bussTimes * 8));
+ return returnData;
+ }
+
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Set<Long> ids) {
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SystemSettingMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SystemSettingMapper.java
new file mode 100644
index 0000000..aeac8de
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SystemSettingMapper.java
@@ -0,0 +1,32 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.system.domain.SystemSetting;
+import me.zhengjie.modules.system.service.dto.SystemSettingDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-01-30
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface SystemSettingMapper extends BaseMapper<SystemSettingDto, SystemSetting> {
+
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
index 88817c2..752b499 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
@@ -23,6 +23,7 @@
import org.springframework.data.jpa.repository.Query;
import java.sql.Timestamp;
+import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -132,4 +133,14 @@
*/
@Query(value = "SELECT COALESCE(SUM(consumed_hours), 0) AS consumedHours, COALESCE(SUM(consumed_workload), 0) AS consumedWorkload, COALESCE(MAX(task_progress), 0) AS taskProgress FROM task_daliy WHERE project_id = ?1 AND task_id = ?2 AND user_id = ?3", nativeQuery = true)
TaskDailyInterface findSumConsumedHoursAndSumConsumedWorkloadAndMaxTaskProgressByProjectIdAndTaskIdAndUserId(Long projectId, Long taskId, Long userId);
+
+ /**
+ * 根据userId,开始时间结束时间范围查询日志表
+ * @param userId
+ * @param startDate
+ * @param endDate
+ * @return
+ */
+ @Query(value = "SELECT * from task_daliy where user_id = ?1 and fill_date <= ?3 and fill_date >= ?2 group by fill_date", nativeQuery = true)
+ List<TaskDaliy> findAllByUserAndDate(Long userId, LocalDate startDate, LocalDate endDate);
}
\ No newline at end of file
diff --git a/eladmin-web-master/package.json b/eladmin-web-master/package.json
index aae94bc..f42ae46 100644
--- a/eladmin-web-master/package.json
+++ b/eladmin-web-master/package.json
@@ -33,6 +33,11 @@
"url": "https://github.com/elunez/eladmin/issues"
},
"dependencies": {
+ "@fullcalendar/core": "^5.11.0",
+ "@fullcalendar/daygrid": "^5.11.0",
+ "@fullcalendar/interaction": "^5.11.0",
+ "@fullcalendar/timegrid": "^5.11.0",
+ "@fullcalendar/vue": "^5.11.0",
"@riophae/vue-treeselect": "^0.4.0",
"axios": "^0.21.1",
"clipboard": "2.0.4",
@@ -48,6 +53,7 @@
"jsencrypt": "^3.0.0-rc.1",
"jszip": "^3.7.1",
"mavon-editor": "^2.9.1",
+ "moment": "^2.29.4",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
diff --git a/eladmin-web-master/src/api/system/systemSetting.js b/eladmin-web-master/src/api/system/systemSetting.js
new file mode 100644
index 0000000..621cdde
--- /dev/null
+++ b/eladmin-web-master/src/api/system/systemSetting.js
@@ -0,0 +1,35 @@
+import request from '@/utils/request'
+
+export function getAll(params) {
+ return request({
+ url: 'api/systemSetting/all',
+ method: 'get',
+ params
+ })
+}
+
+export function add(data) {
+ return request({
+ url: 'api/systemSetting',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/systemSetting/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/systemSetting',
+ method: 'put',
+ data
+ })
+}
+
+export default { add, edit, del, getAll }
diff --git a/eladmin-web-master/src/api/system/user.js b/eladmin-web-master/src/api/system/user.js
index 543191e..a626833 100644
--- a/eladmin-web-master/src/api/system/user.js
+++ b/eladmin-web-master/src/api/system/user.js
@@ -65,4 +65,18 @@
})
}
-export default { getAll, add, edit, del }
+export function getUserCalendarInfo(month) {
+ return request({
+ url: 'api/users/getUserCalendarInfo/' + month,
+ method: 'get'
+ })
+}
+
+export function getUserBaseInfo() {
+ return request({
+ url: 'api/users/getUserBaseInfo',
+ method: 'get'
+ })
+}
+
+export default { getAll, add, edit, del, getUserCalendarInfo, getUserBaseInfo }
diff --git a/eladmin-web-master/src/views/dashboard/PanelGroup.vue b/eladmin-web-master/src/views/dashboard/PanelGroup.vue
index 589236e..a068438 100644
--- a/eladmin-web-master/src/views/dashboard/PanelGroup.vue
+++ b/eladmin-web-master/src/views/dashboard/PanelGroup.vue
@@ -3,52 +3,54 @@
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('newVisitis')">
<div class="card-panel-icon-wrapper icon-people">
- <svg-icon icon-class="peoples" class-name="card-panel-icon" />
+ <svg-icon icon-class="visits" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
- New Visits
+ 出勤天数
</div>
- <count-to :start-val="0" :end-val="102400" :duration="2600" class="card-panel-num" />
+ <count-to :start-val="0" :end-val="userInfo.onDutyDays" :duration="2600" class="card-panel-num" />
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('messages')">
- <div class="card-panel-icon-wrapper icon-message">
- <svg-icon icon-class="message" class-name="card-panel-icon" />
+ <div class="card-panel-icon-wrapper icon-permission">
+ <svg-icon icon-class="people" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
- Messages
+ 剩余年假(小时)
</div>
- <count-to :start-val="0" :end-val="81212" :duration="3000" class="card-panel-num" />
- </div>
- </div>
- </el-col>
- <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
- <div class="card-panel" @click="handleSetLineChartData('purchases')">
- <div class="card-panel-icon-wrapper icon-money">
- <svg-icon icon-class="money" class-name="card-panel-icon" />
- </div>
- <div class="card-panel-description">
- <div class="card-panel-text">
- Purchases
- </div>
- <count-to :start-val="0" :end-val="9280" :duration="3200" class="card-panel-num" />
+ <count-to :start-val="0" :end-val="userInfo.annualLeave" :duration="3000" :decimals="2" class="card-panel-num" />
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('shoppings')">
- <div class="card-panel-icon-wrapper icon-shopping">
- <svg-icon icon-class="shopping" class-name="card-panel-icon" />
+ <div class="card-panel-icon-wrapper icon-message">
+ <svg-icon icon-class="message" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
- Shoppings
+ 剩余补卡次数
</div>
- <count-to :start-val="0" :end-val="13600" :duration="3600" class="card-panel-num" />
+ <count-to :start-val="0" :end-val="userInfo.cardLeft" :duration="3600" class="card-panel-num" />
+ </div>
+ </div>
+ </el-col>
+ <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
+ <div class="card-panel">
+ <div class="card-panel-icon-wrapper icon-timings">
+ <svg-icon icon-class="timing" class-name="card-panel-icon" />
+ </div>
+ <div class="card-panel-description">
+ <div class="card-panel-text">
+ 当前工作时长
+ </div>
+ <count-to :start-val="0" :end-val="userInfo.Times" :decimals="2" :duration="3600" class="card-panel-num" />
+ <span class="card-panel-texts">/</span>
+ <count-to :start-val="0" :end-val="userInfo.Time" :duration="3600" class="card-panel-num" />
</div>
</div>
</el-col>
@@ -61,6 +63,12 @@
export default {
components: {
CountTo
+ },
+ props: {
+ userInfo: {
+ type: Object,
+ required: true
+ }
},
methods: {
handleSetLineChartData(type) {
@@ -102,12 +110,12 @@
background: #36a3f7;
}
- .icon-money {
- background: #f4516c;
+ .icon-permission {
+ background: #34bfa3
}
- .icon-shopping {
- background: #34bfa3
+ .icon-timings{
+ background:#f4516c
}
}
@@ -119,11 +127,7 @@
color: #36a3f7;
}
- .icon-money {
- color: #f4516c;
- }
-
- .icon-shopping {
+ .icon-permission {
color: #34bfa3
}
@@ -153,6 +157,10 @@
margin-bottom: 12px;
}
+ .card-panel-texts{
+ font-size: 20px;
+ }
+
.card-panel-num {
font-size: 20px;
}
@@ -160,7 +168,7 @@
}
}
-@media (max-width:550px) {
+@media (max-width: 550px) {
.card-panel-description {
display: none;
}
diff --git a/eladmin-web-master/src/views/home.vue b/eladmin-web-master/src/views/home.vue
index c2f031b..1562763 100644
--- a/eladmin-web-master/src/views/home.vue
+++ b/eladmin-web-master/src/views/home.vue
@@ -1,41 +1,23 @@
<template>
<div class="dashboard-container">
<div class="dashboard-editor-container">
- <github-corner class="github-corner" />
-
- <panel-group @handleSetLineChartData="handleSetLineChartData" />
-
+ <panel-group :user-info="userInfo" @handleSetLineChartData="handleSetLineChartData" />
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
- <line-chart :chart-data="lineChartData" />
- </el-row>
- <el-row :gutter="32">
- <el-col :xs="24" :sm="24" :lg="8">
- <div class="chart-wrapper">
- <radar-chart />
- </div>
- </el-col>
- <el-col :xs="24" :sm="24" :lg="8">
- <div class="chart-wrapper">
- <pie-chart />
- </div>
- </el-col>
- <el-col :xs="24" :sm="24" :lg="8">
- <div class="chart-wrapper">
- <bar-chart />
- </div>
- </el-col>
+ <FullCalendar ref="fullCalendar" :options="calendarOptions" class="eventDeal-wrap" />
</el-row>
</div>
</div>
</template>
<script>
-import GithubCorner from '@/components/GithubCorner'
+import crudUser from '@/api/system/user'
import PanelGroup from './dashboard/PanelGroup'
-import LineChart from './dashboard/LineChart'
-import RadarChart from '@/components/Echarts/RadarChart'
-import PieChart from '@/components/Echarts/PieChart'
-import BarChart from '@/components/Echarts/BarChart'
+import '@fullcalendar/core/vdom'
+import FullCalendar from '@fullcalendar/vue'
+import dayGridPlugin from '@fullcalendar/daygrid'
+import interactionPlugin from '@fullcalendar/interaction'
+import timeGridPlugin from '@fullcalendar/timegrid'
+import moment from 'moment'
const lineChartData = {
newVisitis: {
@@ -59,21 +41,150 @@
export default {
name: 'Dashboard',
components: {
- GithubCorner,
PanelGroup,
- LineChart,
- RadarChart,
- PieChart,
- BarChart
+ FullCalendar
},
data() {
return {
- lineChartData: lineChartData.newVisitis
+ lineChartData: lineChartData.newVisitis,
+ calendarOptions: {
+ // 引入的插件
+ plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin],
+ // 日历头部按钮位置
+ headerToolbar: {
+ left: '',
+ center: 'title',
+ right: 'prev,today,next'
+ },
+ // 日历头部按钮中文转换
+ buttonText: {
+ today: '今天',
+ month: '月',
+ week: '周',
+ day: '天'
+ },
+ initialView: 'dayGridMonth',
+ locale: 'zh-ch',
+ firstDay: '1',
+ weekNumberCalculation: 'ISO',
+ eventCOlor: '#3d8eec',
+ timeGridEventMinHeight: '20',
+ aspectRatio: '1.5',
+ displayEventTime: false,
+ allDaySlot: false,
+ eventLimit: true,
+ fixedWeekCount: false,
+ eventTimeFormat: {
+ hour: 'numeric',
+ minute: '2-digit',
+ hour12: false
+ },
+ slotLabelFormat: {
+ hour: '2-digit',
+ minute: '2-digit',
+ meridiem: false,
+ hour12: false
+ },
+ businessHours: {
+ dow: [1, 2, 3, 4, 5],
+ start: '9:00',
+ end: '18:00'
+ },
+ events: [],
+ // 事件
+ editable: false,
+ eventStartEditable: false,
+ eventDurationEditable: false,
+ selectable: false,
+ selectMirror: true,
+ selectMinDistance: 0,
+ weekends: true,
+ navLinks: true,
+ selectHelper: false,
+ selectEventOverlap: false,
+ dayMaxEvents: true,
+ dateClick: this.handleDateClick, // 点击日期触发
+ eventsSet: this.handleEvents,
+ eventClick: this.handleEventClick, // 点击日程触发
+ eventDrop: this.handleEventDrop,
+ eventResize: this.eventResize,
+ height: 'auto',
+ customButtons: {
+ prev: {
+ click: () => {
+ this.monthClick('prev')
+ }
+ },
+ today: {
+ text: '今天',
+ click: () => {
+ this.monthClick('')
+ }
+ },
+ next: {
+ click: () => {
+ this.monthClick('next')
+ }
+ }
+ }
+ },
+ userInfo: {}
}
+ },
+ mounted() {
+ this.monthClick('')
+ this.getUserBaseInfo()
},
methods: {
handleSetLineChartData(type) {
this.lineChartData = lineChartData[type]
+ },
+ // 箭头点击事件
+ monthClick(type) {
+ const calendarApi = this.$refs['fullCalendar'].getApi()
+ if (type === 'prev') {
+ calendarApi.prev()
+ } else if (type === 'next') {
+ calendarApi.next()
+ } else {
+ calendarApi.today()
+ }
+ // this.calendarOptions.events = [{title: '上班打卡时间', color: 'red',start: '2023-01-28',date: '2023-01-28'}]
+ this.getUserCalendarInfo(moment(calendarApi.view.currentStart).format('YYYY-MM-DD').toString())
+ },
+ // 获取打卡信息
+ getUserCalendarInfo(month) {
+ crudUser.getUserCalendarInfo(month).then(res => {
+ this.calendarOptions.events = res.map(function(obj) {
+ obj.start = obj.date
+ obj.color = obj.isOk ? 'green' : 'red'
+ obj.date1 = obj.date
+ return obj
+ })
+ }).catch(() => {
+ this.calendarOptions.events = []
+ })
+ },
+ // 日期点击
+ handleDateClick(selectInfo) {
+ console.log('handleDateClick.info:', selectInfo)
+ },
+ // 日程点击信息展示
+ handleEventClick(info) {
+ if (info.event._def.extendedProps.type === 1) {
+ this.$router.push({
+ path: '/attendance/attendance',
+ query: { date: info.event._def.extendedProps.date1 }
+ })
+ } else {
+ this.$router.push({ path: '/task/taskDaliy', query: { date: info.event._def.extendedProps.date1 }})
+ }
+ },
+ // 获取用户信息
+ getUserBaseInfo() {
+ crudUser.getUserBaseInfo().then(res => {
+ this.userInfo = res
+ })
}
}
}
diff --git a/eladmin-web-master/src/views/system/company/index.vue b/eladmin-web-master/src/views/system/company/index.vue
new file mode 100644
index 0000000..c80dfd7
--- /dev/null
+++ b/eladmin-web-master/src/views/system/company/index.vue
@@ -0,0 +1,104 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <div class="head-container">
+ <div v-if="crud.props.searchToggle">
+ <!-- 搜索 -->
+ <el-input v-model="query.label" clearable size="small" placeholder="输入标题搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
+ <rrOperation />
+ </div>
+ <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
+ <crudOperation :permission="permission" />
+ <!--表单组件-->
+ <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
+ <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
+ <el-form-item label="标签" prop="label">
+ <el-input v-model="form.label" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="值" prop="value">
+ <el-input v-model="form.value" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="描述">
+ <el-input v-model="form.description" style="width: 370px;" />
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="text" @click="crud.cancelCU">取消</el-button>
+ <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
+ </div>
+ </el-dialog>
+ <!--表格渲染-->
+ <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
+ <el-table-column type="selection" width="55" />
+ <el-table-column prop="label" label="标签">
+ <template slot-scope="scope">
+ {{ scope.row.label }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="value" label="值">
+ <template slot-scope="scope">
+ {{ scope.row.value }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="description" label="描述" />
+ <el-table-column prop="createTime" label="创建日期" />
+ <el-table-column v-if="checkPer(['admin','systemSetting:edit','systemSetting:del'])" label="操作" width="150px" align="center">
+ <template slot-scope="scope">
+ <udOperation
+ :data="scope.row"
+ :permission="permission"
+ />
+ </template>
+ </el-table-column>
+ </el-table>
+ <!--分页组件-->
+ <pagination />
+ </div>
+ </div>
+</template>
+
+<script>
+import crudSystemSetting from '@/api/system/systemSetting'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import rrOperation from '@crud/RR.operation'
+import crudOperation from '@crud/CRUD.operation'
+import udOperation from '@crud/UD.operation'
+import pagination from '@crud/Pagination'
+
+const defaultForm = { id: null, name: null, description: null, label: null, value: null, createBy: null, updateBy: null, createTime: null, updateTime: null }
+export default {
+ name: 'SystemSetting',
+ components: { pagination, crudOperation, rrOperation, udOperation },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ cruds() {
+ return CRUD({ title: '公司管理', url: 'api/systemSetting', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSystemSetting }})
+ },
+ data() {
+ return {
+ permission: {
+ add: ['admin', 'systemSetting:add'],
+ edit: ['admin', 'systemSetting:edit'],
+ del: ['admin', 'systemSetting:del'],
+ download: ['admin', 'systemSetting:download']
+ },
+ rules: {
+ label: [
+ { required: true, message: '标签不能为空', trigger: 'blur' }
+ ],
+ value: [
+ { required: true, message: '值不能为空', trigger: 'blur' }
+ ]
+ }}
+ },
+ methods: {
+ // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+ [CRUD.HOOK.beforeRefresh]() {
+ return true
+ }
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
--
Gitblit v1.9.3