RAOrderEditViewController.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. //
  2. // RAOrderEditViewController.m
  3. // Apex And Drivers
  4. //
  5. // Created by Jack on 2018/6/4.
  6. // Copyright © 2018年 USAI. All rights reserved.
  7. //
  8. #import "RAOrderEditViewController.h"
  9. #import "RAEditInputModel.h"
  10. #import "RAEditMultInputModel.h"
  11. #import "RAEditLabelModel.h"
  12. #import "RAEditImageBaseModel.h"
  13. #import "RAEditPhotoModel.h"
  14. #import "RAEditSignatureModel.h"
  15. #import "RAProgressHUD.h"
  16. #import "ZipArchive.h"
  17. #import "AppDelegate.h"
  18. #import <CoreLocation/CoreLocation.h>
  19. @interface RAEditSectionModel : NSObject
  20. @property (nonatomic,strong) NSArray <RAEditBaseModel *> *items;
  21. @property (nonatomic,copy) NSString *title;
  22. @end
  23. @implementation RAEditSectionModel
  24. - (void)setValue:(id)value forUndefinedKey:(NSString *)key {
  25. }
  26. - (void)setItems:(NSArray<RAEditBaseModel *> *)items {
  27. NSArray *tmpItems = items;
  28. NSMutableArray *itemArr = [NSMutableArray arrayWithCapacity:items.count];
  29. for (int i = 0; i < tmpItems.count; i++) {
  30. NSDictionary *item = [tmpItems objectAtIndex:i];
  31. RAEditType type = [[item objectForKey:@"type"] intValue];
  32. switch (type) {
  33. case RAEditTypeLabel: {
  34. RAEditLabelModel *model = [RAEditLabelModel new];
  35. [model setValuesForKeysWithDictionary:item];
  36. [itemArr addObject:model];
  37. }
  38. break;
  39. case RAEditTypeInput: {
  40. RAEditInputModel *model = [RAEditInputModel new];
  41. [model setValuesForKeysWithDictionary:item];
  42. [itemArr addObject:model];
  43. }
  44. break;
  45. case RAEditTypeMultInput: {
  46. RAEditMultInputModel *model = [RAEditMultInputModel new];
  47. [model setValuesForKeysWithDictionary:item];
  48. [itemArr addObject:model];
  49. }
  50. break;
  51. case RAEditTypePhoto: {
  52. RAEditPhotoModel *model = [RAEditPhotoModel new];
  53. [model setValuesForKeysWithDictionary:item];
  54. [itemArr addObject:model];
  55. }
  56. break;
  57. case RAEditTypeSignature: {
  58. RAEditSignatureModel *model = [RAEditSignatureModel new];
  59. [model setValuesForKeysWithDictionary:item];
  60. [itemArr addObject:model];
  61. }
  62. break;
  63. default:
  64. break;
  65. }
  66. }
  67. _items = itemArr;
  68. }
  69. - (NSInteger)itemCount {
  70. return self.items.count;
  71. }
  72. - (RAEditBaseModel *)itemModelForIndex:(NSInteger)index {
  73. return [self.items objectAtIndex:index];
  74. }
  75. @end
  76. #pragma mark - View Controller
  77. @interface RAOrderEditViewController ()
  78. @property (nonatomic,strong) IBOutlet UITableView *orderEditTableView;
  79. @property (nonatomic,strong) NSMutableArray *sectionArray;
  80. @property (nonatomic,copy) NSString *photoDir;
  81. @property (nonatomic,strong) UIRefreshControl *refreshControl;
  82. @end
  83. @implementation RAOrderEditViewController
  84. + (instancetype)viewControllerFromStoryboard {
  85. RAOrderEditViewController *editVC = [[UIStoryboard storyboardWithName:@"Edit" bundle:nil] instantiateViewControllerWithIdentifier:[self storyboardID]];
  86. return editVC;
  87. }
  88. - (void)viewDidLoad {
  89. [super viewDidLoad];
  90. // Do any additional setup after loading the view.
  91. [self configureTable];
  92. [self configureNavigationBar];
  93. [self loadData];
  94. }
  95. - (void)viewWillAppear:(BOOL)animated {
  96. [super viewWillAppear:animated];
  97. [self registKeyboardListener];
  98. }
  99. - (void)viewWillDisappear:(BOOL)animated {
  100. [super viewWillDisappear:animated];
  101. [self unregistKeyboardListener];
  102. }
  103. - (void)didReceiveMemoryWarning {
  104. [super didReceiveMemoryWarning];
  105. // Dispose of any resources that can be recreated.
  106. }
  107. #pragma mark - Configure
  108. - (void)configureTable {
  109. if (@available(iOS 11.0, *)) {
  110. self.orderEditTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  111. } else {
  112. self.automaticallyAdjustsScrollViewInsets = NO;
  113. }
  114. self.orderEditTableView.tableFooterView = [UIView new];
  115. self.orderEditTableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
  116. UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
  117. [refresh addTarget:self action:@selector(refreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
  118. [self.orderEditTableView addSubview:refresh];
  119. self.refreshControl = refresh;
  120. }
  121. - (void)configureNavigationBar {
  122. UIBarButtonItem *updateItem = [[UIBarButtonItem alloc] initWithTitle:@"Update" style:UIBarButtonItemStylePlain target:self action:@selector(updateBtnClick:)];
  123. self.navigationItem.rightBarButtonItem = updateItem;
  124. }
  125. - (void)registKeyboardListener {
  126. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
  127. }
  128. - (void)unregistKeyboardListener {
  129. [[NSNotificationCenter defaultCenter] removeObserver:self];
  130. }
  131. #pragma mark - Action
  132. - (void)refreshControlValueChanged:(UIRefreshControl *)refresh {
  133. [self loadData];
  134. }
  135. #pragma mark - Getter
  136. - (NSMutableArray *)sectionArray {
  137. if (!_sectionArray) {
  138. _sectionArray = [NSMutableArray array];
  139. }
  140. return _sectionArray;
  141. }
  142. - (NSUInteger)editSectionCount {
  143. return self.sectionArray.count;
  144. }
  145. - (NSInteger)itemCountForSection:(NSInteger)section {
  146. return [[self.sectionArray objectAtIndex:section] itemCount];
  147. }
  148. - (RAEditBaseModel *)modelForIndexPath:(NSIndexPath *)indexPath {
  149. return [[self.sectionArray objectAtIndex:indexPath.section] itemModelForIndex:indexPath.row];
  150. }
  151. - (NSString *)titleForSection:(NSInteger)section {
  152. return [[self.sectionArray objectAtIndex:section] title];
  153. }
  154. - (NSIndexPath *)indexPathForCell:(UITableViewCell *)cell {
  155. return [self.orderEditTableView indexPathForCell:cell];
  156. }
  157. #pragma mark - Data
  158. - (void)loadData {
  159. if (self.loading) {
  160. return;
  161. }
  162. self.loading = YES;
  163. // show progress
  164. RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
  165. NSString *orderID = self.orderID;
  166. NSInteger actionID = self.actionID;
  167. __weak typeof(self) weakSelf = self;
  168. dispatch_async(dispatch_get_global_queue(0, 0), ^{
  169. NSDictionary *json = [RADataProvider requestUpdateOrder:orderID driverAction:actionID];
  170. dispatch_async(dispatch_get_main_queue(), ^{
  171. // dismiss progress
  172. [hud dismiss];
  173. if (weakSelf.refreshControl.isRefreshing) {
  174. [weakSelf.refreshControl endRefreshing];
  175. }
  176. if (weakSelf) {
  177. __strong typeof(weakSelf) strongSelf = weakSelf;
  178. int result = [[json objectForKey:@"result"] intValue];
  179. if (result == RESULT_TRUE) {
  180. NSArray *sectionArray = [json objectForKey:@"sections"];
  181. [strongSelf.sectionArray removeAllObjects];
  182. for (int i = 0; i < sectionArray.count; i++) {
  183. NSDictionary *section = [sectionArray objectAtIndex:i];
  184. RAEditSectionModel *model = [RAEditSectionModel new];
  185. [model setValuesForKeysWithDictionary:section];
  186. [strongSelf.sectionArray addObject:model];
  187. }
  188. [strongSelf.orderEditTableView reloadData];
  189. } else {
  190. [strongSelf.sectionArray removeAllObjects];
  191. strongSelf.orderEditTableView.contentOffset = CGPointZero;
  192. [strongSelf.orderEditTableView reloadData];
  193. // process error
  194. NSString *msg = [json objectForKey:@"err_msg"];
  195. // [strongSelf showAlert:msg];
  196. [strongSelf showAlertTilte:@"Warning" message:msg];
  197. }
  198. }
  199. self.loading = NO;
  200. });
  201. });
  202. }
  203. #pragma mark - Tap Action
  204. - (IBAction)tapToResignFirstResponder:(UITapGestureRecognizer *)sender {
  205. [self.view endEditing:YES];
  206. }
  207. - (void)updateBtnClick:(UIBarButtonItem *)sender {
  208. // show progress
  209. RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
  210. NSMutableDictionary *params = [NSMutableDictionary dictionary];
  211. if (self.orderType2) {
  212. [params setObject:self.orderType2 forKey:@"orderType2"];
  213. }
  214. if (RASingleton.sharedInstance.requiredLocation) {
  215. CLLocation *location = RASingleton.sharedInstance.currentLocation;
  216. NSString *latLon = [NSString stringWithFormat:@"%f,%f",location.coordinate.latitude,location.coordinate.longitude];
  217. [params setObject:latLon forKey:@"location"];
  218. }
  219. NSMutableArray <RAEditImageBaseModel *> *photoArr = [self prepareParams:params];
  220. __weak typeof(self) weakSelf = self;
  221. dispatch_async(dispatch_get_global_queue(0, 0), ^{
  222. NSDictionary *json = [RADataProvider submitEditOrder:params];
  223. if (weakSelf) {
  224. __strong typeof(weakSelf) strongSelf = weakSelf;
  225. int result = [[json objectForKey:@"result"] intValue];
  226. if (result == RESULT_TRUE) {
  227. BOOL requiredLocation = [[json objectForKey:@"requiredLocation"] boolValue];
  228. [RASingleton sharedInstance].requiredLocation = requiredLocation;
  229. dispatch_async(dispatch_get_main_queue(), ^{
  230. if (photoArr.count > 0) {
  231. [strongSelf syncUploadPhotos:photoArr Json:json HUD:hud];
  232. } else {
  233. [self gobackHome];
  234. }
  235. });
  236. } else {
  237. // process error
  238. dispatch_async(dispatch_get_main_queue(), ^{
  239. // dismiss progress
  240. [hud dismiss:^{
  241. NSString *msg = [json objectForKey:@"err_msg"];
  242. [strongSelf showAlertTilte:@"Warning" message:msg];
  243. }];
  244. });
  245. }
  246. }
  247. });
  248. }
  249. - (void)backgroundUploadPhoto:(NSArray<RAEditImageBaseModel *> *)photos Json:(NSDictionary *)json {
  250. AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
  251. NSDate *date = [NSDate date];
  252. NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
  253. formatter.dateFormat = @"MM/dd/YYYY HH:mm";
  254. NSString *time = [formatter stringFromDate:date];
  255. for (RAEditImageBaseModel *model in photos) {
  256. NSString *serial = [json objectForKey:model.key];
  257. if (serial.length) {
  258. NSMutableDictionary *params = [NSMutableDictionary dictionary];
  259. [params setObject:serial forKey:@"serial"];
  260. if (self.orderType2) {
  261. [params setObject:self.orderType2 forKey:@"orderType2"];
  262. }
  263. [params setObject:[RASingleton.sharedInstance encryptUser] forKey:@"name"];
  264. [params setObject:[RASingleton.sharedInstance encryptPassword] forKey:@"password"];
  265. [params setObject:@"iOS" forKey:@"platform"];
  266. NSString *photoPath = [self.photoDir.lastPathComponent stringByAppendingPathComponent:model.imageName];
  267. NSMutableDictionary *task = [@{
  268. @"order" : self.orderID,
  269. @"action" : self.actionTitle,
  270. @"name" : model.title,
  271. @"time" : time,
  272. @"url" : URL_UPLOAD,
  273. @"file" : photoPath,
  274. @"params" : params
  275. } mutableCopy];
  276. [appDelegate.uploadManager addTask:task];
  277. }
  278. }
  279. }
  280. - (void)syncUploadPhotos:(NSMutableArray<RAEditImageBaseModel *> *)photoArr Json:(NSDictionary *)json HUD:(RAProgressHUD *)hud {
  281. dispatch_async(dispatch_get_main_queue(), ^{
  282. RAProgressHUD *innerHUD = hud;
  283. if (!innerHUD) {
  284. innerHUD = [RAProgressHUD showHUDOnView:self.view]; // main queue
  285. }
  286. dispatch_async(dispatch_get_global_queue(0, 0), ^{ // network
  287. int retryCount = 0;
  288. NSMutableArray *completArr = [NSMutableArray array];
  289. // 同步上传照片
  290. for (int i = 0; i < photoArr.count; i++) {
  291. RAEditImageBaseModel *model = [photoArr objectAtIndex:i];
  292. NSString *serial = [json objectForKey:model.key];
  293. if (serial.length) {
  294. NSMutableDictionary *fileParams = [NSMutableDictionary dictionary];
  295. [fileParams setObject:serial forKey:@"serial"];
  296. if (self.orderType2) {
  297. [fileParams setObject:self.orderType2 forKey:@"orderType2"];
  298. }
  299. NSString *photoPath = [self.photoDir stringByAppendingPathComponent:model.imageName];
  300. NSDictionary *uploadJson = [RADataProvider uploadFile:photoPath parameters:fileParams];
  301. int uploadResult = [[uploadJson objectForKey:@"result"] intValue];
  302. if (uploadResult != RESULT_TRUE) { // 失败重试
  303. i--;
  304. retryCount++;
  305. if (retryCount >= 3) {
  306. break;
  307. }
  308. } else {
  309. [completArr addObject:model];
  310. retryCount = 0;
  311. // 删除文件
  312. if ([[NSFileManager defaultManager] fileExistsAtPath:photoPath]) {
  313. [[NSFileManager defaultManager] removeItemAtPath:photoPath error:nil];
  314. }
  315. }
  316. } // serial
  317. } // for
  318. // 将完成的model移除
  319. [photoArr removeObjectsInArray:completArr];
  320. __weak typeof(self) weakSelf = self;
  321. dispatch_async(dispatch_get_main_queue(), ^{
  322. [innerHUD dismiss:^{
  323. if (photoArr.count > 0) {
  324. // 上传失败,询问是否丢到后台线程上传,否则重启上传
  325. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:@"upload the photos failed,would you like to retry or do it background?" preferredStyle:UIAlertControllerStyleAlert];
  326. UIAlertAction *backgroundAction = [UIAlertAction actionWithTitle:@"Background" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  327. // 开启后台上传
  328. [weakSelf backgroundUploadPhoto:photoArr Json:json];
  329. // 返回首页
  330. [weakSelf gobackHome];
  331. }];
  332. UIAlertAction *retryAction = [UIAlertAction actionWithTitle:@"Retry" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  333. dispatch_async(dispatch_get_global_queue(0, 0), ^{
  334. [weakSelf syncUploadPhotos:photoArr Json:json HUD:nil];
  335. });
  336. }];
  337. [alertVC addAction:backgroundAction];
  338. [alertVC addAction:retryAction];
  339. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  340. } else {
  341. // 上传完成,返回到首页
  342. [weakSelf gobackHome];
  343. }
  344. }];
  345. });
  346. });
  347. });
  348. }
  349. - (void)gobackHome {
  350. [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationReloadHome object:nil];
  351. [self.navigationController popToRootViewControllerAnimated:YES];
  352. }
  353. #pragma mark - Keyboard Listener
  354. - (void)keyboardWillChangeFrame:(NSNotification *)notification {
  355. CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
  356. CGFloat screenHeight = CGRectGetHeight([UIScreen mainScreen].bounds);
  357. CGFloat keyboardHeight = screenHeight - CGRectGetMinY(end);
  358. UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, keyboardHeight, 0);
  359. self.orderEditTableView.contentInset = insets;
  360. if (self.editingIndexPath) {
  361. [self.orderEditTableView scrollToRowAtIndexPath:self.editingIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:NO];
  362. }
  363. }
  364. #pragma mark - Package Update Data
  365. - (NSString *)photoDir {
  366. if (!_photoDir) {
  367. NSString *cacheDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
  368. NSString *photoDir = [cacheDir stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_%ld_%@",self.orderID,(long)self.actionID,[NSUUID UUID].UUIDString]];
  369. NSError *error;
  370. // BOOL dirExist = YES;
  371. // for (int i = 0; i < INT_MAX; i++) {
  372. // if (i != 0) {
  373. // photoDir = [photoDir stringByAppendingString:[NSString stringWithFormat:@"(%d)",i]];
  374. // }
  375. // if (![[NSFileManager defaultManager] fileExistsAtPath:photoDir]) {
  376. // dirExist = NO;
  377. // break;
  378. // }
  379. // }
  380. [[NSFileManager defaultManager] createDirectoryAtPath:photoDir withIntermediateDirectories:YES attributes:nil error:&error];
  381. if (error) {
  382. NSLog(@"create dir %@ failed %@",photoDir,error.localizedDescription);
  383. return nil;
  384. }
  385. _photoDir = photoDir;
  386. }
  387. return _photoDir;
  388. }
  389. - (NSMutableArray <RAEditImageBaseModel *> *)prepareParams:(NSMutableDictionary *)params {
  390. if (params == nil) {
  391. return nil;
  392. }
  393. NSMutableArray <RAEditImageBaseModel *> *photoArr = [NSMutableArray array];
  394. NSString *photoDir = [self photoDir];
  395. [params setObject:self.orderID forKey:@"orderID"];
  396. [params setObject:@(self.actionID) forKey:@"actionID"];
  397. NSString* encryptu = [RASingleton sharedInstance].encryptUser;
  398. NSString* encryptp = [RASingleton sharedInstance].encryptPassword;
  399. [params setObject:encryptu forKey:@"name"];
  400. [params setObject:encryptp forKey:@"password"];
  401. [params setObject:@"iOS" forKey:@"platform"];
  402. if ([RASingleton sharedInstance].currentLocation) {
  403. [params setObject:[NSString stringWithFormat:@"%f,%f",[RASingleton sharedInstance].currentLocation.coordinate.latitude,[RASingleton sharedInstance].currentLocation.coordinate.longitude] forKey:@"location"];
  404. }
  405. for (RAEditSectionModel *section in self.sectionArray) {
  406. for (int i = 0; i < [section itemCount]; i++) {
  407. RAEditBaseModel *model = [section itemModelForIndex:i];
  408. switch (model.type) {
  409. case RAEditTypeLabel: {
  410. }
  411. break;
  412. case RAEditTypeInput: {
  413. RAEditInputModel *inputModel = (RAEditInputModel *)model;
  414. if (inputModel.key && inputModel.value.length > 0) {
  415. [params setObject:inputModel.value forKey:inputModel.key];
  416. }
  417. }
  418. break;
  419. case RAEditTypeMultInput: {
  420. RAEditMultInputModel *multInputModel = (RAEditMultInputModel *)model;
  421. if (multInputModel.key && multInputModel.value.length > 0) {
  422. [params setObject:multInputModel.value forKey:multInputModel.key];
  423. }
  424. }
  425. break;
  426. case RAEditTypePhoto:
  427. case RAEditTypeSignature: {
  428. if (photoDir) {
  429. RAEditImageBaseModel *imageModel = (RAEditImageBaseModel *)model;
  430. if (imageModel.image) {
  431. NSString *photoPath = [photoDir stringByAppendingPathComponent:imageModel.imageName];
  432. NSData *imgData = UIImageJPEGRepresentation(imageModel.image, 1.0f);
  433. if (imgData) {
  434. [imgData writeToFile:photoPath atomically:NO];
  435. [params setObject:imageModel.imageName forKey:imageModel.key];
  436. [photoArr addObject:imageModel];
  437. }
  438. }
  439. }
  440. }
  441. break;
  442. default:
  443. break;
  444. }
  445. }
  446. }
  447. return photoArr;
  448. }
  449. - (NSMutableDictionary *)preparePackage {
  450. NSMutableDictionary *params = [NSMutableDictionary dictionary];
  451. NSInteger photoCount = [self prepareParams:params].count;
  452. NSString *photoDir = [self photoDir];
  453. NSMutableDictionary *task = [@{
  454. @"order" : self.orderID,
  455. @"action" : self.actionTitle,
  456. @"url" : URL_HOST,
  457. @"noFile" : @(YES)
  458. } mutableCopy];
  459. if (photoCount > 0) {
  460. // 压缩文件
  461. NSString *zipPath = [photoDir stringByAppendingPathExtension:@".zip"];
  462. ZipArchive *zip = [[ZipArchive alloc] init];
  463. [zip CreateZipFile2:zipPath];
  464. NSArray *subPaths = [[NSFileManager defaultManager] subpathsAtPath:photoDir];
  465. for (NSString *subPath in subPaths) {
  466. NSString *fullPath = [photoDir stringByAppendingPathComponent:subPath];
  467. BOOL isDir;
  468. if([[NSFileManager defaultManager] fileExistsAtPath:fullPath isDirectory:&isDir]) {
  469. if (!isDir) {
  470. [zip addFileToZip:fullPath newname:subPath];
  471. }
  472. }
  473. }
  474. [zip CloseZipFile2];
  475. [[NSFileManager defaultManager] removeItemAtPath:photoDir error:nil];
  476. NSString *md5 = [RAUtils md5WithFile:zipPath];
  477. [params setObject:md5 forKey:@"md5"];
  478. [task setObject:@"file" forKey:zipPath.lastPathComponent];
  479. }
  480. [task setObject:params forKey:@"params"];
  481. return task;
  482. }
  483. @end