123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- import { ref } from 'vue'
- import { message } from 'ant-design-vue'
- import ServiceManager from "@/views/front/platfrom/serviceproxy/ServiceHelper/TradeHandle";
- import { TransitEntity, AttachFile } from './ServiceEntitys'
- import CommonFunction from "@/views/front/platfrom/serviceproxy/CommonFunction";
- import { ServiceSettings } from "@/views/front/develop/ServiceProxy.Ext/ServiceSettings"
- import FilesHandle from '@/views/front/platfrom/serviceproxy/ServiceHelper/FilesHandle';
- import { CheckInfo } from '@/views/front/develop/ServiceProxy.Ext/ServiceEntitys/CheckInfo';
- import { CheckResult } from '@/views/front/develop/ServiceProxy.Ext/ServiceEntitys/CheckResult';
- import { AuthResult } from '@/views/front/develop/ServiceProxy.Ext/ServiceEntitys/AuthResult';
-
-
- export enum Transit {
- CallServer = 'CallServer',
- CallAgn = 'CallAgn',
- CallTips = 'CallTips',
- CallAgnPay = 'CallAgnPay',
- CallAgnTIPS = 'CallAgnTIPS',
- CallAgnSecdistruct = 'CallAgnSecdistruct',
- CallAgnMobileBanking = 'CallAgnMobileBanking'
- }
-
- export default class TradeHandle {
- /**
- * 获取8583域定义
- */
- static async GetFdItemMap(type: string): Promise<any> {
- const table = {
- Code: '',
- Type: '',
- Length: '',
- DotLength: '',
- Description: '',
- FieldType: '',
- MaxLength: ''
- }
-
- const entity = new TransitEntity()
- entity.ServiceName = 'TradeService'
- entity.FuncName = 'GetFdItemMap'
- entity.Parameters = { '1': type }
-
- const tmpresult = await ServiceManager.GetInstance().Commit(entity)
- let data = null
- if (tmpresult && tmpresult.length === 1) {
- data = tmpresult[0].AttachValue as string
- }
-
- if (data) {
- const lines = data.split('\n')
- return lines.map(line => {
- const rows = line.split('|')
- return {
- ...table,
- Code: rows[0],
- Type: rows[1],
- Length: rows[2],
- DotLength: rows[3],
- Description: rows[4],
- FieldType: rows[5],
- MaxLength: rows[6]
- }
- })
- }
- return []
- }
-
- /**
- * 按照参数指示与外端进行通讯交互
- */
- static async DoTrade(
- transit: string,
- integrateData: Uint8Array,
- kinBrno: string,
- fileName: string,
- fileData: Uint8Array,
- args: any[],
- serialNo: string
- ): Promise<Uint8Array[]> {
- const result: Uint8Array[] = []
- try {
- const entity = new TransitEntity()
- entity.ServiceName = 'TradeService'
- entity.FuncName = 'DoTradeByTransit'
- entity.Parameters = {
- '1': transit,
- '3': kinBrno,
- '4': fileName,
- '6': '',
- '7': serialNo
- }
-
- const data = new AttachFile()
- data.AttachIndex = '2'
- data.AttachType = 'ByteType'
- data.AttachValue = integrateData
- entity.AttachFiles.push(data)
-
- const data1 = new AttachFile()
- data1.AttachIndex = '5'
- data1.AttachType = 'ByteType'
- data1.AttachValue = fileData
- entity.AttachFiles.push(data1)
-
- const tmpresult = await ServiceManager.GetInstance().Commit(entity)
- if (tmpresult) {
- tmpresult.forEach(attachFile => {
- result.push(attachFile.AttachValue as Uint8Array)
- })
- }
- } catch (e) {
- throw e
- }
- return result
- }
-
- /**
- * 获取交易返回的附件信息数据
- */
- static async GetTradeFile(fileName: string): Promise<Uint8Array> {
- const filePath = ServiceSettings.TempFilePath + fileName + 'dhcc'
- return FilesHandle.GetFileData(filePath)
- }
-
- /**
- * 清空交易附件信息
- */
- static async ClearvFile(fileName: string): Promise<boolean> {
- let result = false
- try {
- const entity = new TransitEntity()
- entity.ServiceName = 'UtilService'
- entity.FuncName = 'SaveFile'
- entity.Parameters = {
- '1': fileName,
- '3': 'false'
- }
-
- const data = new AttachFile()
- data.AttachIndex = '2'
- data.AttachType = 'ByteType'
- data.AttachValue = new Uint8Array(0)
- entity.AttachFiles.push(data)
-
- const tmpresult = await ServiceManager.GetInstance().Commit(entity)
- if (tmpresult && tmpresult.length === 1) {
- result = tmpresult[0].AttachValue as boolean
- }
- } catch (e) {
- throw e
- }
- return result
- }
-
- /**
- * 检查交易
- */
- static async Check(inf: CheckInfo): Promise<CheckResult | null> {
- let result: CheckResult | null = null
- try {
- const entity = new TransitEntity()
- entity.ServiceName = 'TradeService'
- entity.FuncName = 'Check'
-
- const data = new AttachFile()
- data.AttachIndex = '1'
- data.AttachType = 'TableType'
- data.AttachValue = CommonFunction.ChangeEntityToTable([inf])
- entity.AttachFiles.push(data)
-
- const tmpresult = await ServiceManager.GetInstance().Commit(entity)
- if (tmpresult && tmpresult.length === 1) {
- const rmpresult = CommonFunction.ChangeTableToEntitys<CheckResult>(
- tmpresult[0].AttachValue
- )
- if (rmpresult.length > 0) {
- result = rmpresult[0]
- }
- }
- } catch (e) {
- throw e
- }
- return result
- }
-
- /**
- * 复核操作
- */
- static async Super(
- serialId: string,
- SuperId: string,
- taskid: string,
- stat: number,
- TellerNo: string,
- tradedata: Record<string, string>,
- pagedata: Uint8Array,
- refuseReason: string
- ): Promise<boolean> {
- let result = false
- try {
- const entity = new TransitEntity()
- entity.ServiceName = 'TradeService'
- entity.FuncName = 'Super'
- entity.Parameters = {
- '1': serialId,
- '2': SuperId,
- '3': taskid,
- '4': stat.toString(),
- '5': TellerNo,
- '6': CommonFunction.ChangeDicToStr(tradedata),
- '8': refuseReason
- }
-
- const data = new AttachFile()
- data.AttachIndex = '7'
- data.AttachType = 'ByteType'
- data.AttachValue = pagedata
- entity.AttachFiles.push(data)
-
- const tmpresult = await ServiceManager.GetInstance().Commit(entity)
- if (tmpresult && tmpresult.length === 1) {
- result = tmpresult[0].AttachValue as boolean
- }
- } catch (e) {
- throw e
- }
- return result
- }
-
- /**
- * 授权验证操作
- */
- static async DoAuth(auth: string, pwd: string, lvl: string | null): Promise<AuthResult | null> {
- let result: AuthResult | null = null
- try {
- const entity = new TransitEntity()
- entity.ServiceName = 'TradeService'
- entity.FuncName = 'DoAuth'
- entity.Parameters = {
- '1': auth,
- '2': pwd,
- '3': lvl || ''
- }
-
- const tmpresult = await ServiceManager.GetInstance().Commit(entity)
- if (tmpresult && tmpresult.length === 1) {
- const rmpresult = CommonFunction.ChangeTableToEntitys<AuthResult>(
- tmpresult[0].AttachValue
- )
- if (rmpresult.length > 0) {
- result = rmpresult[0]
- }
- }
- } catch (e) {
- throw e
- }
- return result
- }
- WriteImportantLog
- }
-
-
-
-
-
- interface AskSuperInfo {
- // ... 申请复核信息字段
- }
-
- interface AskAuthInfo {
- // ... 申请授权信息字段
- }
-
- interface PageData {
- datas: Uint8Array
- dataslength: number
- // ... 其他字段
- }
-
- interface AuthTransRecords {
- // ... 授权交易记录字段
- }
|