1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import 'dart:convert';
- import 'package:fis_jsonrpc/rpc.dart';
- import 'package:vitalapp/managers/interfaces/contract_template.dart';
- import 'package:vitalapp/rpc.dart';
- import 'package:vitalapp/store/store.dart';
- import 'package:fis_common/logger/logger.dart';
- class ContractTemplateManager implements IContractTemplateManager {
- @override
- Future<ContractTemplateDTO?> getContractTemplateDetail(String code) async {
- try {
- final result =
- await rpc.vitalContractTemplate.getContractTemplateDetailAsync(
- GetContractTemplateRequest(code: code, token: Store.user.token),
- );
- return result;
- } catch (e) {
- logger.e("ContractTemplate getContractTemplateDetail error.", e);
- return null;
- }
- }
- @override
- Future<ContractTemplateDTO?> getContractTemplateDetailByKey(
- String key) async {
- try {
- final result =
- await rpc.vitalContractTemplate.getContractTemplateDetailByKeyAsync(
- GetContractTemplateByKeyRequest(
- key: key,
- token: Store.user.token,
- ),
- );
- return result;
- } catch (e) {
- logger.e("ContractTemplate getContractTemplateDetailByKey error.", e);
- return null;
- }
- }
- @override
- Future<List<ContractTemplateDTO>?> getContractTemplatePageAsync() async {
- try {
- var request = ContractTemplatePageRequest(
- token: Store.user.token,
- pageIndex: 1,
- pageSize: 10,
- );
- print(jsonEncode(request));
- final result =
- await rpc.vitalContractTemplate.getContractTemplatePageAsync(request);
- return result.pageData;
- } catch (e) {
- logger.e("ContractTemplate getContractTemplatePageAsync error.", e);
- return null;
- }
- }
- }
|