LApiTest.java 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. package com.jpsoft.smart;
  2. import cn.hutool.json.JSONObject;
  3. import com.jpsoft.smart.modules.base.dao.PersonInfoDAO;
  4. import com.jpsoft.smart.modules.base.dao.WarningPusherDAO;
  5. import com.jpsoft.smart.modules.base.dto.PersonDeviceLogDTO;
  6. import com.jpsoft.smart.modules.base.entity.DeviceInfo;
  7. import com.jpsoft.smart.modules.base.entity.PersonDeviceLog;
  8. import com.jpsoft.smart.modules.base.entity.PersonInfo;
  9. import com.jpsoft.smart.modules.base.entity.WarningPusher;
  10. import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
  11. import com.jpsoft.smart.modules.base.service.impl.PersonDeviceLogServiceImpl;
  12. import com.jpsoft.smart.modules.common.dto.MessageResult;
  13. import com.jpsoft.smart.modules.common.utils.WechatMessageUtil;
  14. import com.jpsoft.smart.modules.lapi.service.ILapiService;
  15. import com.jpsoft.smart.modules.lapi.service.impl.LapiServiceImpl;
  16. import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
  17. import com.jpsoft.smart.modules.lapi.vo.LapiResult;
  18. import org.junit.Test;
  19. import org.junit.runner.RunWith;
  20. import org.springframework.beans.factory.annotation.Autowired;
  21. import org.springframework.boot.test.context.SpringBootTest;
  22. import org.springframework.test.context.junit4.SpringRunner;
  23. import java.math.BigDecimal;
  24. import java.util.*;
  25. /**
  26. * @author 墨鱼_mo
  27. * @date 2020-3-15 9:58
  28. */
  29. @RunWith(SpringRunner.class)
  30. @SpringBootTest
  31. public class LApiTest {
  32. @Autowired
  33. private ILapiService lapiService;
  34. @Autowired
  35. private WarningPusherDAO warningPusherDAO;
  36. @Autowired
  37. private PersonInfoDAO personInfoDAO;
  38. @Autowired
  39. private PersonDeviceLogServiceImpl personDeviceLogService;
  40. @Test
  41. public void testKeepLive(){
  42. try {
  43. Boolean result = lapiService.keepAlive("9f254a38-2b6c-4169-a53c-765ec5e16c51");
  44. System.out.println(result);
  45. } catch (Exception e) {
  46. e.printStackTrace();
  47. String message = e.getMessage();
  48. }
  49. }
  50. @Test
  51. public void testAddPerson(){
  52. try {
  53. //List<LapiMsgResult> result = lapiService.addPerson(11838L);
  54. //System.out.println(result);
  55. } catch (Exception e) {
  56. e.printStackTrace();
  57. String message = e.getMessage();
  58. }
  59. }
  60. @Test
  61. public void testGetFaceDB(){
  62. try {
  63. DeviceInfo deviceInfo = new DeviceInfo();
  64. deviceInfo.setIpAddress("192.168.11.13");
  65. deviceInfo.setPort("80");
  66. lapiService.getFaceDbId(deviceInfo,"荆鹏软件");
  67. System.out.println();
  68. } catch (Exception e) {
  69. e.printStackTrace();
  70. String message = e.getMessage();
  71. }
  72. }
  73. @Test
  74. public void testDeletPerson(){
  75. try {
  76. List<LapiMsgResult> result = lapiService.deletePerson(1111L);
  77. System.out.println(result);
  78. } catch (Exception e) {
  79. e.printStackTrace();
  80. String message = e.getMessage();
  81. }
  82. }
  83. @Test
  84. public void testDeletDevicePerson(){
  85. try {
  86. List<LapiMsgResult> result = lapiService.deleteDevicePerson(10013L,"9f254a38-2b6c-4169-a53c-765ec5e16c51");
  87. System.out.println(result);
  88. } catch (Exception e) {
  89. e.printStackTrace();
  90. String message = e.getMessage();
  91. }
  92. }
  93. @Test
  94. public void testRemoteOpened(){
  95. try {
  96. Boolean success = lapiService.phoneOpenDoor("4b40b1e3-57b9-4119-828e-9d42d56e5b57");
  97. System.out.println(success);
  98. } catch (Exception e) {
  99. e.printStackTrace();
  100. String message = e.getMessage();
  101. }
  102. }
  103. @Test
  104. public void testReBoot(){
  105. try {
  106. Boolean success = lapiService.phoneOpenDoor("4b40b1e3-57b9-4119-828e-9d42d56e5b57");
  107. System.out.println(success);
  108. } catch (Exception e) {
  109. e.printStackTrace();
  110. String message = e.getMessage();
  111. }
  112. }
  113. @Test
  114. public void testAddLibrary(){
  115. try {
  116. List<LapiResult> list = lapiService.addCompanyLib("c6083ba7-6025-11ea-9760-f0761c318e91","4b40b1e3-57b9-4119-828e-9d42d56e5b57");
  117. System.out.println(list);
  118. } catch (Exception e) {
  119. e.printStackTrace();
  120. String message = e.getMessage();
  121. }
  122. }
  123. @Test
  124. public void testDeleteLibrary(){
  125. try {
  126. LapiResult lapiResult = lapiService.deleteCompanyLib("4b40b1e3-57b9-4119-828e-9d42d56e5b57","1584502940");
  127. System.out.println(lapiResult);
  128. } catch (Exception e) {
  129. e.printStackTrace();
  130. String message = e.getMessage();
  131. }
  132. }
  133. @Test
  134. public void testUpdateCompanyLib(){
  135. try {
  136. LapiResult lapiResult = lapiService.updateCompanyLib("c6083ba7-6025-11ea-9760-f0761c318e91","4b40b1e3-57b9-4119-828e-9d42d56e5b57","1584429125");
  137. System.out.println(lapiResult);
  138. } catch (Exception e) {
  139. e.printStackTrace();
  140. String message = e.getMessage();
  141. }
  142. }
  143. @Test
  144. public void testDeleteDeviceAllCompanyLib(){
  145. try {
  146. List<LapiResult> list = lapiService.deleteDeviceAllCompanyLib("4b40b1e3-57b9-4119-828e-9d42d56e5b57");
  147. System.out.println(list);
  148. } catch (Exception e) {
  149. e.printStackTrace();
  150. String message = e.getMessage();
  151. }
  152. }
  153. @Test
  154. public void testWarningPushFindByIdList(){
  155. try {
  156. String ids = "c6083b40-6025-11ea-9760-f0761c318e92,5cebd719-9e0e-4f0b-8414-4d7abe430ebf";
  157. List<String> idList = Arrays.asList(ids.split(","));
  158. List<WarningPusher> list = warningPusherDAO.findByCompanyIdList(idList);
  159. System.out.println(list);
  160. } catch (Exception e) {
  161. e.printStackTrace();
  162. String message = e.getMessage();
  163. }
  164. }
  165. @Test
  166. public void testSendTemperatureAlarmsyncTask(){
  167. try {
  168. // WechatMessageUtil.sendTemperatureAlarmInfo("oLowyuOQ9ULF3LUGt6h3fTrsnbVE","荆鹏软件_门房考勤机","wx0b3c41a903053808","43557bd62f77b0c3d6670e991872f0e7","Mg9Ldk_kaoHAUwXFHEatrGugTlOz3yrMmMk7VoBca4M");
  169. PersonDeviceLog personDeviceLog = new PersonDeviceLog();
  170. personDeviceLog.setDeviceNo("210235C4C33203000165");
  171. personDeviceLog.setPersonId(11622);
  172. personDeviceLog.setRecordTime(new Date());
  173. personDeviceLog.setId("000733db-2945-4a1f-862f-86c24b50f84c");
  174. personDeviceLogService.sendTemperatureAlarmsyncTask(personDeviceLog);
  175. } catch (Exception e) {
  176. e.printStackTrace();
  177. String message = e.getMessage();
  178. }
  179. }
  180. @Test
  181. public void testgetDeviceRule(){
  182. try {
  183. Map<String,Object> map= lapiService.getDeviceRule("32acfc7d-e7d4-4ebb-8170-035d00dc92a8");
  184. System.out.println(map);
  185. } catch (Exception e) {
  186. e.printStackTrace();
  187. String message = e.getMessage();
  188. }
  189. }
  190. @Test
  191. public void testSetDeviceRule(){
  192. try {
  193. Boolean success = lapiService.setDeviceRule("32acfc7d-e7d4-4ebb-8170-035d00dc92a8",0,1,1,1,new BigDecimal(30),new BigDecimal(45),new BigDecimal(37.3));
  194. System.out.println(success);
  195. } catch (Exception e) {
  196. e.printStackTrace();
  197. String message = e.getMessage();
  198. }
  199. }
  200. }