Authored by 胡古飞

屏蔽逻辑优化

@@ -28,7 +28,8 @@ public class ForbiddenBrandsController { @@ -28,7 +28,8 @@ public class ForbiddenBrandsController {
28 testResult.put("code", 200); 28 testResult.put("code", 200);
29 testResult.put("message", "success"); 29 testResult.put("message", "success");
30 } catch (Exception e) { 30 } catch (Exception e) {
31 - testResult.put("code", 400); 31 + e.printStackTrace();
  32 + testResult.put("code", 400);
32 testResult.put("message", e.getMessage()); 33 testResult.put("message", e.getMessage());
33 } 34 }
34 return testResult; 35 return testResult;
@@ -52,7 +52,9 @@ public class ForbidenSortBrandLogicService { @@ -52,7 +52,9 @@ public class ForbidenSortBrandLogicService {
52 if (forbiddenSortBrandsMap != null) { 52 if (forbiddenSortBrandsMap != null) {
53 return; 53 return;
54 } 54 }
  55 + forbiddenSortBrandsMap = new HashMap<String, List<Integer>>();
55 List<ForbiddenSortBrand> forbiddenSortBrands = this.getForbiddenSortBrandList(); 56 List<ForbiddenSortBrand> forbiddenSortBrands = this.getForbiddenSortBrandList();
  57 + System.out.println("total forbiddenSortBrands size is " + forbiddenSortBrands.size());
56 for (ForbiddenSortBrand forbiddenSortBrand : forbiddenSortBrands) { 58 for (ForbiddenSortBrand forbiddenSortBrand : forbiddenSortBrands) {
57 String key = this.getKey(forbiddenSortBrand.getMaxSortId(), forbiddenSortBrand.getMiddleSortId(), forbiddenSortBrand.getSmallSortId()); 59 String key = this.getKey(forbiddenSortBrand.getMaxSortId(), forbiddenSortBrand.getMiddleSortId(), forbiddenSortBrand.getSmallSortId());
58 List<Integer> brandIds = forbiddenSortBrandsMap.get(key); 60 List<Integer> brandIds = forbiddenSortBrandsMap.get(key);
@@ -62,8 +64,7 @@ public class ForbidenSortBrandLogicService { @@ -62,8 +64,7 @@ public class ForbidenSortBrandLogicService {
62 } 64 }
63 brandIds.add(forbiddenSortBrand.getBrandId()); 65 brandIds.add(forbiddenSortBrand.getBrandId());
64 } 66 }
65 -  
66 - // remove from db 67 + //remove from db
67 forbiddenSortBrandMapper.deleteAll(); 68 forbiddenSortBrandMapper.deleteAll();
68 long begin = System.currentTimeMillis(); 69 long begin = System.currentTimeMillis();
69 logger.info("deleteAll forbiddenSortBrand success [cost={}]", (System.currentTimeMillis() - begin)); 70 logger.info("deleteAll forbiddenSortBrand success [cost={}]", (System.currentTimeMillis() - begin));
@@ -194,7 +195,8 @@ public class ForbidenSortBrandLogicService { @@ -194,7 +195,8 @@ public class ForbidenSortBrandLogicService {
194 long time = System.currentTimeMillis() / 1000L; 195 long time = System.currentTimeMillis() / 1000L;
195 forbiddenSortBrand.setCreateTime((int) time); 196 forbiddenSortBrand.setCreateTime((int) time);
196 results.add(forbiddenSortBrand); 197 results.add(forbiddenSortBrand);
197 - transferResult.append(maxSortId).append("-").append(middleSortId).append("-").append(smallSortId).append("-").append(brandId).append(LINE_SEPARATOR); 198 + String result = new StringBuilder(maxSortId+":"+contents[0] + "-").append(middleSortId+":"+contents[1] + "-").append(smallSortId+":"+contents[2]+ "-").append(brandId+":"+contents[3]).toString();
  199 + transferResult.append(result).append(LINE_SEPARATOR);
198 } 200 }
199 } 201 }
200 // 7、拼接数据 202 // 7、拼接数据
This diff could not be displayed because it is too large.