Ver Fonte

考勤设置中增加测温开关。

tomatozq há 5 anos atrás
pai
commit
cf92098c51

+ 2 - 0
common/src/main/java/com/jpsoft/smart/modules/base/dao/PersonDeviceFilterLogDAO.java

@@ -57,4 +57,6 @@ public interface PersonDeviceFilterLogDAO {
     Integer getDayNormalNumByCompanyId( @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("companyId") String companyId,float temperatureMax);
 
     Integer countDayByPersonIdAndDate(Long personId, Date startDate, Date endDate);
+
+    Integer countDetectedByCompanyId(String companyId, Date startDate, Date endDate);
 }

+ 15 - 0
common/src/main/java/com/jpsoft/smart/modules/base/entity/AlarmConfig.java

@@ -93,4 +93,19 @@ public class AlarmConfig {
      */
     @ApiModelProperty(value = "1-上班时间,2-下班时间")
     private Integer classifier;
+
+    /**
+     * 是否需要测温
+     */
+    @ApiModelProperty(value = "是否需要测温")
+    private Boolean needMeasureTemperature;
+
+    public Boolean getNeedMeasureTemperature(){
+        if (this.needMeasureTemperature!=null){
+            return this.needMeasureTemperature;
+        }
+        else{
+            return false;
+        }
+    }
 }

+ 2 - 0
common/src/main/java/com/jpsoft/smart/modules/base/service/PersonDeviceFilterLogService.java

@@ -69,4 +69,6 @@ public interface PersonDeviceFilterLogService {
     Integer getDayNormalNumByCompanyId(Date startTime,Date endTime, String companyId);
 
     Integer countDayByPersonIdAndDate(Long personId, Date startDate, Date endDate);
+
+    Integer countDetectedByCompanyId(String companyId, Date startDate, Date endDate);
 }

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

@@ -264,4 +264,9 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
     public Integer countDayByPersonIdAndDate(Long personId, Date startDate, Date endDate) {
         return personDeviceFilterLogDAO.countDayByPersonIdAndDate(personId,startDate,endDate);
     }
+
+    @Override
+    public Integer countDetectedByCompanyId(String companyId, Date startDate, Date endDate) {
+        return personDeviceFilterLogDAO.countDetectedByCompanyId(companyId,startDate,endDate);
+    }
 }

+ 7 - 2
common/src/main/resources/mapper/base/AlarmConfig.xml

@@ -18,6 +18,7 @@
         <result property="subordinate" column="subordinate_"/>
         <result property="attendanceTime" column="attendance_time"/>
         <result property="classifier" column="classifier_"/>
+        <result property="needMeasureTemperature" column="need_measure_temperature"/>
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.smart.modules.base.entity.AlarmConfig">
         <!--
@@ -28,7 +29,7 @@
         <![CDATA[
 		insert into base_alarm_config
 	    (id_,company_id,weekdays_,start_time,end_time,del_flag,create_by,create_time,
-	    update_by,update_time,subordinate_,attendance_time,classifier_)
+	    update_by,update_time,subordinate_,attendance_time,classifier_,need_measure_temperature)
 		values
 		(
             #{id,jdbcType=VARCHAR}
@@ -43,7 +44,8 @@
             ,#{updateTime,jdbcType= TIMESTAMP }
             ,#{subordinate,jdbcType= NUMERIC }
             ,#{attendanceTime,jdbcType= VARCHAR }
-            ,#{classifier,jdbcType= NUMERIC }
+            ,#{classifier,jdbcType= NUMERIC}
+            ,#{needMeasureTemperature,jdbcType= NUMERIC}}
 		)
 	]]>
     </insert>
@@ -92,6 +94,9 @@
             <if test="classifier!=null">
                 classifier_=#{classifier,jdbcType= NUMERIC },
             </if>
+            <if test="needMeasureTemperature!=null">
+                need_measure_temperature=#{needMeasureTemperature,jdbcType= NUMERIC },
+            </if>
         </set>
         where id_=#{id}
     </update>

+ 10 - 1
common/src/main/resources/mapper/base/PersonDeviceFilterLog.xml

@@ -331,7 +331,16 @@
             and a.record_time>=#{startDate}
             and a.record_time<#{endDate}
             and a.del_flag=0
-            order by record_time asc
+        ]]>
+    </select>
+    <select id="countDetectedByCompanyId" resultType="int">
+        <![CDATA[
+            select count(distinct(a.person_id)) from base_person_device_filter_log a
+            left join base_person_info b on a.person_id = b.id_
+            where b.company_id=#{companyId}
+            and a.record_time>=#{startDate}
+            and a.record_time<#{endDate}
+            and a.del_flag=0
         ]]>
     </select>
 </mapper>

+ 1 - 2
common/src/main/resources/mapper/base/PersonDeviceLog.xml

@@ -109,7 +109,7 @@
 			on a.person_id = c.id_
 		]]>
         <where>
-            and a.del_flag = false and b.del_flag=false
+            and a.del_flag = false
             <if test="searchParams.deviceIdList != null">
                 and b.id_ in
                 <foreach item="item" collection="searchParams.deviceIdList"  open="(" separator="," close=")">
@@ -154,7 +154,6 @@
             <if test="searchParams.matchMsg != null">
                 and a.match_msg like #{searchParams.matchMsg}
             </if>
-
         </where>
         <foreach item="sort" collection="sortList"  open="order by" separator=",">
             ${sort.name} ${sort.order}

+ 12 - 8
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/PersonDeviceLogApiController.java

@@ -219,17 +219,15 @@ public class PersonDeviceLogApiController {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
-            PersonInfo admin = personInfoService.get(Long.valueOf(subject));
-
             Map<String, Object> personSearchParam = new HashMap<>();
 
-            if (StringUtils.isNotEmpty(companyId) && companyInfoService.exist(companyId)) {
-                personSearchParam.put("companyId", companyId);
-            }
-            else{
-                personSearchParam.put("companyId", admin.getCompanyId());
+            if (StringUtils.isEmpty(companyId)) {
+                PersonInfo admin = personInfoService.get(Long.valueOf(subject));
+                companyId = admin.getCompanyId();
             }
 
+            personSearchParam.put("companyId", companyId);
+
             if (StringUtils.isNotEmpty(filter) && "1".equals(filter)){
                 personSearchParam.put("abnormalDate",queryDate);
                 personSearchParam.put("temperature",temperatureConfig.getMax());
@@ -289,8 +287,14 @@ public class PersonDeviceLogApiController {
             recordPageList.setPageNum(personPageList.getPageNum());
             recordPageList.setPageSize(personPageList.getPageSize());
 
+            Map<String,Object> dataMap = PojoUtils.pageWrapper(recordPageList);
+
+            //增加当天打卡人数统计
+            Integer detectedNum = personDeviceFilterLogService.countDetectedByCompanyId(companyId,startTime.toDate(),startTime.plusDays(1).toDate());
+            dataMap.put("detectedNum",detectedNum);
+
             messageResult.setResult(true);
-            messageResult.setData(PojoUtils.pageWrapper(recordPageList));
+            messageResult.setData(dataMap);
         }
         catch (Exception ex){
             messageResult.setResult(false);

+ 10 - 4
web/src/main/java/com/jpsoft/smart/schduled/UnmeasureTemperatureAlarmTask.java

@@ -175,7 +175,9 @@ public class UnmeasureTemperatureAlarmTask {
                 if (weekdays.indexOf(String.valueOf(weekday)) != -1) {
                     if (now.compareTo(alarmTime)>=0 && now.compareTo(alarmTime.plusMinutes(intervalMinute))<0) {
                         //todo 通知个人
-                        noticePerson(alarmConfig,startTime,attendanceTime,endTime);
+                        if(alarmConfig.getNeedMeasureTemperature()){
+                            noticePerson(alarmConfig,startTime,attendanceTime,endTime);
+                        }
                     }
 
                     //todo 考勤时间已到
@@ -183,7 +185,9 @@ public class UnmeasureTemperatureAlarmTask {
                         //todo  未测量人通知管理人员
                         if(alarmConfig.getClassifier().equals(1)){
                             //上班
-                            noticeManager(alarmConfig,startTime,attendanceTime);
+                            if(alarmConfig.getNeedMeasureTemperature()) {
+                                noticeManager(alarmConfig, startTime, attendanceTime);
+                            }
                         }
 
                         //todo 记录考勤
@@ -201,7 +205,9 @@ public class UnmeasureTemperatureAlarmTask {
                     if (now.compareTo(endTime)>=0 && now.compareTo(endTime.plusMinutes(intervalMinute))<0) {
                         if(alarmConfig.getClassifier().equals(2)){
                             //下班
-                            noticeManager(alarmConfig,attendanceTime,endTime);
+                            if(alarmConfig.getNeedMeasureTemperature()) {
+                                noticeManager(alarmConfig, attendanceTime, endTime);
+                            }
                         }
 
                         //todo 记录考勤
@@ -214,7 +220,7 @@ public class UnmeasureTemperatureAlarmTask {
                             recordAttendance(alarmConfig, attendanceTime.toDate(), endTime.toDate(),WorkAttendance.SUCCESS);
                         }
 
-                        //未到开始截止时间内打开算旷工
+                        //未在开始截止时间内打卡算旷工
                         recordUnAttendance(alarmConfig,startTime.toDate(),attendanceTime.toDate(),endTime.toDate(),WorkAttendance.MISSING);
                     }
                 }