ABController.java 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package com.malk.aipocloud.controller;
  2. /**
  3. * 错误抛出与拦截详见 CatchException
  4. */
  5. import com.malk.aipocloud.repository.dao.ABEventDao;
  6. import com.malk.aipocloud.service.ABClient;
  7. import com.malk.delegate.McDelegate;
  8. import com.malk.server.common.McR;
  9. import com.malk.utils.UtilDateTime;
  10. import lombok.Synchronized;
  11. import lombok.extern.slf4j.Slf4j;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.beans.factory.annotation.Value;
  14. import org.springframework.web.bind.annotation.GetMapping;
  15. import org.springframework.web.bind.annotation.PostMapping;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RestController;
  18. @Slf4j
  19. @RestController
  20. @RequestMapping
  21. public class ABController {
  22. @Autowired
  23. private ABClient abClient;
  24. @Autowired
  25. private ABEventDao abEventDao;
  26. /**
  27. * 同步审批单
  28. */
  29. @PostMapping("process/sync")
  30. McR syncProcess() {
  31. abClient.syncProcess(UtilDateTime.parseLocalDateTime("2023-11-29 00:00:00"), UtilDateTime.parseLocalDateTime("2023-11-29 23:59:59"));
  32. // LocalDateTime now = LocalDateTime.now().minusHours(8);
  33. // abClient.syncProcess(now.minusMinutes(5), now);
  34. return McR.success();
  35. }
  36. /**
  37. * 通讯录同步
  38. */
  39. @Synchronized
  40. @PostMapping("contact/sync")
  41. McR syncContact() {
  42. log.info("手动触发, 通讯录同步");
  43. abClient.syncContact();
  44. return McR.success();
  45. }
  46. @Autowired
  47. private McDelegate mcDelegate;
  48. @Value("${server.ssl.key-store}")
  49. private String keyStore;
  50. @Value("${server.ssl.key-store-password}")
  51. private String keyStorePassword;
  52. @GetMapping("test")
  53. McR test() {
  54. log.info("11111, {}, {}", keyStore, keyStorePassword);
  55. mcDelegate.setTimeout(() -> {
  56. log.info("22222");
  57. }, 5000);
  58. return McR.success();
  59. }
  60. }