custom_analysis_edb.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. package excel
  2. import (
  3. "encoding/json"
  4. "errors"
  5. "eta_gn/eta_api/models/data_manage/excel"
  6. "eta_gn/eta_api/services/data"
  7. excelServices "eta_gn/eta_api/services/excel"
  8. "eta_gn/eta_api/utils"
  9. "fmt"
  10. "github.com/araddon/dateparse"
  11. "github.com/shopspring/decimal"
  12. "github.com/tealeg/xlsx"
  13. "github.com/xuri/excelize/v2"
  14. "strings"
  15. )
  16. // GetCustomAnalysisExcelData 获取自定义分析的表格data数据
  17. func GetCustomAnalysisExcelData(excelInfo *excel.ExcelInfo) (luckySheet excelServices.LuckySheet, err error, errMsg string) {
  18. // 查找当前excel的sheet列表
  19. sheetList, err := excel.GetAllSheetList(excelInfo.ExcelInfoId)
  20. if err != nil {
  21. errMsg = "保存失败"
  22. err = errors.New("查找当前excel的sheet列表失败,Err:" + err.Error())
  23. return
  24. }
  25. currSheetMap := make(map[string]string)
  26. for _, sheet := range sheetList {
  27. currSheetMap[sheet.SheetName] = sheet.SheetName
  28. }
  29. sheetCellDataMapList := make(map[int][]excelServices.LuckySheetCellData)
  30. // 通过excel的id获取各个sheet的单元格数据map
  31. {
  32. dataList, tmpErr := excel.GetAllSheetDataListByExcelInfoId(excelInfo.ExcelInfoId)
  33. if tmpErr != nil {
  34. err = tmpErr
  35. return
  36. }
  37. for _, cellData := range dataList {
  38. sheetDataList, ok := sheetCellDataMapList[cellData.ExcelSheetId]
  39. if !ok {
  40. sheetDataList = make([]excelServices.LuckySheetCellData, 0)
  41. }
  42. tmpSheetDataList := make([]excelServices.LuckySheetCellData, 0)
  43. err = json.Unmarshal([]byte(cellData.Data), &tmpSheetDataList)
  44. if err != nil {
  45. err = errors.New(fmt.Sprintf("解析data的配置失败,sheetId:%d,Err:%s", cellData.ExcelDataId, err.Error()))
  46. return
  47. }
  48. sheetCellDataMapList[cellData.ExcelSheetId] = append(sheetDataList, tmpSheetDataList...)
  49. }
  50. }
  51. // 转成luckySheet的数据格式
  52. luckySheet = excelServices.LuckySheet{
  53. SheetList: make([]excelServices.LuckySheetData, 0),
  54. }
  55. for _, sheet := range sheetList {
  56. var luckySheetDataConfig excelServices.LuckySheetDataConfig
  57. err = json.Unmarshal([]byte(sheet.Config), &luckySheetDataConfig)
  58. if err != nil {
  59. err = errors.New(fmt.Sprintf("解析sheet的配置失败,sheetId:%d,Err:%s", sheet.ExcelSheetId, err.Error()))
  60. return
  61. }
  62. tmpLuckySheetDataInfo := excelServices.LuckySheetData{
  63. Name: sheet.SheetName,
  64. Index: sheet.Sort,
  65. CellData: sheetCellDataMapList[sheet.ExcelSheetId],
  66. Config: luckySheetDataConfig,
  67. }
  68. luckySheet.SheetList = append(luckySheet.SheetList, tmpLuckySheetDataInfo)
  69. }
  70. return
  71. }
  72. // GenerateExcelCustomAnalysisExcel 根据自定义分析的表格data数据生成excel
  73. func GenerateExcelCustomAnalysisExcel(excelInfo *excel.ExcelInfo) (downloadFilePath string, err error, errMsg string) {
  74. luckySheet, err, errMsg := GetCustomAnalysisExcelData(excelInfo)
  75. if err != nil {
  76. return
  77. }
  78. downloadFilePath, err = luckySheet.ToExcel(false)
  79. return
  80. }
  81. // 数据集
  82. type dataStruct struct {
  83. Value float64
  84. Ok bool
  85. }
  86. // HandleEdbSequenceVal 处理日期集和数据集(获取可用的日期、数据集)
  87. func HandleEdbSequenceVal(dateSequenceVal, dataSequenceVal []string) (newDateList []string, newDataList []float64, err error, errMsg string) {
  88. newDateList = make([]string, 0)
  89. newDataList = make([]float64, 0)
  90. dataList := make([]dataStruct, 0)
  91. {
  92. for _, v := range dataSequenceVal {
  93. // 如果没有数据集,那么就过滤
  94. if v == `` {
  95. // 如果开始插入数据了,那么就需要插入不存在值
  96. dataList = append(dataList, dataStruct{
  97. Value: 0,
  98. Ok: false,
  99. })
  100. continue
  101. }
  102. v = strings.Replace(v, ",", "", -1)
  103. v = strings.Replace(v, ",", "", -1)
  104. // 过滤空格
  105. v = strings.Replace(v, " ", "", -1)
  106. var tmpVal float64
  107. if strings.Contains(v, "%") {
  108. // 百分比的数
  109. isPercentage, percentageValue := utils.IsPercentage(v)
  110. if !isPercentage {
  111. dataList = append(dataList, dataStruct{
  112. Value: 0,
  113. Ok: false,
  114. })
  115. continue
  116. }
  117. tmpValDec, tmpErr := decimal.NewFromString(percentageValue)
  118. if tmpErr != nil {
  119. dataList = append(dataList, dataStruct{
  120. Value: 0,
  121. Ok: false,
  122. })
  123. continue
  124. }
  125. tmpVal, _ = tmpValDec.Div(decimal.NewFromFloat(100)).Float64()
  126. } else {
  127. tmpValDec, tmpErr := decimal.NewFromString(v)
  128. if tmpErr != nil {
  129. dataList = append(dataList, dataStruct{
  130. Value: 0,
  131. Ok: false,
  132. })
  133. continue
  134. }
  135. tmpVal, _ = tmpValDec.Float64()
  136. }
  137. dataList = append(dataList, dataStruct{
  138. Value: tmpVal,
  139. Ok: true,
  140. })
  141. }
  142. }
  143. // 日期集
  144. dateList := make([]string, 0)
  145. {
  146. for _, v := range dateSequenceVal {
  147. // 如果没有数据集,那么就过滤
  148. if v == `` {
  149. // 如果开始插入数据了,那么就需要插入不存在值
  150. dateList = append(dateList, "")
  151. continue
  152. }
  153. // 过滤空格
  154. v = strings.Replace(v, " ", "", -1)
  155. t1, tmpErr := dateparse.ParseAny(v)
  156. if tmpErr != nil {
  157. dateList = append(dateList, "")
  158. continue
  159. }
  160. dateList = append(dateList, t1.Format(utils.FormatDate))
  161. }
  162. }
  163. lenData := len(dataList)
  164. lenDate := len(dateList)
  165. // 最小个数
  166. num := lenDate
  167. if num > lenData {
  168. num = lenData
  169. }
  170. for i := 0; i < num; i++ {
  171. date := dateList[i]
  172. tmpData := dataList[i]
  173. // 日期为空、数据为空
  174. if !tmpData.Ok || date == `` {
  175. continue
  176. }
  177. newDateList = append(newDateList, date)
  178. newDataList = append(newDataList, tmpData.Value)
  179. }
  180. return
  181. }
  182. // ResetCustomAnalysisData 数据重置的结构体
  183. type ResetCustomAnalysisData struct {
  184. EdbInfoId int
  185. DateList []string
  186. DataList []float64
  187. }
  188. // Refresh 刷新表格关联的指标信息
  189. func Refresh(excelInfo *excel.ExcelInfo, lang string) (err error, errMsg string, isSendEmail bool) {
  190. isSendEmail = true
  191. list, err := excel.GetAllExcelEdbMappingItemByExcelInfoId(excelInfo.ExcelInfoId)
  192. if err != nil {
  193. errMsg = "获取失败"
  194. err = errors.New("查找所有的mapping失败" + err.Error())
  195. return
  196. }
  197. // 没有关联指标,那么就退出吧
  198. if len(list) <= 0 {
  199. return
  200. }
  201. for k, v := range list {
  202. var tmpCalculateFormula excel.CalculateFormula
  203. err = json.Unmarshal([]byte(v.CalculateFormula), &tmpCalculateFormula)
  204. if err != nil {
  205. errMsg = "获取失败"
  206. err = errors.New(fmt.Sprintf("指标id:%d,公式转换失败,Err:%s", v.EdbInfoId, err.Error()))
  207. return
  208. }
  209. v.DateSequenceStr = tmpCalculateFormula.DateSequenceStr
  210. v.DataSequenceStr = tmpCalculateFormula.DataSequenceStr
  211. list[k] = v
  212. }
  213. luckySheet, err, errMsg := GetCustomAnalysisExcelData(excelInfo)
  214. if err != nil {
  215. err = errors.New(fmt.Sprintf("获取自定义分析Excel数据失败,Err:%s", err.Error()))
  216. return
  217. }
  218. // 获取excel表格数据
  219. xlsxFile, err := luckySheet.GetExcelData(false)
  220. if err != nil {
  221. err = errors.New(fmt.Sprintf("获取excel表格数据,Err:%s", err.Error()))
  222. return
  223. }
  224. //fmt.Println(xlsxFile)
  225. edbInfoIdList := make([]int, 0)
  226. for _, v := range list {
  227. edbInfoIdList = append(edbInfoIdList, v.EdbInfoId)
  228. // 获取对应的日期和数据列表
  229. relDateList, relDataList, tmpErr, tmpErrMsg := getDateAndDataList(v, xlsxFile)
  230. if tmpErr != nil {
  231. err = errors.New(fmt.Sprintf("《%s》获取对应的日期和数据列表,Err:%s", v.EdbName, tmpErr.Error()))
  232. errMsg = fmt.Sprintf("《%s》%s", v.EdbName, tmpErrMsg)
  233. return
  234. }
  235. if len(relDateList) <= 0 {
  236. errMsg = fmt.Sprintf("《%s》的日期序列为空", v.EdbName)
  237. err = errors.New(errMsg)
  238. return
  239. }
  240. if len(relDataList) <= 0 {
  241. errMsg = fmt.Sprintf("《%s》的数据序列为空", v.EdbName)
  242. err = errors.New(errMsg)
  243. return
  244. }
  245. //fmt.Println(v)
  246. req2 := &ResetCustomAnalysisData{
  247. EdbInfoId: v.EdbInfoId,
  248. DateList: relDateList,
  249. DataList: relDataList,
  250. }
  251. // 调用指标库去更新
  252. reqJson, tmpErr := json.Marshal(req2)
  253. if tmpErr != nil {
  254. err = errors.New(fmt.Sprintf("结构体转对象失败,Err:%s", tmpErr.Error()))
  255. return
  256. }
  257. respItem, tmpErr := data.ResetCustomAnalysisData(string(reqJson), lang)
  258. if tmpErr != nil {
  259. err = errors.New(fmt.Sprintf("调用指标库去更新,Err:%s", tmpErr.Error()))
  260. return
  261. }
  262. if respItem.Ret != 200 {
  263. errMsg = respItem.Msg
  264. err = errors.New(respItem.ErrMsg)
  265. return
  266. }
  267. }
  268. if len(edbInfoIdList) > 0 {
  269. err, _ = data.EdbInfoRefreshAllFromBaseV3(edbInfoIdList, false, true, true)
  270. }
  271. //xlsxFile.Sheet[]
  272. return
  273. }
  274. // getDateAndDataList
  275. // @Description: 获取待刷新的日期和数据
  276. // @author: Roc
  277. // @datetime 2023-12-21 15:21:14
  278. // @param excelEdbMappingItem *excel.ExcelEdbMappingItem
  279. // @param xlsxFile *xlsx.File
  280. // @return newDateList []string
  281. // @return newDataList []float64
  282. // @return err error
  283. // @return errMsg string
  284. func getDateAndDataList(excelEdbMappingItem *excel.ExcelEdbMappingItem, xlsxFile *xlsx.File) (newDateList []string, newDataList []float64, err error, errMsg string) {
  285. var dateList, dataList []string
  286. // 日期序列
  287. {
  288. sheetName, startColumnName, endColumnName, startNum, endNum, isAll, isRow, isColumn, tmpErr, tmpErrMsg := GetSheetStr(excelEdbMappingItem.DateSequenceStr)
  289. if tmpErr != nil {
  290. errMsg = tmpErrMsg
  291. err = tmpErr
  292. return
  293. }
  294. // 查找sheet页
  295. sheetInfo, ok := xlsxFile.Sheet[sheetName]
  296. if !ok {
  297. errMsg = "找不到" + sheetName
  298. err = errors.New(errMsg)
  299. return
  300. }
  301. startNum = startNum - 1
  302. endNum = endNum - 1
  303. // 选择行的数据
  304. if isRow {
  305. // 因为是选择一行的数据,所以开始行和结束行时一样的
  306. //endNum = startNum - 1
  307. // 开始列名、结束列
  308. var startColumn, endColumn int
  309. if isAll {
  310. // 结束列(其实也就是整列的个数)
  311. endColumn = len(sheetInfo.Cols) - 1
  312. } else {
  313. tmpStartColumn, tmpErr := excelize.ColumnNameToNumber(startColumnName)
  314. if tmpErr != nil {
  315. errMsg = "列名异常:" + startColumnName
  316. err = errors.New(errMsg)
  317. return
  318. }
  319. tmpEndColumn, tmpErr := excelize.ColumnNameToNumber(endColumnName)
  320. if tmpErr != nil {
  321. errMsg = "列名异常:" + endColumnName
  322. err = errors.New(errMsg)
  323. return
  324. }
  325. startColumn = tmpStartColumn - 1
  326. endColumn = tmpEndColumn - 1
  327. }
  328. // 最大列数,如果设置的超过了最大列数,那么结束列就是最大列数
  329. maxCol := len(sheetInfo.Cols)
  330. if endColumn > maxCol {
  331. endColumn = maxCol - 1
  332. }
  333. // 长度固定,避免一直申请内存空间
  334. dateList = make([]string, endColumn-startColumn+1)
  335. i := 0
  336. for currColumn := startColumn; currColumn <= endColumn; currColumn++ {
  337. currCell := sheetInfo.Cell(startNum, currColumn)
  338. if currCell == nil {
  339. errMsg = fmt.Sprintf("第%d列,第%d行数据异常", startColumn, startNum)
  340. err = errors.New(errMsg)
  341. return
  342. }
  343. //dateList = append(dateList, currCell.Value)
  344. dateList[i] = currCell.Value
  345. i++
  346. }
  347. } else if isColumn { // 选择列的数据
  348. if isAll {
  349. // 选择一整列的话,结束行得根据实际情况调整(其实也就是整个sheet有多少行)
  350. endNum = len(sheetInfo.Rows) - 1
  351. }
  352. startColumn, tmpErr := excelize.ColumnNameToNumber(startColumnName)
  353. if tmpErr != nil {
  354. errMsg = "列名异常:" + startColumnName
  355. err = errors.New(errMsg)
  356. return
  357. }
  358. startColumn = startColumn - 1
  359. // 最大行数,如果设置的超过了最大行数,那么结束行就是最大行数
  360. maxRow := len(sheetInfo.Rows)
  361. if endNum > maxRow {
  362. endNum = maxRow - 1
  363. }
  364. // 长度固定,避免一直申请内存空间
  365. dateList = make([]string, endNum-startNum+1)
  366. i := 0
  367. for currRow := startNum; currRow <= endNum; currRow++ {
  368. currCell := sheetInfo.Cell(currRow, startColumn)
  369. if currCell == nil {
  370. errMsg = fmt.Sprintf("第%d列,第%d行数据异常", startColumn, startNum)
  371. err = errors.New(errMsg)
  372. return
  373. }
  374. //dateList = append(dateList, currCell.Value)
  375. dateList[i] = currCell.Value
  376. i++
  377. }
  378. }
  379. }
  380. // 数据序列
  381. {
  382. sheetName, startColumnName, endColumnName, startNum, endNum, isAll, isRow, isColumn, tmpErr, tmpErrMsg := GetSheetStr(excelEdbMappingItem.DataSequenceStr)
  383. if tmpErr != nil {
  384. errMsg = tmpErrMsg
  385. err = tmpErr
  386. return
  387. }
  388. // 查找sheet页
  389. sheetInfo, ok := xlsxFile.Sheet[sheetName]
  390. if !ok {
  391. errMsg = "找不到" + sheetName
  392. err = errors.New(errMsg)
  393. return
  394. }
  395. startNum = startNum - 1
  396. endNum = endNum - 1
  397. // 选择行的数据
  398. if isRow {
  399. // 开始列名、结束列
  400. var startColumn, endColumn int
  401. if isAll {
  402. // 结束列(其实也就是整列的个数)
  403. endColumn = len(sheetInfo.Cols) - 1
  404. } else {
  405. tmpStartColumn, tmpErr := excelize.ColumnNameToNumber(startColumnName)
  406. if tmpErr != nil {
  407. errMsg = "列名异常:" + startColumnName
  408. err = errors.New(errMsg)
  409. return
  410. }
  411. tmpEndColumn, tmpErr := excelize.ColumnNameToNumber(endColumnName)
  412. if tmpErr != nil {
  413. errMsg = "列名异常:" + endColumnName
  414. err = errors.New(errMsg)
  415. return
  416. }
  417. startColumn = tmpStartColumn - 1
  418. endColumn = tmpEndColumn - 1
  419. }
  420. // 最大列数,如果设置的超过了最大列数,那么结束列就是最大列数
  421. maxCol := len(sheetInfo.Cols)
  422. if endColumn > maxCol {
  423. endColumn = maxCol - 1
  424. }
  425. // 长度固定,避免一直申请内存空间
  426. dataList = make([]string, endColumn-startColumn+1)
  427. i := 0
  428. for currColumn := startColumn; currColumn <= endColumn; currColumn++ {
  429. currCell := sheetInfo.Cell(startNum, currColumn)
  430. if currCell == nil {
  431. errMsg = fmt.Sprintf("第%d列,第%d行数据异常", startColumn, startNum)
  432. err = errors.New(errMsg)
  433. return
  434. }
  435. //dataList = append(dataList, currCell.Value)
  436. dataList[i] = currCell.Value
  437. i++
  438. }
  439. } else if isColumn { // 选择列的数据
  440. if isAll {
  441. // 选择一整列的话,结束行得根据实际情况调整(其实也就是整个sheet有多少行)
  442. endNum = len(sheetInfo.Rows) - 1
  443. }
  444. startColumn, tmpErr := excelize.ColumnNameToNumber(startColumnName)
  445. if tmpErr != nil {
  446. errMsg = "列名异常:" + startColumnName
  447. err = errors.New(errMsg)
  448. return
  449. }
  450. startColumn = startColumn - 1
  451. // 最大行数,如果设置的超过了最大行数,那么结束行就是最大行数
  452. maxRow := len(sheetInfo.Rows)
  453. if endNum > maxRow {
  454. endNum = maxRow - 1
  455. }
  456. // 长度固定,避免一直申请内存空间
  457. dataList = make([]string, endNum-startNum+1)
  458. i := 0
  459. for currRow := startNum; currRow <= endNum; currRow++ {
  460. currCell := sheetInfo.Cell(currRow, startColumn)
  461. if currCell == nil {
  462. errMsg = fmt.Sprintf("第%d列,第%d行数据异常", startColumn, startNum)
  463. err = errors.New(errMsg)
  464. return
  465. }
  466. //dataList = append(dataList, currCell.Value)
  467. dataList[i] = currCell.Value
  468. i++
  469. }
  470. }
  471. }
  472. //fmt.Println(dateList, dataList)
  473. //fmt.Println("日期序列结束")
  474. // 将excel中的日期、数据系列处理
  475. newDateList, newDataList, err, errMsg = HandleEdbSequenceVal(dateList, dataList)
  476. return
  477. }
  478. // GetSheetStr
  479. // @return sheetName string 用户选择的sheet名称
  480. // @return startColumnName string 用户选择的开始列名称
  481. // @return endColumnName string 用户选择的结束列名称
  482. // @return startNum int 用户选择的开始列单元格位置
  483. // @return endNum int 用户选择的结束列单元格位置
  484. // @return isAll bool 是否选择整行/列数据
  485. // @return isRow bool 是否选择行数据
  486. // @return isColumn bool 是否选择列数据
  487. // @return err error 错误信息
  488. // @return errMsg string 错误信息
  489. func GetSheetStr(sequenceStr string) (sheetName, startColumnName, endColumnName string, startNum, endNum int, isAll, isRow, isColumn bool, err error, errMsg string) {
  490. // 找出sheetName
  491. tmpList := strings.Split(sequenceStr, "!")
  492. if len(tmpList) != 2 {
  493. errMsg = "错误的公式,查找sheet异常:" + sequenceStr
  494. err = errors.New(errMsg)
  495. return
  496. }
  497. sheetName = tmpList[0]
  498. // 分离开始/结束单元格
  499. tmpList = strings.Split(tmpList[1], ":")
  500. if len(tmpList) != 2 {
  501. errMsg = "错误的公式,查找开始/结束单元格异常:" + sequenceStr
  502. err = errors.New(errMsg)
  503. return
  504. }
  505. startList := strings.Split(tmpList[0], "$")
  506. endList := strings.Split(tmpList[1], "$")
  507. lenList := len(startList)
  508. if lenList != len(endList) {
  509. errMsg = "错误的公式,开始与结束单元格异常:" + sequenceStr
  510. err = errors.New(errMsg)
  511. return
  512. }
  513. if lenList != 3 && lenList != 2 {
  514. errMsg = "错误的公式:" + sequenceStr
  515. err = errors.New(errMsg)
  516. return
  517. }
  518. startColumnName = startList[1]
  519. endColumnName = endList[1]
  520. // 长度为2的话,那说明是整行或整列
  521. if lenList == 2 {
  522. isAll = true
  523. startDeci, tmpErr1 := decimal.NewFromString(startList[1])
  524. endDeci, tmpErr2 := decimal.NewFromString(endList[1])
  525. if tmpErr1 == nil && tmpErr2 == nil {
  526. isRow = true // 正常转换的话,那么就是整行
  527. startNum = int(startDeci.IntPart())
  528. endNum = int(endDeci.IntPart())
  529. startColumnName = ``
  530. endColumnName = ``
  531. return
  532. }
  533. if tmpErr1 == nil || tmpErr2 == nil {
  534. err = errors.New("错误的公式2:" + sequenceStr)
  535. return
  536. }
  537. // 如果不能转成数字,那么就是整列
  538. isColumn = true
  539. return
  540. }
  541. // 确定行
  542. startDeci, tmpErr1 := decimal.NewFromString(startList[2])
  543. endDeci, tmpErr2 := decimal.NewFromString(endList[2])
  544. if tmpErr1 != nil && errors.Is(tmpErr1, tmpErr2) {
  545. err = errors.New("错误的公式3:" + sequenceStr)
  546. return
  547. }
  548. startNum = int(startDeci.IntPart())
  549. endNum = int(endDeci.IntPart())
  550. if startColumnName != endColumnName && startNum != endNum {
  551. errMsg = `选区不允许跨行或者跨列`
  552. err = errors.New(errMsg)
  553. }
  554. if startColumnName == endColumnName {
  555. isColumn = true // 列数据
  556. } else {
  557. isRow = true // 行数据
  558. }
  559. return
  560. }