Selaa lähdekoodia

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

# Conflicts:
#	common/src/main/java/com/jpsoft/smart/modules/base/dto/CompanyInfoDTO.java
zhengqiang 5 vuotta sitten
vanhempi
commit
2e9c5c453f

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

@@ -2,6 +2,7 @@ package com.jpsoft.smart.modules.base.dao;
 import com.jpsoft.smart.modules.base.entity.DeviceInfo;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 import org.springframework.stereotype.Repository;
 import com.jpsoft.smart.modules.base.entity.PersonDeviceRelation;
@@ -18,10 +19,15 @@ public interface PersonDeviceRelationDAO {
 	List<PersonDeviceRelation> list();
 	List<PersonDeviceRelation> findByPersonId(Long personId);
     List<PersonDeviceRelation> findByDeviceId(String deviceId);
+	List<Long> findByDerviceName(String derviceName);
     PersonDeviceRelation findByDeviceIdAndPersonId(String deviceId,Long personId);
 	List<PersonDeviceRelation> search(Map<String, Object> searchParams, List<Sort> sortList);
     List<DeviceInfo> findDeviceByPersonId(Long personId);
 
+    List<PersonDeviceRelation> findByIsBoundAndUpdateTime(Date updateTime, Integer limit);
+
+	void updateIsBound(PersonDeviceRelation personDeviceRelation);
+
 //    List<PersonDeviceRelation>  findByPersonId(@Param("personId")Long personId);
 
 

+ 2 - 0
common/src/main/java/com/jpsoft/smart/modules/base/dto/CompanyInfoDTO.java

@@ -56,6 +56,8 @@ public class CompanyInfoDTO {
     private String type;
     @ApiModelProperty(value = "单位性质翻译")
     private String typeN;
+    @ApiModelProperty(value = "大屏公示墙网址")
+    private String wallUrl;
     @ApiModelProperty(value = "是否有子单位")
     private Boolean hasChildren;
 }

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

@@ -50,4 +50,6 @@ public class CompanyInfo {
 	private String type;
 	@ApiModelProperty(value = "单位性质翻译")
 	private String typeN;
+	@ApiModelProperty(value = "大屏公示墙网址")
+	private String wallUrl;
 }

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

@@ -1,8 +1,10 @@
 package com.jpsoft.smart.modules.base.service;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import cn.hutool.core.date.DateTime;
 import com.jpsoft.smart.modules.base.entity.DeviceInfo;
 import com.jpsoft.smart.modules.base.entity.PersonDeviceRelation;
 import com.github.pagehelper.Page;
@@ -18,10 +20,16 @@ public interface PersonDeviceRelationService {
 	List<PersonDeviceRelation> list();
 	List<PersonDeviceRelation> findByPersonId(Long personId);
 	List<PersonDeviceRelation> findByDeviceId(String deviceId);
+	List<Long> findByDerviceName(String derviceName);
 	PersonDeviceRelation findByDeviceIdAndPersonId(String deviceId,Long personId);
 	Page<PersonDeviceRelation> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize,boolean count, List<Sort> sortList);
 
     List<DeviceInfo> findDeviceByPersonId(Long id);
 
-    //List<PersonDeviceRelation> findByPersonId(Long id);
+	List<PersonDeviceRelation> findByIsBoundAndUpdateTime(Date updateTime, Integer limit);
+
+	void updateIsBound(Long personInfoId, String deviceInfoId,Boolean isBound);
+
+
+	//List<PersonDeviceRelation> findByPersonId(Long id);
 }

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

@@ -1,5 +1,6 @@
 package com.jpsoft.smart.modules.base.service.impl;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -93,6 +94,11 @@ public class PersonDeviceRelationServiceImpl implements PersonDeviceRelationServ
 		return personDeviceRelationDAO.findByDeviceId(deviceId);
 	}
 
+	@Override
+	public List<Long> findByDerviceName(String derviceName){
+		return personDeviceRelationDAO.findByDerviceName(derviceName);
+	}
+
 	@Override
 	public PersonDeviceRelation findByDeviceIdAndPersonId(String deviceId,Long personId){
 		return personDeviceRelationDAO.findByDeviceIdAndPersonId(deviceId,personId);
@@ -120,4 +126,22 @@ public class PersonDeviceRelationServiceImpl implements PersonDeviceRelationServ
 	public List<DeviceInfo> findDeviceByPersonId(Long personId) {
 		return personDeviceRelationDAO.findDeviceByPersonId(personId);
 	}
+
+	@Override
+	public List<PersonDeviceRelation> findByIsBoundAndUpdateTime(Date updateTime, Integer limit) {
+		return personDeviceRelationDAO.findByIsBoundAndUpdateTime(updateTime,limit);
+	}
+
+	@Override
+	public void updateIsBound(Long personInfoId, String deviceInfoId,Boolean isBound) {
+		PersonDeviceRelation personDeviceRelation =  personDeviceRelationDAO.findByDeviceIdAndPersonId(deviceInfoId,personInfoId);
+		if (personDeviceRelation != null){
+				personDeviceRelation.setIsBound(isBound);
+				personDeviceRelation.setUpdateTime(new Date());
+				personDeviceRelationDAO.updateIsBound(personDeviceRelation);
+
+		}
+	}
+
+
 }

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

@@ -180,11 +180,22 @@ public class LapiServiceImpl implements ILapiService {
                         lapiResult.setSuccess(true);
                         lapiResult.setData(dataMap);
                         lapiResultList.add(lapiResult);
+
+                        try{
+                            personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),true);
+                        }catch (Exception e){
+                            log.error(e.getMessage(),e);
+                        }
                     } else {
                         lapiResult.setMsg("绑定失败");
                         lapiResult.setSuccess(false);
                         lapiResult.setData(dataMap);
                         lapiResultList.add(lapiResult);
+                        try{
+                            personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),false);
+                        }catch (Exception e){
+                            log.error(e.getMessage(),e);
+                        }
                     }
 
                 }
@@ -199,6 +210,7 @@ public class LapiServiceImpl implements ILapiService {
                 lapiResult.setMsg(e.getMessage().contains("timed out") ? "设备连接超时" : e.getMessage());
                 lapiResult.setData(dataMap);
                 lapiResultList.add(lapiResult);
+                personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),null);
             }
         }
 
@@ -295,11 +307,21 @@ public class LapiServiceImpl implements ILapiService {
                         lapiResult.setSuccess(true);
                         lapiResult.setData(dataMap);
                         lapiResultList.add(lapiResult);
+                        try{
+                            personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),true);
+                        }catch (Exception e){
+                            log.error(e.getMessage(),e);
+                        }
                     } else {
                         lapiResult.setMsg("绑定失败");
                         lapiResult.setSuccess(false);
                         lapiResult.setData(dataMap);
                         lapiResultList.add(lapiResult);
+                        try{
+                            personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),false);
+                        }catch (Exception e){
+                            log.error(e.getMessage(),e);
+                        }
                     }
 
 
@@ -317,6 +339,7 @@ public class LapiServiceImpl implements ILapiService {
                 lapiResult.setMsg(e.getMessage().contains("timed out") ? "设备连接超时" : e.getMessage());
                 lapiResult.setData(dataMap);
                 lapiResultList.add(lapiResult);
+                personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),null);
             }
 
 
@@ -777,10 +800,24 @@ public class LapiServiceImpl implements ILapiService {
             JSONObject response = LApiUtil.getResponse(dataJson);
             Integer num = response.getInteger("Total");
             if (num > 0) {
+
+                try{
+                    personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),true);
+                }catch (Exception e){
+                    log.error(e.getMessage(),e);
+                }
+
                 return true;
+            }else {
+                try{
+                    personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),false);
+                }catch (Exception e){
+                    log.error(e.getMessage(),e);
+                }
             }
         } catch (Exception e) {
 
+            personDeviceRelationService.updateIsBound(personInfo.getId(),deviceInfo.getId(),null);
             return false;
         }
 

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

@@ -18,6 +18,7 @@
         <result property="code" column="code_"/>
         <result property="parentName" column="parent_name"/>
         <result property="type" column="type_"/>
+        <result property="wallUrl" column="wall_url" />
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.smart.modules.base.entity.CompanyInfo">
         <!--
@@ -27,7 +28,9 @@
         -->
         <![CDATA[
 		insert into base_company_info
-	    (id_,sort_no,name_,logo_,remark_,create_by,create_time,update_by,update_time,del_flag,parent_id,code_,type_)
+	    (id_,sort_no,name_,logo_,remark_,create_by,create_time,
+	    update_by,update_time,del_flag,parent_id,code_,type_,
+	    wall_url)
 		values
 		(
 			#{id,jdbcType=VARCHAR}
@@ -43,6 +46,7 @@
 			,#{parentId,jdbcType=VARCHAR}
 			,#{code,jdbcType=VARCHAR}
 			,#{type,jdbcType=VARCHAR}
+            ,#{wallUrl,jdbcType=VARCHAR}
 		)
 	]]>
     </insert>
@@ -88,6 +92,9 @@
             <if test="type!=null">
                 type_=#{type,jdbcType=VARCHAR},
             </if>
+            <if test="wallUrl!=null">
+                wall_url=#{wallUrl,jdbcType= VARCHAR },
+            </if>
         </set>
         where id_=#{id}
     </update>

+ 4 - 1
common/src/main/resources/mapper/base/DeviceInfo.xml

@@ -36,7 +36,10 @@
 	-->
 	<![CDATA[
 		insert into base_device_info
-	    (id_,header_,device_no,alias_name,address_,is_online,company_id,unlock_password,code_address,ip_address,port_,type_,is_auto_update,del_flag,create_by,create_time,update_by,update_time,default_face_library_id,heartbeat_update_time,abnormal_reason)
+	    (id_,header_,device_no,alias_name,address_,is_online,company_id,
+	    unlock_password,code_address,ip_address,port_,type_,is_auto_update,
+	    del_flag,create_by,create_time,update_by,update_time,
+	    default_face_library_id,heartbeat_update_time,abnormal_reason)
 		values
 		(
 			#{id,jdbcType=VARCHAR}

+ 52 - 0
common/src/main/resources/mapper/base/PersonDeviceRelation.xml

@@ -130,4 +130,56 @@ id_,device_id,person_id,del_flag,create_by,create_time,update_by,update_time		fr
 		and a.device_id = b.id_
 		and a.del_flag=false
 	</select>
+
+    <select id="findByIsBoundAndUpdateTime" resultMap="PersonDeviceRelationMap">
+        <![CDATA[
+        select * from base_person_device_relation
+                where del_flag = false
+                and is_bound is null
+                and update_time <= #{updateTime}
+                or update_time is null
+                and del_flag = false
+                and is_bound is null
+                limit #{limit}
+
+        ]]>
+
+
+</select>
+
+	<update id="updateIsBound" parameterType="com.jpsoft.smart.modules.base.entity.PersonDeviceRelation">
+		update base_person_device_relation
+		<set>
+			<if test="deviceId!=null">
+				device_id=#{deviceId,jdbcType=VARCHAR},
+			</if>
+			<if test="personId!=null">
+				person_id=#{personId,jdbcType=BIGINT},
+			</if>
+			<if test="delFlag!=null">
+				del_flag=#{delFlag,jdbcType= NUMERIC },
+			</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>
+				is_bound=#{isBound,jdbcType= VARCHAR},
+		</set>
+		where id_=#{id}
+	</update>
+	<select id="findByDerviceName" resultType="Long">
+		select a.person_id from base_person_device_relation a,base_device_info b
+		where a.device_id = b.id_
+		and a.del_flag=false
+		and b.alias_name like #{derviceName}
+	</select>
+
 </mapper>

+ 5 - 1
common/src/main/resources/mapper/base/PersonInfo.xml

@@ -230,7 +230,11 @@
                 )
                 ]]>
             </if>
-
+            <if test="searchParams.relationPersonIds != null">
+                <foreach item="relationPersonId" collection="searchParams.relationPersonIds" open="and a.id_ in (" separator="," close=")">
+                    #{relationPersonId}
+                </foreach>
+            </if>
         </where>
         <foreach item="sort" collection="sortList" open="order by" separator=",">
             ${sort.name} ${sort.order}

+ 15 - 0
web/src/main/java/com/jpsoft/smart/modules/base/controller/DeviceInfoController.java

@@ -203,6 +203,21 @@ public class DeviceInfoController {
                     int affectCount = deviceInfoService.update(deviceInfo);
 
                     if (affectCount > 0) {
+                        //判断是否修改公司
+                        //不相同为修改
+                        if(!item.getCompanyId().equals(deviceInfo.getCompanyId())) {
+                            //添加信息到设备与公司关联表
+                            //先删除
+                            companyDeviceRelationService.deleteByCompanyIdAndDeviceId(item.getCompanyId(), item.getId());
+
+                            CompanyDeviceRelation companyDeviceRelation = new CompanyDeviceRelation();
+                            companyDeviceRelation.setId(UUID.randomUUID().toString());
+                            companyDeviceRelation.setCompanyId(deviceInfo.getCompanyId());
+                            companyDeviceRelation.setDeviceId(deviceInfo.getId());
+                            //保存人脸库ID
+                            companyDeviceRelation.setLibraryId("");
+                            companyDeviceRelationService.insert(companyDeviceRelation);
+                        }
                         msgResult.setResult(true);
                         msgResult.setData(deviceInfo);
                     } else {

+ 6 - 0
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonDeviceRelationController.java

@@ -87,6 +87,7 @@ public class PersonDeviceRelationController {
                 personDeviceRelation.setDelFlag(false);
                 personDeviceRelation.setCreateBy(subject);
                 personDeviceRelation.setCreateTime(new Date());
+                personDeviceRelation.setIsBound(true);//绑定设备默认true
 
                 affectCount = personDeviceRelationService.insert(personDeviceRelation);
             }
@@ -160,6 +161,7 @@ public class PersonDeviceRelationController {
                        item.setDelFlag(false);
                        item.setCreateBy(subject);
                        item.setCreateTime(new Date());
+                       item.setIsBound(true);//绑定设备默认true
 
                        affectCount += personDeviceRelationService.insert(item);
                    }
@@ -200,6 +202,7 @@ public class PersonDeviceRelationController {
                         personDeviceRelation.setDelFlag(true);
                         personDeviceRelation.setUpdateBy(subject);
                         personDeviceRelation.setUpdateTime(new Date());
+                        personDeviceRelation.setIsBound(false);
 
                         personDeviceRelationService.update(personDeviceRelation);
                         addCount++;
@@ -277,6 +280,7 @@ public class PersonDeviceRelationController {
                         item.setDelFlag(false);
                         item.setCreateBy(subject);
                         item.setCreateTime(new Date());
+                        item.setIsBound(true);//绑定设备默认true
 
                         affectCount += personDeviceRelationService.insert(item);
                         //往设备库传输人脸信息
@@ -326,6 +330,7 @@ public class PersonDeviceRelationController {
                                 item.setDelFlag(true);
                                 item.setUpdateBy(subject);
                                 item.setUpdateTime(new Date());
+                                item.setIsBound(false);//绑定设备默认true
                                 personDeviceRelationService.update(item);
                                 addCount ++;
                             }
@@ -390,6 +395,7 @@ public class PersonDeviceRelationController {
                         item.setDelFlag(true);
                         item.setUpdateBy(subject);
                         item.setUpdateTime(new Date());
+                        item.setIsBound(false);//绑定设备默认true
                         affectCount += personDeviceRelationService.update(item);
                         //删除设备上的信息
                         new Thread(()->{

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

@@ -432,6 +432,7 @@ public class PersonInfoController {
             @ApiImplicitParam(name = "phone",value = "手机号", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "companyCode",value = "企业编码", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "subordinate",value = "会否保护下级单位", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "derviceName",value = "设备名称", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "position1",value = "一级位置", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "position2",value = "二级位置", required = false, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "position3",value = "三级位置", required = false, paramType = "form",dataType = "String"),
@@ -446,6 +447,7 @@ public class PersonInfoController {
             @RequestParam(value="phone",defaultValue="") String phone,
             @RequestParam(value="companyCode",defaultValue="")  String companyCode,
             @RequestParam(value="subordinate",defaultValue="false")  Boolean subordinate,
+            @RequestParam(value="derviceName",defaultValue="") String derviceName,
             @RequestParam(value="position1",defaultValue="") String position1,
             @RequestParam(value="position2",defaultValue="") String position2,
             @RequestParam(value="position3",defaultValue="") String position3,
@@ -524,6 +526,15 @@ public class PersonInfoController {
             searchParams.put("isUploadPhoto", isUploadPhoto);
         }
 
+        if(StringUtils.isNotEmpty(derviceName)){
+            List<Long> personDeviceRelation = personDeviceRelationService.findByDerviceName("%" + derviceName + "%");
+            //String relationPersonIds = String.join(",",personDeviceRelation);
+            searchParams.put("relationPersonIds", personDeviceRelation);
+        }
+
+
+
+
         Page<PersonInfo> page = personInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
         Page<PersonInfoDTO> pageDTO = PojoUtils.convertPage(page, PersonInfoDTO.class);
 

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

@@ -398,18 +398,18 @@ public class PersonInfoApiController {
                 //插入后,会将自增id写到id属性中
                 int affectCount = personInfoService.insert(personInfo);
 
-                //todo 关联设备
-                String[] deviceIds = bindDevices.split(",");
-                for(String deviceId : deviceIds){
-                    PersonDeviceRelation personDeviceRelation = new PersonDeviceRelation();
-                    personDeviceRelation.setId(UUID.randomUUID().toString());
-                    personDeviceRelation.setDeviceId(deviceId);
-                    personDeviceRelation.setPersonId(personInfo.getId());
-                    personDeviceRelation.setDelFlag(false);
-                    personDeviceRelation.setCreateBy(subject);
-                    personDeviceRelation.setCreateTime(new Date());
-                    personDeviceRelationService.insert(personDeviceRelation);
-                }
+//                //todo 关联设备
+//                String[] deviceIds = bindDevices.split(",");
+//                for(String deviceId : deviceIds){
+//                    PersonDeviceRelation personDeviceRelation = new PersonDeviceRelation();
+//                    personDeviceRelation.setId(UUID.randomUUID().toString());
+//                    personDeviceRelation.setDeviceId(deviceId);
+//                    personDeviceRelation.setPersonId(personInfo.getId());
+//                    personDeviceRelation.setDelFlag(false);
+//                    personDeviceRelation.setCreateBy(subject);
+//                    personDeviceRelation.setCreateTime(new Date());
+//                    personDeviceRelationService.insert(personDeviceRelation);
+//                }
 
                 if(affectCount>0) {
                     //todo 加入到导入图片队列中

+ 80 - 0
web/src/main/java/com/jpsoft/smart/schduled/UpdatePersonDeviceBoundTask.java

@@ -0,0 +1,80 @@
+package com.jpsoft.smart.schduled;
+
+import cn.hutool.core.date.DateField;
+import cn.hutool.core.date.DateUtil;
+import com.github.pagehelper.Page;
+import com.jpsoft.smart.modules.base.entity.DeviceInfo;
+import com.jpsoft.smart.modules.base.entity.PersonDeviceRelation;
+import com.jpsoft.smart.modules.base.entity.PersonInfo;
+import com.jpsoft.smart.modules.base.service.DeviceInfoService;
+import com.jpsoft.smart.modules.base.service.PersonDeviceRelationService;
+import com.jpsoft.smart.modules.base.service.PersonInfoService;
+import com.jpsoft.smart.modules.common.dto.Sort;
+import com.jpsoft.smart.modules.lapi.service.ILapiService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2020-4-8 14:27
+ */
+
+@Component
+@Slf4j
+@Transactional
+public class UpdatePersonDeviceBoundTask {
+
+
+    @Autowired
+    private PersonDeviceRelationService personDeviceRelationService;
+
+    @Autowired
+    private ILapiService lapiService;
+
+    @Autowired
+    private PersonInfoService personInfoService;
+
+    @Autowired
+    private DeviceInfoService deviceInfoService;
+
+    @Scheduled(cron = "0 0/10 * * * ?")
+    public  void run() {
+        log.warn("人员设备绑定关系更新定时任务开始");
+
+
+        //200条数据,更新时间要晚于当前时间的前一天
+        List<PersonDeviceRelation> personDeviceRelationList = personDeviceRelationService.findByIsBoundAndUpdateTime(DateUtil.offset(new Date(),DateField.DAY_OF_MONTH, -1),200);
+        if (personDeviceRelationList.size()>0){
+            for (PersonDeviceRelation personDeviceRelation : personDeviceRelationList){
+                try{
+                    lapiService.keepAlive(personDeviceRelation.getDeviceId());
+                    PersonInfo personInfo = personInfoService.get(personDeviceRelation.getPersonId());
+                    DeviceInfo deviceInfo = deviceInfoService.get(personDeviceRelation.getDeviceId());
+                    String faceDbId = lapiService.getFaceDbId(deviceInfo,personInfo.getCompanyName());
+                    Boolean isSuccessAdd =  lapiService.isSuccessAddPerson(personInfo,deviceInfo,faceDbId);
+                    if (isSuccessAdd){
+                        personDeviceRelation.setIsBound(true);
+                        personDeviceRelation.setUpdateTime(new Date());
+                    }else {
+                        personDeviceRelation.setIsBound(false);
+                        personDeviceRelation.setUpdateTime(new Date());
+                    }
+                }catch (Exception e){
+                    personDeviceRelation.setUpdateTime(new Date());
+                    personDeviceRelation.setIsBound(null);
+                }
+
+                personDeviceRelationService.update(personDeviceRelation);
+
+            }
+        }
+
+    }
+
+
+}

+ 20 - 1
web/src/test/java/com/jpsoft/smart/CheckNumCompanyTest.java

@@ -1,19 +1,25 @@
 package com.jpsoft.smart;
 
+import cn.hutool.core.date.DateField;
+import cn.hutool.core.date.DateUtil;
+import com.github.pagehelper.Page;
 import com.jpsoft.smart.modules.base.dao.CheckNumCompanyDAO;
 import com.jpsoft.smart.modules.base.dao.PersonInfoDAO;
 import com.jpsoft.smart.modules.base.dao.TotalCheckCompanyDAO;
 import com.jpsoft.smart.modules.base.entity.CheckNumCompany;
 import com.jpsoft.smart.modules.base.entity.CompanyInfo;
+import com.jpsoft.smart.modules.base.entity.PersonDeviceRelation;
 import com.jpsoft.smart.modules.base.entity.TotalCheckCompany;
 import com.jpsoft.smart.modules.base.service.CompanyInfoService;
+import com.jpsoft.smart.modules.base.service.PersonDeviceRelationService;
+import com.jpsoft.smart.modules.common.dto.Sort;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import java.util.List;
+import java.util.*;
 
 /**
  * @author 墨鱼_mo
@@ -35,6 +41,9 @@ public class CheckNumCompanyTest {
     @Autowired
     private CompanyInfoService companyInfoService;
 
+    @Autowired
+    private PersonDeviceRelationService personDeviceRelationService;
+
     @Test
     public void testGet(){
        // CheckNumCompany checkNumCompany = checkNumCompanyDAO.get(1L);
@@ -68,4 +77,14 @@ public class CheckNumCompanyTest {
         System.out.println(i);
     }
 
+
+    @Test
+    public void testPersonDevicePage(){
+
+
+        List<PersonDeviceRelation> list =personDeviceRelationService.findByIsBoundAndUpdateTime(DateUtil.offset(new Date(),DateField.DAY_OF_MONTH, -1),50);
+
+        System.out.println(list);
+        System.out.println(list.size());
+    }
 }