123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- import 'liveConsultation.m.dart';
- import 'notification.m.dart';
- import 'device.m.dart';
- enum StatisticTypeEnum {
- Number,
- Customer,
- }
- class CreateStatisticRequest extends TokenRequest{
- String? code;
- String? statisticKey;
- StatisticTypeEnum statisticType;
- String? time;
- String? statisticData;
- CreateStatisticRequest({
- this.code,
- this.statisticKey,
- this.statisticType = StatisticTypeEnum.Number,
- this.time,
- this.statisticData,
- String? token,
- }) : super(
- token: token,
- );
- factory CreateStatisticRequest.fromJson(Map<String, dynamic> map) {
- return CreateStatisticRequest(
- code: map['Code'],
- statisticKey: map['StatisticKey'],
- statisticType: StatisticTypeEnum.values.firstWhere((e) => e.index == map['StatisticType']),
- time: map['Time'],
- statisticData: map['StatisticData'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (code != null)
- map['Code'] = code;
- if (statisticKey != null)
- map['StatisticKey'] = statisticKey;
- map['StatisticType'] = statisticType.index;
- if (time != null)
- map['Time'] = time;
- if (statisticData != null)
- map['StatisticData'] = statisticData;
- return map;
- }
- }
- class StatisticDTO extends BaseDTO{
- String? code;
- String? statisticKey;
- StatisticTypeEnum statisticType;
- String? time;
- String? statisticData;
- StatisticDTO({
- this.code,
- this.statisticKey,
- this.statisticType = StatisticTypeEnum.Number,
- this.time,
- this.statisticData,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- createTime: createTime,
- updateTime: updateTime,
- );
- factory StatisticDTO.fromJson(Map<String, dynamic> map) {
- return StatisticDTO(
- code: map['Code'],
- statisticKey: map['StatisticKey'],
- statisticType: StatisticTypeEnum.values.firstWhere((e) => e.index == map['StatisticType']),
- time: map['Time'],
- statisticData: map['StatisticData'],
- createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
- updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (code != null)
- map['Code'] = code;
- if (statisticKey != null)
- map['StatisticKey'] = statisticKey;
- map['StatisticType'] = statisticType.index;
- if (time != null)
- map['Time'] = time;
- if (statisticData != null)
- map['StatisticData'] = statisticData;
- return map;
- }
- }
- class GetStatisticRequest extends TokenRequest{
- String? code;
- GetStatisticRequest({
- this.code,
- String? token,
- }) : super(
- token: token,
- );
- factory GetStatisticRequest.fromJson(Map<String, dynamic> map) {
- return GetStatisticRequest(
- code: map['Code'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (code != null)
- map['Code'] = code;
- return map;
- }
- }
- class GetStatisticByKeyRequest extends TokenRequest{
- String? key;
- String? value;
- GetStatisticByKeyRequest({
- this.key,
- this.value,
- String? token,
- }) : super(
- token: token,
- );
- factory GetStatisticByKeyRequest.fromJson(Map<String, dynamic> map) {
- return GetStatisticByKeyRequest(
- key: map['Key'],
- value: map['Value'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (key != null)
- map['Key'] = key;
- if (value != null)
- map['Value'] = value;
- return map;
- }
- }
- class StatisticPageRequest extends PageRequest{
- StatisticPageRequest({
- int pageIndex = 0,
- int pageSize = 0,
- String? token,
- }) : super(
- pageIndex: pageIndex,
- pageSize: pageSize,
- token: token,
- );
- factory StatisticPageRequest.fromJson(Map<String, dynamic> map) {
- return StatisticPageRequest(
- pageIndex: map['PageIndex'],
- pageSize: map['PageSize'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- return map;
- }
- }
- class RemoveStatisticRequest extends TokenRequest{
- String? code;
- RemoveStatisticRequest({
- this.code,
- String? token,
- }) : super(
- token: token,
- );
- factory RemoveStatisticRequest.fromJson(Map<String, dynamic> map) {
- return RemoveStatisticRequest(
- code: map['Code'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (code != null)
- map['Code'] = code;
- return map;
- }
- }
- class GetStatisticListRequest extends TokenRequest{
- List<String>? codes;
- GetStatisticListRequest({
- this.codes,
- String? token,
- }) : super(
- token: token,
- );
- factory GetStatisticListRequest.fromJson(Map<String, dynamic> map) {
- return GetStatisticListRequest(
- codes: map['Codes']?.cast<String>().toList(),
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (codes != null)
- map['Codes'] = codes;
- return map;
- }
- }
- class UpdateStatisticRequest extends TokenRequest{
- String? code;
- String? statisticKey;
- StatisticTypeEnum statisticType;
- String? time;
- String? statisticData;
- UpdateStatisticRequest({
- this.code,
- this.statisticKey,
- this.statisticType = StatisticTypeEnum.Number,
- this.time,
- this.statisticData,
- String? token,
- }) : super(
- token: token,
- );
- factory UpdateStatisticRequest.fromJson(Map<String, dynamic> map) {
- return UpdateStatisticRequest(
- code: map['Code'],
- statisticKey: map['StatisticKey'],
- statisticType: StatisticTypeEnum.values.firstWhere((e) => e.index == map['StatisticType']),
- time: map['Time'],
- statisticData: map['StatisticData'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (code != null)
- map['Code'] = code;
- if (statisticKey != null)
- map['StatisticKey'] = statisticKey;
- map['StatisticType'] = statisticType.index;
- if (time != null)
- map['Time'] = time;
- if (statisticData != null)
- map['StatisticData'] = statisticData;
- return map;
- }
- }
- class GetHomePageStatisticRequest extends TokenRequest{
- GetHomePageStatisticRequest({
- String? token,
- }) : super(
- token: token,
- );
- factory GetHomePageStatisticRequest.fromJson(Map<String, dynamic> map) {
- return GetHomePageStatisticRequest(
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- return map;
- }
- }
|