|
@@ -3,7 +3,10 @@ package com.caimei.modules.product.service;
|
|
|
|
|
|
import com.caimei.dfs.image.beens.ImageUploadInfo;
|
|
|
import com.caimei.modules.common.utils.UploadUtils;
|
|
|
-import com.caimei.modules.hehe.dao.CmHeheProductDao;
|
|
|
+import com.caimei.modules.hehe.dao.*;
|
|
|
+import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
|
|
|
+import com.caimei.modules.hehe.entity.CmHeheCollageProduct;
|
|
|
+import com.caimei.modules.hehe.entity.CmHeheFloorProduct;
|
|
|
import com.caimei.modules.hehe.entity.CmHeheProduct;
|
|
|
import com.caimei.modules.product.dao.CmPromotionDao;
|
|
|
import com.caimei.modules.product.dao.ProductDao;
|
|
@@ -48,6 +51,14 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
|
|
|
@Autowired
|
|
|
private CmHeheProductDao cmHeheProductDao;
|
|
|
@Autowired
|
|
|
+ private CmHeheActivityProductDao cmHeheActivityProductDao;
|
|
|
+ @Autowired
|
|
|
+ private CmHeheCollageProductDao cmHeheCollageProductDao;
|
|
|
+ @Autowired
|
|
|
+ private CmHeheCouponDao cmHeheCouponDao;
|
|
|
+ @Autowired
|
|
|
+ private CmHeheFloorProductDao cmHeheFloorProductDao;
|
|
|
+ @Autowired
|
|
|
private ProductService productService;
|
|
|
|
|
|
@Override
|
|
@@ -274,17 +285,18 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
|
|
|
}
|
|
|
|
|
|
public void moveHeheProducts() {
|
|
|
- List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
|
|
|
- heheProductList.forEach(heheProduct->{
|
|
|
- Integer heheProductId = Integer.parseInt(heheProduct.getId());
|
|
|
- // 采美商品id
|
|
|
- Integer productId = heheProduct.getProductId();
|
|
|
- // 查询商品
|
|
|
- Product product = productNewDao.get(productId.toString());
|
|
|
- Integer shopId = productNewDao.getShopIdByName("采美奥泰特殊供应商");
|
|
|
- if (null != shopId) {
|
|
|
+ Integer shopId = productNewDao.getShopIdByName("采美奥泰");
|
|
|
+ if (null != shopId) {
|
|
|
+ List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
|
|
|
+ heheProductList.forEach(heheProduct->{
|
|
|
+ Integer heheProductId = Integer.parseInt(heheProduct.getId());
|
|
|
+ Integer oldProductId = heheProduct.getProductId();
|
|
|
+ // 采美商品id
|
|
|
+ Integer productId = heheProduct.getProductId();
|
|
|
+ // 查询商品
|
|
|
+ Product product = productNewDao.get(productId.toString());
|
|
|
product.setId(null);
|
|
|
- product.setSplitCode("E1807085606");
|
|
|
+ product.setSplitCode("E1807059160");
|
|
|
product.setShopID(shopId);
|
|
|
// 置为冻结状态
|
|
|
product.setValidFlag("10");
|
|
@@ -314,9 +326,35 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
|
|
|
productNewDao.insertParameters(productParam);
|
|
|
});
|
|
|
// 将呵呵商品关联到新商品上
|
|
|
- cmHeheProductDao.updateProductId(heheProductId, newProductId);
|
|
|
- }
|
|
|
- });
|
|
|
+ cmHeheProductDao.updateProductId(oldProductId, newProductId);
|
|
|
+ });
|
|
|
+ // 更新活动商品
|
|
|
+ List<CmHeheActivityProduct> activityProductList = cmHeheActivityProductDao.findAllList(new CmHeheActivityProduct());
|
|
|
+ activityProductList.forEach(activityProduct->{
|
|
|
+ Integer oldProductId = activityProduct.getProductId();
|
|
|
+ Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
|
|
|
+ if (null != newProductId) {
|
|
|
+ cmHeheActivityProductDao.updateProductId(newProductId, oldProductId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 更新拼团商品
|
|
|
+ List<CmHeheCollageProduct> collageProductList = cmHeheCollageProductDao.findAllList(new CmHeheCollageProduct());
|
|
|
+ collageProductList.forEach(collageProduct->{
|
|
|
+ Integer oldProductId = collageProduct.getProductId();
|
|
|
+ Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
|
|
|
+ if (null != newProductId) {
|
|
|
+ cmHeheCollageProductDao.updateProductId(newProductId, oldProductId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 更新优惠券商品
|
|
|
+ List<Integer> productIds = cmHeheCouponDao.findAllProductIds();
|
|
|
+ productIds.forEach(oldProductId->{
|
|
|
+ Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
|
|
|
+ if (null != newProductId) {
|
|
|
+ cmHeheCouponDao.updateProductId(newProductId, oldProductId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void backHeheProducts() {
|