PcMqttLogController.java 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package com.zy.bms.controller.pc;
  2. import com.zy.bms.common.Constant;
  3. import com.zy.bms.common.ServerResponse;
  4. import com.zy.bms.common.io.pc.MqttLogsIO;
  5. import com.zy.bms.service.MqttLogService;
  6. import org.springframework.web.bind.annotation.GetMapping;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.RestController;
  9. import javax.annotation.Resource;
  10. import java.util.HashMap;
  11. /**
  12. * mqtt收发日志
  13. *
  14. * @author yang xiao kun
  15. * create on 2021/1/21
  16. */
  17. @RestController
  18. @RequestMapping("bms/api/pc/logs")
  19. public class PcMqttLogController {
  20. @Resource
  21. private MqttLogService mqttLogService;
  22. private static HashMap<String, String> instruction = new HashMap<>();
  23. /*
  24. * 所有指令暂时写死内存中
  25. */
  26. static {
  27. instruction.put(Constant.M_CODE_REGISTER, "注册");
  28. instruction.put(Constant.M_CODE_RETURN_CODE, "返回授权码");
  29. instruction.put(Constant.M_CODE_UPLOAD_LOCATION, "上传位置信息");
  30. instruction.put(Constant.M_CODE_GPS_RATE, "设置定位频率");
  31. instruction.put(Constant.M_CODE_SOS, "设置联系人");
  32. instruction.put(Constant.M_CODE_VOLUME, "设置音量");
  33. instruction.put(Constant.M_CODE_AUTO_ANSWER, "设置自动接听");
  34. instruction.put(Constant.M_CODE_NEWS, "设置语音播报");
  35. instruction.put(Constant.M_CODE_UPLOAD_CALL_RECORD, "上传通话记录");
  36. instruction.put(Constant.M_CODE_CONTINUE_GPS, "设置连续定位");
  37. }
  38. /**
  39. * 分页查询日志
  40. */
  41. @GetMapping("listPage.do")
  42. public ServerResponse getListPage(MqttLogsIO io) {
  43. return ServerResponse.createBySuccess(mqttLogService.getListPage(io));
  44. }
  45. /**
  46. * 查询所有的指令
  47. */
  48. @GetMapping("getInstruction.do")
  49. public ServerResponse getInstruction() {
  50. return ServerResponse.createBySuccess(instruction);
  51. }
  52. }