模板新增删除功能,调整店铺的模板逻辑
This commit is contained in:
parent
5eed3c89d4
commit
8fb45b9bf9
@ -110,21 +110,23 @@ public class ShopPageAppController extends BaseControllerImpl {
|
|||||||
Map current_tpl = new HashMap();
|
Map current_tpl = new HashMap();
|
||||||
|
|
||||||
Iterator<Map> it = items.iterator();
|
Iterator<Map> it = items.iterator();
|
||||||
|
//读取店铺信息store_template
|
||||||
|
ShopStoreInfo shopStoreInfo = shopStoreInfoService.get(user.getStore_id());
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map item = it.next();
|
Map item = it.next();
|
||||||
Integer tpl_id = Convert.toInt(item.get("tpl_id"));
|
Integer tpl_id = Convert.toInt(item.get("tpl_id"));
|
||||||
String tpl_label =CommonUtil.getTplLable(tpl_id);
|
String tpl_label =CommonUtil.getTplLable(tpl_id);
|
||||||
//String tpl_label = item.get("tpl_label").toString();
|
//String tpl_label = item.get("tpl_label").toString();
|
||||||
item.put("tpl_label",tpl_label);
|
item.put("tpl_label",tpl_label);
|
||||||
|
Integer is_use=Convert.toInt(item.get("app_is_use"),0);
|
||||||
if (user.isStore()) {
|
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*/) {
|
if (tpl_id > 1000 || tpl_id == 109 || tpl_id == 105 || tpl_id == 10/* || tpl_id == 107*/) {
|
||||||
it.remove();
|
it.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String appId= String.valueOf(item.get("app_id"));
|
//String appId= String.valueOf(item.get("tpl_label"));
|
||||||
if (shopStoreInfo.getStore_template().equals(appId)) {
|
if (is_use==1&&(shopStoreInfo.getStore_template().equals(tpl_label)||
|
||||||
|
shopStoreInfo.getStore_template().equals(String.valueOf(item.get("tpl_label"))))) {
|
||||||
current_tpl = item;
|
current_tpl = item;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -526,5 +528,17 @@ public class ShopPageAppController extends BaseControllerImpl {
|
|||||||
return CommonResult.success();
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,4 +58,6 @@ public interface ShopPageAppService extends IBaseService<ShopPageApp> {
|
|||||||
CommonResult copyDiyByStore(Integer sourceStoreId, Integer tpl_id);
|
CommonResult copyDiyByStore(Integer sourceStoreId, Integer tpl_id);
|
||||||
|
|
||||||
CommonResult copyDiyByAppId(Integer appId,String a);
|
CommonResult copyDiyByAppId(Integer appId,String a);
|
||||||
|
|
||||||
|
CommonResult deletePageApp(Integer appId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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.CheckUtil;
|
||||||
import com.suisung.mall.common.utils.ContextUtil;
|
import com.suisung.mall.common.utils.ContextUtil;
|
||||||
import com.suisung.mall.common.utils.I18nUtil;
|
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.CloundService;
|
||||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||||
import com.suisung.mall.shop.base.service.AccountBaseConfigService;
|
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.ShopPageBaseService;
|
||||||
import com.suisung.mall.shop.page.service.ShopPageModuleService;
|
import com.suisung.mall.shop.page.service.ShopPageModuleService;
|
||||||
import com.suisung.mall.shop.product.service.ShopPageUserFormService;
|
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 com.suisung.mall.shop.store.service.ShopStoreInfoService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.security.sasl.AuthenticationException;
|
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -416,19 +415,36 @@ public class ShopPageAppServiceImpl extends BaseServiceImpl<ShopPageAppMapper, S
|
|||||||
QueryWrapper<ShopPageApp> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ShopPageApp> queryWrapper = new QueryWrapper<>();
|
||||||
UserDto user = getCurrentUser();
|
UserDto user = getCurrentUser();
|
||||||
|
|
||||||
|
|
||||||
if (user.isStore()) {
|
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<ShopPageApp> 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()));
|
queryWrapper.eq("store_id", Convert.toInt(user.getStore_id()));
|
||||||
ShopStoreInfo shopStoreInfo = new ShopStoreInfo();
|
ShopStoreInfo shopStoreInfo = new ShopStoreInfo();
|
||||||
shopStoreInfo.setStore_id(Convert.toInt(user.getStore_id()));
|
shopStoreInfo.setStore_id(Convert.toInt(user.getStore_id()));
|
||||||
//shopStoreInfo.setStore_template(getParameter("store_template", "shop1"));
|
//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);
|
shopStoreInfoService.edit(shopStoreInfo);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
queryWrapper.eq("store_id", 0);
|
queryWrapper.eq("store_id", 0);
|
||||||
|
|
||||||
|
|
||||||
Integer subsiteId = accountBaseConfigService.getSubsiteId();
|
Integer subsiteId = accountBaseConfigService.getSubsiteId();
|
||||||
if (CheckUtil.isEmpty(subsiteId)) {
|
if (CheckUtil.isEmpty(subsiteId)) {
|
||||||
AccountBaseConfig config = new AccountBaseConfig();
|
AccountBaseConfig config = new AccountBaseConfig();
|
||||||
@ -602,6 +618,7 @@ public class ShopPageAppServiceImpl extends BaseServiceImpl<ShopPageAppMapper, S
|
|||||||
shopPageAppQueryWrapper.eq("store_id", store_id);
|
shopPageAppQueryWrapper.eq("store_id", store_id);
|
||||||
shopPageAppQueryWrapper.eq("subsite_id", subsite_id);
|
shopPageAppQueryWrapper.eq("subsite_id", subsite_id);
|
||||||
shopPageAppQueryWrapper.eq("tpl_id", tpl_id);
|
shopPageAppQueryWrapper.eq("tpl_id", tpl_id);
|
||||||
|
shopPageAppQueryWrapper.eq("app_is_use",1);//使用中的模板
|
||||||
|
|
||||||
ShopPageApp shopPA = shopPageAppService.findOne(shopPageAppQueryWrapper);
|
ShopPageApp shopPA = shopPageAppService.findOne(shopPageAppQueryWrapper);
|
||||||
Map data = new HashMap();
|
Map data = new HashMap();
|
||||||
@ -1039,6 +1056,40 @@ public class ShopPageAppServiceImpl extends BaseServiceImpl<ShopPageAppMapper, S
|
|||||||
return CommonResult.failed("diy装修模板复制成功");
|
return CommonResult.failed("diy装修模板复制成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public CommonResult deletePageApp(Integer appId) {
|
||||||
|
UserDto user = ContextUtil.getCurrentUser();
|
||||||
|
if (user == null) {
|
||||||
|
throw new ApiException("无权限");
|
||||||
|
}
|
||||||
|
ShopPageApp shopPageApp= shopPageAppService.get(appId);
|
||||||
|
if(shopPageApp==null){
|
||||||
|
return CommonResult.failed("删除出错,不存在模板");
|
||||||
|
}
|
||||||
|
if(!(user.getStore_id().equals(String.valueOf(shopPageApp.getStore_id())))){
|
||||||
|
return CommonResult.failed("删除出错,不存在模板");
|
||||||
|
}
|
||||||
|
if(shopPageApp.getApp_is_use()==1){
|
||||||
|
return CommonResult.failed("模板正在使用,不能删除");
|
||||||
|
}
|
||||||
|
QueryWrapper<ShopPageBase> queryWrapperShopBase = new QueryWrapper<>();
|
||||||
|
queryWrapperShopBase.eq("app_id", appId);
|
||||||
|
List<ShopPageBase> shopPageBases= shopPageBaseService.list(queryWrapperShopBase);
|
||||||
|
if(!shopPageBases.isEmpty()){
|
||||||
|
List<Long> shopPageIdList= shopPageBases.stream().map(ShopPageBase::getPage_id).collect(Collectors.toList());
|
||||||
|
QueryWrapper<ShopPageModule> queryWrapperShopPageModule = new QueryWrapper<>();
|
||||||
|
queryWrapperShopPageModule.in("page_id", shopPageIdList);
|
||||||
|
shopPageModuleService.remove(queryWrapperShopPageModule);
|
||||||
|
QueryWrapper<ShopPageUserForm> queryWrapperShopPageUserForm = new QueryWrapper<>();
|
||||||
|
queryWrapperShopPageUserForm.in("page_id", shopPageIdList);
|
||||||
|
shopPageUserFormService.remove(queryWrapperShopPageUserForm);
|
||||||
|
shopPageBaseService.removeBatchByIds(shopPageIdList);
|
||||||
|
}
|
||||||
|
shopPageAppService.remove(shopPageApp.getApp_id());
|
||||||
|
return CommonResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产新的id
|
* 生产新的id
|
||||||
|
|||||||
1
sql/shop/dev/20251125_ddl.sql
Normal file
1
sql/shop/dev/20251125_ddl.sql
Normal file
@ -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模板删除');
|
||||||
Loading…
Reference in New Issue
Block a user