Ver Fonte

海康威视平台对接,打卡人员

LIVE_YE há 10 meses atrás
pai
commit
b53b1a022c

+ 98 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -4,12 +4,19 @@ import java.lang.management.ManagementFactory;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.*;
+import java.time.temporal.TemporalAdjusters;
+import java.time.*;
 import java.time.temporal.TemporalAdjuster;
 import java.time.temporal.TemporalAdjusters;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 /**
@@ -189,6 +196,97 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
         return Date.from(zdt.toInstant());
     }
+
+    /**
+     * 获取当前周一
+     *
+     * @return
+     */
+    public static String monday()
+    {
+        LocalDate now = LocalDate.now();
+        LocalDate startOfWeek = now.with(DayOfWeek.MONDAY);
+        return String.valueOf(startOfWeek);
+    }
+
+    /**
+     * 获取上周一
+     *
+     * @return
+     */
+    public static String lastMonday()
+    {
+        LocalDate now = LocalDate.now();
+        LocalDate lastMonday = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).minusWeeks(1);
+        return String.valueOf(lastMonday);
+    }
+
+    /**
+     * 获取上周日
+     *
+     * @return
+     */
+    public static String lastSunday()
+    {
+        LocalDate now = LocalDate.now();
+        LocalDate lastMonday = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).minusWeeks(1);
+        LocalDate lastSunday = lastMonday.with(TemporalAdjusters.next(DayOfWeek.SUNDAY));
+        return String.valueOf(lastSunday);
+    }
+
+
+    /**
+     * 获取上周一到周日的时间
+     *
+     * @return
+     */
+    public static List<String> LastWeekList()
+    {
+        // 获取当前日期
+        LocalDate today = LocalDate.now();
+
+        // 获取上周的每一天
+        List<String> collect = IntStream.range(1, 8)
+                .mapToObj(day -> String.valueOf(today.with(TemporalAdjusters.previous(DayOfWeek.MONDAY)).minusWeeks(1).plusDays(day - 1))).collect(Collectors.toList());
+        return collect;
+
+    }
+
+    /**
+     * 获取本周一到周日的时间
+     *
+     * @return
+     */
+    public static List<String> weekList()
+    {
+        // 获取当前日期
+        LocalDate today = LocalDate.now();
+
+        // 获取上周的每一天
+        List<String> collect = IntStream.range(1, 8)
+                .mapToObj(day -> String.valueOf(today.with(TemporalAdjusters.previous(DayOfWeek.MONDAY)).plusDays(day - 1))).collect(Collectors.toList());
+        return collect;
+
+    }
+
+
+
+
+    public static void main(String[] args) {
+        String monday = monday();
+        String lastMonday = lastMonday();
+        List<String> collect = weekList();
+        System.out.println("当前周一:"+monday);
+        System.out.println("上周一:"+lastMonday);
+        System.out.println("上周日:"+collect);
+        // 获取当前日期
+        LocalDate today = LocalDate.now();
+
+        // 获取上周的每一天
+        IntStream.range(1, 8)
+                .mapToObj(day -> today.with(TemporalAdjusters.previous(DayOfWeek.MONDAY)).minusWeeks(1).plusDays(day - 1))
+                .forEach(System.out::println);
+    }
     /**
      * 增加 Date  ==> LocalDate
      */

+ 19 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/BomanReservat.java

@@ -98,6 +98,9 @@ public class BomanReservat extends BaseEntity
     @Excel(name = "创建部门")
     private Long createDept;
 
+    private String startTime;
+    private String endTime;
+
     public void setReservatId(Long reservatId) 
     {
         this.reservatId = reservatId;
@@ -279,6 +282,22 @@ public class BomanReservat extends BaseEntity
         this.appointmentSite = appointmentSite;
     }
 
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/BomanReservatMapper.java

@@ -58,4 +58,6 @@ public interface BomanReservatMapper
      * @return 结果
      */
     public int deleteBomanReservatByReservatIds(Long[] reservatIds);
+
+    List<BomanReservat> selectBomanReservatTimeList(BomanReservat bomanReservat);
 }

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IBomanReservatService.java

@@ -62,4 +62,7 @@ public interface IBomanReservatService
     public int deleteBomanReservatByReservatId(Long reservatId);
 
     AjaxResult examine(BomanReservat bomanReservat);
+
+    AjaxResult weekAppointment();
+
 }

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IClockUserInfoService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.ClockUserInfo;
+
+/**
+ * 打卡人员信息Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-06
+ */
+public interface IClockUserInfoService 
+{
+    /**
+     * 查询打卡人员信息
+     * 
+     * @param userId 打卡人员信息主键
+     * @return 打卡人员信息
+     */
+    public ClockUserInfo selectClockUserInfoByUserId(Long userId);
+
+    /**
+     * 查询打卡人员信息列表
+     * 
+     * @param clockUserInfo 打卡人员信息
+     * @return 打卡人员信息集合
+     */
+    public List<ClockUserInfo> selectClockUserInfoList(ClockUserInfo clockUserInfo);
+
+    /**
+     * 新增打卡人员信息
+     * 
+     * @param clockUserInfo 打卡人员信息
+     * @return 结果
+     */
+    public int insertClockUserInfo(ClockUserInfo clockUserInfo);
+
+    /**
+     * 修改打卡人员信息
+     * 
+     * @param clockUserInfo 打卡人员信息
+     * @return 结果
+     */
+    public int updateClockUserInfo(ClockUserInfo clockUserInfo);
+
+    /**
+     * 批量删除打卡人员信息
+     * 
+     * @param userIds 需要删除的打卡人员信息主键集合
+     * @return 结果
+     */
+    public int deleteClockUserInfoByUserIds(Long[] userIds);
+
+    /**
+     * 删除打卡人员信息信息
+     * 
+     * @param userId 打卡人员信息主键
+     * @return 结果
+     */
+    public int deleteClockUserInfoByUserId(Long userId);
+}

+ 40 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatServiceImpl.java

@@ -103,4 +103,44 @@ public class BomanReservatServiceImpl implements IBomanReservatService
         int i = bomanReservatMapper.updateBomanReservat(bomanReservat);
         return i > 0 ? AjaxResult.success() : AjaxResult.error();
     }
+
+    /***
+     * pc首页统计每周预约
+     * @return
+     */
+    @Override
+    public AjaxResult weekAppointment() {
+        //获取上周一
+        String lastMonday = DateUtils.lastMonday();
+        //获取上周日
+        String lastSunday = DateUtils.lastSunday();
+        //获取本周周一
+        String monday = DateUtils.monday();
+        //获取当前日期
+        String day = DateUtils.getDate();
+
+        //获取上周预约人数
+        int syy = 0;
+        BomanReservat bomanReservat1 = new BomanReservat();
+        bomanReservat1.setStartTime(lastMonday);
+        bomanReservat1.setEndTime(lastSunday);
+        List<BomanReservat> lastList = bomanReservatMapper.selectBomanReservatTimeList(bomanReservat1);
+        //上周访客人数
+        int fk = 0;
+        if(lastList!=null && lastList.size()>0){
+            syy = lastList.size();
+        }
+
+        //获取本周预约人数
+        BomanReservat bomanReservat2 = new BomanReservat();
+        bomanReservat2.setStartTime(monday);
+        bomanReservat2.setEndTime(day);
+        List<BomanReservat> list = bomanReservatMapper.selectBomanReservatTimeList(bomanReservat2);
+
+        //
+
+
+        return null;
+    }
+
 }

+ 0 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderFoodServiceImpl.java

@@ -6,7 +6,6 @@ import java.util.stream.Collectors;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
-import jdk.internal.org.objectweb.asm.Handle;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.OrderFoodMapper;

+ 13 - 1
ruoyi-system/src/main/resources/mapper/system/BomanReservatMapper.xml

@@ -66,7 +66,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectBomanReservatVo"/>
         where reservat_id = #{reservatId}
     </select>
-        
+
+    <select id="selectBomanReservatTimeList" parameterType="BomanReservat" resultMap="BomanReservatResult">
+        <include refid="selectBomanReservatVo"/>
+        <where>
+            <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
+                AND visit_date &gt;= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
+                AND visit_date &lt;= #{endTime}
+            </if>
+        </where>
+    </select>
+
     <insert id="insertBomanReservat" parameterType="BomanReservat" useGeneratedKeys="true" keyProperty="reservatId">
         insert into boman_reservat
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/ConferenceRoomOrderMapper.xml

@@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectConferenceRoomOrderVo"/>
         <where>
             <if test="conferenceRoomId != null "> and conference_room_id = #{conferenceRoomId}</if>
-            <if test="startTime != null "> and startTime &lt; #{endTime}</if>
+            <if test="startTime != null "> and start_time &lt; #{endTime}</if>
         </where>
     </select>