AdapterDictController.java 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. package com.yihu.hos.standard.controller;
  2. import com.yihu.hos.standard.service.adapter.AdapterDictClient;
  3. import com.yihu.hos.web.framework.model.ActionResult;
  4. import com.yihu.hos.web.framework.model.DetailModelResult;
  5. import com.yihu.hos.web.framework.model.Result;
  6. import com.yihu.hos.web.framework.util.controller.BaseController;
  7. import io.swagger.annotations.ApiOperation;
  8. import io.swagger.annotations.ApiParam;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. /**
  12. * Created by LLH on 2016/1/6.
  13. */
  14. @RestController("AdapterDictController")
  15. @RequestMapping("/adapterCenter")
  16. //@Api(protocols = "https", value = "AdapterDictController", description = "适配字典管理", tags = {"适配字典"})
  17. public class AdapterDictController extends BaseController {
  18. @Autowired
  19. private AdapterDictClient adapterDictClient;
  20. /**
  21. * 查询字典列表信息(get)
  22. * @param adapterVersion
  23. * @param condition
  24. * @param order
  25. * @param rows
  26. * @param page
  27. * @return
  28. * @throws Exception
  29. */
  30. @RequestMapping(value = "/searchDictList")
  31. @ApiOperation(value = "获取字典列表", response = DetailModelResult.class, produces = "application/json", notes = "获取字典列表")
  32. public DetailModelResult searchDictList(
  33. @ApiParam(name = "adapterVersion", value = "适配标准版本号")
  34. @RequestParam(value = "adapterVersion") String adapterVersion,
  35. @ApiParam(name = "condition", value = "查询条件:编码或名称")
  36. @RequestParam(value = "condition", required = false) String condition,
  37. @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
  38. @RequestParam(value = "order", required = false) String order,
  39. @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
  40. @RequestParam(value = "rows", required = false) Integer rows,
  41. @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
  42. @RequestParam(value = "page", required = false) Integer page) {
  43. return adapterDictClient.searchDictList(adapterVersion, condition, order, rows, page);
  44. }
  45. @RequestMapping(value = "/getForDictId")
  46. @ApiOperation(value = "获取字典", response = Result.class, produces = "application/json", notes = "获取字典")
  47. public ActionResult get(
  48. @ApiParam(name = "adapterVersion", value = "标准版本号")
  49. @RequestParam(value = "adapterVersion") String adapterVersion,
  50. @ApiParam(name = "dictId", value = "字典ID")
  51. @RequestParam(value = "dictId") Integer dictId) {
  52. return adapterDictClient.get(adapterVersion, dictId);
  53. }
  54. @RequestMapping(value = "/delDict")
  55. @ApiOperation(value = "删除字典", produces = "application/json", notes = "删除字典")
  56. public void delDict(
  57. @ApiParam(name = "adapterVersion", value = "标准版本号")
  58. @RequestParam(value = "adapterVersion") String adapterVersion,
  59. @ApiParam(name = "dictId", value = "字典ID")
  60. @RequestParam(value = "dictId") Integer dictId) {
  61. adapterDictClient.delDict(adapterVersion, dictId);
  62. }
  63. @RequestMapping(value = "/updateDict")
  64. @ApiOperation(value = "修改字典", response = Result.class, produces = "application/json", notes = "修改字典")
  65. public ActionResult updateDict(
  66. @ApiParam(name = "adapterVersion", value = "标准版本号")
  67. @RequestParam(value = "adapterVersion") String adapterVersion,
  68. @ApiParam(name = "dict", value = "字典")
  69. @RequestParam(value = "dict") String dict) {
  70. return adapterDictClient.updateDict(adapterVersion, dict);
  71. }
  72. @RequestMapping(value = "/addDict")
  73. @ApiOperation(value = "保存字典", response = Result.class, produces = "application/json", notes = "保存字典")
  74. public ActionResult addDict(
  75. @ApiParam(name = "adapterVersion", value = "标准版本号")
  76. @RequestParam(value = "adapterVersion") String adapterVersion,
  77. @ApiParam(name = "dict", value = "字典")
  78. @RequestParam(value = "dict") String dict) {
  79. return adapterDictClient.addDict(adapterVersion, dict);
  80. }
  81. @RequestMapping(value = "/isStrategyDic", method = RequestMethod.POST , produces = "application/json")
  82. @ResponseBody
  83. @ApiOperation(value = "是否智能匹配", response = Object.class, produces = "application/json", notes = "是否智能匹配")
  84. public ActionResult isStrategy(
  85. @ApiParam(value = "匹配version", required = true) @RequestParam("version") String version
  86. ) throws Exception {
  87. return adapterDictClient.isStrategy(version);
  88. }
  89. /**
  90. * 智能匹配
  91. *
  92. * @param version
  93. * @return
  94. * @throws Exception
  95. */
  96. @ResponseBody
  97. @RequestMapping(value = "/strategyDic", method = RequestMethod.POST)
  98. @ApiOperation(value = "智能匹配", response = Object.class, produces = "application/json", notes = "智能匹配")
  99. public ActionResult strategyDic(
  100. @ApiParam(value = "匹配version", required = true) @RequestParam("version") String version,
  101. @ApiParam(value = "平台标准version", required = true) @RequestParam("std_version") String std_version,
  102. @ApiParam(value = "适配方案版本号", required = true) @RequestParam("adapter_std_version") String adapter_std_version
  103. ) throws Exception {
  104. return adapterDictClient.strategyDic(version,std_version,adapter_std_version);
  105. }
  106. @RequestMapping(value = "/getStrategyDicSize", method = RequestMethod.POST)
  107. @ResponseBody
  108. @ApiOperation(value = "智能匹配进行", response = Object.class, produces = "application/json", notes = "智能匹配进行")
  109. public ActionResult getStrategyDicSize(
  110. @ApiParam(value = "匹配version", required = true) @RequestParam("version") String version
  111. ) throws Exception {
  112. return adapterDictClient.getStrategyDicSize(version);
  113. }
  114. @RequestMapping(value = "/endStrategyDic", method = RequestMethod.POST)
  115. @ResponseBody
  116. @ApiOperation(value = "智能匹配結束", response = Object.class, produces = "application/json", notes = "智能匹配結束")
  117. public ActionResult endStrategyDic(
  118. @ApiParam(value = "匹配version", required = true) @RequestParam("version") String version
  119. ) throws Exception {
  120. return adapterDictClient.endStrategyDic(version);
  121. }
  122. }