index.ts 4.0 KB

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