DictionaryController.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package com.demo.wjj.controller;
  2. import com.demo.wjj.po.Dictionary;
  3. import com.demo.wjj.po.ImgList;
  4. import com.demo.wjj.po.TbImgItem;
  5. import com.demo.wjj.service.DictionaryService;
  6. import com.demo.wjj.utils.ApiResult;
  7. import org.slf4j.Logger;
  8. import org.slf4j.LoggerFactory;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. import java.util.List;
  12. /**
  13. * 数据字典
  14. * @author wangqing
  15. * @date 2018.11.11
  16. */
  17. @RequestMapping("/dic")
  18. @RestController
  19. public class DictionaryController {
  20. private final Logger LOG = LoggerFactory.getLogger(getClass());
  21. @Autowired
  22. private DictionaryService dictionaryService;
  23. /**
  24. * 获取设备类型
  25. * @return apiResult
  26. */
  27. @GetMapping("/getDeviceType")
  28. public ApiResult queryDeviceType() {
  29. LOG.info("调用获取设备类型(/dic/getDeviceType)接口");
  30. try {
  31. List<Dictionary> dictionaries = dictionaryService.queryDictionaryList(DictionaryService.DEVICE_TYPE);
  32. LOG.info("调用获取设备类型(/dic/getDeviceType)接口成功");
  33. return ApiResult.createSuccess(dictionaries);
  34. } catch (Exception e) {
  35. LOG.error("调用获取设备类型(/dic/getDeviceType)接口异常", e);
  36. return ApiResult.createFailure();
  37. }
  38. }
  39. /**
  40. * 获取配置说明
  41. * @return apiResult
  42. */
  43. @GetMapping("/getConfigInstructions")
  44. public ApiResult queryConfigInstructions() {
  45. LOG.info("调用获取配置说明(/dic/getDeviceType)接口");
  46. try {
  47. List<Dictionary> dictionaries = dictionaryService.queryDictionaryList(DictionaryService.CONFIG_INSTRUCTIONS);
  48. LOG.info("调用获取配置说明(/dic/getDeviceType)接口成功");
  49. return ApiResult.createSuccess(dictionaries);
  50. } catch (Exception e) {
  51. LOG.error("调用获取配置说明(/dic/getDeviceType)接口异常", e);
  52. return ApiResult.createFailure();
  53. }
  54. }
  55. /**
  56. * 获取作业履历
  57. * @return apiResult
  58. */
  59. @GetMapping("/getJobResume")
  60. public ApiResult queryJobResume() {
  61. LOG.info("调用获取作业履历(/dic/getJobResume)接口");
  62. try {
  63. List<Dictionary> dictionaries = dictionaryService.queryDictionaryList(DictionaryService.JOB_RESUME);
  64. LOG.info("调用获取作业履历(/dic/getJobResume)接口成功");
  65. return ApiResult.createSuccess(dictionaries);
  66. } catch (Exception e) {
  67. LOG.error("调用获取作业履历(/dic/getJobResume)接口异常", e);
  68. return ApiResult.createFailure();
  69. }
  70. }
  71. /**
  72. * 获取细节分类
  73. * @return apiResult
  74. */
  75. @PostMapping("/queryImgItemListByType")
  76. public ApiResult queryImgItemListByType(Integer type, Integer bqId) {
  77. LOG.info("获取细节分类(/dic/getQueryImgItemList)接口");
  78. try {
  79. List<TbImgItem> ImgItemList = dictionaryService.queryImgItemListByType(type, bqId);
  80. LOG.info("获取细节分类(/dic/getQueryImgItemList)接口成功 ImgItemList{}",ImgItemList);
  81. return ApiResult.createSuccess(ImgItemList);
  82. } catch (Exception e) {
  83. LOG.error("获取细节分类(/dic/getQueryImgItemList)接口异常", e);
  84. return ApiResult.createFailure();
  85. }
  86. }
  87. }