package com.jpsoft.smart; import cn.hutool.json.JSONObject; import com.jpsoft.smart.modules.base.dao.PersonInfoDAO; import com.jpsoft.smart.modules.base.dao.WarningPusherDAO; import com.jpsoft.smart.modules.base.dto.PersonDeviceLogDTO; import com.jpsoft.smart.modules.base.entity.DeviceInfo; import com.jpsoft.smart.modules.base.entity.PersonDeviceLog; import com.jpsoft.smart.modules.base.entity.PersonInfo; import com.jpsoft.smart.modules.base.entity.WarningPusher; import com.jpsoft.smart.modules.base.service.PersonDeviceLogService; import com.jpsoft.smart.modules.base.service.impl.PersonDeviceLogServiceImpl; import com.jpsoft.smart.modules.common.dto.MessageResult; import com.jpsoft.smart.modules.common.utils.WechatMessageUtil; import com.jpsoft.smart.modules.lapi.service.ILapiService; import com.jpsoft.smart.modules.lapi.service.impl.LapiServiceImpl; import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult; import com.jpsoft.smart.modules.lapi.vo.LapiResult; 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.math.BigDecimal; import java.util.*; /** * @author 墨鱼_mo * @date 2020-3-15 9:58 */ @RunWith(SpringRunner.class) @SpringBootTest public class LApiTest { @Autowired private ILapiService lapiService; @Autowired private WarningPusherDAO warningPusherDAO; @Autowired private PersonInfoDAO personInfoDAO; @Autowired private PersonDeviceLogServiceImpl personDeviceLogService; @Test public void testKeepLive(){ try { Boolean result = lapiService.keepAlive("9f254a38-2b6c-4169-a53c-765ec5e16c51"); System.out.println(result); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testAddPerson(){ try { //List result = lapiService.addPerson(11838L); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testGetFaceDB(){ try { DeviceInfo deviceInfo = new DeviceInfo(); deviceInfo.setIpAddress("192.168.11.13"); deviceInfo.setPort("80"); lapiService.getFaceDbId(deviceInfo,"荆鹏软件"); System.out.println(); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testDeletPerson(){ try { List result = lapiService.deletePerson(1111L); System.out.println(result); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testDeletDevicePerson(){ try { List result = lapiService.deleteDevicePerson(10013L,"9f254a38-2b6c-4169-a53c-765ec5e16c51"); System.out.println(result); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testRemoteOpened(){ try { Boolean success = lapiService.phoneOpenDoor("4b40b1e3-57b9-4119-828e-9d42d56e5b57"); System.out.println(success); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testReBoot(){ try { Boolean success = lapiService.phoneOpenDoor("4b40b1e3-57b9-4119-828e-9d42d56e5b57"); System.out.println(success); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testAddLibrary(){ try { List list = lapiService.addCompanyLib("c6083ba7-6025-11ea-9760-f0761c318e91","4b40b1e3-57b9-4119-828e-9d42d56e5b57"); System.out.println(list); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testDeleteLibrary(){ try { LapiResult lapiResult = lapiService.deleteCompanyLib("4b40b1e3-57b9-4119-828e-9d42d56e5b57","1584502940"); System.out.println(lapiResult); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testUpdateCompanyLib(){ try { LapiResult lapiResult = lapiService.updateCompanyLib("c6083ba7-6025-11ea-9760-f0761c318e91","4b40b1e3-57b9-4119-828e-9d42d56e5b57","1584429125"); System.out.println(lapiResult); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testDeleteDeviceAllCompanyLib(){ try { List list = lapiService.deleteDeviceAllCompanyLib("4b40b1e3-57b9-4119-828e-9d42d56e5b57"); System.out.println(list); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testWarningPushFindByIdList(){ try { String ids = "c6083b40-6025-11ea-9760-f0761c318e92,5cebd719-9e0e-4f0b-8414-4d7abe430ebf"; List idList = Arrays.asList(ids.split(",")); List list = warningPusherDAO.findByCompanyIdList(idList); System.out.println(list); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testSendTemperatureAlarmsyncTask(){ try { // WechatMessageUtil.sendTemperatureAlarmInfo("oLowyuOQ9ULF3LUGt6h3fTrsnbVE","荆鹏软件_门房考勤机","wx0b3c41a903053808","43557bd62f77b0c3d6670e991872f0e7","Mg9Ldk_kaoHAUwXFHEatrGugTlOz3yrMmMk7VoBca4M"); PersonDeviceLog personDeviceLog = new PersonDeviceLog(); personDeviceLog.setDeviceNo("210235C4C33203000165"); personDeviceLog.setPersonId(11622); personDeviceLog.setRecordTime(new Date()); personDeviceLog.setId("000733db-2945-4a1f-862f-86c24b50f84c"); personDeviceLogService.sendTemperatureAlarmsyncTask(personDeviceLog); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testgetDeviceRule(){ try { Map map= lapiService.getDeviceRule("32acfc7d-e7d4-4ebb-8170-035d00dc92a8"); System.out.println(map); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } @Test public void testSetDeviceRule(){ try { Boolean success = lapiService.setDeviceRule("32acfc7d-e7d4-4ebb-8170-035d00dc92a8",0,1,1,1,new BigDecimal(30),new BigDecimal(45),new BigDecimal(37.3)); System.out.println(success); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); } } }