Authored by wangnan

fix

@@ -23,498 +23,498 @@ import java.util.stream.Collectors; @@ -23,498 +23,498 @@ import java.util.stream.Collectors;
23 */ 23 */
24 @Component 24 @Component
25 public class TblLogicService { 25 public class TblLogicService {
26 - private final Logger logger = LoggerFactory.getLogger(ProductIndexLogicService.class); 26 + private final Logger logger = LoggerFactory.getLogger(ProductIndexLogicService.class);
27 27
28 - @Autowired  
29 - private TblProductService tblProductService;  
30 - @Autowired  
31 - private TblBrandService tblBrandService;  
32 - @Autowired  
33 - private TblProductSkcService tblProductSkcService;  
34 - @Autowired  
35 - private TblProductSkuService tblProductSkuService;  
36 - @Autowired  
37 - private TblSortService tblSortService;  
38 - @Autowired  
39 - private TblSiteService tblSiteService;  
40 - @Autowired  
41 - private TblImgUrlLogicService tblImgUrlLogicService; 28 + @Autowired
  29 + private TblProductService tblProductService;
  30 + @Autowired
  31 + private TblBrandService tblBrandService;
  32 + @Autowired
  33 + private TblProductSkcService tblProductSkcService;
  34 + @Autowired
  35 + private TblProductSkuService tblProductSkuService;
  36 + @Autowired
  37 + private TblSortService tblSortService;
  38 + @Autowired
  39 + private TblSiteService tblSiteService;
  40 + @Autowired
  41 + private TblImgUrlLogicService tblImgUrlLogicService;
42 42
43 - /**  
44 - * 全量构建  
45 - *  
46 - * @param start  
47 - * @param limit  
48 - * @return  
49 - */  
50 - public List<ProductIndexBO> getProductIndex(int start, int limit) {  
51 - long begin = System.currentTimeMillis();  
52 - List<TblProduct> tblProducts = tblProductService.getPageLists(start, limit);  
53 - if (CollectionUtils.isEmpty(tblProducts)) {  
54 - return new ArrayList<ProductIndexBO>();  
55 - }  
56 - List<ProductIndexBO> productIndexBOS = buildProductIndex(tblProducts);  
57 - logger.info("tblProduct->productIndex构建完成,[size:{}],[cost: {}]", productIndexBOS.size(), System.currentTimeMillis() - begin);  
58 - return productIndexBOS;  
59 - } 43 + /**
  44 + * 全量构建
  45 + *
  46 + * @param start
  47 + * @param limit
  48 + * @return
  49 + */
  50 + public List<ProductIndexBO> getProductIndex(int start, int limit) {
  51 + long begin = System.currentTimeMillis();
  52 + List<TblProduct> tblProducts = tblProductService.getPageLists(start, limit);
  53 + if (CollectionUtils.isEmpty(tblProducts)) {
  54 + return new ArrayList<ProductIndexBO>();
  55 + }
  56 + List<ProductIndexBO> productIndexBOS = buildProductIndex(tblProducts);
  57 + logger.info("tblProduct->productIndex构建完成,[size:{}],[cost: {}]", productIndexBOS.size(), System.currentTimeMillis() - begin);
  58 + return productIndexBOS;
  59 + }
60 60
61 - /**  
62 - * 增量构建  
63 - *  
64 - * @param skns  
65 - * @return  
66 - */  
67 - public List<ProductIndexBO> getProductIndex(List<Integer> skns) {  
68 - long begin = System.currentTimeMillis();  
69 - List<TblProduct> tblProducts = tblProductService.getByskns(skns);  
70 - if (CollectionUtils.isEmpty(tblProducts)) {  
71 - return new ArrayList<ProductIndexBO>();  
72 - }  
73 - List<ProductIndexBO> productIndexBOS = buildProductIndex(tblProducts);  
74 - logger.info("tblProduct->productIndex构建完成,[size:{}],[cost: {}]", productIndexBOS.size(), System.currentTimeMillis() - begin);  
75 - return productIndexBOS;  
76 - } 61 + /**
  62 + * 增量构建
  63 + *
  64 + * @param skns
  65 + * @return
  66 + */
  67 + public List<ProductIndexBO> getProductIndex(List<Integer> skns) {
  68 + long begin = System.currentTimeMillis();
  69 + List<TblProduct> tblProducts = tblProductService.getByskns(skns);
  70 + if (CollectionUtils.isEmpty(tblProducts)) {
  71 + return new ArrayList<ProductIndexBO>();
  72 + }
  73 + List<ProductIndexBO> productIndexBOS = buildProductIndex(tblProducts);
  74 + logger.info("tblProduct->productIndex构建完成,[size:{}],[cost: {}]", productIndexBOS.size(), System.currentTimeMillis() - begin);
  75 + return productIndexBOS;
  76 + }
77 77
78 - /**  
79 - * 构建ProductIndexBO  
80 - *  
81 - * @param tblProducts  
82 - * @return  
83 - */  
84 - public List<ProductIndexBO> buildProductIndex(List<TblProduct> tblProducts) {  
85 - List<ProductIndexBO> productIndexBOs = new ArrayList<>();  
86 - // 获取brandMap  
87 - Map<Integer, TblBrand> brandMap = getBrandMap(tblProducts);  
88 - // 获取siteMap  
89 - Map<Integer, TblSite> siteMap = getSiteMap(tblProducts);  
90 - // 获取tblProductSkcMap  
91 - Map<Integer, List<TblProductSkc>> tblProductSkcMap = getTblProductSkcMap(tblProducts);  
92 - // 获取tblProductSkuMap  
93 - Map<Integer, List<TblProductSku>> tblProductSkuMap = getTblProductSkuMap(tblProducts);  
94 - // 获取sortMap  
95 - Map<Integer, String> sortMap = getSortMap();  
96 - // 生成ProductIndexBO  
97 - for (TblProduct tblProduct : tblProducts) {  
98 - ProductIndexBO productIndexBO = new ProductIndexBO();  
99 - // 全球购标识  
100 - productIndexBO.setIsGlobal("Y");  
101 - // 名称  
102 - productIndexBO.setProductName(tblProduct.getProductName());  
103 - // 特殊处理id,productId,productSkn  
104 - productIndexBO.setId(tblProduct.getProductSkn() * (-1));  
105 - productIndexBO.setProductId(tblProduct.getProductSkn());  
106 - productIndexBO.setProductSkn(tblProduct.getProductSkn());  
107 - // 处理品牌  
108 - TblBrand tblBrand = brandMap.get(tblProduct.getBrandId());  
109 - productIndexBO = processBrand(productIndexBO, tblBrand);  
110 - // 品类  
111 - productIndexBO = processSort(productIndexBO, sortMap, tblProduct);  
112 - // showStatus处理逻辑  
113 - productIndexBO = processShowStatus(productIndexBO, siteMap, tblProduct, tblBrand);  
114 - // 根据skc拼装 Goods color  
115 - productIndexBO = processGoods(tblProductSkcMap, productIndexBO, tblProduct);  
116 - // 根据sku拼装size  
117 - productIndexBO = processSize(tblProductSkuMap, productIndexBO, tblProduct);  
118 - // 其他字段  
119 - productIndexBO = processSimpleField(productIndexBO, tblProduct);  
120 - productIndexBOs.add(productIndexBO);  
121 - }  
122 - return productIndexBOs;  
123 - } 78 + /**
  79 + * 构建ProductIndexBO
  80 + *
  81 + * @param tblProducts
  82 + * @return
  83 + */
  84 + public List<ProductIndexBO> buildProductIndex(List<TblProduct> tblProducts) {
  85 + List<ProductIndexBO> productIndexBOs = new ArrayList<>();
  86 + // 获取brandMap
  87 + Map<Integer, TblBrand> brandMap = getBrandMap(tblProducts);
  88 + // 获取siteMap
  89 + Map<Integer, TblSite> siteMap = getSiteMap(tblProducts);
  90 + // 获取tblProductSkcMap
  91 + Map<Integer, List<TblProductSkc>> tblProductSkcMap = getTblProductSkcMap(tblProducts);
  92 + // 获取tblProductSkuMap
  93 + Map<Integer, List<TblProductSku>> tblProductSkuMap = getTblProductSkuMap(tblProducts);
  94 + // 获取sortMap
  95 + Map<Integer, String> sortMap = getSortMap();
  96 + // 生成ProductIndexBO
  97 + for (TblProduct tblProduct : tblProducts) {
  98 + ProductIndexBO productIndexBO = new ProductIndexBO();
  99 + // 全球购标识
  100 + productIndexBO.setIsGlobal("Y");
  101 + // 名称
  102 + productIndexBO.setProductName(tblProduct.getProductName());
  103 + // 特殊处理id,productId,productSkn
  104 + productIndexBO.setId(tblProduct.getProductSkn() * (-1));
  105 + productIndexBO.setProductId(tblProduct.getProductSkn());
  106 + productIndexBO.setProductSkn(tblProduct.getProductSkn());
  107 + // 处理品牌
  108 + TblBrand tblBrand = brandMap.get(tblProduct.getBrandId());
  109 + productIndexBO = processBrand(productIndexBO, tblBrand);
  110 + // 品类
  111 + productIndexBO = processSort(productIndexBO, sortMap, tblProduct);
  112 + // showStatus处理逻辑
  113 + productIndexBO = processShowStatus(productIndexBO, siteMap, tblProduct, tblBrand);
  114 + // 根据skc拼装 Goods color
  115 + productIndexBO = processGoods(tblProductSkcMap, productIndexBO, tblProduct);
  116 + // 根据sku拼装size
  117 + productIndexBO = processSize(tblProductSkuMap, productIndexBO, tblProduct);
  118 + // 其他字段
  119 + productIndexBO = processSimpleField(productIndexBO, tblProduct);
  120 + productIndexBOs.add(productIndexBO);
  121 + }
  122 + return productIndexBOs;
  123 + }
124 124
125 - /**  
126 - * 获取品牌Map  
127 - *  
128 - * @param tblProducts  
129 - * @return  
130 - */  
131 - private Map<Integer, TblBrand> getBrandMap(List<TblProduct> tblProducts) {  
132 - Map<Integer, TblBrand> brandMap = new HashMap<>();  
133 - List<Integer> brandIds = tblProducts.stream().map(TblProduct::getBrandId).collect(Collectors.toList());  
134 - if (CollectionUtils.isNotEmpty(brandIds)) {  
135 - List<TblBrand> tblBrands = tblBrandService.selectByIds(brandIds);  
136 - if (CollectionUtils.isNotEmpty(tblBrands)) {  
137 - brandMap = tblBrands.stream().parallel().collect(Collectors.toMap(TblBrand::getBrandId, (p) -> p));  
138 - }  
139 - }  
140 - return brandMap;  
141 - } 125 + /**
  126 + * 获取品牌Map
  127 + *
  128 + * @param tblProducts
  129 + * @return
  130 + */
  131 + private Map<Integer, TblBrand> getBrandMap(List<TblProduct> tblProducts) {
  132 + Map<Integer, TblBrand> brandMap = new HashMap<>();
  133 + List<Integer> brandIds = tblProducts.stream().map(TblProduct::getBrandId).collect(Collectors.toList());
  134 + if (CollectionUtils.isNotEmpty(brandIds)) {
  135 + List<TblBrand> tblBrands = tblBrandService.selectByIds(brandIds);
  136 + if (CollectionUtils.isNotEmpty(tblBrands)) {
  137 + brandMap = tblBrands.stream().parallel().collect(Collectors.toMap(TblBrand::getBrandId, (p) -> p));
  138 + }
  139 + }
  140 + return brandMap;
  141 + }
142 142
143 - /**  
144 - * 获取SiteMap  
145 - *  
146 - * @param tblProducts  
147 - * @return  
148 - */  
149 - private Map<Integer, TblSite> getSiteMap(List<TblProduct> tblProducts) {  
150 - Map<Integer, TblSite> siteMap = new HashMap<>();  
151 - List<Integer> siteId = tblProducts.stream().map(TblProduct::getSiteId).collect(Collectors.toList());  
152 - if (CollectionUtils.isNotEmpty(siteId)) {  
153 - List<TblSite> tblSites = tblSiteService.getBySiteIds(siteId);  
154 - if (CollectionUtils.isNotEmpty(tblSites)) {  
155 - siteMap = tblSites.stream().parallel().collect(Collectors.toMap(TblSite::getSiteId, (p) -> p));  
156 - }  
157 - }  
158 - return siteMap;  
159 - } 143 + /**
  144 + * 获取SiteMap
  145 + *
  146 + * @param tblProducts
  147 + * @return
  148 + */
  149 + private Map<Integer, TblSite> getSiteMap(List<TblProduct> tblProducts) {
  150 + Map<Integer, TblSite> siteMap = new HashMap<>();
  151 + List<Integer> siteId = tblProducts.stream().map(TblProduct::getSiteId).collect(Collectors.toList());
  152 + if (CollectionUtils.isNotEmpty(siteId)) {
  153 + List<TblSite> tblSites = tblSiteService.getBySiteIds(siteId);
  154 + if (CollectionUtils.isNotEmpty(tblSites)) {
  155 + siteMap = tblSites.stream().parallel().collect(Collectors.toMap(TblSite::getSiteId, (p) -> p));
  156 + }
  157 + }
  158 + return siteMap;
  159 + }
160 160
161 - /**  
162 - * 获取TblProductSkcMap  
163 - *  
164 - * @param tblProducts  
165 - * @return  
166 - */  
167 - private Map<Integer, List<TblProductSkc>> getTblProductSkcMap(List<TblProduct> tblProducts) {  
168 - Map<Integer, List<TblProductSkc>> tblProductSkcMap = new HashMap<>();  
169 - List<Integer> productSkns = tblProducts.stream().map(TblProduct::getProductSkn).collect(Collectors.toList());  
170 - if (CollectionUtils.isNotEmpty(productSkns)) {  
171 - List<TblProductSkc> tblProductSkcs = tblProductSkcService.getBySkns(productSkns);  
172 - if (CollectionUtils.isNotEmpty(tblProductSkcs)) {  
173 - for (TblProductSkc tblProductSkc : tblProductSkcs) {  
174 - if (tblProductSkcMap.containsKey(tblProductSkc.getProductSkn())) {  
175 - List<TblProductSkc> skcs = tblProductSkcMap.get(tblProductSkc.getProductSkn());  
176 - skcs.add(tblProductSkc);  
177 - tblProductSkcMap.put(tblProductSkc.getProductSkn(), skcs);  
178 - } else {  
179 - List<TblProductSkc> skcs = new ArrayList<>();  
180 - skcs.add(tblProductSkc);  
181 - tblProductSkcMap.put(tblProductSkc.getProductSkn(), skcs);  
182 - }  
183 - }  
184 - }  
185 - }  
186 - return tblProductSkcMap;  
187 - } 161 + /**
  162 + * 获取TblProductSkcMap
  163 + *
  164 + * @param tblProducts
  165 + * @return
  166 + */
  167 + private Map<Integer, List<TblProductSkc>> getTblProductSkcMap(List<TblProduct> tblProducts) {
  168 + Map<Integer, List<TblProductSkc>> tblProductSkcMap = new HashMap<>();
  169 + List<Integer> productSkns = tblProducts.stream().map(TblProduct::getProductSkn).collect(Collectors.toList());
  170 + if (CollectionUtils.isNotEmpty(productSkns)) {
  171 + List<TblProductSkc> tblProductSkcs = tblProductSkcService.getBySkns(productSkns);
  172 + if (CollectionUtils.isNotEmpty(tblProductSkcs)) {
  173 + for (TblProductSkc tblProductSkc : tblProductSkcs) {
  174 + if (tblProductSkcMap.containsKey(tblProductSkc.getProductSkn())) {
  175 + List<TblProductSkc> skcs = tblProductSkcMap.get(tblProductSkc.getProductSkn());
  176 + skcs.add(tblProductSkc);
  177 + tblProductSkcMap.put(tblProductSkc.getProductSkn(), skcs);
  178 + } else {
  179 + List<TblProductSkc> skcs = new ArrayList<>();
  180 + skcs.add(tblProductSkc);
  181 + tblProductSkcMap.put(tblProductSkc.getProductSkn(), skcs);
  182 + }
  183 + }
  184 + }
  185 + }
  186 + return tblProductSkcMap;
  187 + }
188 188
189 - /**  
190 - * 获取TblProductSkuMap  
191 - *  
192 - * @param tblProducts  
193 - * @return  
194 - */  
195 - private Map<Integer, List<TblProductSku>> getTblProductSkuMap(List<TblProduct> tblProducts) {  
196 - Map<Integer, List<TblProductSku>> tblProductSkuMap = new HashMap<>();  
197 - List<Integer> productSkns = tblProducts.stream().map(TblProduct::getProductSkn).collect(Collectors.toList());  
198 - if (CollectionUtils.isNotEmpty(productSkns)) {  
199 - List<TblProductSku> tblProductSkus = tblProductSkuService.getBySkns(productSkns);  
200 - if (CollectionUtils.isNotEmpty(tblProductSkus)) {  
201 - for (TblProductSku tblProductSku : tblProductSkus) {  
202 - if (tblProductSkuMap.containsKey(tblProductSku.getProductSkn())) {  
203 - List<TblProductSku> skus = tblProductSkuMap.get(tblProductSku.getProductSkn());  
204 - skus.add(tblProductSku);  
205 - tblProductSkuMap.put(tblProductSku.getProductSkn(), skus);  
206 - } else {  
207 - List<TblProductSku> skus = new ArrayList<>();  
208 - skus.add(tblProductSku);  
209 - tblProductSkuMap.put(tblProductSku.getProductSkn(), skus);  
210 - }  
211 - }  
212 - }  
213 - }  
214 - return tblProductSkuMap;  
215 - } 189 + /**
  190 + * 获取TblProductSkuMap
  191 + *
  192 + * @param tblProducts
  193 + * @return
  194 + */
  195 + private Map<Integer, List<TblProductSku>> getTblProductSkuMap(List<TblProduct> tblProducts) {
  196 + Map<Integer, List<TblProductSku>> tblProductSkuMap = new HashMap<>();
  197 + List<Integer> productSkns = tblProducts.stream().map(TblProduct::getProductSkn).collect(Collectors.toList());
  198 + if (CollectionUtils.isNotEmpty(productSkns)) {
  199 + List<TblProductSku> tblProductSkus = tblProductSkuService.getBySkns(productSkns);
  200 + if (CollectionUtils.isNotEmpty(tblProductSkus)) {
  201 + for (TblProductSku tblProductSku : tblProductSkus) {
  202 + if (tblProductSkuMap.containsKey(tblProductSku.getProductSkn())) {
  203 + List<TblProductSku> skus = tblProductSkuMap.get(tblProductSku.getProductSkn());
  204 + skus.add(tblProductSku);
  205 + tblProductSkuMap.put(tblProductSku.getProductSkn(), skus);
  206 + } else {
  207 + List<TblProductSku> skus = new ArrayList<>();
  208 + skus.add(tblProductSku);
  209 + tblProductSkuMap.put(tblProductSku.getProductSkn(), skus);
  210 + }
  211 + }
  212 + }
  213 + }
  214 + return tblProductSkuMap;
  215 + }
216 216
217 - /**  
218 - * 获取品类Map  
219 - *  
220 - * @return  
221 - */  
222 - private Map<Integer, String> getSortMap() {  
223 - Map<Integer, String> sortMap = new HashMap<>();  
224 - List<TblSort> tblSorts = tblSortService.getAll();  
225 - if (CollectionUtils.isNotEmpty(tblSorts)) {  
226 - sortMap = tblSorts.stream().parallel().collect(Collectors.toMap(TblSort::getSortId, TblSort::getSortName));  
227 - }  
228 - return sortMap;  
229 - } 217 + /**
  218 + * 获取品类Map
  219 + *
  220 + * @return
  221 + */
  222 + private Map<Integer, String> getSortMap() {
  223 + Map<Integer, String> sortMap = new HashMap<>();
  224 + List<TblSort> tblSorts = tblSortService.getAll();
  225 + if (CollectionUtils.isNotEmpty(tblSorts)) {
  226 + sortMap = tblSorts.stream().parallel().collect(Collectors.toMap(TblSort::getSortId, TblSort::getSortName));
  227 + }
  228 + return sortMap;
  229 + }
230 230
231 - /**  
232 - * 处理brand  
233 - *  
234 - * @param productIndexBO  
235 - * @param tblBrand  
236 - * @return  
237 - */  
238 - private ProductIndexBO processBrand(ProductIndexBO productIndexBO, TblBrand tblBrand) {  
239 - productIndexBO.setBrandId(null);  
240 - productIndexBO.setBrandAlif(null);  
241 - productIndexBO.setBrandDomain(null);  
242 - if (tblBrand != null) {  
243 - productIndexBO.setBrandName(tblBrand.getBrandNameEn());  
244 - productIndexBO.setBrandNameEn(tblBrand.getBrandNameEn());  
245 - productIndexBO.setBrandNameCn(tblBrand.getBrandNameCn());  
246 - } else {  
247 - // 增量当品牌删除的时候  
248 - productIndexBO.setBrandName(null);  
249 - productIndexBO.setBrandNameEn(null);  
250 - productIndexBO.setBrandNameCn(null);  
251 - }  
252 - if(tblBrand.getBrandId()!=null){  
253 - productIndexBO.setShopId(tblBrand.getBrandId()*(-1)); 231 + /**
  232 + * 处理brand
  233 + *
  234 + * @param productIndexBO
  235 + * @param tblBrand
  236 + * @return
  237 + */
  238 + private ProductIndexBO processBrand(ProductIndexBO productIndexBO, TblBrand tblBrand) {
  239 + productIndexBO.setBrandId(null);
  240 + productIndexBO.setBrandAlif(null);
  241 + productIndexBO.setBrandDomain(null);
  242 + if (tblBrand != null) {
  243 + productIndexBO.setBrandName(tblBrand.getBrandNameEn());
  244 + productIndexBO.setBrandNameEn(tblBrand.getBrandNameEn());
  245 + productIndexBO.setBrandNameCn(tblBrand.getBrandNameCn());
  246 + if (tblBrand.getBrandId() != null) {
  247 + productIndexBO.setShopId(tblBrand.getBrandId() * (-1));
  248 + }
  249 + } else {
  250 + // 增量当品牌删除的时候
  251 + productIndexBO.setBrandName(null);
  252 + productIndexBO.setBrandNameEn(null);
  253 + productIndexBO.setBrandNameCn(null);
254 } 254 }
255 - return productIndexBO;  
256 - } 255 + return productIndexBO;
  256 + }
257 257
258 - /**  
259 - * 处理ShowStatus  
260 - *  
261 - * @param productIndexBO  
262 - * @param siteMap  
263 - * @param tblProduct  
264 - * @param tblBrand  
265 - * @return  
266 - */  
267 - private ProductIndexBO processShowStatus(ProductIndexBO productIndexBO, Map<Integer, TblSite> siteMap, TblProduct tblProduct, TblBrand tblBrand) {  
268 - String showStatus = "Y";  
269 - TblSite tblSite = siteMap.get(tblProduct.getSiteId());  
270 - if (tblProduct.getSource() != null) {  
271 - if (tblProduct.getSource().equals("1")) {  
272 - if (tblSite != null && tblSite.getStatus().equals("1")) {  
273 - showStatus = "N";  
274 - }  
275 - if (tblBrand != null && tblBrand.getStatus().equals("1")) {  
276 - showStatus = "N";  
277 - }  
278 - }  
279 - if (tblProduct.getSource().equals("2")) {  
280 - if (tblBrand.getStatus().equals("1")) {  
281 - showStatus = "N";  
282 - }  
283 - }  
284 - }  
285 - // 判断上架状态  
286 - boolean isShow = false;  
287 - if ((tblProduct.getStatus() != null && tblProduct.getStatus() == 4 && "Y".equalsIgnoreCase(showStatus))) {  
288 - isShow = true;  
289 - }  
290 - productIndexBO.setStatus(isShow ? 1 : 0);  
291 - productIndexBO.setIsSales(productIndexBO.getStatus() == 1 ? "Y" : "N");  
292 - productIndexBO.setIssales(productIndexBO.getIsSales().equals("Y") ? 1 : 2);  
293 - // 判断库存状态  
294 - if (tblProduct.getStockStatus() != null) {  
295 - boolean hasStock = tblProduct.getStockStatus().equals("1") ? true : false;  
296 - productIndexBO.setStorageNum(isShow && hasStock ? new BigDecimal(100) : BigDecimal.ZERO);  
297 - productIndexBO.setIsSoonSoldOut("N");  
298 - productIndexBO.setIsSoldOut("N");  
299 - productIndexBO.setSoldOut(1);  
300 - }  
301 - return productIndexBO;  
302 - } 258 + /**
  259 + * 处理ShowStatus
  260 + *
  261 + * @param productIndexBO
  262 + * @param siteMap
  263 + * @param tblProduct
  264 + * @param tblBrand
  265 + * @return
  266 + */
  267 + private ProductIndexBO processShowStatus(ProductIndexBO productIndexBO, Map<Integer, TblSite> siteMap, TblProduct tblProduct, TblBrand tblBrand) {
  268 + String showStatus = "Y";
  269 + TblSite tblSite = siteMap.get(tblProduct.getSiteId());
  270 + if (tblProduct.getSource() != null) {
  271 + if (tblProduct.getSource().equals("1")) {
  272 + if (tblSite != null && tblSite.getStatus().equals("1")) {
  273 + showStatus = "N";
  274 + }
  275 + if (tblBrand != null && tblBrand.getStatus().equals("1")) {
  276 + showStatus = "N";
  277 + }
  278 + }
  279 + if (tblProduct.getSource().equals("2")) {
  280 + if (tblBrand.getStatus().equals("1")) {
  281 + showStatus = "N";
  282 + }
  283 + }
  284 + }
  285 + // 判断上架状态
  286 + boolean isShow = false;
  287 + if ((tblProduct.getStatus() != null && tblProduct.getStatus() == 4 && "Y".equalsIgnoreCase(showStatus))) {
  288 + isShow = true;
  289 + }
  290 + productIndexBO.setStatus(isShow ? 1 : 0);
  291 + productIndexBO.setIsSales(productIndexBO.getStatus() == 1 ? "Y" : "N");
  292 + productIndexBO.setIssales(productIndexBO.getIsSales().equals("Y") ? 1 : 2);
  293 + // 判断库存状态
  294 + if (tblProduct.getStockStatus() != null) {
  295 + boolean hasStock = tblProduct.getStockStatus().equals("1") ? true : false;
  296 + productIndexBO.setStorageNum(isShow && hasStock ? new BigDecimal(100) : BigDecimal.ZERO);
  297 + productIndexBO.setIsSoonSoldOut("N");
  298 + productIndexBO.setIsSoldOut("N");
  299 + productIndexBO.setSoldOut(1);
  300 + }
  301 + return productIndexBO;
  302 + }
303 303
304 - /**  
305 - * 处理Sort  
306 - *  
307 - * @param productIndexBO  
308 - * @param sortMap  
309 - * @param tblProduct  
310 - * @return  
311 - */  
312 - private ProductIndexBO processSort(ProductIndexBO productIndexBO, Map<Integer, String> sortMap, TblProduct tblProduct) {  
313 - String sortOne = sortMap.get(tblProduct.getSortOne()) == null ? "" : sortMap.get(tblProduct.getSortOne());  
314 - String sortTwo = sortMap.get(tblProduct.getSortTwo()) == null ? "" : sortMap.get(tblProduct.getSortTwo());  
315 - String sortThree = sortMap.get(tblProduct.getSortThree()) == null ? "" : sortMap.get(tblProduct.getSortThree());  
316 - String sortfour = sortMap.get(tblProduct.getSortFour()) == null ? "" : sortMap.get(tblProduct.getSortFour()); 304 + /**
  305 + * 处理Sort
  306 + *
  307 + * @param productIndexBO
  308 + * @param sortMap
  309 + * @param tblProduct
  310 + * @return
  311 + */
  312 + private ProductIndexBO processSort(ProductIndexBO productIndexBO, Map<Integer, String> sortMap, TblProduct tblProduct) {
  313 + String sortOne = sortMap.get(tblProduct.getSortOne()) == null ? "" : sortMap.get(tblProduct.getSortOne());
  314 + String sortTwo = sortMap.get(tblProduct.getSortTwo()) == null ? "" : sortMap.get(tblProduct.getSortTwo());
  315 + String sortThree = sortMap.get(tblProduct.getSortThree()) == null ? "" : sortMap.get(tblProduct.getSortThree());
  316 + String sortfour = sortMap.get(tblProduct.getSortFour()) == null ? "" : sortMap.get(tblProduct.getSortFour());
317 317
318 - // 处理大分类  
319 - productIndexBO.setMaxSortId(new Integer(0));  
320 - productIndexBO.setMaxSortName(sortOne + "," + sortTwo);  
321 - productIndexBO.setMaxSort(sortTwo); 318 + // 处理大分类
  319 + productIndexBO.setMaxSortId(new Integer(0));
  320 + productIndexBO.setMaxSortName(sortOne + "," + sortTwo);
  321 + productIndexBO.setMaxSort(sortTwo);
322 322
323 - // 处理中分类  
324 - productIndexBO.setMiddleSortId(new Integer(0));  
325 - productIndexBO.setMiddleSortName(sortThree);  
326 - // if(!sortThree.equals(sortTwo)){  
327 - productIndexBO.setMiddleSort(sortThree);  
328 - // } 323 + // 处理中分类
  324 + productIndexBO.setMiddleSortId(new Integer(0));
  325 + productIndexBO.setMiddleSortName(sortThree);
  326 + // if(!sortThree.equals(sortTwo)){
  327 + productIndexBO.setMiddleSort(sortThree);
  328 + // }
329 329
330 - // 处理小分类  
331 - productIndexBO.setSmallSortId(new Integer(0));  
332 - productIndexBO.setSmallSortName(sortfour);  
333 - // if(!sortfour.equals(sortTwo) && !sortfour.equals(sortThree)){  
334 - productIndexBO.setSmallSort(sortfour);  
335 - // }  
336 - return productIndexBO;  
337 - } 330 + // 处理小分类
  331 + productIndexBO.setSmallSortId(new Integer(0));
  332 + productIndexBO.setSmallSortName(sortfour);
  333 + // if(!sortfour.equals(sortTwo) && !sortfour.equals(sortThree)){
  334 + productIndexBO.setSmallSort(sortfour);
  335 + // }
  336 + return productIndexBO;
  337 + }
338 338
339 - /**  
340 - * 处理Goods  
341 - *  
342 - * @param tblProductSkcMap  
343 - * @param productIndexBO  
344 - * @param tblProduct  
345 - * @return  
346 - */  
347 - private ProductIndexBO processGoods(Map<Integer, List<TblProductSkc>> tblProductSkcMap, ProductIndexBO productIndexBO, TblProduct tblProduct) {  
348 - List<TblProductSkc> tblProductSkcs = tblProductSkcMap.get(tblProduct.getProductSkn());  
349 - if (CollectionUtils.isNotEmpty(tblProductSkcs)) {  
350 - // 设置skn封面  
351 - int defaultCoverPosition = 0;  
352 - for (int i = 0; i < tblProductSkcs.size(); i++) {  
353 - if (tblProductSkcs.get(i).getIsDefault().equals("1")) {  
354 - defaultCoverPosition = i;  
355 - }  
356 - }  
357 - TblProductSkc tblProductSkc = tblProductSkcs.get(defaultCoverPosition);  
358 - JSONArray jsonArray = JSONArray.parseArray(tblProductSkc.getPics());  
359 - String defaultSknImages = getCover(jsonArray, true);  
360 - productIndexBO.setDefaultImages(defaultSknImages);  
361 - StringBuilder colorNames = new StringBuilder();  
362 - StringBuilder colorIds = new StringBuilder();  
363 - JSONArray goodsArray = new JSONArray();  
364 - for (TblProductSkc skc : tblProductSkcs) {  
365 - // 颜色名称  
366 - colorNames.append(skc.getColor() + ",");  
367 - colorIds.append(skc.getColorSysId() + ",");  
368 - jsonArray = JSONArray.parseArray(tblProductSkc.getPics());  
369 - String skcDefaultImages = getCover(jsonArray, false);  
370 - JSONObject jsonObj = new JSONObject();  
371 - jsonObj.put("goods_id", skc.getProductSkc() == null ? "" : skc.getProductSkc());  
372 - jsonObj.put("color_name", skc.getColor() == null ? "" : skc.getColor());  
373 - jsonObj.put("color_id", skc.getColorSysId() == null ? "" : skc.getColorSysId());  
374 - jsonObj.put("cover_1", "");  
375 - jsonObj.put("cover_2", "");  
376 - jsonObj.put("status", "1");  
377 - jsonObj.put("color_code", "");  
378 - jsonObj.put("color_value", "");  
379 - jsonObj.put("images_url", skcDefaultImages == null ? "" : skcDefaultImages);  
380 - jsonObj.put("is_default", skc.getIsDefault().equals("1") ? "Y" : "N");  
381 - jsonObj.put("storage_num", "100");  
382 - goodsArray.add(jsonObj);  
383 - }  
384 - productIndexBO.setColorIds(colorIds.toString());  
385 - productIndexBO.setColorNames(colorNames.toString());  
386 - productIndexBO.setGoodsList(goodsArray.toString());  
387 - } else {  
388 - // 增量,skn下的最后一个skc被删除时  
389 - productIndexBO.setDefaultImages(null);  
390 - productIndexBO.setColorIds(null);  
391 - productIndexBO.setColorNames(null);  
392 - productIndexBO.setGoodsList(null);  
393 - }  
394 - return productIndexBO;  
395 - } 339 + /**
  340 + * 处理Goods
  341 + *
  342 + * @param tblProductSkcMap
  343 + * @param productIndexBO
  344 + * @param tblProduct
  345 + * @return
  346 + */
  347 + private ProductIndexBO processGoods(Map<Integer, List<TblProductSkc>> tblProductSkcMap, ProductIndexBO productIndexBO, TblProduct tblProduct) {
  348 + List<TblProductSkc> tblProductSkcs = tblProductSkcMap.get(tblProduct.getProductSkn());
  349 + if (CollectionUtils.isNotEmpty(tblProductSkcs)) {
  350 + // 设置skn封面
  351 + int defaultCoverPosition = 0;
  352 + for (int i = 0; i < tblProductSkcs.size(); i++) {
  353 + if (tblProductSkcs.get(i).getIsDefault().equals("1")) {
  354 + defaultCoverPosition = i;
  355 + }
  356 + }
  357 + TblProductSkc tblProductSkc = tblProductSkcs.get(defaultCoverPosition);
  358 + JSONArray jsonArray = JSONArray.parseArray(tblProductSkc.getPics());
  359 + String defaultSknImages = getCover(jsonArray, true);
  360 + productIndexBO.setDefaultImages(defaultSknImages);
  361 + StringBuilder colorNames = new StringBuilder();
  362 + StringBuilder colorIds = new StringBuilder();
  363 + JSONArray goodsArray = new JSONArray();
  364 + for (TblProductSkc skc : tblProductSkcs) {
  365 + // 颜色名称
  366 + colorNames.append(skc.getColor() + ",");
  367 + colorIds.append(skc.getColorSysId() + ",");
  368 + jsonArray = JSONArray.parseArray(tblProductSkc.getPics());
  369 + String skcDefaultImages = getCover(jsonArray, false);
  370 + JSONObject jsonObj = new JSONObject();
  371 + jsonObj.put("goods_id", skc.getProductSkc() == null ? "" : skc.getProductSkc());
  372 + jsonObj.put("color_name", skc.getColor() == null ? "" : skc.getColor());
  373 + jsonObj.put("color_id", skc.getColorSysId() == null ? "" : skc.getColorSysId());
  374 + jsonObj.put("cover_1", "");
  375 + jsonObj.put("cover_2", "");
  376 + jsonObj.put("status", "1");
  377 + jsonObj.put("color_code", "");
  378 + jsonObj.put("color_value", "");
  379 + jsonObj.put("images_url", skcDefaultImages == null ? "" : skcDefaultImages);
  380 + jsonObj.put("is_default", skc.getIsDefault().equals("1") ? "Y" : "N");
  381 + jsonObj.put("storage_num", "100");
  382 + goodsArray.add(jsonObj);
  383 + }
  384 + productIndexBO.setColorIds(colorIds.toString());
  385 + productIndexBO.setColorNames(colorNames.toString());
  386 + productIndexBO.setGoodsList(goodsArray.toString());
  387 + } else {
  388 + // 增量,skn下的最后一个skc被删除时
  389 + productIndexBO.setDefaultImages(null);
  390 + productIndexBO.setColorIds(null);
  391 + productIndexBO.setColorNames(null);
  392 + productIndexBO.setGoodsList(null);
  393 + }
  394 + return productIndexBO;
  395 + }
396 396
397 - /**  
398 - * 处理Size  
399 - *  
400 - * @param tblProductSkuMap  
401 - * @param productIndexBO  
402 - * @param tblProduct  
403 - * @return  
404 - */  
405 - private ProductIndexBO processSize(Map<Integer, List<TblProductSku>> tblProductSkuMap, ProductIndexBO productIndexBO, TblProduct tblProduct) {  
406 - List<TblProductSku> tblProductSkus = tblProductSkuMap.get(tblProduct.getProductSkn());  
407 - if (CollectionUtils.isNotEmpty(tblProductSkus)) {  
408 - StringBuilder sizeNames = new StringBuilder();  
409 - for (TblProductSku tblProductSku : tblProductSkus) {  
410 - sizeNames.append(tblProductSku.getSize() + ",");  
411 - }  
412 - productIndexBO.setSizeNames(sizeNames.toString());  
413 - } else {  
414 - // 增量,skn下的最后一个sku被删除时  
415 - productIndexBO.setSizeNames(null);  
416 - }  
417 - return productIndexBO;  
418 - } 397 + /**
  398 + * 处理Size
  399 + *
  400 + * @param tblProductSkuMap
  401 + * @param productIndexBO
  402 + * @param tblProduct
  403 + * @return
  404 + */
  405 + private ProductIndexBO processSize(Map<Integer, List<TblProductSku>> tblProductSkuMap, ProductIndexBO productIndexBO, TblProduct tblProduct) {
  406 + List<TblProductSku> tblProductSkus = tblProductSkuMap.get(tblProduct.getProductSkn());
  407 + if (CollectionUtils.isNotEmpty(tblProductSkus)) {
  408 + StringBuilder sizeNames = new StringBuilder();
  409 + for (TblProductSku tblProductSku : tblProductSkus) {
  410 + sizeNames.append(tblProductSku.getSize() + ",");
  411 + }
  412 + productIndexBO.setSizeNames(sizeNames.toString());
  413 + } else {
  414 + // 增量,skn下的最后一个sku被删除时
  415 + productIndexBO.setSizeNames(null);
  416 + }
  417 + return productIndexBO;
  418 + }
419 419
420 - /**  
421 - * 处理其他简单字段  
422 - *  
423 - * @param productIndexBO  
424 - * @param tblProduct  
425 - * @return  
426 - */  
427 - private ProductIndexBO processSimpleField(ProductIndexBO productIndexBO, TblProduct tblProduct) {  
428 - if (tblProduct.getIsLimited() != null) {  
429 - productIndexBO.setIslimited("1".equals(tblProduct.getIsLimited()) ? "Y" : "N");  
430 - }  
431 - if (tblProduct.getGender() != null) {  
432 - productIndexBO.setGender(tblProduct.getGender());  
433 - productIndexBO.setGenderS(tblProduct.getGender().replace("1", "男").replace("2", "女").replace("3", "男/女"));  
434 - }  
435 - productIndexBO.setIsSpecial("N");  
436 - productIndexBO.setIsHot("N");  
437 - productIndexBO.setIshot(2);  
438 - productIndexBO.setIspromotion(0);  
439 - productIndexBO.setIsAdvance("N");  
440 - productIndexBO.setIsadvance(2);  
441 - productIndexBO.setIsAuditing("N");  
442 - productIndexBO.setIsauditing(2);  
443 - productIndexBO.setAttribute(1);  
444 - productIndexBO.setIsDown("N");  
445 - productIndexBO.setIsdown(2);  
446 - productIndexBO.setIsrecommend(2);  
447 - productIndexBO.setIsOutlets(2);  
448 - productIndexBO.setIsnew("N");  
449 - if (null != tblProduct.getShelfTime()) {  
450 - productIndexBO.setShelveTime(Integer.valueOf(tblProduct.getShelfTime()));  
451 - productIndexBO.setFirstShelveTime(productIndexBO.getShelveTime());  
452 - productIndexBO.setShelveDay(DateUtil.TimeStamp2DateWithFormat(Long.valueOf(productIndexBO.getShelveTime()), "yyyy-MM-dd"));  
453 - }  
454 - productIndexBO.setEditTime(null == tblProduct.getUpdateTime() ? null : Integer.valueOf(tblProduct.getUpdateTime()));  
455 - productIndexBO.setMarketPrice(null == tblProduct.getOrignPrice() ? new BigDecimal(0) : tblProduct.getOrignPrice());  
456 - productIndexBO.setSalesPrice(null == tblProduct.getGoodsPrice() ? new BigDecimal(0) : tblProduct.getGoodsPrice());  
457 - if (productIndexBO.getSalesPrice() != null) {  
458 - if (productIndexBO.getMarketPrice() != null && productIndexBO.getMarketPrice().doubleValue() != 0d) {  
459 - BigDecimal promotionDiscount = productIndexBO.getSalesPrice().divide(productIndexBO.getMarketPrice(), 4, BigDecimal.ROUND_HALF_UP);  
460 - productIndexBO.setPromotionDiscount(promotionDiscount);  
461 - productIndexBO.setPromotionDiscountInt((promotionDiscount.multiply(BigDecimal.TEN)).longValue());  
462 - if (productIndexBO.getSalesPrice().compareTo(productIndexBO.getMarketPrice()) < 0) {  
463 - productIndexBO.setIsDiscount("Y");  
464 - }  
465 - }  
466 - productIndexBO.setVip1Price(productIndexBO.getSalesPrice());  
467 - productIndexBO.setVip2Price(productIndexBO.getSalesPrice());  
468 - productIndexBO.setVip3Price(productIndexBO.getSalesPrice());  
469 - productIndexBO.setVipPrice(productIndexBO.getSalesPrice());  
470 - productIndexBO.setSpecialPrice(productIndexBO.getSalesPrice());  
471 - }  
472 - productIndexBO.setSpecialoffer("N");  
473 - productIndexBO.setIsDiscount("N");  
474 - productIndexBO.setBreakingRate(0d);  
475 - productIndexBO.setBasePinRatio(0);  
476 - return productIndexBO; 420 + /**
  421 + * 处理其他简单字段
  422 + *
  423 + * @param productIndexBO
  424 + * @param tblProduct
  425 + * @return
  426 + */
  427 + private ProductIndexBO processSimpleField(ProductIndexBO productIndexBO, TblProduct tblProduct) {
  428 + if (tblProduct.getIsLimited() != null) {
  429 + productIndexBO.setIslimited("1".equals(tblProduct.getIsLimited()) ? "Y" : "N");
  430 + }
  431 + if (tblProduct.getGender() != null) {
  432 + productIndexBO.setGender(tblProduct.getGender());
  433 + productIndexBO.setGenderS(tblProduct.getGender().replace("1", "男").replace("2", "女").replace("3", "男/女"));
  434 + }
  435 + productIndexBO.setIsSpecial("N");
  436 + productIndexBO.setIsHot("N");
  437 + productIndexBO.setIshot(2);
  438 + productIndexBO.setIspromotion(0);
  439 + productIndexBO.setIsAdvance("N");
  440 + productIndexBO.setIsadvance(2);
  441 + productIndexBO.setIsAuditing("N");
  442 + productIndexBO.setIsauditing(2);
  443 + productIndexBO.setAttribute(1);
  444 + productIndexBO.setIsDown("N");
  445 + productIndexBO.setIsdown(2);
  446 + productIndexBO.setIsrecommend(2);
  447 + productIndexBO.setIsOutlets(2);
  448 + productIndexBO.setIsnew("N");
  449 + if (null != tblProduct.getShelfTime()) {
  450 + productIndexBO.setShelveTime(Integer.valueOf(tblProduct.getShelfTime()));
  451 + productIndexBO.setFirstShelveTime(productIndexBO.getShelveTime());
  452 + productIndexBO.setShelveDay(DateUtil.TimeStamp2DateWithFormat(Long.valueOf(productIndexBO.getShelveTime()), "yyyy-MM-dd"));
  453 + }
  454 + productIndexBO.setEditTime(null == tblProduct.getUpdateTime() ? null : Integer.valueOf(tblProduct.getUpdateTime()));
  455 + productIndexBO.setMarketPrice(null == tblProduct.getOrignPrice() ? new BigDecimal(0) : tblProduct.getOrignPrice());
  456 + productIndexBO.setSalesPrice(null == tblProduct.getGoodsPrice() ? new BigDecimal(0) : tblProduct.getGoodsPrice());
  457 + if (productIndexBO.getSalesPrice() != null) {
  458 + if (productIndexBO.getMarketPrice() != null && productIndexBO.getMarketPrice().doubleValue() != 0d) {
  459 + BigDecimal promotionDiscount = productIndexBO.getSalesPrice().divide(productIndexBO.getMarketPrice(), 4, BigDecimal.ROUND_HALF_UP);
  460 + productIndexBO.setPromotionDiscount(promotionDiscount);
  461 + productIndexBO.setPromotionDiscountInt((promotionDiscount.multiply(BigDecimal.TEN)).longValue());
  462 + if (productIndexBO.getSalesPrice().compareTo(productIndexBO.getMarketPrice()) < 0) {
  463 + productIndexBO.setIsDiscount("Y");
  464 + }
  465 + }
  466 + productIndexBO.setVip1Price(productIndexBO.getSalesPrice());
  467 + productIndexBO.setVip2Price(productIndexBO.getSalesPrice());
  468 + productIndexBO.setVip3Price(productIndexBO.getSalesPrice());
  469 + productIndexBO.setVipPrice(productIndexBO.getSalesPrice());
  470 + productIndexBO.setSpecialPrice(productIndexBO.getSalesPrice());
  471 + }
  472 + productIndexBO.setSpecialoffer("N");
  473 + productIndexBO.setIsDiscount("N");
  474 + productIndexBO.setBreakingRate(0d);
  475 + productIndexBO.setBasePinRatio(0);
  476 + return productIndexBO;
477 477
478 - } 478 + }
479 479
480 - /**  
481 - * 获取封面值  
482 - *  
483 - * @param jsonArray  
484 - * @return  
485 - */  
486 - private String getCover(JSONArray jsonArray, boolean needFormatter) {  
487 - if (jsonArray == null) {  
488 - return "";  
489 - }  
490 - boolean hasCover = false;  
491 - int picPosition = 0;  
492 - int minSort = 10000;  
493 - int minSortPosition = 0;  
494 - for (int i = 0; i < jsonArray.size(); i++) {  
495 - JSONObject jsonObject = jsonArray.getJSONObject(i);  
496 - String cover = jsonObject.get("cover") == null ? "" : jsonObject.get("cover").toString();  
497 - String sortString = jsonObject.get("sort") == null ? "" : jsonObject.get("sort").toString().trim();  
498 - if (StringUtils.isNotBlank(sortString)) {  
499 - Integer sortNum = Integer.valueOf(sortString);  
500 - if (sortNum < minSort) {  
501 - minSort = sortNum;  
502 - minSortPosition = i;  
503 - }  
504 - }  
505 - if (cover.equals("1")) {  
506 - picPosition = i;  
507 - hasCover = true;  
508 - }  
509 - }  
510 - String defaultImages = "";  
511 - if (hasCover) {  
512 - JSONObject jsonObject = jsonArray.getJSONObject(picPosition);  
513 - defaultImages = jsonObject.get("src") == null ? "" : jsonObject.get("src").toString();  
514 - } else {  
515 - JSONObject jsonObject = jsonArray.getJSONObject(minSortPosition);  
516 - defaultImages = jsonObject.get("src") == null ? "" : jsonObject.get("src").toString();  
517 - }  
518 - return tblImgUrlLogicService.getTblImageUrl(defaultImages, needFormatter);  
519 - } 480 + /**
  481 + * 获取封面值
  482 + *
  483 + * @param jsonArray
  484 + * @return
  485 + */
  486 + private String getCover(JSONArray jsonArray, boolean needFormatter) {
  487 + if (jsonArray == null) {
  488 + return "";
  489 + }
  490 + boolean hasCover = false;
  491 + int picPosition = 0;
  492 + int minSort = 10000;
  493 + int minSortPosition = 0;
  494 + for (int i = 0; i < jsonArray.size(); i++) {
  495 + JSONObject jsonObject = jsonArray.getJSONObject(i);
  496 + String cover = jsonObject.get("cover") == null ? "" : jsonObject.get("cover").toString();
  497 + String sortString = jsonObject.get("sort") == null ? "" : jsonObject.get("sort").toString().trim();
  498 + if (StringUtils.isNotBlank(sortString)) {
  499 + Integer sortNum = Integer.valueOf(sortString);
  500 + if (sortNum < minSort) {
  501 + minSort = sortNum;
  502 + minSortPosition = i;
  503 + }
  504 + }
  505 + if (cover.equals("1")) {
  506 + picPosition = i;
  507 + hasCover = true;
  508 + }
  509 + }
  510 + String defaultImages = "";
  511 + if (hasCover) {
  512 + JSONObject jsonObject = jsonArray.getJSONObject(picPosition);
  513 + defaultImages = jsonObject.get("src") == null ? "" : jsonObject.get("src").toString();
  514 + } else {
  515 + JSONObject jsonObject = jsonArray.getJSONObject(minSortPosition);
  516 + defaultImages = jsonObject.get("src") == null ? "" : jsonObject.get("src").toString();
  517 + }
  518 + return tblImgUrlLogicService.getTblImageUrl(defaultImages, needFormatter);
  519 + }
520 } 520 }