eSystemMenuValue.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. using Muchinfo.MTPClient.Data.Helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace Muchinfo.MTPClient.Data.Enums
  7. {
  8. // <summary>
  9. // 菜单总集合及ResourceCode
  10. // </summary>
  11. public class eSystemMenuValue
  12. {
  13. private volatile static eSystemMenuValue _instance = null;
  14. private static readonly object lockHelper = new object();
  15. // <summary>
  16. // The menu
  17. // </summary>
  18. public Dictionary<MenuCommandType, string> menu;
  19. // <summary>
  20. // The fixed menu list
  21. // </summary>
  22. public List<SysMenuItem> fixedMenuList;
  23. private List<SysMenuItem> _serviceMenus;
  24. /// <summary>
  25. /// 私有构造函数,初始化功能菜单
  26. /// </summary>
  27. private eSystemMenuValue()
  28. {
  29. //初始化本地菜单配置
  30. InitLocalFixedMenus();
  31. //初始化服务端菜单配置
  32. InitServiceMenus();
  33. //根据本地菜单及服务端菜单初始化全部菜单字典
  34. InitAllMenus();
  35. }
  36. #region MTP2.0
  37. /// <summary>
  38. /// 初始化本地固定菜单-根据资管菜单配置
  39. /// </summary>
  40. private void InitLocalFixedMenus()
  41. {
  42. //交易-本地固定菜单使用L开头
  43. var tradeMenuCode = "L00100000000";
  44. //公告通知-本地固定菜单使用M开头
  45. var noticeInfoMenuCode = "L00200000000";
  46. fixedMenuList = new List<SysMenuItem>()
  47. {
  48. new SysMenuItem("交易", MenuCommandType.Trade)// : 界面改版后。这里的买入卖出不需要了
  49. {
  50. FuncMenuCode = tradeMenuCode,
  51. SortId = -9999,
  52. Children = new List<SysMenuItem>()
  53. {
  54. new SysMenuItem("买入", MenuCommandType.BuyIn){ParentFuncMenuCode =tradeMenuCode , FuncMenuCode ="L00100010000"},
  55. new SysMenuItem("卖出", MenuCommandType.Sellout){ParentFuncMenuCode =tradeMenuCode , FuncMenuCode ="L00100020000"},
  56. new SysMenuItem("撤单", MenuCommandType.Cancel){ParentFuncMenuCode =tradeMenuCode , FuncMenuCode ="L00100030000"},
  57. }
  58. },
  59. //new SysMenuItem("公告通知", MenuCommandType.NoticeInform)
  60. //{
  61. // FuncMenuCode = noticeInfoMenuCode,
  62. // SortId = 9999,
  63. // Children = new List<SysMenuItem>()
  64. // {
  65. // new SysMenuItem("公告", MenuCommandType.Notice){ParentFuncMenuCode =tradeMenuCode , FuncMenuCode ="L00200010000"},
  66. // }
  67. //},
  68. };
  69. }
  70. /// <summary>
  71. /// 初始化服务端配置菜单-根据资管菜单配置
  72. /// </summary>
  73. private void InitServiceMenus()
  74. {
  75. //查询-服务配置菜单使用T开头
  76. var queryMenuCode = "T00500000000";
  77. //报表-服务配置菜单使用T开头
  78. var reportMenuCode = "T01500000000";
  79. _serviceMenus = new List<SysMenuItem>()
  80. {
  81. new SysMenuItem("查询", MenuCommandType.Query)
  82. {
  83. FuncMenuCode = queryMenuCode,
  84. Children = new List<SysMenuItem>()
  85. {
  86. new SysMenuItem("交易汇总", MenuCommandType.TradeSum){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500110000"},
  87. new SysMenuItem("账户资金", MenuCommandType.AccountInfo){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500120000"},
  88. new SysMenuItem("资金流水", MenuCommandType.QueryAmountLog){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500160000"},
  89. new SysMenuItem("委托单", MenuCommandType.EntrustOrder){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500130000"},
  90. new SysMenuItem("成交明细", MenuCommandType.TransactionOrder){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500140000"},
  91. new SysMenuItem("持仓汇总", MenuCommandType.Position){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500150000"},
  92. //new SysMenuItem("止盈止损", MenuCommandType.SPSLOrder){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500170000"},
  93. }
  94. },
  95. //new SysMenuItem("报表", MenuCommandType.Report)
  96. //{
  97. // FuncMenuCode = reportMenuCode,
  98. // Children = new List<SysMenuItem>()
  99. // {
  100. // new SysMenuItem("结算单", MenuCommandType.ReckonReport){ParentFuncMenuCode =reportMenuCode , FuncMenuCode ="T01500010000"},
  101. // }
  102. //},
  103. };
  104. }
  105. /// <summary>
  106. /// 根据本地菜单及服务端菜单初始化全部菜单字典
  107. /// </summary>
  108. private void InitAllMenus()
  109. {
  110. menu = new Dictionary<MenuCommandType, string>();
  111. foreach (var item in fixedMenuList)
  112. {
  113. menu.Add(item.SysCommandType, item.FuncMenuCode);
  114. if (item.Children == null) continue;
  115. foreach (var subItem in item.Children)
  116. {
  117. menu.Add(subItem.SysCommandType, subItem.FuncMenuCode);
  118. }
  119. }
  120. foreach (var item in _serviceMenus)
  121. {
  122. menu.Add(item.SysCommandType, item.FuncMenuCode);
  123. if (item.Children == null) continue;
  124. foreach (var subItem in item.Children)
  125. {
  126. menu.Add(subItem.SysCommandType, subItem.FuncMenuCode);
  127. }
  128. }
  129. }
  130. #endregion
  131. #region MTP1.0
  132. private void InitMenus()
  133. {
  134. #region ///交易
  135. menu.Add(MenuCommandType.Trade, "T00100000000");
  136. var tradeMenu = new SysMenuItem("交易", MenuCommandType.Trade)
  137. {
  138. FuncMenuCode = "T00100000000",
  139. Children = new List<SysMenuItem>()
  140. };
  141. ///买入
  142. menu.Add(MenuCommandType.BuyIn, "T00100010000");
  143. var buyinMenu = new SysMenuItem("买入", MenuCommandType.BuyIn)
  144. {
  145. ParentFuncMenuCode = "T00100000000",
  146. FuncMenuCode = "T00100010000",
  147. Children = new List<SysMenuItem>()
  148. };
  149. tradeMenu.Children.Add(buyinMenu);
  150. ///卖出
  151. menu.Add(MenuCommandType.Sellout, "T00100020000");
  152. var selloutMenu = new SysMenuItem("卖出", MenuCommandType.Sellout)
  153. {
  154. ParentFuncMenuCode = "T00100000000",
  155. FuncMenuCode = "T00100020000",
  156. Children = new List<SysMenuItem>()
  157. };
  158. tradeMenu.Children.Add(selloutMenu);
  159. ///撤单
  160. menu.Add(MenuCommandType.Cancel, "T00100030000");
  161. var cancelMenu = new SysMenuItem("撤单", MenuCommandType.Cancel)
  162. {
  163. ParentFuncMenuCode = "T00100000000",
  164. FuncMenuCode = "T00100030000",
  165. Children = new List<SysMenuItem>()
  166. };
  167. tradeMenu.Children.Add(cancelMenu);
  168. ///协议转让
  169. menu.Add(MenuCommandType.DealClose, "T00100040000");
  170. fixedMenuList.Add(tradeMenu);
  171. #endregion
  172. #region ///查询
  173. menu.Add(MenuCommandType.Query, "T00200000000");
  174. var queryMenu = new SysMenuItem("查询", MenuCommandType.Query)
  175. {
  176. FuncMenuCode = "T00200000000",
  177. Children = new List<SysMenuItem>()
  178. };
  179. /// 交易汇总
  180. menu.Add(MenuCommandType.TradeSum, "T00200010001");
  181. var TradeSumMenu = new SysMenuItem("交易汇总", MenuCommandType.TradeSum)
  182. {
  183. ParentFuncMenuCode = "T00200000000",
  184. FuncMenuCode = "T00200010001",
  185. Children = new List<SysMenuItem>()
  186. };
  187. queryMenu.Children.Add(TradeSumMenu);
  188. ///资金信息
  189. menu.Add(MenuCommandType.AccountInfo, "T00200010000");
  190. var accountInfoMenu = new SysMenuItem("资金信息", MenuCommandType.AccountInfo)
  191. {
  192. ParentFuncMenuCode = "T00200000000",
  193. FuncMenuCode = "T00200010000",
  194. Children = new List<SysMenuItem>()
  195. };
  196. queryMenu.Children.Add(accountInfoMenu);
  197. ///委托单
  198. menu.Add(MenuCommandType.EntrustOrder, "T00200020000");
  199. var entrustOrderMenu = new SysMenuItem("委托单", MenuCommandType.EntrustOrder)
  200. {
  201. ParentFuncMenuCode = "T00200000000",
  202. FuncMenuCode = "T00200020000",
  203. Children = new List<SysMenuItem>()
  204. };
  205. queryMenu.Children.Add(entrustOrderMenu);
  206. ///持仓汇总
  207. menu.Add(MenuCommandType.Position, "T00200030000");
  208. var holdDetailsMenu = new SysMenuItem("持仓汇总", MenuCommandType.Position)
  209. {
  210. ParentFuncMenuCode = "T00200000000",
  211. FuncMenuCode = "T00200030000",
  212. Children = new List<SysMenuItem>()
  213. };
  214. queryMenu.Children.Add(holdDetailsMenu);
  215. ///预埋单
  216. menu.Add(MenuCommandType.PrePostOrder, "T00200040000");
  217. ///成交明细
  218. menu.Add(MenuCommandType.TransactionOrder, "T00200050000");
  219. var transactionOrderMenu = new SysMenuItem("成交明细", MenuCommandType.TransactionOrder)
  220. {
  221. ParentFuncMenuCode = "T00200000000",
  222. FuncMenuCode = "T00200050000",
  223. Children = new List<SysMenuItem>()
  224. };
  225. queryMenu.Children.Add(transactionOrderMenu);
  226. ///资金流水
  227. menu.Add(MenuCommandType.QueryAmountLog, "T00200060000");
  228. var queryAmountLogMenu = new SysMenuItem("资金流水", MenuCommandType.QueryAmountLog)
  229. {
  230. ParentFuncMenuCode = "T00200000000",
  231. FuncMenuCode = "T00200060000",
  232. Children = new List<SysMenuItem>()
  233. };
  234. queryMenu.Children.Add(queryAmountLogMenu);
  235. //日报表
  236. menu.Add(MenuCommandType.DayReport, "T00200070000");
  237. var dayReportMenu = new SysMenuItem("日报表", MenuCommandType.DayReport)
  238. {
  239. ParentFuncMenuCode = "T00200000000",
  240. FuncMenuCode = "T00200070000",
  241. Children = new List<SysMenuItem>()
  242. };
  243. queryMenu.Children.Add(dayReportMenu);
  244. ///操作日志
  245. menu.Add(MenuCommandType.OperationLog, "T00200080000");
  246. var operationLogMenu = new SysMenuItem("操作日志", MenuCommandType.OperationLog)
  247. {
  248. ParentFuncMenuCode = "T00200000000",
  249. FuncMenuCode = "T00200080000",
  250. Children = new List<SysMenuItem>()
  251. };
  252. queryMenu.Children.Add(operationLogMenu);
  253. fixedMenuList.Add(queryMenu);
  254. #endregion
  255. #region ///仓单管理
  256. menu.Add(MenuCommandType.WarehouseManagement, "T00300000000");
  257. ///仓单
  258. menu.Add(MenuCommandType.WarehouseSearch, "T00300010000");
  259. ///提货单
  260. menu.Add(MenuCommandType.TakaDeliveryGoodsQuery, "T00300020000");
  261. #endregion
  262. #region ///交割管理
  263. menu.Add(MenuCommandType.DeliveryManage, "T00800000000");
  264. ///申报单
  265. menu.Add(MenuCommandType.DeliveryDeclarationSearch, "T00800010000");
  266. ///购销合同
  267. menu.Add(MenuCommandType.DeliveryOrderSearch, "T00800020000");
  268. #endregion
  269. #region ///公告通知
  270. menu.Add(MenuCommandType.NoticeInform, "T00500000000");
  271. var noticeInformMenu = new SysMenuItem("公告通知", MenuCommandType.NoticeInform)
  272. {
  273. FuncMenuCode = "T00500000000",
  274. Children = new List<SysMenuItem>()
  275. };
  276. ///公告
  277. menu.Add(MenuCommandType.Notice, "T00500010000");
  278. var noticeMenu = new SysMenuItem("公告", MenuCommandType.Notice)
  279. {
  280. ParentFuncMenuCode = "T00500000000",
  281. FuncMenuCode = "T00500010000",
  282. Children = new List<SysMenuItem>()
  283. };
  284. noticeInformMenu.Children.Add(noticeMenu);
  285. fixedMenuList.Add(noticeInformMenu);
  286. #endregion
  287. #region ///银行业务
  288. menu.Add(MenuCommandType.Apply, "T00600000000");
  289. var applyMenu = new SysMenuItem("银行业务", MenuCommandType.Apply)
  290. {
  291. FuncMenuCode = "T00600000000",
  292. Children = new List<SysMenuItem>()
  293. };
  294. ///出金申请
  295. menu.Add(MenuCommandType.AmountOutApply, "T00600010000");
  296. var amountOutApplyMenu = new SysMenuItem("出金申请", MenuCommandType.AmountOutApply)
  297. {
  298. ParentFuncMenuCode = "T00600000000",
  299. FuncMenuCode = "T00600010000",
  300. Children = new List<SysMenuItem>()
  301. };
  302. applyMenu.Children.Add(amountOutApplyMenu);
  303. ///入金申请
  304. menu.Add(MenuCommandType.AmountInApply, "T00600020000");
  305. var amountInApplyMenu = new SysMenuItem("入金申请", MenuCommandType.AmountInApply)
  306. {
  307. ParentFuncMenuCode = "T00600000000",
  308. FuncMenuCode = "T00600020000",
  309. Children = new List<SysMenuItem>()
  310. };
  311. applyMenu.Children.Add(amountInApplyMenu);
  312. ///出入金查询
  313. menu.Add(MenuCommandType.AmountQuety, "T00600030000");
  314. var amountQuetyMenu = new SysMenuItem("出入金查询", MenuCommandType.AmountQuety)
  315. {
  316. ParentFuncMenuCode = "T00600000000",
  317. FuncMenuCode = "T00600030000",
  318. Children = new List<SysMenuItem>()
  319. };
  320. applyMenu.Children.Add(amountQuetyMenu);
  321. ///签约信息/银行签约
  322. menu.Add(MenuCommandType.BankSign, "T00600040000");
  323. var bankSignMenu = new SysMenuItem("签约信息", MenuCommandType.BankSign)
  324. {
  325. ParentFuncMenuCode = "T00600000000",
  326. FuncMenuCode = "T00600040000",
  327. Children = new List<SysMenuItem>()
  328. };
  329. applyMenu.Children.Add(bankSignMenu);
  330. ///银行解约
  331. menu.Add(MenuCommandType.BankBreak, "T00600050000");
  332. var bankBreakMenu = new SysMenuItem("银行解约", MenuCommandType.BankBreak)
  333. {
  334. ParentFuncMenuCode = "T00600000000",
  335. FuncMenuCode = "T00600050000",
  336. Children = new List<SysMenuItem>()
  337. };
  338. applyMenu.Children.Add(bankBreakMenu);
  339. //资管注释“银行业务”
  340. fixedMenuList.Add(applyMenu);
  341. #endregion
  342. }
  343. #endregion
  344. /// <summary>
  345. /// 单例实例
  346. /// </summary>
  347. /// <returns>eSystemMenuValue.</returns>
  348. public static eSystemMenuValue CreateInstance()
  349. {
  350. if (_instance == null)
  351. {
  352. lock (lockHelper)
  353. {
  354. if (_instance == null)
  355. {
  356. _instance = new eSystemMenuValue();
  357. }
  358. }
  359. }
  360. return _instance;
  361. }
  362. }
  363. }