Authored by hugufei

fix RecallConfigSortBrandService

  1 +package com.yoho.search;
  2 +
  3 +import com.yoho.search.base.utils.ConvertUtils;
  4 +
  5 +import java.util.*;
  6 +
  7 +public class GenSql {
  8 +
  9 + public static void main(String[] args) {
  10 + Map<Integer, String> sortBrands = new LinkedHashMap<Integer, String>();
  11 + sortBrands.put(11, "60,144,197,208,230,232,257,261,341,342,343,361,396,482,560,630,654,710,1099,1175,1986,2362,2258,439");
  12 + sortBrands.put(16, "4,60,208,228,230,232,235,341,342,349,361,482,506,512,654,710,963,1099,1175,1557,1986,2258,3022,3390,3432,3438");
  13 + sortBrands.put(18, "27,37,62,138,144,208,230,232,450,471,479,482,506,519,536,550,644,692,710,720,1387,1752,2720,3146");
  14 + sortBrands.put(20, "108,141,208,232,257,343,443,444,447,450,471,536,657,1175,1986,2258,2420,2720,3022");
  15 + sortBrands.put(21, "27,62,138,141,144,208,230,232,341,361,469,471,479,482,506,512,536,550,677,700,710,1523,1557,2258,2420,3022,3146");
  16 +
  17 + sortBrands.put(26, "4,26,60,138,141,144,174,208,230,232,256,341,342,443,447,471,482,506,710,1099,1387,1557,1680,2224,2420,2600,3022,3476");
  18 + sortBrands.put(27, "62,138,196,208,341,354,364,471,479,496,536,677,985,1387,2258,2420,3438");
  19 + sortBrands.put(28, "60,144,145,208,230,257,342,361,396,444,450,560,710,1175,2224,2258");
  20 + sortBrands.put(31, "141,144,230,342,349,536,752,890,1082,1387,1697,2166,2912,3146,3384");
  21 + sortBrands.put(32, "141,342,524,710,882,1248,1387,1652,1697,1986,2166,2556,2912,3146,3384");
  22 +
  23 + sortBrands.put(44, "27,68,144,241,248,255,302,313,330,343,349,469,512,583,813,852,1632,2264,2836");
  24 + sortBrands.put(45, "327,469,583,674,852,1283,1363,2422,3302");
  25 + sortBrands.put(46, "144,210,239,302,327,349,583,852,963,1363,3206");
  26 + sortBrands.put(59, "129,424,708,727,783,919,993,1016,1025,1434,1474,1475,1894,2082,2132");
  27 + sortBrands.put(60, "141,144,210,361,512,795,2872,3390,3432");
  28 +
  29 + sortBrands.put(61, "129,208,210,641,877,1571,1575,1685,1870,3312");
  30 + sortBrands.put(65, "117,129,162,426,717,732,953,1424,1540,1638,2800,2806,2816,2872,3392");
  31 + sortBrands.put(226, "138,208,256,349,444,471,495,710,963,1523");
  32 + sortBrands.put(1892, "4,60,108,208,591,631,692,700,752,763,1082,1248,1387,1524,1584,2292,2840,3146");
  33 + sortBrands.put(1896, "62,138,141,341,471,710,1082,1387,1632");
  34 +
  35 + sortBrands.put(1900, "60,208,342,1512,1523,2258,3438");
  36 + sortBrands.put(1904, "60,208,342,710,752,1387,1697,2166,2720");
  37 +
  38 + String sql = "INSERT INTO `cs_recall_config_sort_brand` (`id`, `sort_id`, `brand_id`, `update_time`) VALUES (%s, %s, %s, '2018-05-08 18:11:47');";
  39 + int id = 1;
  40 + for (Map.Entry<Integer, String> entry : sortBrands.entrySet()) {
  41 + int sortId = entry.getKey();
  42 + List<Integer> brandIds = ConvertUtils.stringToIntList(entry.getValue(), ",");
  43 + Collections.sort(brandIds);
  44 + for (Integer brandId : brandIds) {
  45 + System.out.println(String.format(sql, id++, sortId,brandId ));
  46 + }
  47 + }
  48 +
  49 + }
  50 +
  51 +}
1 package com.yoho.search.recall.config; 1 package com.yoho.search.recall.config;
2 2
3 -import com.yoho.search.base.utils.ConvertUtils;  
4 import com.yoho.search.core.personalized.models.SortBrand; 3 import com.yoho.search.core.personalized.models.SortBrand;
5 import com.yoho.search.dal.model.CsRecallConfigSortBrand; 4 import com.yoho.search.dal.model.CsRecallConfigSortBrand;
6 import com.yoho.search.recall.models.personal.PagePersonalFactor; 5 import com.yoho.search.recall.models.personal.PagePersonalFactor;
@@ -44,10 +43,8 @@ class RecallConfigSortBrandService { @@ -44,10 +43,8 @@ class RecallConfigSortBrandService {
44 List<CsRecallConfigSortBrand> csRecallConfigSortBrands = csRecallConfigSortBrandIndexBaseService.queryAll(); 43 List<CsRecallConfigSortBrand> csRecallConfigSortBrands = csRecallConfigSortBrandIndexBaseService.queryAll();
45 for (CsRecallConfigSortBrand csRecallConfigSortBrand : csRecallConfigSortBrands) { 44 for (CsRecallConfigSortBrand csRecallConfigSortBrand : csRecallConfigSortBrands) {
46 Integer misort = csRecallConfigSortBrand.getSortId(); 45 Integer misort = csRecallConfigSortBrand.getSortId();
47 - List<Integer> brandIds = ConvertUtils.stringToIntList(csRecallConfigSortBrand.getBrandIds(), ",");  
48 - for (Integer brandId : brandIds) {  
49 - tempCache.add(new SortBrand(misort, brandId));  
50 - } 46 + Integer brandId = csRecallConfigSortBrand.getBrandId();
  47 + tempCache.add(new SortBrand(misort, brandId));
51 } 48 }
52 configSortBrandsCache = tempCache; 49 configSortBrandsCache = tempCache;
53 RECALL_NEW_LOGGER.info("loadConfigSortBrandsCache success,configSortBrandsCache size is[{}], cost is[{}] ", configSortBrandsCache.size(), System.currentTimeMillis() - begin); 50 RECALL_NEW_LOGGER.info("loadConfigSortBrandsCache success,configSortBrandsCache size is[{}], cost is[{}] ", configSortBrandsCache.size(), System.currentTimeMillis() - begin);