index.ts 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import { getUserId } from "@/services/bus/account";
  2. import { getAreaUserId, getUserAccountType } from "@/services/bus/user";
  3. import { commonSearch_go } from '@/services/go';
  4. import { Ermcp3AreaSpot, Ermcp3AreaSpotDetail, Ermcp3AreaSpotDetailReq, Ermcp3ExposureDetail, Ermcp3ExposureReq, ErmcpExposurePostion, ErmcpExposurePostionReq, ErmcpHedgePosition, ErmcpHedgePositionDetail, ErmcpHedgePositionDetailReq, ErmcpRealExposureModel } from '@/services/go/ermcp/exposure/interface';
  5. /** ================================= 业务 - 敞口 ================================**/
  6. /**
  7. * 请求实时敞口 (敞口 -> 实时敞口) /Ermcp/QueryRealtimeExposure
  8. * @constructor
  9. */
  10. export function QueryActualExposure(): Promise<ErmcpRealExposureModel[]> {
  11. const userid = getUserId(); // 所属机构id
  12. return commonSearch_go('/Ermcp/QueryRealtimeExposure', { userid }).catch((err) => {
  13. throw new Error(`查询敞口 -> 实时敞口: ${err}`);
  14. });
  15. }
  16. /**
  17. * 请求实时敞口现货明细信息 (敞口 ->实时敞口 -> 现货明细) /Ermcp3/QueryExposureDetail
  18. * @param req.middlegoodsid 套保商品
  19. * @constructor
  20. */
  21. export function QueryActualExposureDetail(req: Ermcp3ExposureReq): Promise<Ermcp3ExposureDetail[]> {
  22. const userid = getAreaUserId(); // 用户id
  23. return commonSearch_go('/Ermcp3/QueryExposureDetail', { userid, ...req }).catch((err) => {
  24. throw new Error(`查询敞口 ->实时敞口 -> 现货明细: ${err}`);
  25. });
  26. }
  27. /**
  28. * 查询实时敞口期货头寸明细 (敞口 ->实时敞口 -> 期货明细) /Ermcp/QueryRealtimeExposurePosition
  29. * @param req.middleGoodsId 套保商品ID
  30. * @constructor
  31. */
  32. export function QueryAutualExposurePosition(req: ErmcpExposurePostionReq): Promise<ErmcpExposurePostion[]> {
  33. const userid = getUserId(); // 所属机构id
  34. return commonSearch_go('/Ermcp/QueryRealtimeExposurePosition', { userid, ...req }).catch((err) => {
  35. throw new Error(`查询敞口 ->实时敞口 -> 期货明细: ${err}`);
  36. });
  37. }
  38. /**
  39. * 请求敞口现货头寸 (敞口 -> 现货头寸) /Ermcp3/QueryExposureSpot
  40. * @constructor
  41. */
  42. export function QuerySpotPosition(): Promise<Ermcp3AreaSpot[]> {
  43. const userid = getUserId(); // 用户id
  44. const usertype = getUserAccountType(); // 用户类型 2-机构 7-企业成员
  45. return commonSearch_go('/Ermcp3/QueryExposureSpot', { userid, usertype }).catch((err) => {
  46. throw new Error(`查询敞口 -> 现货头寸: ${err}`);
  47. });
  48. }
  49. /**
  50. * 查询敞口现货头寸明细(敞口 -> 现货头寸 -> 现货明细) /Ermcp3/QueryExposureSpotDetail
  51. * req.deliverygoodsid 现货品种ID
  52. * @constructor
  53. */
  54. export function QuerySpotPositionDetail(req: Ermcp3AreaSpotDetailReq): Promise<Ermcp3AreaSpotDetail[]> {
  55. const userid = getUserId(); // 用户id
  56. const usertype = getUserAccountType(); // 用户类型 2-机构 7-企业成员
  57. return commonSearch_go('/Ermcp3/QueryExposureSpotDetail', { userid, usertype, ...req }).catch((err) => {
  58. throw new Error(`查询敞口 -> 现货头寸 -> 现货明细: ${err}`);
  59. });
  60. }
  61. /**
  62. * 查询敞口期货头寸(菜单:敞口-> 期货头寸) /Ermcp/QueryExposureHedgePosition
  63. * @constructor
  64. */
  65. export function QueryExposureHedgePosition(): Promise<ErmcpHedgePosition[]> {
  66. const userid = getUserId(); // 所属机构id
  67. return commonSearch_go('/Ermcp/QueryExposureHedgePosition', { userid }).catch((err) => {
  68. throw new Error(`查询敞口 -> 期货头寸: ${err}`);
  69. });
  70. }
  71. /**
  72. * 查询敞口期货头寸期货明细(菜单:敞口 -> 期货头寸 -> 期货明细) /Ermcp/QueryExposureHedgePositionDetail
  73. * @param req.goodsId 商品id
  74. * @constructor
  75. */
  76. export function QueryExposureHedgePositionDetail(req: ErmcpHedgePositionDetailReq): Promise<ErmcpHedgePositionDetail[]> {
  77. const userid = getUserId(); // 所属机构id
  78. return commonSearch_go('/Ermcp/QueryExposureHedgePositionDetail', { userid, ...req }).catch((err) => {
  79. throw new Error(`查询敞口->期货头寸->期货明细: ${err}`);
  80. });
  81. }