فهرست منبع

Merge remote-tracking branch 'origin/V1' into V1

jz.kai 5 سال پیش
والد
کامیت
23edc1d724
19فایلهای تغییر یافته به همراه271 افزوده شده و 62 حذف شده
  1. 2 0
      common/src/main/java/com/jpsoft/smart/modules/base/dao/PersonDeviceRelationDAO.java
  2. 6 0
      common/src/main/java/com/jpsoft/smart/modules/base/entity/CompanyInfo.java
  3. 5 1
      common/src/main/java/com/jpsoft/smart/modules/base/service/PersonDeviceRelationService.java
  4. 9 7
      common/src/main/java/com/jpsoft/smart/modules/base/service/impl/DeviceInfoServiceImpl.java
  5. 3 2
      common/src/main/java/com/jpsoft/smart/modules/base/service/impl/PersonDeviceFilterLogServiceImpl.java
  6. 8 0
      common/src/main/java/com/jpsoft/smart/modules/base/service/impl/PersonDeviceRelationServiceImpl.java
  7. 2 2
      common/src/main/java/com/jpsoft/smart/modules/common/utils/LApiUtil.java
  8. 10 4
      common/src/main/java/com/jpsoft/smart/modules/lapi/service/impl/LapiServiceImpl.java
  9. 11 1
      common/src/main/resources/mapper/base/CompanyInfo.xml
  10. 16 3
      common/src/main/resources/mapper/base/PersonDeviceFilterLog.xml
  11. 4 0
      common/src/main/resources/mapper/base/PersonDeviceLog.xml
  12. 6 3
      common/src/main/resources/mapper/base/PersonDeviceRelation.xml
  13. 19 0
      common/src/main/resources/mapper/base/PersonInfo.xml
  14. 4 0
      lapi/src/main/resources/application-test.yml
  15. 7 3
      web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonDeviceLogController.java
  16. 16 11
      web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonInfoController.java
  17. 133 19
      web/src/main/java/com/jpsoft/smart/modules/mobile/controller/PersonDeviceLogApiController.java
  18. 8 4
      web/src/main/resources/application-production.yml
  19. 2 2
      web/src/test/java/com/jpsoft/smart/LApiTest.java

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

@@ -1,4 +1,5 @@
 package com.jpsoft.smart.modules.base.dao;
+import com.jpsoft.smart.modules.base.entity.DeviceInfo;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -19,6 +20,7 @@ public interface PersonDeviceRelationDAO {
     List<PersonDeviceRelation> findByDeviceId(String deviceId);
     PersonDeviceRelation findByDeviceIdAndPersonId(String deviceId,Long personId);
 	List<PersonDeviceRelation> search(Map<String, Object> searchParams, List<Sort> sortList);
+    List<DeviceInfo> findDeviceByPersonId(Long personId);
 
 //    List<PersonDeviceRelation>  findByPersonId(@Param("personId")Long personId);
 

+ 6 - 0
common/src/main/java/com/jpsoft/smart/modules/base/entity/CompanyInfo.java

@@ -42,4 +42,10 @@ public class CompanyInfo {
 	private Date updateTime;
     @ApiModelProperty(value = "是否删除")
 	private Boolean delFlag;
+
+	@ApiModelProperty(value = "上级公司")
+	private String parentId;
+
+	@ApiModelProperty(value = "企业编码")
+	private String code;
 }

+ 5 - 1
common/src/main/java/com/jpsoft/smart/modules/base/service/PersonDeviceRelationService.java

@@ -2,6 +2,8 @@ package com.jpsoft.smart.modules.base.service;
 
 import java.util.List;
 import java.util.Map;
+
+import com.jpsoft.smart.modules.base.entity.DeviceInfo;
 import com.jpsoft.smart.modules.base.entity.PersonDeviceRelation;
 import com.github.pagehelper.Page;
 import com.jpsoft.smart.modules.common.dto.Sort;
@@ -18,5 +20,7 @@ public interface PersonDeviceRelationService {
 	PersonDeviceRelation findByDeviceIdAndPersonId(String deviceId,Long personId);
 	Page<PersonDeviceRelation> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize,boolean count, List<Sort> sortList);
 
-	//List<PersonDeviceRelation> findByPersonId(Long id);
+    List<DeviceInfo> findDeviceByPersonId(Long id);
+
+    //List<PersonDeviceRelation> findByPersonId(Long id);
 }

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

@@ -88,13 +88,15 @@ public class DeviceInfoServiceImpl implements DeviceInfoService {
 	@Override
 	public void updateByDeviceNo(String deviceNo, String ip) {
 		try{
-		DeviceInfo deviceInfo= deviceInfoDAO.findByDeviceNo(deviceNo);
-		String oldIp = deviceInfo.getIpAddress();
-		if (deviceInfo.getIsAutoUpdate() && !deviceInfo.getIpAddress().equals(ip)){
-			deviceInfo.setIpAddress(ip);
-			deviceInfoDAO.update(deviceInfo);
-			log.warn(deviceNo+"的ip由原来的:"+oldIp+"自动更新为:"+ip);
-		}
+			DeviceInfo deviceInfo= deviceInfoDAO.findByDeviceNo(deviceNo);
+			String oldIp = deviceInfo.getIpAddress();
+
+			if (deviceInfo.getIsAutoUpdate()!=null &&
+			deviceInfo.getIsAutoUpdate() && !deviceInfo.getIpAddress().equals(ip)){
+				deviceInfo.setIpAddress(ip);
+				deviceInfoDAO.update(deviceInfo);
+				log.warn(deviceNo+"的ip由原来的:"+oldIp+"自动更新为:"+ip);
+			}
 		}catch (Exception e){
 			log.error(deviceNo +":" +e.getMessage());
 		}

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

@@ -77,6 +77,7 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
             PersonDeviceFilterLog personDeviceFilterLog = personDeviceFilterLogDAO.findByPersonIdAndDeviceNoAndTimeZones(personId,deviceNo,timeZones);
 
             if (personDeviceFilterLog != null){
+                BigDecimal oldTemper = personDeviceFilterLog.getTemperature();
                 personDeviceFilterLog.setUpdateTime(new Date());
                 personDeviceFilterLog.setTemperature(temperature);
                 personDeviceFilterLog.setRecordTime(date);
@@ -91,7 +92,7 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
                     personDeviceFilterLog.setMatchStatus(0);
                     personDeviceFilterLog.setMatchFaceId(0);
                 }
-                BigDecimal oldTemper = personDeviceFilterLog.getTemperature();
+
                 if (!LApiUtil.compareToInterval(oldTemper,36,37)){
                     if (LApiUtil.compareToInterval(temperature,36,37)){
 
@@ -127,7 +128,7 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
 
         }catch (Exception e){
 
-            log.warn(e.getMessage());
+            log.error(e.getMessage());
         }
 
 

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

@@ -4,6 +4,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 import javax.annotation.Resource;
+
+import com.jpsoft.smart.modules.base.entity.DeviceInfo;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 import com.jpsoft.smart.modules.base.dao.PersonDeviceRelationDAO;
@@ -90,4 +92,10 @@ public class PersonDeviceRelationServiceImpl implements PersonDeviceRelationServ
 //
 //		return personDeviceRelationDAO.findByPersonId(id);
 //	}
+
+
+	@Override
+	public List<DeviceInfo> findDeviceByPersonId(Long personId) {
+		return personDeviceRelationDAO.findDeviceByPersonId(personId);
+	}
 }

+ 2 - 2
common/src/main/java/com/jpsoft/smart/modules/common/utils/LApiUtil.java

@@ -202,9 +202,9 @@ public class LApiUtil {
       // long time = date.getTime();
      //   System.out.println(date);
       //  192.168.11.13:80/V1.0/PeopleLibraries/1584409665/People/1111?LastChange=1584428390872
+        boolean success = LApiUtil.compareToInterval(new BigDecimal(36.3),36,37);
+        System.out.println(success);
 
-        String format = DateUtil.format(new Date(), "yyyy-MM-dd-HH");
-        System.out.println(format);
     }
 
 

+ 10 - 4
common/src/main/java/com/jpsoft/smart/modules/lapi/service/impl/LapiServiceImpl.java

@@ -91,6 +91,10 @@ public class LapiServiceImpl implements ILapiService {
         if (deviceList.size() <= 0) {
             throw new Exception("人员与设备绑定错误");
         }
+        String base64Data = OSSUtil.downloadToBase64(personInfo.getFaceImageUrl());
+        if (base64Data.length()>512*1024 || base64Data.length()<10*1024){
+            throw new Exception("人员照片大小限定为10k~512k");
+        }
         List<LapiMsgResult> lapiMsgResults = new ArrayList<>();
         for (DeviceInfo deviceInfo : deviceList) {
             HashMap<String, Object> map = new HashMap<>();
@@ -118,7 +122,7 @@ public class LapiServiceImpl implements ILapiService {
             map3.put("FaceID", personInfo.getId());
             map3.put("Name", personInfo.getId() + ".jpg");
 
-            String base64Data = OSSUtil.downloadToBase64(personInfo.getFaceImageUrl());
+
 
             map3.put("Size", base64Data.length());
             map3.put("Data", base64Data);
@@ -130,9 +134,10 @@ public class LapiServiceImpl implements ILapiService {
             map.put("PersonInfoList", listMap1);
 
 
+            String faceDbId = getFaceDbId(deviceInfo, companyInfo.getName());
             try {
                 //获取人员人脸库id
-                String faceDbId = getFaceDbId(deviceInfo, companyInfo.getName());
+
                 JSONObject jsonObject = LApiUtil.PostRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.ADDPERSON + faceDbId + "/People", map);
                 JSONObject dataJson = jsonObject.getJSONObject("Response");
                 JSONObject response = LApiUtil.getResponse(dataJson);
@@ -173,7 +178,7 @@ public class LapiServiceImpl implements ILapiService {
         JSONObject response = LApiUtil.getResponse(dataJson);
         List listData = response.getJSONArray("LibList");
         if (listData.size() <= 0) {
-            throw new Exception("设备没有配置人脸库");
+            throw new Exception(deviceInfo.getAliasName()+"设备没有配置人脸库");
         }
         for (int i = 0; i < listData.size(); i++) {
             JSONObject jsonObject1 = (JSONObject) JSONArray.toJSON(listData.get(i));
@@ -184,7 +189,8 @@ public class LapiServiceImpl implements ILapiService {
         }
         //人员所属的公司库不存在,保存到默认库
         if (StringUtils.isBlank(faceDbId)) {
-            faceDbId = deviceInfo.getDefaultFaceLibraryId();
+            throw new Exception(deviceInfo.getAliasName()+"设备中未配置"+companyName+"人脸库");
+       //    faceDbId = deviceInfo.getDefaultFaceLibraryId();
         }
         return faceDbId;
     }

+ 11 - 1
common/src/main/resources/mapper/base/CompanyInfo.xml

@@ -14,6 +14,8 @@
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
         <result property="delFlag" column="del_flag"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="code" column="code_"/>
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.smart.modules.base.entity.CompanyInfo">
         <!--
@@ -23,7 +25,7 @@
         -->
         <![CDATA[
 		insert into base_company_info
-	    (id_,sort_no,name_,logo_,remark_,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,sort_no,name_,logo_,remark_,create_by,create_time,update_by,update_time,del_flag,parent_id,code_)
 		values
 		(
 			#{id,jdbcType=VARCHAR}
@@ -36,6 +38,8 @@
 			,#{updateBy,jdbcType=VARCHAR}
 			,#{updateTime,jdbcType= TIMESTAMP }
 			,#{delFlag,jdbcType= NUMERIC }
+			,#{parentId,jdbcType=VARCHAR}
+			,#{code,jdbcType=VARCHAR}
 		)
 	]]>
     </insert>
@@ -72,6 +76,12 @@
             <if test="delFlag!=null">
                 del_flag=#{delFlag,jdbcType= NUMERIC },
             </if>
+            <if test="parentId!=null">
+                parent_id=#{parentId,jdbcType=VARCHAR},
+            </if>
+            <if test="code!=null">
+                code_=#{code,jdbcType=VARCHAR},
+            </if>
         </set>
         where id_=#{id}
     </update>

+ 16 - 3
common/src/main/resources/mapper/base/PersonDeviceFilterLog.xml

@@ -142,6 +142,19 @@
             <if test="searchParams.personId != null">
                 and a.person_id = #{searchParams.personId}
             </if>
+            <if test="searchParams.beginTime != null">
+                <![CDATA[
+                  and a.record_time >= #{searchParams.beginTime}
+                ]]>
+            </if>
+            <if test="searchParams.endTime != null">
+                <![CDATA[
+                  and a.record_time <= #{searchParams.endTime}
+                ]]>
+            </if>
+            <if test="searchParams.abnormalFilter!=null">
+                and a.temperature_>37
+            </if>
         </where>
         <foreach item="sort" collection="sortList"  open="order by" separator=",">
             ${sort.name} ${sort.order}
@@ -163,12 +176,12 @@
         select * from base_person_device_filter_log where del_flag=false
     </select>
 
-    <select id="unusualStatistics"   resultMap="PersonDeviceFilterLogMap">
-        select c.name_ as name,count(b.id_) as personCount from base_person_device_filter_log a
+    <select id="unusualStatistics"   resultType="java.util.HashMap">
+        select c.id_ as id, c.name_ as name,count(b.id_) as personCount from base_person_device_filter_log a
         LEFT JOIN base_person_info b on a.person_id=b.id_
         LEFT JOIN base_company_info c on b.company_id=c.id_
         <![CDATA[
-            where a.del_flag=false and a.temperature_ <= #{temperature} and
+            where a.del_flag=false and a.temperature_ >= #{temperature} and
             a.record_time >= #{startDate} and a.record_time < #{endDate}
         ]]>
         GROUP BY c.id_

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

@@ -132,6 +132,10 @@
                   and a.temperature_ <= #{searchParams.maxTemperature}
                 ]]>
             </if>
+            <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}

+ 6 - 3
common/src/main/resources/mapper/base/PersonDeviceRelation.xml

@@ -117,7 +117,10 @@ id_,device_id,person_id,del_flag,create_by,create_time,update_by,update_time		fr
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
-
-
-
+    <select id="findDeviceByPersonId" resultMap="com.jpsoft.smart.modules.base.dao.DeviceInfoDAO.DeviceInfoMap">
+		select b.* from base_person_device_relation a,base_device_info b
+		where a.person_id=#{personId}
+		and a.device_id = b.id_
+		and a.del_flag=false
+	</select>
 </mapper>

+ 19 - 0
common/src/main/resources/mapper/base/PersonInfo.xml

@@ -206,6 +206,25 @@
             <if test="searchParams.faceBound != null">
                 and a.face_bound = #{searchParams.faceBound}
             </if>
+            <if test="'1'.toString() == searchParams.isUploadPhoto and null != searchParams.isUploadPhoto">
+                and a.face_image_url is not null
+            </if>
+            <if test="'0'.toString() == searchParams.isUploadPhoto and null != searchParams.isUploadPhoto">
+                and a.face_image_url is null
+            </if>
+
+            <if test="searchParams.abnormalDate != null">
+                <![CDATA[
+                and a.id_ in (
+                    select b.person_id from base_person_device_filter_log b,base_person_info c
+                    where b.person_id = c.id_
+                    and c.company_id = a.company_id
+                    and DATEDIFF(b.record_time,#{searchParams.abnormalDate})=0
+                    and b.del_flag=0
+                    and b.temperature_>37
+                )
+                ]]>
+            </if>
 
         </where>
         <foreach item="sort" collection="sortList" open="order by" separator=",">

+ 4 - 0
lapi/src/main/resources/application-test.yml

@@ -6,6 +6,10 @@ spring:
     url: jdbc:log4jdbc:mysql://127.0.0.1:3306/smart-community?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
     username: root
     password: slgo^Root_!Q@W#E)P(O*I
+#  datasource:
+#    url: jdbc:log4jdbc:mysql://hbjpsoft.mysql.rds.aliyuncs.com:3306/smart?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+#    username: smart
+#    password: smart_123
   devtools:
     add-properties: false
     restart:

+ 7 - 3
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonDeviceLogController.java

@@ -62,12 +62,12 @@ public class PersonDeviceLogController {
             @ApiImplicitParam(name = "aliasName",value = "设备别名", paramType = "query"),
             @ApiImplicitParam(name = "personName",value = "人员姓名", paramType = "query"),
             @ApiImplicitParam(name = "timeRanges",value = "时间范围", paramType = "query"),
-            @ApiImplicitParam(name = "temperatureRanges",value = "温度范围", paramType = "query")
-
+            @ApiImplicitParam(name = "temperatureRanges",value = "温度范围", paramType = "query"),
+            @ApiImplicitParam(name = "matchMsg",value = "匹配状态", paramType = "query")
     })
     public MessageResult<Map> pageList(
             String deviceNo,String aliasName,String personName,
-            String timeRanges,String temperatureRanges,
+            String timeRanges,String temperatureRanges,String matchMsg,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -112,6 +112,10 @@ public class PersonDeviceLogController {
             searchParams.put("personName","%"+personName+"%");
         }
 
+        if(StringUtil.isNotEmpty(matchMsg)){
+            searchParams.put("matchMsg","%"+matchMsg+"%");
+        }
+
 
         if(StringUtil.isNotEmpty(timeRanges)){
             String[] timeRangeArray = timeRanges.split(",");

+ 16 - 11
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonInfoController.java

@@ -42,6 +42,7 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/base/personInfo")
@@ -384,7 +385,8 @@ public class PersonInfoController {
             @ApiImplicitParam(name = "position3",value = "三级位置", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "position4",value = "四级位置", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "position5",value = "五级位置", required = false, paramType = "form",dataType = "String"),
-            @ApiImplicitParam(name = "faceBound",value = "是否同步", required = false, paramType = "form",dataType = "String")
+            @ApiImplicitParam(name = "faceBound",value = "是否同步", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "isUploadPhoto",value = "是否上传照片", required = false, paramType = "form",dataType = "String")
     })
     public MessageResult<Map> pageList(
             @RequestParam(value="name",defaultValue="") String name,
@@ -399,6 +401,7 @@ public class PersonInfoController {
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestParam(value="faceBound",defaultValue="") String faceBound,
+            @RequestParam(value="isUploadPhoto",defaultValue="") String isUploadPhoto,
             @RequestAttribute String subject){
 
         //当前用户ID
@@ -456,19 +459,21 @@ public class PersonInfoController {
             searchParams.put("faceBound",faceBound);
         }
 
+        if(StringUtils.isNotEmpty(isUploadPhoto)){
+            searchParams.put("isUploadPhoto", isUploadPhoto);
+        }
+
         Page<PersonInfo> page = personInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
         Page<PersonInfoDTO> pageDTO = PojoUtils.convertPage(page, PersonInfoDTO.class);
+
         for(PersonInfoDTO dto : pageDTO.getResult()){
-            String deviceName = "";
-            List<PersonDeviceRelation> personDeviceRelationList = personDeviceRelationService.findByPersonId(dto.getId());
-            for(PersonDeviceRelation personDeviceRelation : personDeviceRelationList){
-                DeviceInfo deviceInfo = deviceInfoService.get(personDeviceRelation.getDeviceId());
-                deviceName += deviceInfo.getAliasName() + ",";
-            }
-            if(StringUtils.isNotEmpty(deviceName)) {
-                deviceName = deviceName.substring(0,deviceName.length()-1);
-                dto.setDeviceName(deviceName);
-            }
+            List<DeviceInfo> deviceNameList = personDeviceRelationService.findDeviceByPersonId(dto.getId());
+
+            String deviceName = deviceNameList.stream()
+                                .map((device)->device.getAliasName())
+                                .collect(Collectors.joining(","));
+
+            dto.setDeviceName(deviceName);
         }
 
         msgResult.setResult(true);

+ 133 - 19
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/PersonDeviceLogApiController.java

@@ -46,15 +46,15 @@ public class PersonDeviceLogApiController {
     @Autowired
     private CompanyInfoService companyInfoService;
 
-    @PostMapping("queryTemperatureRecordListByEnt")
-    @ApiOperation(value="企业管理员查看温度记录(需要传令牌)")
+    @PostMapping("queryTemperatureRawRecordList")
+    @ApiOperation(value="根据实时数据查看企业人员温度数据")
     @ApiImplicitParams({
             @ApiImplicitParam(name="queryDate",value = "查询日期",required = true,paramType = "form"),
             @ApiImplicitParam(name="companyId",value = "单位编号",paramType = "form"),
             @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
             @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
     })
-    public MessageResult<Map> queryTemperatureRecordListByEnt(
+    public MessageResult<Map> queryTemperatureRawRecordList(
             @DateTimeFormat(pattern = "yyyy-MM-dd") Date queryDate,
             String companyId,
             String token,
@@ -189,6 +189,106 @@ public class PersonDeviceLogApiController {
         return messageResult;
     }
 
+
+    @PostMapping("queryTemperatureRecordListByEnt")
+    @ApiOperation(value="根据过滤后考勤记录统计单位员工温度数据")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="queryDate",value = "查询日期",required = true,paramType = "form"),
+            @ApiImplicitParam(name="companyId",value = "单位编号",paramType = "form"),
+            @ApiImplicitParam(name="filter",value = "是否过滤(1-显示异常数据,0-显示全部)",paramType = "form"),
+            @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
+            @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
+    })
+    public MessageResult<Map> queryTemperatureRecordListByEnt(
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date queryDate,
+            String companyId,
+            String token,
+            String filter,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestAttribute String subject){
+        Page<Map> recordPageList = new Page<>();
+
+        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.isNotEmpty(filter) && "1".equals(filter)){
+                personSearchParam.put("abnormalDate",queryDate);
+            }
+
+            List<Sort> sortList1 = new ArrayList<>();
+            sortList1.add(new Sort("id_","asc"));
+
+            Page<PersonInfo> personPageList = personInfoService.pageSearch(personSearchParam,pageIndex,pageSize,true,sortList1);
+
+            DateTime startTime = new DateTime(queryDate);
+
+            for (PersonInfo person : personPageList) {
+                Map<String, Object> recordMap = new HashMap<>();
+
+                recordMap.put("name", person.getName());
+                recordMap.put("faceImageUrl", person.getFaceImageUrl());
+
+                Map<String, Object> searchParams = new HashMap<>();
+
+                searchParams.put("personId", person.getId());
+                searchParams.put("beginTime", startTime.toDate());
+                searchParams.put("endTime", startTime.plusDays(1).toDate());
+
+                if (StringUtils.isNotEmpty(filter) && "1".equals(filter)){
+                    searchParams.put("abnormalFilter","1");
+                }
+
+                List<Sort> sortList = new ArrayList<>();
+                sortList.add(new Sort("record_time", "asc"));
+
+                Page<PersonDeviceFilterLog> page = personDeviceFilterLogService.pageSearch(searchParams,1,24,false,sortList);
+
+                SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+
+                List<Map> personDeviceLogs = page.stream()
+                        .filter((log)->log.getTemperature().compareTo(BigDecimal.ZERO)>0)
+                        .map((log)->{
+                            Map<String,Object> map = new HashMap<>();
+                            map.put("temperature",log.getTemperature());
+                            map.put("recordTime",sdf.format(log.getRecordTime()));
+
+                            return map;
+                        })
+                        .collect(Collectors.toList());
+
+                recordMap.put("list", personDeviceLogs);
+
+                recordPageList.add(recordMap);
+            }
+
+            recordPageList.setTotal(personPageList.getTotal());
+            recordPageList.setPages(personPageList.getPages());
+            recordPageList.setPageNum(personPageList.getPageNum());
+            recordPageList.setPageSize(personPageList.getPageSize());
+
+            messageResult.setResult(true);
+            messageResult.setData(PojoUtils.pageWrapper(recordPageList));
+        }
+        catch (Exception ex){
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
     @PostMapping("queryCompanyList")
     @ApiOperation(value="查询企业列表")
     @ApiImplicitParams({
@@ -366,16 +466,15 @@ public class PersonDeviceLogApiController {
         try{
             List<PersonDeviceFilterLog> personDeviceFilterLogList = personDeviceFilterLogService.list();
             Map map = new HashMap();
-            map.put("已检测",personDeviceFilterLogList.size());
+            map.put("detected",personDeviceFilterLogList.size());
             List<CompanyInfo> companyList = companyInfoService.list();
-            listMap.add(map);
-            Map map1 = new HashMap();
-            map1.put("企业数量",companyList.size());
-            listMap.add(map1);
+
+            map.put("companyCount",companyList.size());
+
             List<PersonInfo> personInfo = personInfoService.list();
-            Map map2 = new HashMap();
-            map2.put("监管人数",personInfo.size());
-            listMap.add(map2);
+
+            map.put("personCount",personInfo.size());
+            listMap.add(map);
 
             msgResult.setResult(true);
             msgResult.setData(listMap);
@@ -398,12 +497,12 @@ public class PersonDeviceLogApiController {
             @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
             @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
     })
-    public MessageResult< List<Map<String, Object>>> unusualStatistics(
+    public MessageResult<Map<String, Object>> unusualStatistics(
             String startTime,String endTime,
             String token, @RequestAttribute String subject) {
-        MessageResult<List<Map<String, Object>>> msgResult = new MessageResult<>();
+        MessageResult<Map<String, Object>> msgResult = new MessageResult<>();
 
-        List<Map<String, Object>> list = new ArrayList<>();
+        Map<String, Object> map = new HashMap<>();
 
         try{
             String startDate = "";
@@ -434,16 +533,31 @@ public class PersonDeviceLogApiController {
             }
 
             List<Map<String, Object>> mapList = personDeviceFilterLogService.unusualStatistics(bd,startDate,endDate);
+            List<Map<String, Object>> list = new ArrayList<>();
+
+            int companyTotalCount = 0;
+            int personTotalCount = 0;
+
+            for (Map<String, Object> curMap:mapList) {
+                if(curMap.get("name")!=null){
+                    list.add(curMap);
+                    companyTotalCount++;
+                    if(curMap.get("personCount")!=null){
+                        String personCountStr = curMap.get("personCount").toString();
+                        if(StringUtil.isNotEmpty(personCountStr)){
+                            personTotalCount = personTotalCount + Integer.parseInt(personCountStr);
+                        }
+                    }
 
-
-            for (Map<String, Object> map:mapList) {
-                if(map.get("name")!=null&&StringUtil.isNotEmpty(map.get("name").toString())){
-                    list.add(map);
                 }
             }
 
+            map.put("companyTotalCount",companyTotalCount);
+            map.put("personTotalCount",personTotalCount);
+            map.put("list",list);
+
             msgResult.setResult(true);
-            msgResult.setData(list);
+            msgResult.setData(map);
         }
         catch (Exception ex){
             msgResult.setMessage(ex.getMessage());

+ 8 - 4
web/src/main/resources/application-production.yml

@@ -5,9 +5,13 @@ server:
 
 spring:
   datasource:
-    url: jdbc:log4jdbc:mysql://hbjpsoft.mysql.rds.aliyuncs.com:3306/smart?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-    username: smart
-    password: smart_123
+    url: jdbc:log4jdbc:mysql://127.0.0.1:3306/smart-community?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+    username: root
+    password: slgo^Root_!Q@W#E)P(O*I
+  #  datasource:
+  #    url: jdbc:log4jdbc:mysql://hbjpsoft.mysql.rds.aliyuncs.com:3306/smart?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+  #    username: smart
+  #    password: smart_123
   devtools:
     restart:
       enabled: true
@@ -23,7 +27,7 @@ spring:
     host: 127.0.0.1
     port: 5672
     username: admin
-    password: admin
+    password: jpsoft
     #虚拟host 可以不设置,使用server默认host
     virtual-host: prodmq
 logger:

+ 2 - 2
web/src/test/java/com/jpsoft/smart/LApiTest.java

@@ -26,7 +26,7 @@ public class LApiTest {
     @Test
     public void testKeepLive(){
         try {
-            Boolean result = lapiService.keepAlive("1");
+            Boolean result = lapiService.keepAlive("9f254a38-2b6c-4169-a53c-765ec5e16c51");
             System.out.println(result);
         } catch (Exception e) {
             e.printStackTrace();
@@ -39,7 +39,7 @@ public class LApiTest {
     public void testAddPerson(){
         try {
 
-            List<LapiMsgResult> result = lapiService.addPerson(1111L);
+            List<LapiMsgResult> result = lapiService.addPerson(11838L);
             System.out.println(result);
         } catch (Exception e) {
             e.printStackTrace();