|
@@ -4,6 +4,7 @@ import com.caimei.modules.brand.entity.CmBrand;
|
|
import com.caimei.modules.brand.service.CmBrandService;
|
|
import com.caimei.modules.brand.service.CmBrandService;
|
|
import com.caimei.modules.common.entity.Province;
|
|
import com.caimei.modules.common.entity.Province;
|
|
import com.caimei.modules.common.service.AreaService;
|
|
import com.caimei.modules.common.service.AreaService;
|
|
|
|
+import com.caimei.modules.opensearch.GenerateUtils;
|
|
import com.caimei.modules.opensearch.SearchUitls;
|
|
import com.caimei.modules.opensearch.SearchUitls;
|
|
import com.caimei.modules.product.entity.*;
|
|
import com.caimei.modules.product.entity.*;
|
|
import com.caimei.modules.product.service.*;
|
|
import com.caimei.modules.product.service.*;
|
|
@@ -72,7 +73,8 @@ public class ProductNewController extends BaseController {
|
|
private CmSecondHandDetailService cmSecondHandDetailService;
|
|
private CmSecondHandDetailService cmSecondHandDetailService;
|
|
@Autowired
|
|
@Autowired
|
|
private RedisService redisService;
|
|
private RedisService redisService;
|
|
-
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private GenerateUtils generateUtils;
|
|
@ModelAttribute
|
|
@ModelAttribute
|
|
public Product get(@RequestParam(required = false) String id) {
|
|
public Product get(@RequestParam(required = false) String id) {
|
|
Product entity = null;
|
|
Product entity = null;
|
|
@@ -325,8 +327,6 @@ public class ProductNewController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
addMessage(redirectAttributes, "保存商品成功");
|
|
addMessage(redirectAttributes, "保存商品成功");
|
|
- // 更新索引
|
|
|
|
- searchUitls.updateProductIndex(product.getProductID());
|
|
|
|
String editFlag = product.getEditFlag();
|
|
String editFlag = product.getEditFlag();
|
|
if (StringUtils.equals("1", editFlag)) {
|
|
if (StringUtils.equals("1", editFlag)) {
|
|
redirectAttributes.addAttribute("id", product.getId());
|
|
redirectAttributes.addAttribute("id", product.getId());
|
|
@@ -346,6 +346,8 @@ public class ProductNewController extends BaseController {
|
|
}
|
|
}
|
|
// 有数据变动时需要清除缓存
|
|
// 有数据变动时需要清除缓存
|
|
cleanRedisCache();
|
|
cleanRedisCache();
|
|
|
|
+ // 更新索引
|
|
|
|
+ searchUitls.updateProductIndex(product.getProductID());
|
|
return "redirect:" + Global.getAdminPath() + "/product/new/list/";
|
|
return "redirect:" + Global.getAdminPath() + "/product/new/list/";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -362,6 +364,7 @@ public class ProductNewController extends BaseController {
|
|
map.put("msg", "操作成功");
|
|
map.put("msg", "操作成功");
|
|
// 更新索引
|
|
// 更新索引
|
|
searchUitls.updateProductIndex(productId);
|
|
searchUitls.updateProductIndex(productId);
|
|
|
|
+ cleanRedisCache();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
logger.debug(e.toString(), e);
|
|
logger.debug(e.toString(), e);
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
@@ -452,6 +455,7 @@ public class ProductNewController extends BaseController {
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
jsonModel = productService.editProductCustomClassification(productId, ids);
|
|
jsonModel = productService.editProductCustomClassification(productId, ids);
|
|
|
|
+ cleanRedisCache();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
jsonModel.error("数据异常");
|
|
jsonModel.error("数据异常");
|
|
}
|
|
}
|
|
@@ -517,6 +521,7 @@ public class ProductNewController extends BaseController {
|
|
productNewService.addProductImage(imgPath, productID, shopID, request);
|
|
productNewService.addProductImage(imgPath, productID, shopID, request);
|
|
map.put("success", true);
|
|
map.put("success", true);
|
|
map.put("msg", "操作成功");
|
|
map.put("msg", "操作成功");
|
|
|
|
+ cleanRedisCache();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
logger.debug(e.toString(), e);
|
|
logger.debug(e.toString(), e);
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
@@ -536,6 +541,7 @@ public class ProductNewController extends BaseController {
|
|
productNewService.updateImageSort(productImageID, sortIndex);
|
|
productNewService.updateImageSort(productImageID, sortIndex);
|
|
map.put("success", true);
|
|
map.put("success", true);
|
|
map.put("msg", "操作成功");
|
|
map.put("msg", "操作成功");
|
|
|
|
+ cleanRedisCache();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
logger.debug(e.toString(), e);
|
|
logger.debug(e.toString(), e);
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
@@ -571,6 +577,7 @@ public class ProductNewController extends BaseController {
|
|
}
|
|
}
|
|
map.put("success", true);
|
|
map.put("success", true);
|
|
map.put("msg", "更新排序成功");
|
|
map.put("msg", "更新排序成功");
|
|
|
|
+ cleanRedisCache();
|
|
return map;
|
|
return map;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
@@ -623,6 +630,7 @@ public class ProductNewController extends BaseController {
|
|
map.put("msg", "操作成功");
|
|
map.put("msg", "操作成功");
|
|
// 更新索引
|
|
// 更新索引
|
|
searchUitls.updateProductIndex(productID);
|
|
searchUitls.updateProductIndex(productID);
|
|
|
|
+ cleanRedisCache();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
logger.debug(e.toString(), e);
|
|
logger.debug(e.toString(), e);
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
@@ -644,6 +652,7 @@ public class ProductNewController extends BaseController {
|
|
map.put("msg", "操作成功");
|
|
map.put("msg", "操作成功");
|
|
// 更新索引
|
|
// 更新索引
|
|
searchUitls.updateProductIndex(productID);
|
|
searchUitls.updateProductIndex(productID);
|
|
|
|
+ cleanRedisCache();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
logger.debug(e.toString(), e);
|
|
logger.debug(e.toString(), e);
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
@@ -682,6 +691,7 @@ public class ProductNewController extends BaseController {
|
|
// 删除索引
|
|
// 删除索引
|
|
searchUitls.deleteProductIndex(productID);
|
|
searchUitls.deleteProductIndex(productID);
|
|
}
|
|
}
|
|
|
|
+ cleanRedisCache();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
logger.debug(e.toString(), e);
|
|
logger.debug(e.toString(), e);
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
@@ -715,6 +725,7 @@ public class ProductNewController extends BaseController {
|
|
} else {
|
|
} else {
|
|
cmSecondHandDetailService.updateRevieweInfo(date, date, productID);
|
|
cmSecondHandDetailService.updateRevieweInfo(date, date, productID);
|
|
}
|
|
}
|
|
|
|
+ cleanRedisCache();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
logger.debug(e.toString(), e);
|
|
logger.debug(e.toString(), e);
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
@@ -764,6 +775,7 @@ public class ProductNewController extends BaseController {
|
|
// 更新商品库上下架状态
|
|
// 更新商品库上下架状态
|
|
productNewService.auditProduct(validFlag, productId);
|
|
productNewService.auditProduct(validFlag, productId);
|
|
map.put("success", true);
|
|
map.put("success", true);
|
|
|
|
+ cleanRedisCache();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
logger.error(e.getMessage());
|
|
logger.error(e.getMessage());
|
|
@@ -844,6 +856,7 @@ public class ProductNewController extends BaseController {
|
|
cmProductRecommendService.addRecommendProduct(productID, base.split(":")[0], base.split(":")[1]);
|
|
cmProductRecommendService.addRecommendProduct(productID, base.split(":")[0], base.split(":")[1]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ cleanRedisCache();
|
|
return "redirect:" + Global.getAdminPath() + "/product/new/recommend?id=" + productID;
|
|
return "redirect:" + Global.getAdminPath() + "/product/new/recommend?id=" + productID;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -855,6 +868,7 @@ public class ProductNewController extends BaseController {
|
|
@RequestMapping(value = "recommend/delete")
|
|
@RequestMapping(value = "recommend/delete")
|
|
public String deleteProductRecommend(String productID, String recommendId) {
|
|
public String deleteProductRecommend(String productID, String recommendId) {
|
|
cmProductRecommendService.deleteProductRecommend(recommendId);
|
|
cmProductRecommendService.deleteProductRecommend(recommendId);
|
|
|
|
+ cleanRedisCache();
|
|
return "redirect:" + Global.getAdminPath() + "/product/new/recommend?id=" + productID;
|
|
return "redirect:" + Global.getAdminPath() + "/product/new/recommend?id=" + productID;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -866,6 +880,9 @@ public class ProductNewController extends BaseController {
|
|
String homeData = "getHomeData*";
|
|
String homeData = "getHomeData*";
|
|
redisService.removePattern(homeData);
|
|
redisService.removePattern(homeData);
|
|
redisService.removePattern("getHomeCommodityData*");
|
|
redisService.removePattern("getHomeCommodityData*");
|
|
|
|
+ redisService.removePattern("insCommodityData*");
|
|
|
|
+ // 重新生成静态首页
|
|
|
|
+ generateUtils.generateHome();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|