同步数据和菜单相关问题解决
This commit is contained in:
parent
da24e3dfd2
commit
4947025a25
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.api.StateCode;
|
||||
import com.suisung.mall.common.modules.product.*;
|
||||
import com.suisung.mall.common.utils.StringUtils;
|
||||
import com.suisung.mall.shop.product.service.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -119,6 +120,9 @@ public class ShopProductInfoController {
|
||||
List<ShopProductAssistIndex> assistIndexList = assistIndexService.find(indexQueryWrapper);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
if(StringUtils.isEmpty(shopProductInfo.getProduct_spec())){
|
||||
shopProductInfo.setProduct_spec("[]");
|
||||
}
|
||||
map.put("shop_product_info", shopProductInfo);
|
||||
map.put("shop_product_image", shopProductImages);
|
||||
map.put("shop_product_detail", shopProductDetail);
|
||||
|
||||
@ -9,6 +9,7 @@ import com.suisung.mall.common.pojo.dto.EduCourseDetailDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -31,4 +32,5 @@ public interface ShopProductItemMapper extends BaseMapper<ShopProductItem> {
|
||||
|
||||
int lockSkuStock(@Param("item_id") Long itemId, @Param("cart_quantity") int cart_quantity);
|
||||
|
||||
void updateBatchByProductId(List<ShopProductItem> list,Integer itemEnable);
|
||||
}
|
||||
|
||||
@ -79,4 +79,10 @@ public interface ShopProductItemService extends IBaseService<ShopProductItem> {
|
||||
|
||||
void clearProductItemIdByStore(Integer store_id);
|
||||
|
||||
/**
|
||||
* 更加产品名称更新状态
|
||||
* @param shopProductItemList
|
||||
* @return
|
||||
*/
|
||||
void batchUpdateByCondition(List<ShopProductItem> shopProductItemList);
|
||||
}
|
||||
|
||||
@ -5379,6 +5379,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
shopProductIndexList.get(i).setSubsite_id(0);
|
||||
shopProductIndexList.get(i).setProduct_number(base.getProduct_number());
|
||||
base.setProduct_market_price(base.getProduct_unit_price());
|
||||
shopProductInfoList.get(i).setProduct_spec("[]");
|
||||
if(CollUtil.isNotEmpty(shopProductIndexList)){
|
||||
newShopProductIndexList.add(shopProductIndexList.get(i));
|
||||
}
|
||||
|
||||
@ -2288,6 +2288,10 @@ public class ShopProductItemServiceImpl extends BaseServiceImpl<ShopProductItemM
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 通过product_id 批量更新
|
||||
@Override
|
||||
public void batchUpdateByCondition(List<ShopProductItem> shopProductItemList) {
|
||||
shopProductItemMapper.updateBatchByProductId(shopProductItemList,shopProductItemList.get(0).getItem_enable());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.suisung.mall.common.api.StateCode;
|
||||
import com.suisung.mall.common.modules.product.ShopProductBase;
|
||||
import com.suisung.mall.common.modules.product.ShopProductImage;
|
||||
import com.suisung.mall.common.modules.product.ShopProductIndex;
|
||||
import com.suisung.mall.common.modules.product.ShopProductItem;
|
||||
import com.suisung.mall.common.modules.sync.ImageMappingDto;
|
||||
import com.suisung.mall.common.utils.StringUtils;
|
||||
@ -19,6 +20,7 @@ import com.suisung.mall.shop.product.mapper.ShopProductImageMapper;
|
||||
|
||||
import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductImageService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductIndexService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductItemService;
|
||||
import com.suisung.mall.shop.sixun.utils.CommonUtil;
|
||||
import com.suisung.mall.shop.sync.mapper.ShopImageMappingTempMapper;
|
||||
@ -54,6 +56,9 @@ public class SyncShopImageServiceImpl implements SyncShopImageService {
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductIndexService shopProductIndexService;
|
||||
|
||||
@Value("${project.static_domain}")
|
||||
private String staticDomain;
|
||||
|
||||
@ -146,6 +151,7 @@ public class SyncShopImageServiceImpl implements SyncShopImageService {
|
||||
List<ShopProductBase> shopProductBaseList=new ArrayList<>();
|
||||
List<ShopProductItem> shopProductItemList=new ArrayList<>();
|
||||
List<ShopProductImage> shopProductImageList=new ArrayList<>();
|
||||
List<ShopProductIndex> shopProductIndexList=new ArrayList<>();
|
||||
for (ImageMappingDto imageMappingDto:imageMappingDtos){
|
||||
String mergedImageUrl=imageMappingDto.getMergedImageUrl();
|
||||
if(StringUtils.isEmpty(mergedImageUrl)){
|
||||
@ -162,15 +168,22 @@ public class SyncShopImageServiceImpl implements SyncShopImageService {
|
||||
}else {
|
||||
shopProductImage.setItem_image_other(imageMappingDto.addDomainPrefix(staticDomain,mergedImageUrl));
|
||||
}
|
||||
String thumb=imageMappingDto.addDomainPrefix(staticDomain,imageMappingDto.getThumb());
|
||||
shopProductImage.setProduct_id(imageMappingDto.getProductId());
|
||||
shopProductImage.setProduct_image_id(imageMappingDto.getProductImageId());
|
||||
shopProductImage.setItem_image_default(imageMappingDto.addDomainPrefix(staticDomain,imageMappingDto.getThumb()));
|
||||
shopProductImage.setItem_image_default(thumb);
|
||||
shopProductImageList.add(shopProductImage);
|
||||
shopProductBase.setProduct_id(imageMappingDto.getProductId());
|
||||
shopProductBase.setProduct_image(thumb);
|
||||
shopProductBase.setProduct_state_id(StateCode.PRODUCT_STATE_NORMAL);
|
||||
shopProductBaseList.add(shopProductBase);
|
||||
shopProductItem.setProduct_id(imageMappingDto.getProductId());
|
||||
shopProductItem.setItem_enable(StateCode.PRODUCT_STATE_NORMAL);
|
||||
shopProductItemList.add(shopProductItem);
|
||||
ShopProductIndex shopProductIndex=new ShopProductIndex();
|
||||
shopProductIndex.setProduct_id(imageMappingDto.getProductId());
|
||||
shopProductIndex.setProduct_state_id(StateCode.PRODUCT_STATE_NORMAL);
|
||||
shopProductIndexList.add(shopProductIndex);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(shopProductImageList)){
|
||||
shopProductImageService.updateBatchById(shopProductImageList);
|
||||
@ -179,7 +192,10 @@ public class SyncShopImageServiceImpl implements SyncShopImageService {
|
||||
shopProductBaseService.updateBatchById(shopProductBaseList);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(shopProductItemList)){
|
||||
shopProductItemService.updateBatchById(shopProductItemList);
|
||||
shopProductItemService.batchUpdateByCondition(shopProductItemList);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(shopProductIndexList)){
|
||||
shopProductIndexService.updateBatchById(shopProductIndexList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -218,4 +218,14 @@
|
||||
where f.product_id = #{product_id}
|
||||
</select>
|
||||
|
||||
<update id="updateBatchByProductId">
|
||||
UPDATE shop_product_item
|
||||
SET item_enable= #{itemEnable}
|
||||
WHERE product_id in
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item.product_id}
|
||||
</foreach>
|
||||
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
INSERT INTO admin_base_menu (menu_parent_id,menu_rel,menu_name,menu_url,menu_path,menu_component,menu_close,menu_label,menu_order,menu_enable,menu_class,menu_icon,menu_bubble,menu_url_path,menu_url_mdu,menu_url_ctl,menu_url_met,menu_url_parem,menu_time,menu_type,menu_note,menu_func,menu_role,menu_hidden) VALUES
|
||||
(320,'pageTab','分类管理','','category','@/views/base/product/category',0,'CategoryManagement',50,1,'','','','/admin/shop/shop-base-product-category/list','','Base_ProductCategory','index','','2024-07-12 21:33:44',1,'<div class="chat-group">
|
||||
(8021,'pageTab','分类管理','','category','@/views/base/product/category',0,'CategoryManagement',50,1,'','','','/admin/shop/shop-base-product-category/list','','Base_ProductCategory','index','','2024-07-12 21:33:44',1,'<div class="chat-group">
|
||||
<strong>分类管理</strong>
|
||||
<a><span class="user-status is-online"></span><em>当店主添加商品时可选择商品分类,用户可根据分类查询商品列表。</em></a>
|
||||
<a><span class="user-status is-online"></span><em>平台可以对商家上传的商品进行审核、下架等。</em></a>
|
||||
</div>','',2,0),
|
||||
(320,'pageTab','品牌管理','','brand','@/views/base/product/brand/index.vue',0,'BrandManagement',51,1,'','','','/admin/shop/shop-base-product-brand/list','','Base_ProductBrand','index','','2024-07-12 21:33:44',1,'<div class="chat-group">
|
||||
(8021,'pageTab','品牌管理','','brand','@/views/base/product/brand/index.vue',0,'BrandManagement',51,1,'','','','/admin/shop/shop-base-product-brand/list','','Base_ProductBrand','index','','2024-07-12 21:33:44',1,'<div class="chat-group">
|
||||
<strong>品牌管理</strong>
|
||||
<a><span class="user-status is-online"></span><em>当店主添加商品时可选择商品品牌,用户可根据品牌查询商品列表</em></a>
|
||||
<a><span class="user-status is-online"></span><em>被推荐品牌,将在前台品牌推荐模块处显示。</em></a>
|
||||
<a><span class="user-status is-online"></span><em>在品牌列表页面,品牌将按类别分组,即具有相同类别的品牌为一组,品牌类别与品牌分类无联系。</em></a>
|
||||
</div>','',2,0),
|
||||
(320,'pageTab','类型管理','','type','@/views/base/product/type/index.vue',0,'Vab3204',52,1,'','','','/admin/shop/shop-base-product-type/list','','Base_ProductType','index','','2024-07-12 21:33:44',1,'<div class="chat-group">
|
||||
(8021,'pageTab','类型管理','','type','@/views/base/product/type/index.vue',0,'Vab3204',52,1,'','','','/admin/shop/shop-base-product-type/list','','Base_ProductType','index','','2024-07-12 21:33:44',1,'<div class="chat-group">
|
||||
<strong>类型管理</strong>
|
||||
<a><span class="user-status is-online"></span><em>当管理员添加商品分类时需选择类型。前台分类下商品列表页通过类型生成商品检索,方便用户搜索需要的商品。</em></a>
|
||||
</div>','',2,0),
|
||||
(320,'pageTab','规格管理','','spec','@/views/base/product/spec/index.vue',0,'CpecManagement',53,1,'','','','m','','Base_ProductSpec','index','','2025-06-12 17:19:46',1,'<div class="chat-group">
|
||||
(8021,'pageTab','规格管理','','spec','@/views/base/product/spec/index.vue',0,'CpecManagement',53,1,'','','','m','','Base_ProductSpec','index','','2025-06-12 17:19:46',1,'<div class="chat-group">
|
||||
<strong>规格管理</strong>
|
||||
<a><span class="user-status is-online"></span><em>规格将会对应到商品发布的规格,规格值由店铺自己添加。</em></a>
|
||||
<a><span class="user-status is-online"></span><em>默认安装中会添加一个默认颜色规格,请不要删除,只有这个颜色规格才能在商品详细页显示为图片。</em></a>
|
||||
|
||||
5
sql/shop/dev/202506027_dml.sql
Normal file
5
sql/shop/dev/202506027_dml.sql
Normal file
@ -0,0 +1,5 @@
|
||||
INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`) VALUES ('/admin/shop/shop-sync-productMapper/syncShopImages', 'index', 'master', '', '0', '/admin/shop/shop-sync-productMapper/syncShopImages');
|
||||
|
||||
update admin_base_menu set menu_parent_id ='8021' where menu_url_path in('/admin/shop/shop-base-product-category/list','/admin/shop/shop-base-product-brand/list','/admin/shop/shop-base-product-type/list','/admin/shop/shop-base-product-spec/list') and menu_role='2';
|
||||
|
||||
update shop_product_image set item_image_default='1' where product_from ='1005' and item_image_default !='1';
|
||||
Loading…
Reference in New Issue
Block a user