Ver Fonte

健康公示先改为显示最后一个实时测温记录。

zhengqiang há 5 anos atrás
pai
commit
272c9ab994

+ 3 - 0
common/src/main/java/com/jpsoft/smart/modules/base/dao/PersonDeviceLogDAO.java

@@ -1,5 +1,6 @@
 package com.jpsoft.smart.modules.base.dao;
 
+import com.jpsoft.smart.modules.base.entity.PersonDeviceFilterLog;
 import com.jpsoft.smart.modules.base.entity.PersonDeviceLog;
 import com.jpsoft.smart.modules.base.entity.PersonInfo;
 import com.jpsoft.smart.modules.common.dto.Sort;
@@ -30,4 +31,6 @@ public interface PersonDeviceLogDAO {
 
     List<PersonInfo> queryUnAttendanceList(String companyCode, Date startTime, Date endTime);
     List<PersonInfo> queryAttendanceList(String companyCode, Date startTime, Date endTime);
+
+    PersonDeviceLog findLastPersonLog(Long personId, float temperatureMax);
 }

+ 3 - 5
common/src/main/java/com/jpsoft/smart/modules/base/service/PersonDeviceLogService.java

@@ -27,14 +27,12 @@ public interface PersonDeviceLogService {
      * @param libMatInfoListJson
      * @param matchPersonInfo
      */
-    void deviceInsertLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date) ;
-
+    void deviceInsertLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date);
     Page<PersonDeviceLog> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize,boolean count, List<Sort> sortList);
     List<PersonDeviceLog> findByPersonAndDate(Long personId,Date startDate,Date endDate);
     Page<PersonDeviceLog> simplePageSearch(Map<String, Object> searchParams, int pageNum, int pageSize,boolean count, List<Sort> sortList);
     PersonDeviceLog get(String id);
-
-
     List<PersonInfo> queryUnAttendanceList(String companyCode, Date startTime, Date endTime);
-    List<PersonInfo> queryAttendanceList(String companyCode, Date toDate, Date toDate1);
+    List<PersonInfo> queryAttendanceList(String companyCode, Date startDate, Date endDate);
+    PersonDeviceLog findLastPersonLog(Long personId, float temperatureMax);
 }

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

@@ -209,4 +209,9 @@ public class PersonDeviceLogServiceImpl implements PersonDeviceLogService {
     public List<PersonInfo> queryAttendanceList(String companyCode, Date startTime, Date endTime) {
         return personDeviceLogDAO.queryAttendanceList(companyCode, startTime, endTime);
     }
+
+    @Override
+    public PersonDeviceLog findLastPersonLog(Long personId, float temperatureMax) {
+        return personDeviceLogDAO.findLastPersonLog(personId,temperatureMax);
+    }
 }

+ 1 - 0
common/src/main/resources/mapper/base/AlarmConfig.xml

@@ -131,6 +131,7 @@
     <![CDATA[
         select * from base_alarm_config
         where company_id=#{companyId} and del_flag=0
+        order by start_time asc
     ]]>
     </select>
 </mapper>

+ 8 - 0
common/src/main/resources/mapper/base/PersonDeviceLog.xml

@@ -191,4 +191,12 @@
         )
         ]]>
     </select>
+    <select id="findLastPersonLog" resultMap="PersonDeviceLogMap">
+        <![CDATA[
+            select * from base_person_device_log
+            where person_id=#{personId} and temperature_<=#{temperatureMax} and del_flag=0
+            order by record_time desc
+            limit 1
+        ]]>
+    </select>
 </mapper>

+ 8 - 6
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/IndividualLogApiController.java

@@ -2,10 +2,7 @@ package com.jpsoft.smart.modules.mobile.controller;
 
 import com.github.pagehelper.Page;
 import com.jpsoft.smart.config.TemperatureConfig;
-import com.jpsoft.smart.modules.base.entity.AlarmConfig;
-import com.jpsoft.smart.modules.base.entity.CompanyInfo;
-import com.jpsoft.smart.modules.base.entity.PersonDeviceFilterLog;
-import com.jpsoft.smart.modules.base.entity.PersonInfo;
+import com.jpsoft.smart.modules.base.entity.*;
 import com.jpsoft.smart.modules.base.service.*;
 import com.jpsoft.smart.modules.business.service.WorkAttendanceService;
 import com.jpsoft.smart.modules.common.dto.MessageResult;
@@ -31,6 +28,9 @@ public class IndividualLogApiController {
     @Autowired
     private PersonInfoService personInfoService;
 
+    @Autowired
+    private PersonDeviceLogService personDeviceLogService;
+
     @Autowired
     private PersonDeviceFilterLogService personDeviceFilterLogService;
 
@@ -120,9 +120,10 @@ public class IndividualLogApiController {
             map.put("temperatureMax", temperatureConfig.getMax());
             map.put("faceImageUrl",person.getFaceImageUrl());
 
-            PersonDeviceFilterLog personDeviceFilterLog = personDeviceFilterLogService.lastPersonLog(person.getId());
+            PersonDeviceLog lastPersonLog = personDeviceLogService.findLastPersonLog(person.getId(),temperatureConfig.getMax());
+
+            BigDecimal lastTemperature = lastPersonLog.getTemperature();
 
-            BigDecimal lastTemperature =  personDeviceFilterLog.getTemperature();
             DecimalFormat df = new DecimalFormat("##.#");
 
             if(lastTemperature != null){
@@ -144,6 +145,7 @@ public class IndividualLogApiController {
             //todo 最近14天未测体温数
             Integer detectedCount = personDeviceFilterLogService.countDayByPersonIdAndDate(person.getId(),today.minusDays(13).toDate(),today.plusDays(1).toDate());
             map.put("undetectedCount",14 - detectedCount);
+
             //todo 获取连续检测天数
             //最近一年的节假日
             Set<String> holidaySet = holidayInfoService.getHolidaySetByDate(today.minusDays(364).toDate(),today.plusDays(1).toDate());