ExternalManageController.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. using ICSharpCode.TextEditor.Actions;
  2. using PMS.BusinessModels.ExternalManage;
  3. using PMS.EntityModels.ExternalManage;
  4. using PMS.Interface;
  5. using PMS.Interface.ExternalManage;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Configuration;
  9. using System.Drawing.Printing;
  10. using System.Linq;
  11. using System.Runtime.InteropServices;
  12. using System.Web;
  13. using System.Web.Mvc;
  14. using System.Web.Razor.Tokenizer.Symbols;
  15. namespace PMS.WebUI.Controllers
  16. {
  17. [CheckLogin(true)]
  18. public class ExternalManageController : BaseController
  19. {
  20. private string url = ConfigurationManager.AppSettings["External"].ToStringEx();
  21. IExternalManage externalManage = InterfaceFactory.CreateBusinessInstance<IExternalManage>();
  22. // GET: ExternalManage
  23. public ActionResult ExternalManage()
  24. {
  25. ViewBag.RYXZ = GetCurrentUser().PersonProperty;
  26. return View();
  27. }
  28. public ActionResult ExternalAccredit()
  29. {
  30. ViewBag.baseUrl = url;
  31. ViewBag.userName = GetCurrentUser().Name;
  32. return View();
  33. }
  34. public ActionResult ExternalRecords()
  35. {
  36. ViewBag.baseUrl = url;
  37. ViewBag.userName = GetCurrentUser().Name;
  38. return View();
  39. }
  40. /// <summary>
  41. /// 关键字查询外部服务分类
  42. /// </summary>
  43. /// <param name="keyword">关键字</param>
  44. /// <returns></returns>
  45. [HttpPost]
  46. public ActionResult GetMenu(string keyword, string productId, int type)
  47. {
  48. var json = externalManage.GetMenu(keyword, productId, type);
  49. return Content(json, "application/json");
  50. }
  51. /// <summary>
  52. /// 产品ID查询分类
  53. /// </summary>
  54. /// <param name="keyword">关键字</param>
  55. /// <returns></returns>
  56. [HttpPost]
  57. public ActionResult GetMenuByProduct(List<string> productIds)
  58. {
  59. var json = externalManage.GetMenuByProduct(productIds);
  60. return Content(json, "application/json");
  61. }
  62. /// <summary>
  63. /// 获取编码
  64. /// </summary>
  65. /// <param name="tableName">表名</param>
  66. /// <returns></returns>
  67. [HttpPost]
  68. public ActionResult GetMaxClassCode(string parent_id, int type, string productId)
  69. {
  70. var json = externalManage.GetMaxClassCode( parent_id, type, productId);
  71. return Content(json);
  72. }
  73. /// <summary>
  74. /// 保存服务分类
  75. /// </summary>
  76. /// <param name="model"></param>
  77. /// <returns></returns>
  78. [HttpPost]
  79. public ActionResult SaveExternalClass(ExternalClass model)
  80. {
  81. var json = externalManage.SaveExternalClass(model);
  82. if (json)
  83. {
  84. return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功");
  85. }
  86. else
  87. {
  88. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败");
  89. }
  90. }
  91. /// <summary>
  92. /// 删除服务分类
  93. /// </summary>
  94. /// <param name="id"></param>
  95. /// <returns></returns>
  96. [HttpPost]
  97. public ActionResult DeleteClass(string id)
  98. {
  99. var res = externalManage.DeleteClass(id);
  100. if (res)
  101. {
  102. return this.ResponseJson(System.Net.HttpStatusCode.OK, "删除成功");
  103. }
  104. else
  105. {
  106. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "删除失败");
  107. }
  108. }
  109. /// <summary>
  110. /// 获取服务目录
  111. /// </summary>
  112. /// <param name="class_id">分类id</param>
  113. /// <param name="keyword">关键字</param>
  114. /// <returns></returns>
  115. [HttpPost]
  116. public ActionResult GetExternal(string class_id, string keyword, int pageSize, int pageNum)
  117. {
  118. var json = externalManage.GetExternal(class_id, keyword, pageSize, pageNum);
  119. return Content(json, "application/json");
  120. }
  121. /// <summary>
  122. /// 保存服务
  123. /// </summary>
  124. /// <param name="model"></param>
  125. /// <returns></returns>
  126. [HttpPost]
  127. public ActionResult SaveExternal(External model)
  128. {
  129. var json = externalManage.SaveExternal(model);
  130. if(json)
  131. {
  132. return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功");
  133. }else
  134. {
  135. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败");
  136. }
  137. }
  138. /// <summary>
  139. /// 获取参数
  140. /// </summary>
  141. /// <param name="type"></param>
  142. /// <param name="id"></param>
  143. /// <returns></returns>
  144. [HttpPost]
  145. public ActionResult GetParameter(string type, string id)
  146. {
  147. var json = externalManage.GetParameter(type, id);
  148. return Content(json, "application/json");
  149. }
  150. /// <summary>
  151. /// 参数设置
  152. /// </summary>
  153. /// <param name="id"></param>
  154. /// <returns></returns>
  155. [HttpPost]
  156. public ActionResult GetExternalParameter(string id)
  157. {
  158. var json = externalManage.GetExternalParameter(id);
  159. return Content(json, "application/json");
  160. }
  161. /// <summary>
  162. /// 保存参数设置
  163. /// </summary>
  164. /// <param name="model"></param>
  165. /// <returns></returns>
  166. [HttpPost]
  167. public ActionResult SavaExternalSet(v_parameter model)
  168. {
  169. var json = externalManage.SavaExternalSet(model);
  170. if (json)
  171. {
  172. return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功");
  173. }
  174. else
  175. {
  176. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败");
  177. }
  178. }
  179. /// <summary>
  180. /// 删除服务和出入参信息
  181. /// </summary>
  182. /// <param name="id"></param>
  183. /// <returns></returns>
  184. [HttpPost]
  185. public ActionResult deleteExternal(string id)
  186. {
  187. var res = externalManage.deleteExternal(id);
  188. if (res)
  189. {
  190. return this.ResponseJson(System.Net.HttpStatusCode.OK, "删除成功");
  191. }
  192. else
  193. {
  194. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "删除失败");
  195. }
  196. }
  197. /// <summary>
  198. /// 复制
  199. /// </summary>
  200. /// <param name="model"></param>
  201. /// <returns></returns>
  202. [HttpPost]
  203. public ActionResult CopyExternalByClass(dto_copy_class model)
  204. {
  205. var res = externalManage.CopyExternalByClass(model);
  206. if (res)
  207. {
  208. return this.ResponseJson(System.Net.HttpStatusCode.OK, "成功");
  209. }
  210. else
  211. {
  212. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "失败");
  213. }
  214. }
  215. /// <summary>
  216. /// 复制
  217. /// </summary>
  218. /// <param name="model"></param>
  219. /// <returns></returns>
  220. [HttpPost]
  221. public ActionResult CopyExternal(dto_copy_external model)
  222. {
  223. var res = externalManage.CopyExternal(model);
  224. if (res)
  225. {
  226. return this.ResponseJson(System.Net.HttpStatusCode.OK, "成功");
  227. }
  228. else
  229. {
  230. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "失败");
  231. }
  232. }
  233. /// <summary>
  234. /// 查询授权接口
  235. /// </summary>
  236. /// <param name="keyword"></param>
  237. /// <param name="pageSize"></param>
  238. /// <param name="pageNum"></param>
  239. /// <returns></returns>
  240. [HttpPost]
  241. public ActionResult GetAccredit(string keyword, int pageSize, int pageNum, int is_stop)
  242. {
  243. var json = externalManage.GetAccredit(keyword, pageSize, pageNum, is_stop);
  244. return Content(json, "application/json");
  245. }
  246. /// <summary>
  247. /// 保存授权信息
  248. /// </summary>
  249. /// <param name="model"></param>
  250. /// <returns></returns>
  251. [HttpPost]
  252. public ActionResult SavaAccredit(ExternalAccredit model)
  253. {
  254. var res = externalManage.SavaAccredit(model);
  255. if (res)
  256. {
  257. return this.ResponseJson(System.Net.HttpStatusCode.OK, "成功");
  258. }
  259. else
  260. {
  261. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "失败");
  262. }
  263. }
  264. /// <summary>
  265. /// 授权信息
  266. /// </summary>
  267. /// <param name="id"></param>
  268. /// <param name="channel_id"></param>
  269. /// <param name="project_id"></param>
  270. /// <param name="pageSize"></param>
  271. /// <param name="pageNum"></param>
  272. /// <returns></returns>
  273. [HttpPost]
  274. public ActionResult GetAccredView(string id, string channel_id, string project_id, int pageSize, int pageNum, int is_stop)
  275. {
  276. var json = externalManage.GetAccredView(id, channel_id, project_id, pageSize, pageNum, is_stop);
  277. return Content(json, "application/json");
  278. }
  279. [HttpPost]
  280. public ActionResult GetRecords(dto_records_in model)
  281. {
  282. var json = externalManage.GetRecords(model);
  283. return Content(json, "application/json");
  284. }
  285. }
  286. }