index.ts 4.2 KB

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