Просмотр исходного кода

New: 新增业务异常类,并替换处理异常

lwh 1 неделя назад
Родитель
Сommit
23825474cd

+ 5 - 0
pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/ServiceNameConstants.java

@@ -32,4 +32,9 @@ public interface ServiceNameConstants {
 	 */
 	 */
 	String UPMS_SERVICE = "pig-upms-biz";
 	String UPMS_SERVICE = "pig-upms-biz";
 
 
+	/**
+	 * 营销模块
+	 */
+	String MARKETING_SERVICE = "pig-marketing-biz";
+
 }
 }

+ 59 - 0
pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/exception/BusinessException.java

@@ -0,0 +1,59 @@
+package com.pig4cloud.pig.common.core.exception;
+
+
+import com.pig4cloud.pig.common.core.util.MsgUtils;
+import lombok.NoArgsConstructor;
+
+import java.io.Serial;
+
+/**
+ * @author: lwh
+ * @date: 2025-07-28
+ * @description: 业务异常类
+ */
+@NoArgsConstructor
+public class BusinessException extends CheckedException {
+
+	@Serial
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 通过错误码构建异常(支持i18n)
+	 * @param code 错误码(对应messages配置)
+	 */
+	public BusinessException(String code) {
+		super(MsgUtils.getMessage(code));
+	}
+
+	/**
+	 * 通过错误码和参数构建异常(支持i18n)
+	 * @param code 错误码
+	 * @param args 格式化参数
+	 */
+	public BusinessException(String code, Object... args) {
+		super(MsgUtils.getMessage(code, args));
+	}
+
+	/**
+	 * 直接传入错误信息
+	 * @param message 错误信息
+	 */
+	public BusinessException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	/**
+	 * 带 cause 的异常
+	 * @param cause 原始异常
+	 */
+	public BusinessException(Throwable cause) {
+		super(cause);
+	}
+
+	/**
+	 * 完整构造器
+	 */
+	public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+}

+ 2 - 5
pig-marketing/pig-marketing-biz/src/main/java/com/pig4cloud/pig/marketing/controller/MarketingAppsController.java

@@ -2,15 +2,12 @@ package com.pig4cloud.pig.marketing.controller;
 
 
 
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.pig4cloud.pig.common.core.exception.BusinessException;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.marketing.api.dto.app.*;
 import com.pig4cloud.pig.marketing.api.dto.app.*;
-import com.pig4cloud.pig.marketing.api.dto.data.PageFirstLevelDataDTO;
-import com.pig4cloud.pig.marketing.api.dto.data.PageSecondLevelDataDTO;
 import com.pig4cloud.pig.marketing.api.vo.app.PageMarketingAppsVO;
 import com.pig4cloud.pig.marketing.api.vo.app.PageMarketingAppsVO;
 import com.pig4cloud.pig.marketing.service.MarketingAppsService;
 import com.pig4cloud.pig.marketing.service.MarketingAppsService;
-import com.pig4cloud.pig.marketing.service.MarketingDataService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import jakarta.validation.Valid;
 import jakarta.validation.Valid;
@@ -53,7 +50,7 @@ public class MarketingAppsController {
 	@Operation(summary = "查询应用详情")
 	@Operation(summary = "查询应用详情")
 	public R getMarketingAppById(@ParameterObject Long id) {
 	public R getMarketingAppById(@ParameterObject Long id) {
 		if (id == null){
 		if (id == null){
-			throw new RuntimeException("应用ID不能为空");
+			throw new BusinessException("应用ID不能为空");
 		}
 		}
 		PageMarketingAppsVO res = marketingAppsService.getMarketingAppById(id);
 		PageMarketingAppsVO res = marketingAppsService.getMarketingAppById(id);
 		return R.ok(res);
 		return R.ok(res);

+ 2 - 1
pig-marketing/pig-marketing-biz/src/main/java/com/pig4cloud/pig/marketing/controller/MarketingConfigController.java

@@ -1,6 +1,7 @@
 package com.pig4cloud.pig.marketing.controller;
 package com.pig4cloud.pig.marketing.controller;
 
 
 
 
+import com.pig4cloud.pig.common.core.exception.BusinessException;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.marketing.api.dto.config.*;
 import com.pig4cloud.pig.marketing.api.dto.config.*;
 import com.pig4cloud.pig.marketing.api.vo.config.*;
 import com.pig4cloud.pig.marketing.api.vo.config.*;
@@ -59,7 +60,7 @@ public class MarketingConfigController {
 	@Operation(summary = "根据ID查询分组详情")
 	@Operation(summary = "根据ID查询分组详情")
 	public R getMarketingGroupDetail(@ParameterObject  Long id) {
 	public R getMarketingGroupDetail(@ParameterObject  Long id) {
 		if (id == null){
 		if (id == null){
-			throw new RuntimeException("分组ID不能为空");
+			throw new BusinessException("分组ID不能为空");
 		}
 		}
 		return marketingConfigService.getMarketingGroupDetail(id);
 		return marketingConfigService.getMarketingGroupDetail(id);
 	}
 	}

+ 36 - 23
pig-marketing/pig-marketing-biz/src/main/java/com/pig4cloud/pig/marketing/service/impl/MarketingAppsServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.pig4cloud.pig.common.core.exception.BusinessException;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.marketing.api.dto.app.*;
 import com.pig4cloud.pig.marketing.api.dto.app.*;
 import com.pig4cloud.pig.marketing.api.entity.*;
 import com.pig4cloud.pig.marketing.api.entity.*;
@@ -130,7 +131,7 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 	public PageMarketingAppsVO getMarketingAppById(Long id) {
 	public PageMarketingAppsVO getMarketingAppById(Long id) {
 		MarketingApps app = appsMapper.selectById(id);
 		MarketingApps app = appsMapper.selectById(id);
 		if (app == null){
 		if (app == null){
-			throw new RuntimeException("应用不存在");
+			throw new BusinessException("应用不存在");
 		}
 		}
 		PageMarketingAppsVO appsVO = new PageMarketingAppsVO();
 		PageMarketingAppsVO appsVO = new PageMarketingAppsVO();
 		BeanUtils.copyProperties(app, appsVO);
 		BeanUtils.copyProperties(app, appsVO);
@@ -177,15 +178,15 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 		for (BatchUpdateMarketingAppsDTO reqDto : reqDtoList) {
 		for (BatchUpdateMarketingAppsDTO reqDto : reqDtoList) {
 			Long id = reqDto.getId();
 			Long id = reqDto.getId();
 			if (reqDto.getId() == null){
 			if (reqDto.getId() == null){
-				throw new RuntimeException("应用ID不能为空");
+				throw new BusinessException("应用ID不能为空");
 			}
 			}
 
 
 			MarketingApps apps = appsMapper.selectById(id);
 			MarketingApps apps = appsMapper.selectById(id);
 			if (apps == null){
 			if (apps == null){
-				throw new RuntimeException("应用ID:"+id+"不存在");
+				throw new BusinessException("应用ID:"+id+"不存在");
 			}
 			}
 			if (!apps.getStatus()){
 			if (!apps.getStatus()){
-				throw new RuntimeException("应用ID:"+id+"已拉黑,请还原后操作");
+				throw new BusinessException("应用ID:"+id+"已拉黑,请还原后操作");
 			}
 			}
 
 
 			// 1、更新基本信息
 			// 1、更新基本信息
@@ -212,10 +213,10 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 	public Boolean setMarketingAppsInfo(SetMarketingAppsDTO reqDto) {
 	public Boolean setMarketingAppsInfo(SetMarketingAppsDTO reqDto) {
 		MarketingApps app = appsMapper.selectById(reqDto.getId());
 		MarketingApps app = appsMapper.selectById(reqDto.getId());
 		if (app == null){
 		if (app == null){
-			throw new RuntimeException("应用不存在");
+			throw new BusinessException("应用不存在");
 		}
 		}
 		if (!app.getStatus()){
 		if (!app.getStatus()){
-			throw new RuntimeException("应用ID:"+app.getId()+"已拉黑,请还原后操作");
+			throw new BusinessException("应用ID:"+app.getId()+"已拉黑,请还原后操作");
 		}
 		}
 		MarketingApps apps = new MarketingApps();
 		MarketingApps apps = new MarketingApps();
 		BeanUtils.copyProperties(reqDto, apps);
 		BeanUtils.copyProperties(reqDto, apps);
@@ -232,7 +233,7 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 	public Boolean setAppStatusById(SetMarketingAppsStatusDTO reqDto) {
 	public Boolean setAppStatusById(SetMarketingAppsStatusDTO reqDto) {
 		MarketingApps apps = appsMapper.selectById(reqDto.getId());
 		MarketingApps apps = appsMapper.selectById(reqDto.getId());
 		if (apps == null) {
 		if (apps == null) {
-			throw new RuntimeException("应用不存在");
+			throw new BusinessException("应用不存在");
 		}
 		}
 		apps.setStatus(reqDto.getStatus());
 		apps.setStatus(reqDto.getStatus());
 		return appsMapper.updateById(apps) > 0;
 		return appsMapper.updateById(apps) > 0;
@@ -323,14 +324,14 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 	public R modMarketingAppsIps(ModMarketingAppsIpDTO reqDto) {
 	public R modMarketingAppsIps(ModMarketingAppsIpDTO reqDto) {
 		Long appId = reqDto.getId();
 		Long appId = reqDto.getId();
 		if (reqDto.getId() == null) {
 		if (reqDto.getId() == null) {
-			throw new RuntimeException("应用ID不能为空");
+			throw new BusinessException("应用ID不能为空");
 		}
 		}
 		MarketingApps app = appsMapper.selectById(appId);
 		MarketingApps app = appsMapper.selectById(appId);
 		if (app == null){
 		if (app == null){
-			throw new RuntimeException("应用ID:"+appId+"不存在");
+			throw new BusinessException("应用ID:"+appId+"不存在");
 		}
 		}
 		if (!app.getStatus()){
 		if (!app.getStatus()){
-			throw new RuntimeException("应用ID:"+app.getId()+"已拉黑,请还原后操作");
+			throw new BusinessException("应用ID:"+app.getId()+"已拉黑,请还原后操作");
 		}
 		}
 		BatchUpdateMarketingAppsDTO updateIp = new BatchUpdateMarketingAppsDTO();
 		BatchUpdateMarketingAppsDTO updateIp = new BatchUpdateMarketingAppsDTO();
 		updateIp.setId(appId);
 		updateIp.setId(appId);
@@ -350,14 +351,14 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 	public R modMarketingAppsDomains(ModMarketingAppsDomainDTO reqDto) {
 	public R modMarketingAppsDomains(ModMarketingAppsDomainDTO reqDto) {
 		Long appId = reqDto.getId();
 		Long appId = reqDto.getId();
 		if (reqDto.getId() == null){
 		if (reqDto.getId() == null){
-			throw new RuntimeException("应用ID不能为空");
+			throw new BusinessException("应用ID不能为空");
 		}
 		}
 		MarketingApps app = appsMapper.selectById(appId);
 		MarketingApps app = appsMapper.selectById(appId);
 		if (app == null){
 		if (app == null){
-			throw new RuntimeException("应用ID:"+appId+"不存在");
+			throw new BusinessException("应用ID:"+appId+"不存在");
 		}
 		}
 		if (!app.getStatus()){
 		if (!app.getStatus()){
-			throw new RuntimeException("应用ID:"+app.getId()+"已拉黑,请还原后操作");
+			throw new BusinessException("应用ID:"+app.getId()+"已拉黑,请还原后操作");
 		}
 		}
 		BatchUpdateMarketingAppsDTO updateDomain = new BatchUpdateMarketingAppsDTO();
 		BatchUpdateMarketingAppsDTO updateDomain = new BatchUpdateMarketingAppsDTO();
 		updateDomain.setId(appId);
 		updateDomain.setId(appId);
@@ -455,7 +456,10 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 
 
 				// 查询ip表和ip分组表中是否存在
 				// 查询ip表和ip分组表中是否存在
 				if (checkIp(ipDto, appId)){
 				if (checkIp(ipDto, appId)){
-					throw new RuntimeException("ip已存在");
+					if (ipDto.getIpMode() == 1){
+						throw new BusinessException("ip:"+ipDto.getStartIp()+"已存在");
+					}
+					throw new BusinessException("ip:"+ipDto.getStartIp()+"/"+ipDto.getEndIp()+"已存在");
 				}
 				}
 
 
 				// 执行新增或修改
 				// 执行新增或修改
@@ -490,7 +494,7 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 				}
 				}
 
 
 				if (checkDomain(domainDto, appId)){
 				if (checkDomain(domainDto, appId)){
-					throw new RuntimeException("域名已存在");
+					throw new BusinessException("域名:"+domainDto.getDomain()+"已存在");
 				}
 				}
 
 
 				// 执行新增或修改
 				// 执行新增或修改
@@ -511,17 +515,21 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 	/**
 	/**
 	 * 判断IP是否已存在(单IP或IP段)
 	 * 判断IP是否已存在(单IP或IP段)
 	 * @param appId 应用数据ID
 	 * @param appId 应用数据ID
-	 * @param ipDTO IP
+	 * @param ipDto IP
 	 * @return 是否存在
 	 * @return 是否存在
 	 */
 	 */
-	public boolean checkIp(MarketingAppsIpDTO ipDTO, Long appId) {
+	public boolean checkIp(MarketingAppsIpDTO ipDto, Long appId) {
+		List<Long> groupIds = getAppRelatedGroupIds(appId, true);
+		if (ipDto.getSourceType().equals(1)){
+			return groupIds.contains(ipDto.getGroupId());
+		}
 		// 1. 检查应用IP表
 		// 1. 检查应用IP表
-		if (checkAppsIpExists(ipDTO, appId)) {
+		if (checkAppsIpExists(ipDto, appId)) {
 			return true;
 			return true;
 		}
 		}
 
 
 		// 2. 检查分组IP表(需要关联应用关联的分组)
 		// 2. 检查分组IP表(需要关联应用关联的分组)
-		return checkGroupIpExists(ipDTO, appId);
+		return checkGroupIpExists(ipDto, groupIds);
 	}
 	}
 
 
 	/**
 	/**
@@ -531,16 +539,22 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 	 * @return 是否存在
 	 * @return 是否存在
 	 */
 	 */
 	public Boolean checkDomain(MarketingAppsDomainDTO domainDTO, Long appId) {
 	public Boolean checkDomain(MarketingAppsDomainDTO domainDTO, Long appId) {
+		List<Long> groupIds = getAppRelatedGroupIds(appId, false);  // 需要实现获取应用关联的分组ID列表
+		if (domainDTO.getSourceType().equals(1)){
+			// 来自分组
+			return groupIds.contains(domainDTO.getGroupId());
+		}
+
 		// 1. 检查应用域名表
 		// 1. 检查应用域名表
 		LambdaQueryWrapper<MarketingAppsDomain> appsQuery = new LambdaQueryWrapper<>();
 		LambdaQueryWrapper<MarketingAppsDomain> appsQuery = new LambdaQueryWrapper<>();
 		appsQuery.eq(MarketingAppsDomain::getAppId, appId)
 		appsQuery.eq(MarketingAppsDomain::getAppId, appId)
+				.eq(MarketingAppsDomain::getSourceType, 2)
 				.eq(MarketingAppsDomain::getDomain, domainDTO.getDomain());
 				.eq(MarketingAppsDomain::getDomain, domainDTO.getDomain());
 		if (appsDomainMapper.selectCount(appsQuery) > 0) {
 		if (appsDomainMapper.selectCount(appsQuery) > 0) {
 			return true;
 			return true;
 		}
 		}
 
 
 		// 2. 检查分组域名表(需要关联应用关联的分组)
 		// 2. 检查分组域名表(需要关联应用关联的分组)
-		List<Long> groupIds = getAppRelatedGroupIds(appId, false);  // 需要实现获取应用关联的分组ID列表
 		if (!groupIds.isEmpty()) {
 		if (!groupIds.isEmpty()) {
 			LambdaQueryWrapper<MarketingGroupDomain> groupQuery = new LambdaQueryWrapper<>();
 			LambdaQueryWrapper<MarketingGroupDomain> groupQuery = new LambdaQueryWrapper<>();
 			groupQuery.in(MarketingGroupDomain::getGroupId, groupIds)
 			groupQuery.in(MarketingGroupDomain::getGroupId, groupIds)
@@ -558,7 +572,7 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 		// 1.1、校验marketing_apps_ip表,appId=appId,是否包含
 		// 1.1、校验marketing_apps_ip表,appId=appId,是否包含
 		// 1.2、校验marketing_group_ip表,是否包含ip,如果包含查出分组id,在查看appId下是否包含这个分组
 		// 1.2、校验marketing_group_ip表,是否包含ip,如果包含查出分组id,在查看appId下是否包含这个分组
 		QueryWrapper<MarketingAppsIp> query = new QueryWrapper<>();
 		QueryWrapper<MarketingAppsIp> query = new QueryWrapper<>();
-		query.eq("app_id", appId);
+		query.eq("app_id", appId).eq("source_type",2);
 
 
 		// 单IP模式检查
 		// 单IP模式检查
 		if (ipDto.getIpMode() == 1) {
 		if (ipDto.getIpMode() == 1) {
@@ -601,8 +615,7 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
 	/**
 	/**
 	 * 检查分组IP表中是否存在冲突
 	 * 检查分组IP表中是否存在冲突
 	 */
 	 */
-	private boolean checkGroupIpExists(MarketingAppsIpDTO ipDTO, Long appId) {
-		List<Long> groupIds = getAppRelatedGroupIds(appId, true);  // 需要实现获取应用关联的分组ID列表
+	private boolean checkGroupIpExists(MarketingAppsIpDTO ipDTO, List<Long> groupIds) {
 		if (groupIds.isEmpty()) {
 		if (groupIds.isEmpty()) {
 			return false;
 			return false;
 		}
 		}

+ 8 - 6
pig-marketing/pig-marketing-biz/src/main/java/com/pig4cloud/pig/marketing/service/impl/MarketingConfigServiceImpl.java

@@ -1,11 +1,11 @@
 package com.pig4cloud.pig.marketing.service.impl;
 package com.pig4cloud.pig.marketing.service.impl;
 
 
 
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.pig4cloud.pig.admin.api.dto.SysPublicParamDTO;
 import com.pig4cloud.pig.admin.api.dto.SysPublicParamDTO;
 import com.pig4cloud.pig.admin.api.feign.RemoteParamService;
 import com.pig4cloud.pig.admin.api.feign.RemoteParamService;
+import com.pig4cloud.pig.common.core.exception.BusinessException;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.marketing.api.dto.config.*;
 import com.pig4cloud.pig.marketing.api.dto.config.*;
 import com.pig4cloud.pig.marketing.api.entity.*;
 import com.pig4cloud.pig.marketing.api.entity.*;
@@ -15,7 +15,6 @@ import com.pig4cloud.pig.marketing.service.MarketingConfigService;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
-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;
 
 
@@ -102,7 +101,7 @@ public class MarketingConfigServiceImpl implements MarketingConfigService {
 	public R getMarketingGroupDetail(Long id) {
 	public R getMarketingGroupDetail(Long id) {
 		MarketingConfigGroup group = groupMapper.selectById(id);
 		MarketingConfigGroup group = groupMapper.selectById(id);
 		if (group == null){
 		if (group == null){
-			throw new RuntimeException("id:"+id+",分组不存在");
+			throw new BusinessException("id:"+id+",分组不存在");
 		}
 		}
 		if (group.getGroupType().equals(1)){
 		if (group.getGroupType().equals(1)){
 			// IP类型
 			// IP类型
@@ -252,7 +251,10 @@ public class MarketingConfigServiceImpl implements MarketingConfigService {
 			// 新增、修改
 			// 新增、修改
 			Boolean isExist = groupIpMapper.checkIpConflict(ipDto.getIpMode(),ipDto.getStartIp(), ipDto.getEndIp(), ipDto.getId(), reqDto.getId());
 			Boolean isExist = groupIpMapper.checkIpConflict(ipDto.getIpMode(),ipDto.getStartIp(), ipDto.getEndIp(), ipDto.getId(), reqDto.getId());
 			if (isExist){
 			if (isExist){
-				return R.failed("IP已存在");
+				if (ipDto.getIpMode() == 1){
+					throw new BusinessException("ip:"+ipDto.getStartIp()+"已存在");
+				}
+				throw new BusinessException("ip:"+ipDto.getStartIp()+"/"+ipDto.getEndIp()+"已存在");
 			}
 			}
 			 if (ipDto.getId() == null){
 			 if (ipDto.getId() == null){
 				 // 新增
 				 // 新增
@@ -356,7 +358,7 @@ public class MarketingConfigServiceImpl implements MarketingConfigService {
 				.eq(MarketingAppsIp::getId, id)
 				.eq(MarketingAppsIp::getId, id)
 				.eq(MarketingAppsIp::getConfig, true));
 				.eq(MarketingAppsIp::getConfig, true));
 		if (ip == null) {
 		if (ip == null) {
-			throw new RuntimeException("id: "+id+" ,IP不存在");
+			throw new BusinessException("id: "+id+" ,IP不存在");
 		}
 		}
 		int delete = ipMapper.deleteById(id);
 		int delete = ipMapper.deleteById(id);
 		return delete > 0;
 		return delete > 0;
@@ -413,7 +415,7 @@ public class MarketingConfigServiceImpl implements MarketingConfigService {
 				.eq(MarketingAppsDomain::getId, id)
 				.eq(MarketingAppsDomain::getId, id)
 				.eq(MarketingAppsDomain::getConfig, true));
 				.eq(MarketingAppsDomain::getConfig, true));
 		if (domain == null){
 		if (domain == null){
-			throw new RuntimeException("id:"+id+",域名不存在");
+			throw new BusinessException("id:"+id+",域名不存在");
 		}
 		}
 		int delete = domainMapper.deleteById(id);
 		int delete = domainMapper.deleteById(id);
 		return delete > 0;
 		return delete > 0;

+ 0 - 1
pig-marketing/pig-marketing-biz/src/main/java/com/pig4cloud/pig/marketing/service/impl/MarketingDataServiceImpl.java

@@ -19,7 +19,6 @@ import jakarta.servlet.http.HttpServletRequest;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.context.annotation.Bean;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 

+ 2 - 1
pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysPublicParamController.java

@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.pig4cloud.pig.admin.api.dto.SysPublicParamDTO;
 import com.pig4cloud.pig.admin.api.dto.SysPublicParamDTO;
 import com.pig4cloud.pig.admin.api.entity.SysPublicParam;
 import com.pig4cloud.pig.admin.api.entity.SysPublicParam;
 import com.pig4cloud.pig.admin.service.SysPublicParamService;
 import com.pig4cloud.pig.admin.service.SysPublicParamService;
+import com.pig4cloud.pig.common.core.exception.BusinessException;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.common.core.util.R;
 import com.pig4cloud.pig.common.log.annotation.SysLog;
 import com.pig4cloud.pig.common.log.annotation.SysLog;
 import com.pig4cloud.pig.common.security.annotation.HasPermission;
 import com.pig4cloud.pig.common.security.annotation.HasPermission;
@@ -81,7 +82,7 @@ public class SysPublicParamController {
 			SysPublicParam param = sysPublicParamService.getOne(Wrappers.<SysPublicParam>lambdaQuery()
 			SysPublicParam param = sysPublicParamService.getOne(Wrappers.<SysPublicParam>lambdaQuery()
 					.eq(SysPublicParam::getPublicKey, paramDTO.getPublicKey()));
 					.eq(SysPublicParam::getPublicKey, paramDTO.getPublicKey()));
 			if (param == null){
 			if (param == null){
-				throw new RuntimeException("key:"+paramDTO.getPublicKey()+"参数不存在");
+				throw new BusinessException("key:"+paramDTO.getPublicKey()+"参数不存在");
 			}
 			}
 			param.setPublicValue(paramDTO.getPublicValue());
 			param.setPublicValue(paramDTO.getPublicValue());
 			params.add(param);
 			params.add(param);