Browse Source

1.修改考勤设置。

zhengqiang 5 years ago
parent
commit
3328998fd4

+ 8 - 9
common/pom.xml

@@ -137,19 +137,18 @@
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>3.1.0</version>
         </dependency>
+        <!-- aliyun oss end -->
+
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-web</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tomcat.embed</groupId>
-            <artifactId>tomcat-embed-core</artifactId>
-        </dependency>
-        <!-- aliyun oss end -->
 
         <dependency>
             <groupId>javax.servlet</groupId>

+ 3 - 1
common/src/main/java/com/jpsoft/smart/modules/base/dao/PersonDeviceFilterLogDAO.java

@@ -48,7 +48,9 @@ public interface PersonDeviceFilterLogDAO {
 
     long countByTimeRangeAndCompanyCode(String companyCode,Long personId,int status, Date startDate, Date endDate);
 
-    List<PersonInfo> queryUnmeasuredList(String companyCode, Date startTime, Date endTime);
+    List<PersonInfo> queryUnAttendanceList(String companyCode, Date startTime, Date endTime);
 
     long countUndetectedByCompanyCode(String companyCode,Long personId, Date startTime, Date endTime);
+
+    List<PersonInfo> queryAttendanceList(String companyCode, Date startTime, Date endTime);
 }

+ 7 - 2
common/src/main/java/com/jpsoft/smart/modules/base/entity/WarningPusher.java

@@ -87,8 +87,13 @@ public class WarningPusher {
 	/**
 	 *更新时间
 	 */
-    	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "更新时间")
+	@ApiModelProperty(value = "更新时间")
 	private Date updateTime;
+	/**
+	 * 未测温提醒
+	 */
+	@ApiModelProperty(value = "未测温提醒")
+	private Boolean missingNoticeEnabled;
 }

+ 3 - 1
common/src/main/java/com/jpsoft/smart/modules/base/service/PersonDeviceFilterLogService.java

@@ -49,7 +49,9 @@ public interface PersonDeviceFilterLogService {
 
     long countByTimeRangeAndCompanyCode(String companyCode,Long personId,int status,Date startTime, Date endTime);
 
-    List<PersonInfo> queryUnmeasuredList(String companyId, Date startTime, Date endTime);
+    List<PersonInfo> queryUnAttendanceList(String companyId, Date startTime, Date endTime);
 
     long countUndetectedByCompanyCode(String companyCode,Long personId, Date startTime, Date endTime);
+
+    List<PersonInfo> queryAttendanceList(String companyCode, Date toDate, Date toDate1);
 }

+ 7 - 2
common/src/main/java/com/jpsoft/smart/modules/base/service/impl/PersonDeviceFilterLogServiceImpl.java

@@ -199,8 +199,13 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
     }
 
     @Override
-    public List<PersonInfo> queryUnmeasuredList(String companyCode, Date startTime, Date endTime) {
-        return personDeviceFilterLogDAO.queryUnmeasuredList(companyCode,startTime,endTime);
+    public List<PersonInfo> queryUnAttendanceList(String companyCode, Date startTime, Date endTime) {
+        return personDeviceFilterLogDAO.queryUnAttendanceList(companyCode,startTime,endTime);
+    }
+
+    @Override
+    public List<PersonInfo> queryAttendanceList(String companyCode, Date startTime, Date endTime) {
+        return personDeviceFilterLogDAO.queryAttendanceList(companyCode,startTime,endTime);
     }
 
     @Override

+ 72 - 45
common/src/main/java/com/jpsoft/smart/modules/business/entity/WorkAttendance.java

@@ -4,6 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
+
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -11,53 +12,79 @@ import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
 /**
-  描述:business_work_attendance的实体类
+ * 描述:business_work_attendance的实体类
  */
 @Data
 @ApiModel(value = "business_work_attendance的实体类")
 public class WorkAttendance {
-	/**
-	 *主键
-	 */
-        @ApiModelProperty(value = "主键")
-	private String id;
-	/**
-	 *考勤设置编号
-	 */
-        @ApiModelProperty(value = "考勤设置编号")
-	private String alarmConfigId;
-	/**
-	 *0-缺卡,1-正常,2-迟到,3-早退
-	 */
-        @ApiModelProperty(value = "0-缺卡,1-正常,2-迟到,3-早退")
-	private String result;
-	/**
-	 *创建人
-	 */
-        @ApiModelProperty(value = "创建人")
-	private String createBy;
-	/**
-	 *创建时间
-	 */
-    	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "创建时间")
-	private Date createTime;
-	/**
-	 *更新人
-	 */
-        @ApiModelProperty(value = "更新人")
-	private String updateBy;
-	/**
-	 *更新时间
-	 */
-    	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "更新时间")
-	private Date updateTime;
-	/**
-	 *是否删除
-	 */
-        @ApiModelProperty(value = "是否删除")
-	private Boolean delFlag;
+    /**
+     * 缺卡
+     */
+    public static final String MISSING = "0";
+
+    /**
+     * 正常打卡
+     */
+    public static final String SUCCESS = "1";
+
+    /**
+     * 迟到
+     */
+    public static final String LATE = "2";
+
+    /**
+     * 早退
+     */
+    public static final String LEAVE_EARLY = "3";
+
+    /**
+     * 主键
+     */
+    @ApiModelProperty(value = "主键")
+    private String id;
+    /**
+     * 考勤设置编号
+     */
+    @ApiModelProperty(value = "考勤设置编号")
+    private String alarmConfigId;
+    /**
+     * 0-缺卡,1-正常,2-迟到,3-早退
+     */
+    @ApiModelProperty(value = "0-缺卡,1-正常,2-迟到,3-早退")
+    private String result;
+    /**
+     * 创建人
+     */
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 更新人
+     */
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+    /**
+     * 更新时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+    /**
+     * 是否删除
+     */
+    @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag;
+
+    /**
+     * 人员编号
+     */
+    @ApiModelProperty(value = "人员编号")
+    private Long personId;
 }

+ 23 - 11
common/src/main/resources/mapper/base/PersonDeviceFilterLog.xml

@@ -276,17 +276,29 @@
         ]]>
         </if>
     </select>
-    <select id="queryUnmeasuredList" resultMap="com.jpsoft.smart.modules.base.dao.PersonInfoDAO.PersonInfoMap">
-        <![CDATA[
-            select * from base_person_info a,base_company_info b
-            where a.company_id=b.id_ and b.code_ like #{companyCode}
-            and a.del_flag=0
-            and a.id_ not in (
-                select person_id from base_person_device_filter_log
-                where record_time>=#{startTime}
-                and record_time <= #{endTime}
-            )
-        ]]>
+    <select id="queryUnAttendanceList" resultMap="com.jpsoft.smart.modules.base.dao.PersonInfoDAO.PersonInfoMap">
+    <![CDATA[
+        select * from base_person_info a,base_company_info b
+        where a.company_id=b.id_ and b.code_ like #{companyCode}
+        and a.del_flag=0
+        and a.id_ not in (
+            select person_id from base_person_device_filter_log
+            where record_time>=#{startTime}
+            and record_time <= #{endTime}
+        )
+    ]]>
+    </select>
+    <select id="queryAttendanceList" resultMap="com.jpsoft.smart.modules.base.dao.PersonInfoDAO.PersonInfoMap">
+    <![CDATA[
+        select a.* from base_person_info a,base_company_info b,base_person_device_filter_log c
+        where a.company_id=b.id_
+        and b.code_ like #{companyCode}
+        and a.del_flag=0
+        and a.id_ = c.person_id
+        and c.record_time>=#{startTime}
+        and c.record_time<=#{endTime}
+        and c.del_flag=0
+    ]]>
     </select>
     <select id="countUndetectedByCompanyCode" resultType="long">
         <![CDATA[

+ 8 - 4
common/src/main/resources/mapper/base/WarningPusher.xml

@@ -18,6 +18,7 @@
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
+        <result property="missingNoticeEnabled" column="missing_notice_enabled"/>
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.smart.modules.base.entity.WarningPusher">
         <!--
@@ -27,7 +28,8 @@
         -->
         <![CDATA[
 		insert into base_warning_pusher
-	    (id_,company_id,times_,temperature_,name_,phone_,open_id,remark_,del_flag,create_by,create_time,update_by,update_time)
+	    (id_,company_id,times_,temperature_,name_,phone_,open_id,remark_,del_flag,
+	    create_by,create_time,update_by,update_time,missing_notice_enabled)
 		values
 		(
             #{id,jdbcType=VARCHAR}
@@ -43,6 +45,7 @@
             ,#{createTime,jdbcType= TIMESTAMP }
             ,#{updateBy,jdbcType=VARCHAR}
             ,#{updateTime,jdbcType= TIMESTAMP }
+            ,#{missingNoticeEnabled,jdbcType= NUMERIC}
 		)
 	]]>
     </insert>
@@ -88,13 +91,14 @@
             <if test="updateTime!=null">
                 update_time=#{updateTime,jdbcType= TIMESTAMP },
             </if>
+            <if test="missingNoticeEnabled!=null">
+                missing_notice_enabled=#{missingNoticeEnabled,jdbcType= TIMESTAMP },
+            </if>
         </set>
         where id_=#{id}
     </update>
     <select id="get" parameterType="string" resultMap="WarningPusherMap">
-        select
-        id_,company_id,times_,temperature_,name_,phone_,open_id,remark_,del_flag,create_by,create_time,update_by,update_time
-        from base_warning_pusher where id_=#{0}
+        select * from base_warning_pusher where id_=#{0}
         and del_flag = 0
     </select>
     <select id="exist" parameterType="string" resultType="int">

+ 76 - 71
common/src/main/resources/mapper/business/WorkAttendance.xml

@@ -1,31 +1,33 @@
 <?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">
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!-- namespace必须指向DAO接口 -->
 <mapper namespace="com.jpsoft.smart.modules.business.dao.WorkAttendanceDAO">
-	<resultMap id="WorkAttendanceMap" type="com.jpsoft.smart.modules.business.entity.WorkAttendance">
-		<id property="id" column="id_" />
-			<result property="alarmConfigId" column="alarm_config_id" />
-			<result property="result" column="result_" />
-			<result property="createBy" column="create_by" />
-			<result property="createTime" column="create_time" />
-			<result property="updateBy" column="update_by" />
-			<result property="updateTime" column="update_time" />
-			<result property="delFlag" column="del_flag" />
-			</resultMap>
-	<insert id="insert" parameterType="com.jpsoft.smart.modules.business.entity.WorkAttendance">
-	<!--
-	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
-		select sys_guid() from dual
-	</selectKey>
-	-->
-	<![CDATA[
+    <resultMap id="WorkAttendanceMap" type="com.jpsoft.smart.modules.business.entity.WorkAttendance">
+        <id property="id" column="id_"/>
+        <result property="alarmConfigId" column="alarm_config_id"/>
+        <result property="personId" column="person_id"/>
+        <result property="result" column="result_"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="delFlag" column="del_flag"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.smart.modules.business.entity.WorkAttendance">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
 		insert into business_work_attendance
-	    (id_,alarm_config_id,result_,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,alarm_config_id,person_id,result_,create_by,create_time,update_by,update_time,del_flag)
 		values
 		(
 			#{id,jdbcType=VARCHAR}
 			,#{alarmConfigId,jdbcType=VARCHAR}
+			,#{personId,jdbcType=NUMERIC}
 			,#{result,jdbcType=VARCHAR}
 			,#{createBy,jdbcType=VARCHAR}
 			,#{createTime,jdbcType= TIMESTAMP }
@@ -34,57 +36,60 @@
 			,#{delFlag,jdbcType= NUMERIC }
 		)
 	]]>
-	</insert>
-	<delete id="delete" parameterType="string">
-		delete from business_work_attendance where id_=#{id,jdbcType=VARCHAR}
-	</delete>
-	<update id="update" parameterType="com.jpsoft.smart.modules.business.entity.WorkAttendance">
-		update business_work_attendance
-		<set>
-				<if test="alarmConfigId!=null">
-		alarm_config_id=#{alarmConfigId,jdbcType=VARCHAR},
-		</if>
-				<if test="result!=null">
-		result_=#{result,jdbcType=VARCHAR},
-		</if>
-				<if test="createBy!=null">
-		create_by=#{createBy,jdbcType=VARCHAR},
-		</if>
-				<if test="createTime!=null">
-		create_time=#{createTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="updateBy!=null">
-		update_by=#{updateBy,jdbcType=VARCHAR},
-		</if>
-				<if test="updateTime!=null">
-		update_time=#{updateTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="delFlag!=null">
-		del_flag=#{delFlag,jdbcType= NUMERIC },
-		</if>
-		</set>
-	where id_=#{id}
-	</update>
-	<select id="get" parameterType="string" resultMap="WorkAttendanceMap">
-		select * from business_work_attendance where id_=#{0}
-	</select>
-	<select id="exist" parameterType="string" resultType="int">
-		select count(*) from business_work_attendance where id_=#{0}
-	</select>
-	<select id="list" resultMap="WorkAttendanceMap">
-		select * from business_work_attendance
-	</select>
-	<select id="search" parameterType="hashmap" resultMap="WorkAttendanceMap">
-		<![CDATA[
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from business_work_attendance where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.smart.modules.business.entity.WorkAttendance">
+        update business_work_attendance
+        <set>
+            <if test="alarmConfigId!=null">
+                alarm_config_id=#{alarmConfigId,jdbcType=VARCHAR},
+            </if>
+            <if test="personId!=null">
+                person_id=#{personId,jdbcType=NUMERIC},
+            </if>
+            <if test="result!=null">
+                result_=#{result,jdbcType=VARCHAR},
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="WorkAttendanceMap">
+        select * from business_work_attendance where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from business_work_attendance where id_=#{0}
+    </select>
+    <select id="list" resultMap="WorkAttendanceMap">
+        select * from business_work_attendance
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="WorkAttendanceMap">
+        <![CDATA[
 			select * from business_work_attendance
 		]]>
-		<where>
-			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
-			</if>
-		</where>
-		<foreach item="sort" collection="sortList"  open="order by" separator=",">
-	        ${sort.name} ${sort.order}
-	 	</foreach>
-	</select>
+        <where>
+            <if test="searchParams.id != null">
+                and ID_ like #{searchParams.id}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
 </mapper>

+ 0 - 4
lapi/pom.xml

@@ -32,10 +32,6 @@
             <artifactId>spring-tx</artifactId>
             <scope>compile</scope>
         </dependency>
-
-
-
-
         <dependency>
             <groupId>com.jpsoft.smart</groupId>
             <artifactId>common</artifactId>

+ 5 - 2
lapi/src/main/resources/application-dev.yml

@@ -13,8 +13,11 @@ spring:
 
 logger:
   level: WARN
-  dir: E:\mye\WORK\wisdowHouse
-
+  dir: E:/mye/WORK/wisdowHouse
+  level1: ERROR
+  dir1: ${logger.dir}/error
+  level2: WARN
+  dir2: ${logger.dir}/personDevice
 wx:
   pay:
     appId: wx0b3c41a903053808

+ 8 - 3
lapi/src/main/resources/logback-spring.xml

@@ -50,10 +50,15 @@
         </rollingPolicy>
     </appender>
 
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>${pattern}</pattern>
+        </encoder>
+    </appender>
+
     <springProfile name="dev">
-        <root level="WARN">
-            <appender-ref ref="fileInfoLog"/>
-            <appender-ref ref="fileErrorLog"/>
+        <root level="INFO">
+            <appender-ref ref="STDOUT"/>
         </root>
 
     </springProfile>

+ 2 - 0
web/src/main/java/com/jpsoft/smart/SmartCommunityServerApplication.java

@@ -6,12 +6,14 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 @SpringBootApplication
 @EnableTransactionManagement
 @EnableScheduling
+@EnableAsync
 @MapperScan("com.jpsoft.smart.**.dao")
 public class SmartCommunityServerApplication extends SpringBootServletInitializer {
 

+ 1 - 2
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/PersonDeviceFilterLogController.java

@@ -13,7 +13,6 @@ import com.jpsoft.smart.modules.common.utils.PojoUtils;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
 import org.joda.time.DateTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -187,7 +186,7 @@ public class PersonDeviceFilterLogController {
                 DateTime startTime = new DateTime(sdf.parse(dateStr + " " + alarmConfig.getStartTime()));
                 DateTime endTime = new DateTime(sdf.parse(dateStr + " " + alarmConfig.getEndTime()));
 
-                List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(personInfo.getCompanyId(),startTime.toDate(),endTime.toDate());
+                List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnAttendanceList(personInfo.getCompanyId(),startTime.toDate(),endTime.toDate());
 
                 map.put("startTime",alarmConfig.getStartTime());
                 map.put("endTime",alarmConfig.getEndTime());

+ 122 - 12
web/src/main/java/com/jpsoft/smart/schduled/UnmeasureTemperatureAlarmTask.java

@@ -6,18 +6,22 @@ import com.jpsoft.smart.modules.base.service.AlarmConfigService;
 import com.jpsoft.smart.modules.base.service.CompanyInfoService;
 import com.jpsoft.smart.modules.base.service.PersonDeviceFilterLogService;
 import com.jpsoft.smart.modules.base.service.WarningPusherService;
+import com.jpsoft.smart.modules.business.entity.WorkAttendance;
+import com.jpsoft.smart.modules.business.service.WorkAttendanceService;
 import com.jpsoft.smart.modules.common.utils.WechatMessageUtil;
-import com.jpsoft.smart.modules.common.utils.WeixinUtil;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.joda.time.DateTime;
-import org.joda.time.Minutes;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 
 @Component
 @Slf4j
@@ -34,6 +38,9 @@ public class UnmeasureTemperatureAlarmTask {
     @Autowired
     private CompanyInfoService companyInfoService;
 
+    @Autowired
+    private WorkAttendanceService workAttendanceService;
+
     @Autowired
     private WxConfig wxConfig;
 
@@ -62,20 +69,49 @@ public class UnmeasureTemperatureAlarmTask {
             try {
                 String weekdays = alarmConfig.getWeekdays();
                 DateTime startTime = new DateTime(sdf.parse(date + " " + alarmConfig.getStartTime()));
-                DateTime endTime = new DateTime(sdf.parse(date + " " + alarmConfig.getAttendanceTime()));
+                DateTime attendanceTime = new DateTime(sdf.parse(date + " " + alarmConfig.getAttendanceTime()));
+                DateTime endTime = new DateTime(sdf.parse(date + " " + alarmConfig.getEndTime()));
 
-                DateTime alarmTime = endTime.plusMinutes(-10);
+                DateTime alarmTime = attendanceTime.plusMinutes(-10);
 
                 //开始时间
                 if (weekdays.indexOf(String.valueOf(weekday)) != -1) {
+                    //todo 考勤时间提前10分钟通知人员
                     if (now.compareTo(alarmTime)>=0 && now.compareTo(alarmTime.plusMinutes(intervalMinute))<0) {
                             //todo 通知个人
-                            noticePerson(alarmConfig,startTime,endTime);
+                            noticePerson(alarmConfig,startTime,attendanceTime);
                     }
 
+                    //todo 考勤时间已到
+                    if (now.compareTo(attendanceTime)>=0 && now.compareTo(attendanceTime.plusMinutes(intervalMinute))<0) {
+                        //todo  未测量人通知管理人员
+                        noticeManager(alarmConfig,startTime,attendanceTime);
+
+                        //todo 记录考勤
+                        if (alarmConfig.getClassifier().equals(1)) {
+                            //上班时间前打卡算正常上班
+                            recordAttendance(alarmConfig, startTime.toDate(), attendanceTime.toDate(), WorkAttendance.SUCCESS);
+                        }
+                        else{
+                            //下班时间前打卡算早退
+                            recordAttendance(alarmConfig, startTime.toDate(), attendanceTime.toDate(), WorkAttendance.LEAVE_EARLY);
+                        }
+                    }
+
+                    //todo 截止时间已到
                     if (now.compareTo(endTime)>=0 && now.compareTo(endTime.plusMinutes(intervalMinute))<0) {
-                        //todo 通知管理人员
-                        noticeManager(alarmConfig,startTime,endTime);
+                        //todo 记录考勤
+                        if (alarmConfig.getClassifier().equals(1)) {
+                            //上班时间后截止时间前打卡算迟到
+                            recordAttendance(alarmConfig, attendanceTime.toDate(), endTime.toDate(),WorkAttendance.LATE);
+                        }
+                        else{
+                            //下班时间后截止时间前打卡算正常下班
+                            recordAttendance(alarmConfig, attendanceTime.toDate(), endTime.toDate(),WorkAttendance.SUCCESS);
+                        }
+
+                        //未到开始截止时间内打开算旷工
+                        recordUnAttendance(alarmConfig,startTime.toDate(),endTime.toDate(),WorkAttendance.MISSING);
                     }
                 }
             }
@@ -85,7 +121,68 @@ public class UnmeasureTemperatureAlarmTask {
         }
     }
 
-    private void noticePerson(AlarmConfig alarmConfig, DateTime startTime, DateTime endTime) {
+    /**
+     * 记录未考勤人员
+     * @param alarmConfig
+     * @param startDate
+     * @param endDate
+     * @param result
+     */
+    private void recordUnAttendance(AlarmConfig alarmConfig, Date startDate, Date endDate, String result) {
+        CompanyInfo companyInfo = companyInfoService.get(alarmConfig.getCompanyId());
+
+        String companyCode = companyInfo.getCode();
+
+        if (alarmConfig.getSubordinate()!=null && alarmConfig.getSubordinate()){
+            companyCode += "%";
+        }
+
+        //todo 查询该单位当前时间段未考勤人员列表
+        List<PersonInfo> attendanceList = personDeviceFilterLogService.queryUnAttendanceList(companyCode,startDate,endDate);
+
+        for (PersonInfo personInfo: attendanceList) {
+            WorkAttendance workAttendance = new WorkAttendance();
+            workAttendance.setId(UUID.randomUUID().toString());
+            workAttendance.setPersonId(personInfo.getId());
+            workAttendance.setAlarmConfigId(alarmConfig.getId());
+            workAttendance.setCreateTime(new Date());
+            workAttendance.setResult(result);
+
+            workAttendanceService.insert(workAttendance);
+        }
+    }
+
+    /**
+     * 记录考勤
+     * @param alarmConfig
+     */
+    @Async
+    public void recordAttendance(AlarmConfig alarmConfig,Date startDate,Date endDate,String result) {
+        CompanyInfo companyInfo = companyInfoService.get(alarmConfig.getCompanyId());
+
+        String companyCode = companyInfo.getCode();
+
+        if (alarmConfig.getSubordinate()!=null && alarmConfig.getSubordinate()){
+            companyCode += "%";
+        }
+
+        //todo 查询该单位当前时间段考勤人员列表
+        List<PersonInfo> unAttendanceList = personDeviceFilterLogService.queryAttendanceList(companyCode,startDate,endDate);
+
+        for (PersonInfo personInfo: unAttendanceList) {
+            WorkAttendance workAttendance = new WorkAttendance();
+            workAttendance.setId(UUID.randomUUID().toString());
+            workAttendance.setPersonId(personInfo.getId());
+            workAttendance.setAlarmConfigId(alarmConfig.getId());
+            workAttendance.setCreateTime(new Date());
+            workAttendance.setResult(result);
+
+            workAttendanceService.insert(workAttendance);
+        }
+    }
+
+    @Async
+    public void noticePerson(AlarmConfig alarmConfig, DateTime startTime, DateTime endTime) {
         CompanyInfo companyInfo = companyInfoService.get(alarmConfig.getCompanyId());
 
         String companyCode = companyInfo.getCode();
@@ -95,7 +192,7 @@ public class UnmeasureTemperatureAlarmTask {
         }
 
         //todo 查询该单位当前时间段是否有人员未测体温
-        List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyCode,startTime.toDate(),endTime.toDate());
+        List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnAttendanceList(companyCode,startTime.toDate(),endTime.toDate());
 
         if (unmeasuredList.size()==0){
             return;
@@ -114,7 +211,8 @@ public class UnmeasureTemperatureAlarmTask {
         }
     }
 
-    private void noticeManager(AlarmConfig alarmConfig, DateTime startTime, DateTime endTime) {
+    @Async
+    public void noticeManager(AlarmConfig alarmConfig, DateTime startTime, DateTime endTime) {
         CompanyInfo companyInfo = companyInfoService.get(alarmConfig.getCompanyId());
 
         String companyCode = companyInfo.getCode();
@@ -124,7 +222,7 @@ public class UnmeasureTemperatureAlarmTask {
         }
 
         //todo 查询该单位当前时间段是否有人员未测体温
-        List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyCode,startTime.toDate(),endTime.toDate());
+        List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnAttendanceList(companyCode,startTime.toDate(),endTime.toDate());
 
         if (unmeasuredList.size()==0){
             return;
@@ -149,7 +247,8 @@ public class UnmeasureTemperatureAlarmTask {
 
         //todo 给单位相关人员推送通知
         for (WarningPusher pusher: pusherList) {
-            if (StringUtils.isNotEmpty(pusher.getOpenId())) {
+            if (StringUtils.isNotEmpty(pusher.getOpenId())
+            && pusher.getMissingNoticeEnabled()!=null && pusher.getMissingNoticeEnabled()) {
                 String message = "尊敬的用户:" + pusher.getName()
                         + ",当天时段" + startTime.toString("HH:mm") + "至" + endTime.toString("HH:mm")
                         + ",有" + total + "人未测量体温。名单如下:" + sb.toString();
@@ -161,4 +260,15 @@ public class UnmeasureTemperatureAlarmTask {
             }
         }
     }
+
+    public static void main(String[] args) {
+        Boolean result = null;
+
+        if (result){
+            System.out.println("yes");
+        }
+        else{
+            System.out.println("no");
+        }
+    }
 }