From 06df245d59598e97d86eaefe55e287a5c0c5ca1f Mon Sep 17 00:00:00 2001 From: liyj <1617420630@qq.com> Date: Tue, 25 Nov 2025 11:26:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=96=B0=E5=A2=9E=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=8A=9F=E8=83=BD=EF=BC=8C=E8=B0=83=E6=95=B4=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E7=9A=84=E6=A8=A1=E6=9D=BF=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/ShopPageAppController.java | 22 +++++-- .../shop/page/service/ShopPageAppService.java | 2 + .../service/impl/ShopPageAppServiceImpl.java | 63 +++++++++++++++++-- sql/shop/dev/20251125_ddl.sql | 1 + 4 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 sql/shop/dev/20251125_ddl.sql diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/page/controller/admin/ShopPageAppController.java b/mall-shop/src/main/java/com/suisung/mall/shop/page/controller/admin/ShopPageAppController.java index 440fa94d..f52f7ea9 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/page/controller/admin/ShopPageAppController.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/page/controller/admin/ShopPageAppController.java @@ -110,21 +110,23 @@ public class ShopPageAppController extends BaseControllerImpl { Map current_tpl = new HashMap(); Iterator it = items.iterator(); + //读取店铺信息store_template + ShopStoreInfo shopStoreInfo = shopStoreInfoService.get(user.getStore_id()); while (it.hasNext()) { Map item = it.next(); Integer tpl_id = Convert.toInt(item.get("tpl_id")); String tpl_label =CommonUtil.getTplLable(tpl_id); //String tpl_label = item.get("tpl_label").toString(); item.put("tpl_label",tpl_label); + Integer is_use=Convert.toInt(item.get("app_is_use"),0); if (user.isStore()) { - //读取店铺信息store_template - ShopStoreInfo shopStoreInfo = shopStoreInfoService.get(user.getStore_id()); if (tpl_id > 1000 || tpl_id == 109 || tpl_id == 105 || tpl_id == 10/* || tpl_id == 107*/) { it.remove(); continue; } - String appId= String.valueOf(item.get("app_id")); - if (shopStoreInfo.getStore_template().equals(appId)) { + //String appId= String.valueOf(item.get("tpl_label")); + if (is_use==1&&(shopStoreInfo.getStore_template().equals(tpl_label)|| + shopStoreInfo.getStore_template().equals(String.valueOf(item.get("tpl_label"))))) { current_tpl = item; } } else { @@ -526,5 +528,17 @@ public class ShopPageAppController extends BaseControllerImpl { return CommonResult.success(); } + + /** + * 市场app删除 + * @param appId + * @return + */ + @ApiOperation(value = "店铺风格表-市场app删除", notes = "店铺风格表-市场app删除") + @RequestMapping(value = "/deletePageApp", method = RequestMethod.DELETE) + public CommonResult deletePageApp(Integer appId) { + return shopPageAppService.deletePageApp(appId); + } + } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/page/service/ShopPageAppService.java b/mall-shop/src/main/java/com/suisung/mall/shop/page/service/ShopPageAppService.java index 6cba0730..ff367287 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/page/service/ShopPageAppService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/page/service/ShopPageAppService.java @@ -58,4 +58,6 @@ public interface ShopPageAppService extends IBaseService { CommonResult copyDiyByStore(Integer sourceStoreId, Integer tpl_id); CommonResult copyDiyByAppId(Integer appId,String a); + + CommonResult deletePageApp(Integer appId); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/page/service/impl/ShopPageAppServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/page/service/impl/ShopPageAppServiceImpl.java index f091b627..4141e94a 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/page/service/impl/ShopPageAppServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/page/service/impl/ShopPageAppServiceImpl.java @@ -24,6 +24,7 @@ import com.suisung.mall.common.modules.store.ShopStoreInfo; import com.suisung.mall.common.utils.CheckUtil; import com.suisung.mall.common.utils.ContextUtil; import com.suisung.mall.common.utils.I18nUtil; +import com.suisung.mall.common.utils.StringUtils; import com.suisung.mall.core.web.service.CloundService; import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.shop.base.service.AccountBaseConfigService; @@ -35,14 +36,12 @@ import com.suisung.mall.shop.page.service.ShopPageAppService; import com.suisung.mall.shop.page.service.ShopPageBaseService; import com.suisung.mall.shop.page.service.ShopPageModuleService; import com.suisung.mall.shop.product.service.ShopPageUserFormService; -import com.suisung.mall.shop.product.service.impl.ShopPageUserFormServiceImpl; import com.suisung.mall.shop.store.service.ShopStoreInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.ModelAndView; -import javax.security.sasl.AuthenticationException; import javax.servlet.http.Cookie; import java.util.*; import java.util.stream.Collectors; @@ -415,19 +414,36 @@ public class ShopPageAppServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); UserDto user = getCurrentUser(); - if (user.isStore()) { + String app_idStr=getParameter("app_id"); + if(StringUtils.isNotEmpty(app_idStr)){ + Integer app_id=Convert.toInt(app_idStr); + ShopPageApp shopPageApp= this.get(app_id); + if(null!=shopPageApp){ + queryWrapper.eq("store_id", shopPageApp.getStore_id()); + queryWrapper.eq("app_is_use", 1); + List updateShopPageApps= this.list(queryWrapper); + if(!updateShopPageApps.isEmpty()){ + updateShopPageApps=updateShopPageApps.stream().peek(s->s.setApp_is_use(0)).collect(Collectors.toList()); + this.updateBatchById(updateShopPageApps,updateShopPageApps.size()); + } + shopPageApp.setApp_is_use(1); + this.updateById(shopPageApp); + } + } queryWrapper.eq("store_id", Convert.toInt(user.getStore_id())); ShopStoreInfo shopStoreInfo = new ShopStoreInfo(); shopStoreInfo.setStore_id(Convert.toInt(user.getStore_id())); //shopStoreInfo.setStore_template(getParameter("store_template", "shop1")); - shopStoreInfo.setStore_template(String.valueOf(getParameter("app_id", 0))); + String store_template="shop7"; + if(null!=getParameter("store_template")){ + store_template=String.valueOf(getParameter("store_template")); + } + shopStoreInfo.setStore_template(store_template); shopStoreInfoService.edit(shopStoreInfo); } else { queryWrapper.eq("store_id", 0); - - Integer subsiteId = accountBaseConfigService.getSubsiteId(); if (CheckUtil.isEmpty(subsiteId)) { AccountBaseConfig config = new AccountBaseConfig(); @@ -601,6 +617,7 @@ public class ShopPageAppServiceImpl extends BaseServiceImpl queryWrapperShopBase = new QueryWrapper<>(); + queryWrapperShopBase.eq("app_id", appId); + List shopPageBases= shopPageBaseService.list(queryWrapperShopBase); + if(!shopPageBases.isEmpty()){ + List shopPageIdList= shopPageBases.stream().map(ShopPageBase::getPage_id).collect(Collectors.toList()); + QueryWrapper queryWrapperShopPageModule = new QueryWrapper<>(); + queryWrapperShopPageModule.in("page_id", shopPageIdList); + shopPageModuleService.remove(queryWrapperShopPageModule); + QueryWrapper queryWrapperShopPageUserForm = new QueryWrapper<>(); + queryWrapperShopPageUserForm.in("page_id", shopPageIdList); + shopPageUserFormService.remove(queryWrapperShopPageUserForm); + shopPageBaseService.removeBatchByIds(shopPageIdList); + } + shopPageAppService.remove(shopPageApp.getApp_id()); + return CommonResult.success(); + } + /** * 生产新的id diff --git a/sql/shop/dev/20251125_ddl.sql b/sql/shop/dev/20251125_ddl.sql new file mode 100644 index 00000000..0476bcc9 --- /dev/null +++ b/sql/shop/dev/20251125_ddl.sql @@ -0,0 +1 @@ +INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`,`comment`) VALUES ('/admin/shop/shop-page-app/deletePageApp', 'index', 'master', '', '0', '/admin/shop/shop-page-app/deletePageApp','dy模板删除'); \ No newline at end of file