123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- 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<LapiMsgResult> 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<LapiMsgResult> result = lapiService.deletePerson(1111L);
- System.out.println(result);
- } catch (Exception e) {
- e.printStackTrace();
- String message = e.getMessage();
- }
- }
- @Test
- public void testDeletDevicePerson(){
- try {
- List<LapiMsgResult> 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<LapiResult> 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<LapiResult> 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<String> idList = Arrays.asList(ids.split(","));
- List<WarningPusher> 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<String,Object> 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();
- }
- }
- }
|