--- title: '[AI] 優化成效觀察名單系統文件筆記' disqus: hackmd --- ###### tags: `system` [AI] 優化成效觀察名單系統文件筆記 === [TOC] ## 筆記目的 了解AI優化成效觀察名單此系統的用途 ## 先備條件 1. 請在eclipse上裝入 spring tools 4 (4.1.1.0) ![](https://i.imgur.com/qhnknqb.png) 2. 利用smart import來去gitlab把專案import下Eclipse裡面 ## 執行部分 1. 須帶入argument格式: --SERVICE=AI_CAMPAIGN_UPDATE_SPREADSHEET_SERVICE ## 文件部分 ## 變數定義 1. FinalProcessCustomerMap = GAds_CustomerEntity 2. CampaignEntityMap = GAds_CampaignEntity 3. AiCampaignSettingMap = AI_OptimizationCampaign_PayloadDataBean 4. campaignReportSpreadsheetOfGoogleDriveFileMap = com.google.api.services.drive.model.File 5. CampaignPerformance_WithSegmentDate_Map = CommonPerformanceReportBean 6. aiCampaignList=從ALLIE拿到的LIST,裡面裝的都是AI_OptimizationCampaign_PayloadDataBean ### log ```java= 2021-08-13 09:11:18.468 [main] INFO c.a.a.a.AllieGoogleOptimizePerformanceObserveApplication - Starting AllieGoogleOptimizePerformanceObserveApplication using Java 1.8.0_301 on DESKTOP-SC0VR8S with PID 4380 (C:\Users\TDG_USER\git\allie-google-optimize-performance-observe2\target\classes started by TDG_USER in C:\Users\TDG_USER\git\allie-google-optimize-performance-observe2) 2021-08-13 09:11:18.471 [main] INFO c.a.a.a.AllieGoogleOptimizePerformanceObserveApplication - The following profiles are active: dev 2021-08-13 09:11:18.478 [background-preinit] INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 6.1.6.Final 2021-08-13 09:11:19.019 [main] INFO o.s.d.r.config.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2021-08-13 09:11:19.084 [main] INFO o.s.d.r.config.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 55 ms. Found 3 JPA repository interfaces. 2021-08-13 09:11:19.513 [main] INFO org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: GoogleAdsData] 2021-08-13 09:11:19.583 [main] INFO org.hibernate.Version - HHH000412: Hibernate ORM core version 5.4.32.Final 2021-08-13 09:11:19.774 [main] INFO org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {5.1.2.Final} 2021-08-13 09:11:20.047 [main] WARN com.zaxxer.hikari.HikariConfig - HikariPool-1 - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool. 2021-08-13 09:11:20.048 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting... 2021-08-13 09:11:20.291 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed. 2021-08-13 09:11:20.313 [main] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect 2021-08-13 09:11:20.960 [main] WARN org.hibernate.mapping.RootClass - HHH000038: Composite-id class does not override equals(): com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.datasource.googleadsdata.entity.pk.GAds_DailyCampaignSettingEntityPK 2021-08-13 09:11:20.960 [main] WARN org.hibernate.mapping.RootClass - HHH000039: Composite-id class does not override hashCode(): com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.datasource.googleadsdata.entity.pk.GAds_DailyCampaignSettingEntityPK 2021-08-13 09:11:20.960 [main] WARN org.hibernate.mapping.RootClass - HHH000038: Composite-id class does not override equals(): com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.datasource.googleadsdata.entity.pk.GAds_CustomerEntityPK 2021-08-13 09:11:20.960 [main] WARN org.hibernate.mapping.RootClass - HHH000039: Composite-id class does not override hashCode(): com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.datasource.googleadsdata.entity.pk.GAds_CustomerEntityPK 2021-08-13 09:11:20.961 [main] WARN org.hibernate.mapping.RootClass - HHH000038: Composite-id class does not override equals(): com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.datasource.googleadsdata.entity.pk.GAds_CampaignEntityPK 2021-08-13 09:11:20.961 [main] WARN org.hibernate.mapping.RootClass - HHH000039: Composite-id class does not override hashCode(): com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.datasource.googleadsdata.entity.pk.GAds_CampaignEntityPK 2021-08-13 09:11:21.344 [main] INFO o.h.e.t.jta.platform.internal.JtaPlatformInitiator - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2021-08-13 09:11:21.355 [main] INFO o.s.orm.jpa.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'GoogleAdsData' 2021-08-13 09:11:22.287 [main] INFO c.a.a.a.AllieGoogleOptimizePerformanceObserveApplication - Started AllieGoogleOptimizePerformanceObserveApplication in 4.486 seconds (JVM running for 5.254) 2021-08-13 09:11:22.289 [main] INFO c.a.a.a.AllieGoogleOptimizePerformanceObserveApplication - run() start 2021-08-13 09:11:22.290 [main] INFO c.a.a.a.t.SpringbootApplicationArgumentsToolkit - com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.toolkit.SpringbootApplicationArgumentsToolkit processArguments() start... 2021-08-13 09:11:22.290 [main] INFO c.a.a.a.t.SpringbootApplicationArgumentsToolkit - # NonOptionArgs size: 0 2021-08-13 09:11:22.291 [main] INFO c.a.a.a.t.SpringbootApplicationArgumentsToolkit - # OptionArgs size: 1 2021-08-13 09:11:22.291 [main] INFO c.a.a.a.t.SpringbootApplicationArgumentsToolkit - ## Option Args: SERVICE = AI_CAMPAIGN_UPDATE_SPREADSHEET_SERVICE 2021-08-13 09:11:22.292 [main] INFO c.a.a.a.t.SpringbootApplicationArgumentsToolkit - ## Source Args: --SERVICE=AI_CAMPAIGN_UPDATE_SPREADSHEET_SERVICE 2021-08-13 09:11:22.292 [main] INFO c.a.a.a.t.SpringbootApplicationArgumentsToolkit - com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.toolkit.SpringbootApplicationArgumentsToolkit processArguments() return... 2021-08-13 09:11:22.292 [main] INFO c.a.a.a.AllieGoogleOptimizePerformanceObserveApplication - Execute: AI_CAMPAIGN_UPDATE_SPREADSHEET_SERVICE...Start 2021-08-13 09:11:22.292 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - [AI] CPV優化成效觀察名單功能已啟動.... 2021-08-13 09:11:22.603 [main] INFO c.a.a.a.g.agent.GoogleSheetsAuthorizedServiceAgent - TOKENS_DIRECTORY_PATH: C:\Users\TDG_USER\git\allie-google-optimize-performance-observe2\GoogleSheetsTokens 2021-08-13 09:11:22.652 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - ========開始讀取 Spreadsheet [AI] 優化成效觀察名單=========== 2021-08-13 09:11:24.236 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - <==============GoogleSpreadsheet_SettingTable_DataBean============> ==> rowIndex: 2 ==> customerId: 5066148468 ==> campaignId: 1981944685 ==> status: true ==> startDate: ==> endDate: ==> baselineDate: 2019-06-19 ==> processResult: OK ==> lastUpdateTime: 2021-08-09 11:32:26 ==> spreadsheetURL: https://docs.google.com/spreadsheets/d/1PGnVFk4HFQjijLF6BV9UdLu2Lr2w_HdYMHyFWnkWFqA ==> note: CPA 2021-08-13 09:11:24.237 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - <==============GoogleSpreadsheet_SettingTable_DataBean============> ==> rowIndex: 3 ==> customerId: 7290017129 ==> campaignId: 11563485006 ==> status: true ==> startDate: ==> endDate: ==> baselineDate: 2020-12-09 ==> processResult: OK ==> lastUpdateTime: 2021-08-09 11:33:05 ==> spreadsheetURL: https://docs.google.com/spreadsheets/d/1fFUeWS76pDA1WsXP9SdwlwDqeIh9nCdfMfxq2hYPsNY ==> note: CPV 2021-08-13 09:11:24.238 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - <==============GoogleSpreadsheet_SettingTable_DataBean============> ==> rowIndex: 4 ==> customerId: 4684471857 ==> campaignId: 12546817340 ==> status: true ==> startDate: ==> endDate: ==> baselineDate: 2021-03-18 ==> processResult: OK ==> lastUpdateTime: 2021-08-09 11:33:42 ==> spreadsheetURL: https://docs.google.com/spreadsheets/d/13vhi_f3Bl2-XrpsIwUDwWQ4GMx7LagSh4EzQ_aCL1b8 ==> note: CPC 2021-08-13 09:11:24.238 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - ========開始掃描讀取(CPC/CPA/CPV)資料夾底下已存在的Spreadsheet檔案=========== 2021-08-13 09:11:24.247 [main] INFO c.a.a.a.g.agent.GoogleDriveAuthorizedServiceAgent - TOKENS_DIRECTORY_PATH: C:\Users\TDG_USER\git\allie-google-optimize-performance-observe2\GoogleDriveTokens 2021-08-13 09:11:24.255 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - processGoogleDriveFile start... 2021-08-13 09:11:24.261 [main] INFO c.a.a.a.googledrive.agent.GoogleDriveSearchAgent - Q: ('1UJVu6LD29XKkLBg4zmOevmgGzqOgD28H' in parents) and (trashed = false) and (visibility != 'limited') 2021-08-13 09:11:24.764 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - [1UJVu6LD29XKkLBg4zmOevmgGzqOgD28H]取得資料夾底下所有檔案資源 ---> total get 1 筆. 2021-08-13 09:11:24.765 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - [1] [CPC]468-447-1857(TWD)_12546817340_通用字 (13vhi_f3Bl2-XrpsIwUDwWQ4GMx7LagSh4EzQ_aCL1b8) [application/vnd.google-apps.spreadsheet] 2021-08-13 09:11:24.765 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - porcessGoogleDriveFile end... 2021-08-13 09:11:24.765 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - processGoogleDriveFile start... 2021-08-13 09:11:24.765 [main] INFO c.a.a.a.googledrive.agent.GoogleDriveSearchAgent - Q: ('1Tw3mjAc6sUGOfeBPEIkaaD6XnnvIlkQN' in parents) and (trashed = false) and (visibility != 'limited') 2021-08-13 09:11:25.218 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - [1Tw3mjAc6sUGOfeBPEIkaaD6XnnvIlkQN]取得資料夾底下所有檔案資源 ---> total get 1 筆. 2021-08-13 09:11:25.218 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - [1] [CPV]729-001-7129(TWD)_11563485006_[影片購物廣告]-[寶拉珍選]-[繁中]-[台灣] 11/6 (1fFUeWS76pDA1WsXP9SdwlwDqeIh9nCdfMfxq2hYPsNY) [application/vnd.google-apps.spreadsheet] 2021-08-13 09:11:25.218 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - porcessGoogleDriveFile end... 2021-08-13 09:11:25.218 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - processGoogleDriveFile start... 2021-08-13 09:11:25.218 [main] INFO c.a.a.a.googledrive.agent.GoogleDriveSearchAgent - Q: ('1urXOo43-4GB3BPB2Md8AdKPmX_T3ZRcB' in parents) and (trashed = false) and (visibility != 'limited') 2021-08-13 09:11:25.672 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - [1urXOo43-4GB3BPB2Md8AdKPmX_T3ZRcB]取得資料夾底下所有檔案資源 ---> total get 1 筆. 2021-08-13 09:11:25.673 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - [1] [CPA]506-614-8468(TWD)_1981944685_搜尋再行銷 (1PGnVFk4HFQjijLF6BV9UdLu2Lr2w_HdYMHyFWnkWFqA) [application/vnd.google-apps.spreadsheet] 2021-08-13 09:11:25.673 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - porcessGoogleDriveFile end... 2021-08-13 09:11:25.674 [main] INFO c.a.a.a.r.a.a.GoogleAdsCommandLineArgsProcessAgency - run_GoogleAdsCommandLineArgsProcess Start.... 2021-08-13 09:11:25.674 [main] INFO c.a.a.a.r.a.a.GoogleAdsCommandLineArgsProcessAgency - run_GoogleAdsCommandLineArgsProcess args: ALLMCC 2021-08-13 09:11:25.674 [main] INFO c.a.a.a.r.a.a.GoogleAdsCommandLineArgsProcessAgency - command: 'ALLMCC' will Adopted 2021-08-13 09:11:27.256 [main] INFO c.a.a.a.b.s.AICampaignUpdateSpreadsheetFigureService - Total Assign 7139 筆帳戶進行偵測... 2021-08-13 09:11:27.257 [main] INFO c.a.a.a.allie.agent.AIAllieService - getAiCampaignByAiRestfulService()....start 2021-08-13 09:11:27.260 [main] INFO c.a.a.a.toolkit.RestfulServiceRequestJobAgent - [sendRequestJob] Parameter: platform=Google 2021-08-13 09:11:27.260 [main] INFO c.a.a.a.toolkit.RestfulServiceRequestJobAgent - [sendRequestJob] URL With Parameter: http://ai-ext.allproducts.com:8080/Allie/api/optimizationList?platform=Google ``` ### 敘述解析 1. **AllieGoogleOptimizePerformanceObserveApplication**(主程式)會去 implement ApplicationRunner(spring boot 內建的interface),然後引入會用到的各個service 當然最重要的是利用參數AI_CAMPAIGN_UPDATE_SPREADSHEET_SERVICE來進行主要的服務。 2. 之後把注意力放到**AICampaignUpdateSpreadsheetFigureService**這個service中,首先會去先跟**GoogleSheetsAuthorizedServiceAgent**要他的google sheet token(將此份檔案放在 `/src/main/resources/GoogleSheets_credentials.json)`,並且建立好service 3. 接下來會去讀所謂的主表(設定表),執行*convertSourceSpreadsheetRawDataToPOJOBean*這樣便可以將主表上的資訊轉成javapojobean,這裡會去印出主表的相關資訊 ```java=223 for(GoogleSpreadsheet_SettingTable_DataBean each : GoogleSpreadsheet_SettingTable_DataBeanList) { rowIndex++; each.setRowIndex(rowIndex); logger.info(each.printNodeInfo()); } ``` 4. 印完相關資訊後便是 開始掃描讀取(CPC/CPA/CPV)資料夾底下已存在的Spreadsheet檔案, 這裡我們一樣需要先去呼叫GoogleDriveAuthorizedServiceAgent(裡面一樣有token,drive token `/src/main/resources/GoogleDrive_credentials.json` ) ```java=229 logger.info("========開始掃描讀取(CPC/CPA/CPV)資料夾底下已存在的Spreadsheet檔案==========="); googleDriveAuthedService = GoogleDriveAuthorizedServiceAgent.getAuthorizedDriveService(); List<com.google.api.services.drive.model.File> CPC_TypeReportOfGoogleDriveFiles = getGoogleDriveFileOfFolder(googleDriveAuthedService, serviceProperties.getAICampaignSpreadsheetFigureGoogleDriveCPCRootFolder()); List<com.google.api.services.drive.model.File> CPV_TypeReportOfGoogleDriveFiles = getGoogleDriveFileOfFolder(googleDriveAuthedService, serviceProperties.getAICampaignSpreadsheetFigureGoogleDriveCPVRootFolder()); List<com.google.api.services.drive.model.File> CPA_TypeReportOfGoogleDriveFiles = getGoogleDriveFileOfFolder(googleDriveAuthedService, serviceProperties.getAICampaignSpreadsheetFigureGoogleDriveCPARootFolder()); campaignReportSpreadsheetOfGoogleDriveFileMap.putAll(convertDrvieFileListIntoCampaignViewMap(CPC_TypeReportOfGoogleDriveFiles)); campaignReportSpreadsheetOfGoogleDriveFileMap.putAll(convertDrvieFileListIntoCampaignViewMap(CPV_TypeReportOfGoogleDriveFiles)); campaignReportSpreadsheetOfGoogleDriveFileMap.putAll(convertDrvieFileListIntoCampaignViewMap(CPA_TypeReportOfGoogleDriveFiles)); FinalProcessCustomerMap = googleAdsCommandLineArgsProcessAgency.run_GoogleAdsCommandLineArgsProcess(); ``` 這裡你會發現他利用了`serviceProperties`去拿到了位於`service-dev-admin.properties`的google drive資料夾的UID參數(使用value annotation來完成) 5. 接下來會拿到CPC_TypeReportOfGoogleDriveFiles等 ``` FinalProcessCustomerMap = googleAdsCommandLineArgsProcessAgency.run_GoogleAdsCommandLineArgsProcess(); if(FinalProcessCustomerMap.size() > 0) { logger.info("Total Assign " + FinalProcessCustomerMap.size() + " 筆帳戶進行偵測..."); ``` ``` campaignReportSpreadsheetOfGoogleDriveFileMap ??? HashMap<Long, com.google.api.services.drive.model.File> FinalProcessCustomerMap ??? HashMap<Long, GAds_CustomerEntity> ``` 6. 開始去跟allie要資料 ```java=244 List<String> selectAIStatus = new ArrayList<String>(); List<AI_OptimizationCampaign_PayloadDataBean> aiCampaignList = aIAllieService.getAiCampaignByAiRestfulService(serviceProperties.getaIAllieServiceOptimizationList(), selectAIStatus, aIAllieService.PLATFORM_GOOGLE, AIAllieService.AI_SOURCETYPE_ALL); logger.info("Total get " + aiCampaignList.size() + " 筆 AI Campaign by aIOptimizationService..."); ``` ``` private HashMap<Long, AI_OptimizationCampaign_PayloadDataBean> migrateAiCampaignListIntoCampaignViewMap(List<AI_OptimizationCampaign_PayloadDataBean> input) { //key = CampaignId HashMap<Long, AI_OptimizationCampaign_PayloadDataBean> result = new HashMap<Long, AI_OptimizationCampaign_PayloadDataBean>(); for(AI_OptimizationCampaign_PayloadDataBean eachAICampaign : input) { result.put(eachAICampaign.getCampaignId(), eachAICampaign); }//End for--eachAICampaign return result; }//End function ``` 7. doreport ``` AiCampaignSettingMap = migrateAiCampaignListIntoCampaignViewMap(aiCampaignList); doReportRun(GoogleSpreadsheet_SettingTable_DataBeanList); //後續會用到AiCampaignSettingMap ``` ## 小技巧 ```java= private static Drive googleDriveAuthedService = null; googleDriveAuthedService = GoogleDriveAuthorizedServiceAgent.getAuthorizedDriveService(); ``` > 可以先宣告`googleDriveAuthedService`為 `null`再利用 `getAuthorizedDriveService()`將它變得可以使用。 > 另外你會發現`GoogleDriveAuthorizedServiceAgent`裡面的function都會設計成`static`方便你去呼叫 line:239 GoogleAdsCommandLineArgsProcessAgency會去執行run_GoogleAdsCommandLineArgsProcess來拿到 7116 筆帳戶進行偵測 RestfulServiceRequestJobAgent line:248 Total get 7920 筆 AI Campaign by aIOptimizationService... c.a.a.a.allie.agent.AIAllieService c.a.a.a.toolkit.RestfulServiceRequestJobAgent ## 問題集結 1. 跟Allie要資料的資料不是都存在DB,幹嘛不要直接跟DB拿資料 ANS:因為這樣未來如果有其他人也想要同樣的資料,也可以跟Allie拿 2. Campaign的數量是不是理論上要比帳戶多 ANS:理論上是,但是不要這樣想,因為不是每個跟Allie要的Campaign都有被MCC控管 3. pringnodeinfo有快捷鍵嗎 ANS:沒有,那是手刻的,現在也不建議這樣做,建議都用`log.info` ## v8 改版後的問題 ### 改版要做的事 1. 確認自己本機端已經是最新的狀態 2. 更改POM 檔換 google-ads 3. 調整code 換到v8 java google-ad library 4. 測試環境測試 5. 打包 6. Production released ### 改版方法 1. 將pom.xml的版本從v7換成v8,但是觀看pom.xml裡面的數字是12.0.0所以要自己去找對應的數字,查詢後發現v8應該為15.0.0 3. 將所有的**import XXXX v7 ** 替換成 **import XXXX v8 **,這個可以用replacewith來替換,serach功能 4. 有小紅點的地方Eclipse可以直接點,就可以看出錯誤 ### 錯誤代碼 ```java Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2021-08-26 10:41:03.665 [main] ERROR org.springframework.boot.SpringApplication - Application run failed java.lang.Error: Unresolved compilation problem: Type mismatch: cannot convert from com.google.ads.googleads.v8.services.GoogleAdsServiceClient to com.google.ads.googleads.v7.services.GoogleAdsServiceClient at com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.googleads.agent.SearchGoogleAdsRequestAgent.initialGoogleAdsServiceClient(SearchGoogleAdsRequestAgent.java:193) at com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.googleads.agent.SearchGoogleAdsRequestAgent.<init>(SearchGoogleAdsRequestAgent.java:167) at com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.googleads.agent.PreAllocateSearchGoogleAdsRequestAgent.deliverBuildupSearchGoogleAdsRequestAgentByManagerId(PreAllocateSearchGoogleAdsRequestAgent.java:52) at com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.googleads.agent.PreAllocateSearchGoogleAdsRequestAgent.giveMeAllMCCPreAllocateSearchGoogleAdsRequestAgent(PreAllocateSearchGoogleAdsRequestAgent.java:24) at com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.business.service.AICampaignUpdateSpreadsheetFigureService.doReportRun(AICampaignUpdateSpreadsheetFigureService.java:270) at com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.business.service.AICampaignUpdateSpreadsheetFigureService.activateDetectProcess(AICampaignUpdateSpreadsheetFigureService.java:258) at com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.AllieGoogleOptimizePerformanceObserveApplication.run(AllieGoogleOptimizePerformanceObserveApplication.java:66) at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:782) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:772) at org.springframework.boot.SpringApplication.run(SpringApplication.java:345) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) at com.allproduct.aicenter.alliegoogleoptimizeperformanceobserve.AllieGoogleOptimizePerformanceObserveApplication.main(AllieGoogleOptimizePerformanceObserveApplication.java:45) 2021-08-26 10:41:03.669 [main] INFO o.s.orm.jpa.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'GoogleAdsData' 2021-08-26 10:41:03.670 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated... 2021-08-26 10:41:03.696 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed. ``` ### 錯誤成因 ```java Type mismatch: cannot convert from com.google.ads.googleads.v8.services.GoogleAdsServiceClient to com.google.ads.googleads.v7.services.GoogleAdsServiceClient ``` ### 錯誤解法 [Google改版的更新](https://developers.google.com/google-ads/api/docs/version-migration) 首先將所有的com.google.ads.googleads.v7換成com.google.ads.googleads.v8 接著根據 > The CallOnlyAdInfo has been replaced with CallAdInfo. 將相關的物件替換他的type