mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、统一抛出ServiceException带占位符的填充方式,不再使用ServiceExceptionUtils;2、新增System服务ErrorCode的国际化;3、Webcad异步导入移除分布式锁,导入解析事务完善;
This commit is contained in:
+2
-4
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.application;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.dal.dataobject.application.ApplicationDO;
|
||||
import com.cf.imes.module.system.service.application.ApplicationService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -9,9 +10,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.APPLICATION_NOT_EXISTS;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@@ -26,7 +24,7 @@ public class ApplicationApiImpl implements ApplicationApi{
|
||||
// 获取数值
|
||||
ApplicationDO applicationDO = applicationService.getApplicationByOrganId(organId);
|
||||
if (applicationDO == null){
|
||||
throw exception(APPLICATION_NOT_EXISTS);
|
||||
throw new ServiceException(APPLICATION_NOT_EXISTS);
|
||||
}
|
||||
// 数据转json
|
||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(applicationDO);
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.api.datasource;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
||||
import com.cf.imes.module.system.dal.dataobject.datasource.DataSourceDO;
|
||||
@@ -10,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
|
||||
@RestController
|
||||
public class DataSourceApiImpl implements DataSourceApi {
|
||||
@@ -22,7 +23,7 @@ public class DataSourceApiImpl implements DataSourceApi {
|
||||
public CommonResult<String> getSqlById(Long id) {
|
||||
DataSourceDO dataSourceDO = dataSourceMapper.selectById(id);
|
||||
if(Objects.isNull(dataSourceDO)) {
|
||||
throw exception(new ErrorCode(2133,"数据源不存在"));
|
||||
throw new ServiceException(new ErrorCode(2133,"数据源不存在"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.organ;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.api.organ.dto.OrganizationDTO;
|
||||
@@ -18,7 +19,6 @@ import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ORG_PRODUCT_EXPIRED;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@@ -75,7 +75,7 @@ public class OrganApiImpl implements OrganApi {
|
||||
}
|
||||
// 产品过期且没有有效的延期记录时,提示产品已过期
|
||||
if (!productMatch && !delayMatch) {
|
||||
throw exception(ORG_PRODUCT_EXPIRED);
|
||||
throw new ServiceException(ORG_PRODUCT_EXPIRED);
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.api.process;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.api.process.dto.ProcessListReqDTO;
|
||||
import com.cf.imes.module.system.api.process.dto.ProcessRespDTO;
|
||||
@@ -15,7 +16,6 @@ import jakarta.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PROCESS_GROUP_NOT_EXISTS;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@@ -41,7 +41,7 @@ public class ProcessGroupApiImpl implements ProcessGroupApi {
|
||||
ProcessGroupDO processGroupDO = processGroupMapper.selectById(groupId);
|
||||
|
||||
if (processGroupDO == null)
|
||||
throw exception(PROCESS_GROUP_NOT_EXISTS);
|
||||
throw new ServiceException(PROCESS_GROUP_NOT_EXISTS);
|
||||
String[] items = processGroupDO.getItems().split(",");
|
||||
List<ProcessRespDTO> lists = new ArrayList<>();
|
||||
ProcessListReqDTO processListReqDTO = BeanUtils.toBean(processGroupDO, ProcessListReqDTO.class).setLists(lists);
|
||||
|
||||
+2
-2
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.setting;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.enums.UserSettingTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.module.system.api.setting.dto.PackageConfigDTO;
|
||||
@@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CURRENTLY_NO_CONFIGURATION_AVAILABLE;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SettingApiImpl implements SettingApi{
|
||||
PackageConfigDO packageConfigDO = packageConfigMapper.selectSetting(type, loginUser.getId(), loginUser.getOrganId());
|
||||
|
||||
if(packageConfigDO == null){
|
||||
throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE,type == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName());
|
||||
throw new ServiceException(CURRENTLY_NO_CONFIGURATION_AVAILABLE,type == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName());
|
||||
}
|
||||
|
||||
return BeanUtils.toBean(packageConfigDO,PackageConfigDTO.class);
|
||||
|
||||
+7
-7
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.systemconfig;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -31,7 +32,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||
@@ -112,7 +112,7 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
.select(SystemConfigSchemeDO::getId,SystemConfigDO::getSetting));
|
||||
|
||||
if(CollUtil.isEmpty(systemConfigSchemeDOS)){
|
||||
throw exception(PLAN_PROCESS_CONFIG_ALL_IS_NULL);
|
||||
throw new ServiceException(PLAN_PROCESS_CONFIG_ALL_IS_NULL);
|
||||
}
|
||||
|
||||
AtomicReference<Integer> processSize = new AtomicReference<>(0);
|
||||
@@ -126,13 +126,13 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
||||
throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(processSize.get() == 0){
|
||||
throw exception(PLAN_PROCESS_CONFIG_ALL_IS_NULL);
|
||||
throw new ServiceException(PLAN_PROCESS_CONFIG_ALL_IS_NULL);
|
||||
}
|
||||
|
||||
return success(processSize.get());
|
||||
@@ -166,7 +166,7 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
||||
throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
||||
}
|
||||
|
||||
List<ProcessSchemeDTO> schemeDTOS = BeanUtils.toBean(processSchemeConfigs, ProcessSchemeDTO.class);
|
||||
@@ -201,7 +201,7 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
||||
throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
||||
}
|
||||
|
||||
return success(BeanUtils.toBean(processSchemeConfigs,ProcessSchemeDTO.class));
|
||||
@@ -214,7 +214,7 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
private void checkValueIsNotEmpty(List<?> value,String error) {
|
||||
|
||||
if(ObjectUtils.isEmpty(value)){
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR,error);
|
||||
throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR,error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
@@ -42,7 +43,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.hutool.core.date.DatePattern.NORM_DATE_FORMATTER;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORGAN_EXPIRETIME_PRODUCTID_LACK;
|
||||
@@ -119,7 +119,7 @@ public class OrganController {
|
||||
public CommonResult<OrganRespVO> getOrgan(@RequestParam("id") Long id) {
|
||||
OrganizationDO organ = organService.getOrgan(id);
|
||||
if (ObjectUtil.isNull(organ)) {
|
||||
throw exception(ORGAN_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||
}
|
||||
OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class);
|
||||
|
||||
@@ -151,14 +151,14 @@ public class OrganController {
|
||||
String expireTime = "";
|
||||
OrganizationDO organ = organService.getOrgan(id);
|
||||
if (ObjectUtil.isNull(organ)) {
|
||||
throw exception(ORGAN_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||
}
|
||||
OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class);
|
||||
// 是否管理端,管理端要选了产品后展示有效时间
|
||||
boolean manageEndPoint = SecurityFrameworkUtils.isManageEndPoint();
|
||||
if (manageEndPoint) {
|
||||
if (ObjectUtil.isNull(productId)) {
|
||||
throw exception(ORGAN_EXPIRETIME_PRODUCTID_LACK);
|
||||
throw new ServiceException(ORGAN_EXPIRETIME_PRODUCTID_LACK);
|
||||
}
|
||||
} else {
|
||||
// 生产端从token中获取产品
|
||||
|
||||
+1
-2
@@ -34,7 +34,6 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ROLE_NOT_EXISTS;
|
||||
@@ -98,7 +97,7 @@ public class RoleController {
|
||||
public CommonResult<RoleRespVO> getRole(@RequestParam("id") Long id) {
|
||||
RoleDO role = roleService.getRole(id);
|
||||
if (ObjectUtil.isNull(role)) {
|
||||
throw exception(ROLE_NOT_EXISTS);
|
||||
throw new ServiceException(ROLE_NOT_EXISTS);
|
||||
}
|
||||
return success(BeanUtils.toBean(role, RoleRespVO.class));
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.controller.admin.user;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
@@ -43,7 +44,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
@@ -167,7 +167,7 @@ public class UserController {
|
||||
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
|
||||
AdminUserDO user = userService.getUser(id);
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
throw new ServiceException(USER_NOT_EXISTS);
|
||||
}
|
||||
// 拼接数据
|
||||
DeptDO dept = deptService.getDept(user.getDeptId());
|
||||
|
||||
+2
-2
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.user;
|
||||
|
||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.profile.UserMobileUpdateReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
|
||||
@@ -27,7 +28,6 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
|
||||
@@ -83,7 +83,7 @@ public class UserProfileController {
|
||||
@Operation(summary = "上传用户个人头像")
|
||||
public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception {
|
||||
if (file.isEmpty()) {
|
||||
throw exception(FILE_IS_EMPTY);
|
||||
throw new ServiceException(FILE_IS_EMPTY);
|
||||
}
|
||||
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
||||
return success(avatar);
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.dal.mysql.user;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -53,7 +53,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
.eq(AdminUserDO::getUsername, userName));
|
||||
if (CollUtil.isNotEmpty(adminUserDOS)) {
|
||||
if (adminUserDOS.size() > 1) {
|
||||
throw ServiceExceptionUtil.exception(USERNAME_MULTIPLE_ERROR, userName);
|
||||
throw new ServiceException(USERNAME_MULTIPLE_ERROR, userName);
|
||||
}
|
||||
adminUserDO = adminUserDOS.get(0);
|
||||
}
|
||||
|
||||
+5
-13
@@ -1,13 +1,8 @@
|
||||
package com.cf.imes.module.system.service.application;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServerException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.monitor.TracerUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.api.logger.dto.LoginLogCreateReqDTO;
|
||||
import com.cf.imes.module.system.controller.admin.application.vo.application.ApplicationPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.application.vo.application.ApplicationRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.application.vo.application.ApplicationSaveReqVO;
|
||||
@@ -16,11 +11,9 @@ import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginRespVO;
|
||||
import com.cf.imes.module.system.convert.auth.AuthConvert;
|
||||
import com.cf.imes.module.system.dal.dataobject.application.ApplicationDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO;
|
||||
import com.cf.imes.module.system.dal.mysql.application.ApplicationMapper;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.cf.imes.module.system.enums.logger.LoginLogTypeEnum;
|
||||
import com.cf.imes.module.system.enums.logger.LoginResultEnum;
|
||||
import com.cf.imes.module.system.enums.oauth2.OAuth2ClientConstants;
|
||||
import com.cf.imes.module.system.service.oauth2.OAuth2TokenService;
|
||||
import com.cf.imes.module.system.util.rsa.AsymmetricAlgorithmUtil;
|
||||
@@ -29,10 +22,9 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.APPLICATION_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@@ -84,7 +76,7 @@ public class ApplicationServiceImpl implements ApplicationService{
|
||||
|
||||
private void validateApplicationExists(Long id) {
|
||||
if (applicationMapper.selectById(id) == null) {
|
||||
throw exception(APPLICATION_NOT_EXISTS);
|
||||
throw new ServiceException(APPLICATION_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,12 +94,12 @@ public class ApplicationServiceImpl implements ApplicationService{
|
||||
public ApplicationLoginRespVO loginApplication(ApplicationRespVO reqVO) {
|
||||
ApplicationDO app = applicationMapper.selectByAppId(reqVO.getAppId());
|
||||
if (Objects.isNull(app)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.APPLICATION_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.APPLICATION_NOT_EXISTS);
|
||||
}
|
||||
// 公钥加密,私钥解密
|
||||
String appId = AsymmetricAlgorithmUtil.encryptByPublic(reqVO.getAppKey(), app.getAppSecret());
|
||||
if (!appId.equals(app.getAppId())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.APPLICATION_LOGIN_USER_DISABLED);
|
||||
throw new ServiceException(ErrorCodeConstants.APPLICATION_LOGIN_USER_DISABLED);
|
||||
}
|
||||
// 创建 Token 令牌,记录登录日志
|
||||
return BeanUtils.toBean(createTokenAfterLoginSuccess(app.getId(), app.getAppId(), LoginLogTypeEnum.LOGIN_USERNAME), ApplicationLoginRespVO.class).setAppId(app.getId());
|
||||
|
||||
+11
-13
@@ -6,7 +6,6 @@ import com.anji.captcha.service.CaptchaService;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.util.monitor.TracerUtils;
|
||||
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
||||
import com.cf.imes.framework.common.util.validation.ValidationUtils;
|
||||
@@ -57,7 +56,6 @@ import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORGAN_DATA_CODE_NOT_EXISTS;
|
||||
|
||||
@@ -132,7 +130,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
// 校验用户是否存在
|
||||
if (user == null) {
|
||||
createLoginLog(null, username, null, null, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
|
||||
}
|
||||
Long organId = user.getOrganId();
|
||||
// 校验机构有效性
|
||||
@@ -143,12 +141,12 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
// 校验密码
|
||||
if (!userService.isPasswordMatch(password, user.getPassword())) {
|
||||
createLoginLog(user.getId(), username, null, organId, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
|
||||
}
|
||||
// 校验是否禁用
|
||||
if (CommonStatusEnum.isDisable(user.getStatus())) {
|
||||
createLoginLog(user.getId(), username, null, organId, logTypeEnum, LoginResultEnum.USER_DISABLED);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_USER_DISABLED);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_LOGIN_USER_DISABLED);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
@@ -183,7 +181,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
String dataSourceCode = organ.getDataSourceCode();
|
||||
// 校验机构数据源
|
||||
if (StringUtils.isBlank(dataSourceCode)) {
|
||||
throw exception(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||
}
|
||||
if (CommonStatusEnum.ENABLE.getStatus().equals(organ.getGrayStatus())) {
|
||||
// 机构启用灰度、版本赋值到user
|
||||
@@ -230,7 +228,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
public void sendSmsCode(AuthSmsSendReqVO reqVO) {
|
||||
// 登录场景,验证是否存在
|
||||
if (userService.getUserByMobile(reqVO.getMobile()) == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
}
|
||||
// 发送验证码
|
||||
smsCodeApi.sendSmsCode(AuthConvert.INSTANCE.convert(reqVO).setCreateIp(getClientIP()));
|
||||
@@ -244,13 +242,13 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
// 获得用户信息
|
||||
AdminUserDO user = userService.getUserByMobile(reqVO.getMobile());
|
||||
if (user == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
}
|
||||
Long organId = user.getOrganId();
|
||||
OrganizationDO organ = organService.getOrgan(organId);
|
||||
String dataSourceCode = organ.getDataSourceCode();
|
||||
if(StringUtils.isBlank(dataSourceCode)) {
|
||||
throw exception(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 创建 Token 令牌,记录登录日志
|
||||
@@ -297,20 +295,20 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
SocialUserRespDTO socialUser = socialUserService.getSocialUserByCode(UserTypeEnum.ADMIN.getValue(), reqVO.getType(),
|
||||
reqVO.getCode(), reqVO.getState());
|
||||
if (socialUser == null || socialUser.getUserId() == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_THIRD_LOGIN_NOT_BIND);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_THIRD_LOGIN_NOT_BIND);
|
||||
}
|
||||
|
||||
// 获得用户
|
||||
AdminUserDO user = userService.getUser(socialUser.getUserId());
|
||||
if (user == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long organId = user.getOrganId();
|
||||
OrganizationDO organ = organService.getOrgan(organId);
|
||||
String dataSourceCode = organ.getDataSourceCode();
|
||||
if(StringUtils.isBlank(dataSourceCode)) {
|
||||
throw exception(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 创建 Token 令牌,记录登录日志
|
||||
@@ -332,7 +330,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
if (!response.isSuccess()) {
|
||||
// 创建登录失败日志(验证码不正确)
|
||||
createLoginLog(null, reqVO.getUsername(), null, null, LoginLogTypeEnum.LOGIN_USERNAME, LoginResultEnum.CAPTCHA_CODE_ERROR);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_CAPTCHA_CODE_ERROR, response.getRepMsg());
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_LOGIN_CAPTCHA_CODE_ERROR, response.getRepMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_FIND;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS;
|
||||
|
||||
@@ -87,7 +87,7 @@ public class CustomPlateNoSeqServiceImpl implements CustomPlateNoSeqService {
|
||||
.eq(SystemConfigDO::getType, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
return systemConfigDO;
|
||||
}
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.*;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.framework.common.util.object.BeanUtils.toBean;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.DATA_SOURCE_NOT_EXISTS;
|
||||
|
||||
@@ -294,7 +294,7 @@ public class DataSourceServiceImpl implements DataSourceService {
|
||||
|
||||
private void validateDataSourceExists(Long id) {
|
||||
if (dataSourceMapper.selectById(id) == null) {
|
||||
throw exception(DATA_SOURCE_NOT_EXISTS);
|
||||
throw new ServiceException(DATA_SOURCE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-18
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
@@ -30,7 +30,6 @@ import jakarta.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.DEPT_USER_OPER_NOT_ALLOW;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PARENT_DEPT_USER_OPER_NOT_ALLOW;
|
||||
@@ -101,13 +100,13 @@ public class DeptServiceImpl implements DeptService {
|
||||
validateDeptExists(id);
|
||||
// 校验是否有子部门
|
||||
if (deptMapper.selectCountByParentId(id) > 0) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_EXITS_CHILDREN);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_EXITS_CHILDREN);
|
||||
}
|
||||
// 校验部门内用户操作
|
||||
checkCurrentWhenOperate(id);
|
||||
// 校验部门内是否存在用户,存在用户则禁止删除
|
||||
if (!userService.getUserListByDeptIds(Collections.singletonList(id)).isEmpty()) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_EXISTS_USER);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_EXISTS_USER);
|
||||
}
|
||||
// 删除部门
|
||||
deptMapper.deleteById(id);
|
||||
@@ -123,12 +122,12 @@ public class DeptServiceImpl implements DeptService {
|
||||
private void checkCurrentWhenOperate(Long deptId) {
|
||||
Long currentDeptId = SecurityFrameworkUtils.getUserDeptId();
|
||||
if (ObjectUtil.equal(deptId, currentDeptId)) {
|
||||
throw exception(DEPT_USER_OPER_NOT_ALLOW);
|
||||
throw new ServiceException(DEPT_USER_OPER_NOT_ALLOW);
|
||||
}
|
||||
// 递归查询所有下级,如果当前用户在范围内不允许操作
|
||||
List<DeptDO> childDeptList = getChildDeptList(deptId);
|
||||
childDeptList.stream().filter(d -> d.getId().equals(currentDeptId)).findAny().ifPresent(deptDO -> {
|
||||
throw exception(PARENT_DEPT_USER_OPER_NOT_ALLOW);
|
||||
throw new ServiceException(PARENT_DEPT_USER_OPER_NOT_ALLOW);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -139,7 +138,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
}
|
||||
DeptDO dept = deptMapper.selectById(id);
|
||||
if (dept == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NOT_FOUND);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,12 +149,12 @@ public class DeptServiceImpl implements DeptService {
|
||||
}
|
||||
// 1. 不能设置自己为父部门
|
||||
if (Objects.equals(id, parentId)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_ERROR);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_ERROR);
|
||||
}
|
||||
// 2. 父部门不存在
|
||||
DeptDO parentDept = deptMapper.selectById(parentId);
|
||||
if (parentDept == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS);
|
||||
}
|
||||
// 2.1 父部门状态校验
|
||||
checkParentStatus(parentDept.getStatus(), parentDept.getName());
|
||||
@@ -164,7 +163,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
// 3.1 校验环路
|
||||
parentId = parentDept.getParentId();
|
||||
if (Objects.equals(id, parentId)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_IS_CHILD);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_IS_CHILD);
|
||||
}
|
||||
// 3.2 继续递归下一级父部门
|
||||
if (parentId == null || DeptDO.PARENT_ID_ROOT.equals(parentId)) {
|
||||
@@ -187,7 +186,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
*/
|
||||
private void checkParentStatus(Integer status, String parentName) {
|
||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(status)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.PARENT_DEPT_DISABLE, parentName);
|
||||
throw new ServiceException(ErrorCodeConstants.PARENT_DEPT_DISABLE, parentName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,10 +198,10 @@ public class DeptServiceImpl implements DeptService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的部门
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NAME_DUPLICATE);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_NAME_DUPLICATE);
|
||||
}
|
||||
if (ObjectUtil.notEqual(dept.getId(), id)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NAME_DUPLICATE);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_NAME_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,10 +265,10 @@ public class DeptServiceImpl implements DeptService {
|
||||
public void validDept(Long deptId) {
|
||||
DeptDO deptDO = deptMapper.selectById(deptId);
|
||||
if (deptDO == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NOT_FOUND);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_NOT_FOUND);
|
||||
}
|
||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(deptDO.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_DISABLE, deptDO.getName());
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_DISABLE, deptDO.getName());
|
||||
}
|
||||
// 递归校验上级部门
|
||||
validParentDept(deptDO);
|
||||
@@ -287,7 +286,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
return;
|
||||
}
|
||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(deptDO.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NOT_ALLOWED_LOGIN, deptDO.getName());
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_NOT_ALLOWED_LOGIN, deptDO.getName());
|
||||
}
|
||||
// 递归校验上级部门
|
||||
validParentDept(deptDO);
|
||||
@@ -308,9 +307,9 @@ public class DeptServiceImpl implements DeptService {
|
||||
return;
|
||||
}
|
||||
if (parentDept == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS);
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS);
|
||||
} else if (!CommonStatusEnum.ENABLE.getStatus().equals(parentDept.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_DISABLE, parentDept.getName());
|
||||
throw new ServiceException(ErrorCodeConstants.DEPT_DISABLE, parentDept.getName());
|
||||
} else {
|
||||
validParentDept(parentDept);
|
||||
}
|
||||
|
||||
+9
-9
@@ -8,7 +8,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -151,10 +151,10 @@ public class DictDataServiceImpl implements DictDataService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的字典数据
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE);
|
||||
}
|
||||
if (!dictData.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class DictDataServiceImpl implements DictDataService {
|
||||
}
|
||||
DictDataDO dictData = dictDataMapper.selectById(id);
|
||||
if (dictData == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_DATA_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,10 +173,10 @@ public class DictDataServiceImpl implements DictDataService {
|
||||
public void validateDictTypeExists(String type) {
|
||||
DictTypeDO dictType = dictTypeService.getDictType(type);
|
||||
if (dictType == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS);
|
||||
}
|
||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(dictType.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NOT_ENABLE);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NOT_ENABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,10 +191,10 @@ public class DictDataServiceImpl implements DictDataService {
|
||||
values.forEach(value -> {
|
||||
DictDataDO dictData = dictDataMap.get(value);
|
||||
if (dictData == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_DATA_NOT_EXISTS);
|
||||
}
|
||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(dictData.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_NOT_ENABLE, dictData.getLabel());
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_DATA_NOT_ENABLE, dictData.getLabel());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -246,7 +246,7 @@ public class DictDataServiceImpl implements DictDataService {
|
||||
JSONObject obj = JSON.parseObject(transResult);
|
||||
String errorCode = obj.getString("error_code");
|
||||
if (StringUtils.isNotEmpty(errorCode)) {
|
||||
throw ServiceExceptionUtil.exception(DICT_DATA_TRANS_ERROR, errorCode);
|
||||
throw new ServiceException(DICT_DATA_TRANS_ERROR, errorCode);
|
||||
}
|
||||
JSONArray arr = obj.getJSONArray("trans_result");
|
||||
|
||||
|
||||
+7
-7
@@ -4,7 +4,7 @@ import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -97,7 +97,7 @@ public class DictTypeServiceImpl implements DictTypeService {
|
||||
DictTypeDO dictType = validateDictTypeExists(id);
|
||||
// 校验是否有字典数据
|
||||
if (dictDataService.getDictDataCountByDictType(dictType.getType()) > 0) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_HAS_CHILDREN);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_HAS_CHILDREN);
|
||||
}
|
||||
// 删除字典类型
|
||||
dictTypeMapper.updateToDelete(id, LocalDateTime.now());
|
||||
@@ -116,10 +116,10 @@ public class DictTypeServiceImpl implements DictTypeService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的字典类型
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE);
|
||||
}
|
||||
if (!dictType.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,10 +134,10 @@ public class DictTypeServiceImpl implements DictTypeService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的字典类型
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE);
|
||||
}
|
||||
if (!dictType.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class DictTypeServiceImpl implements DictTypeService {
|
||||
}
|
||||
DictTypeDO dictType = dictTypeMapper.selectById(id);
|
||||
if (dictType == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS);
|
||||
}
|
||||
return dictType;
|
||||
}
|
||||
|
||||
+5
-4
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.service.errorcode;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.api.errorcode.dto.ErrorCodeAutoGenerateReqDTO;
|
||||
@@ -21,7 +22,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ERROR_CODE_DUPLICATE;
|
||||
@@ -90,17 +91,17 @@ public class ErrorCodeServiceImpl implements ErrorCodeService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的错误码
|
||||
if (id == null) {
|
||||
throw exception(ERROR_CODE_DUPLICATE);
|
||||
throw new ServiceException(ERROR_CODE_DUPLICATE);
|
||||
}
|
||||
if (!errorCodeDO.getId().equals(id)) {
|
||||
throw exception(ERROR_CODE_DUPLICATE);
|
||||
throw new ServiceException(ERROR_CODE_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateErrorCodeExists(Long id) {
|
||||
if (errorCodeMapper.selectById(id) == null) {
|
||||
throw exception(ERROR_CODE_NOT_EXISTS);
|
||||
throw new ServiceException(ERROR_CODE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.service.funds.advertisement;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -24,7 +25,6 @@ import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
||||
|
||||
if (createReqVO.getStartTime().isAfter(createReqVO.getEndTime())) {
|
||||
|
||||
throw exception(ADVERTISEMENT_TIME_ERROR);
|
||||
throw new ServiceException(ADVERTISEMENT_TIME_ERROR);
|
||||
}
|
||||
|
||||
AdvertisementDO aDo = advertisementMapper.selectAdByAdName(createReqVO.getAdName(), null);
|
||||
@@ -74,7 +74,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
||||
@Override
|
||||
public void update(AdvertisementSaveReqVO reqVO) {
|
||||
if (reqVO.getStartTime().isAfter(reqVO.getEndTime())) {
|
||||
throw exception(ADVERTISEMENT_TIME_ERROR);
|
||||
throw new ServiceException(ADVERTISEMENT_TIME_ERROR);
|
||||
}
|
||||
|
||||
Long id = reqVO.getId();
|
||||
@@ -83,7 +83,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
||||
|
||||
// 发布中的广告不允许编辑
|
||||
if (advertisementDO.getStatus().equals(AdvertisementStatusEnum.PUBLISHED.getStatus())) {
|
||||
throw exception(ADVERTISEMENT_UPDATE_STATUS_ERROR);
|
||||
throw new ServiceException(ADVERTISEMENT_UPDATE_STATUS_ERROR);
|
||||
}
|
||||
|
||||
// 广告名重复校验
|
||||
@@ -111,7 +111,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
||||
AdvertisementDO advertisementDO = validateAdvertisementExists(id);
|
||||
|
||||
if (advertisementDO.getStatus().equals(AdvertisementStatusEnum.PUBLISHED.getStatus())) {
|
||||
throw exception(ADVERTISEMENT_NO_DELETE);
|
||||
throw new ServiceException(ADVERTISEMENT_NO_DELETE);
|
||||
}
|
||||
// 删除广告
|
||||
advertisementMapper.deleteById(id);
|
||||
@@ -161,7 +161,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
||||
// 广告的结束时间
|
||||
LocalDate endTime = advertisementDO.getEndTime();
|
||||
if (LocalDate.now().isAfter(endTime)) {
|
||||
throw exception(ADVERTISEMENT_STATUS_ENDTIME_EXPIRED);
|
||||
throw new ServiceException(ADVERTISEMENT_STATUS_ENDTIME_EXPIRED);
|
||||
}
|
||||
|
||||
advertisementMapper.update(new LambdaUpdateWrapper<AdvertisementDO>()
|
||||
@@ -186,7 +186,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
||||
validateAdvertisementExists(id);
|
||||
|
||||
if (reqVO.getStartTime().isAfter(reqVO.getEndTime())) {
|
||||
throw exception(ADVERTISEMENT_TIME_ERROR);
|
||||
throw new ServiceException(ADVERTISEMENT_TIME_ERROR);
|
||||
}
|
||||
|
||||
advertisementMapper.update(new LambdaUpdateWrapper<AdvertisementDO>()
|
||||
@@ -221,7 +221,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
||||
.eq(AdvertisementDO::getDeleted, false)
|
||||
.eq(AdvertisementDO::getId, id));
|
||||
if (advertisementDO == null) {
|
||||
throw exception(ADVERTISEMENT_NO_EXIST);
|
||||
throw new ServiceException(ADVERTISEMENT_NO_EXIST);
|
||||
}
|
||||
return advertisementDO;
|
||||
}
|
||||
@@ -230,12 +230,12 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
||||
public String uploadAdImage(MultipartFile adImageFile) {
|
||||
try {
|
||||
if (adImageFile.isEmpty()) {
|
||||
throw exception(ADVERTISEMENT_IMAGE_EMPTY_ERROR);
|
||||
throw new ServiceException(ADVERTISEMENT_IMAGE_EMPTY_ERROR);
|
||||
}
|
||||
return fileApi.createFile(adImageFile.getBytes());
|
||||
} catch (IOException e) {
|
||||
log.error("上传广告图片失败", e);
|
||||
throw exception(ADVERTISEMENT_IMAGE_UPLOAD_FAIL);
|
||||
throw new ServiceException(ADVERTISEMENT_IMAGE_UPLOAD_FAIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -58,7 +58,6 @@ import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
|
||||
import static cn.hutool.core.date.DatePattern.PURE_DATETIME_PATTERN;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseObject;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||
@@ -343,7 +342,7 @@ public class InvoiceServiceImpl implements InvoiceService {
|
||||
|
||||
if (invoiceRecordsDO.getStatus().equals(InvoiceStatusEnum.INVOICINGFAILED.getCode())
|
||||
|| invoiceRecordsDO.getStatus().equals(InvoiceStatusEnum.INVOICINGSUCCESSFUL.getCode())) {
|
||||
throw exception(THIS_INVOICE_IS_FAIL);
|
||||
throw new ServiceException(THIS_INVOICE_IS_FAIL);
|
||||
}
|
||||
|
||||
// 校验发票记录下的购买记录是否存在
|
||||
@@ -425,7 +424,7 @@ public class InvoiceServiceImpl implements InvoiceService {
|
||||
private InvoiceRecordsDO validateInvoiceExists(Long invoiceId) {
|
||||
InvoiceRecordsDO invoiceRecordsDO = invoiceRecordsMapper.selectById(invoiceId);
|
||||
if (ObjectUtil.isNull(invoiceRecordsDO)) {
|
||||
throw exception(INVOICE_NO_EXIST);
|
||||
throw new ServiceException(INVOICE_NO_EXIST);
|
||||
}
|
||||
return invoiceRecordsDO;
|
||||
}
|
||||
@@ -439,7 +438,7 @@ public class InvoiceServiceImpl implements InvoiceService {
|
||||
private List<PurchaseRecordDO> validatePurchaseRecordExists(List<Long> purchaseId) {
|
||||
List<PurchaseRecordDO> purchaseRecordDOS = purchaseRecordMapper.selectBatchIds(purchaseId);
|
||||
if (CollUtil.isEmpty(purchaseRecordDOS)) {
|
||||
throw exception(PURCHASE_RECORD_NO_EXIST);
|
||||
throw new ServiceException(PURCHASE_RECORD_NO_EXIST);
|
||||
}
|
||||
return purchaseRecordDOS;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.service.funds.productpromotion;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
||||
@@ -21,7 +22,6 @@ import jakarta.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PRODUCT_PROMOTION_ACTIVE_NAME_IS_EXIST;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PRODUCT_PROMOTION_NO_EXIST;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PRODUCT_PROMOTION_PURCHASEDURATION_IS_EXIST;
|
||||
@@ -138,13 +138,13 @@ public class ProductPromotionServiceImpl implements ProductPromotionService {
|
||||
// 校验是否存在
|
||||
private ProductPromotionDO validateRechargeActiveExists(Long id) {
|
||||
if (id == null) {
|
||||
throw exception(PRODUCT_PROMOTION_NO_EXIST);
|
||||
throw new ServiceException(PRODUCT_PROMOTION_NO_EXIST);
|
||||
}
|
||||
ProductPromotionDO giftMoneyDetailsDO = productPromotionMapper.selectOne(new LambdaQueryWrapperX<ProductPromotionDO>()
|
||||
.eq(ProductPromotionDO::getId, id)
|
||||
.eq(ProductPromotionDO::getDeleted, false));
|
||||
if (giftMoneyDetailsDO == null) {
|
||||
throw exception(PRODUCT_PROMOTION_NO_EXIST);
|
||||
throw new ServiceException(PRODUCT_PROMOTION_NO_EXIST);
|
||||
}
|
||||
|
||||
return giftMoneyDetailsDO;
|
||||
|
||||
+6
-7
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.funds.products;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -23,7 +23,6 @@ import jakarta.annotation.Resource;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -99,7 +98,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
||||
@Override
|
||||
public ProductsDetailDO validateProductDetailsExists(Long id) {
|
||||
if (id == null) {
|
||||
throw exception(PRODUCTS_DETAIL_NO_EXIST);
|
||||
throw new ServiceException(PRODUCTS_DETAIL_NO_EXIST);
|
||||
}
|
||||
|
||||
ProductsDetailDO productsDetailDO = productDetailsMapper.selectOne(new LambdaQueryWrapperX<ProductsDetailDO>()
|
||||
@@ -107,7 +106,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
||||
.eq(ProductsDetailDO::getDeleted, false));
|
||||
|
||||
if (productsDetailDO == null) {
|
||||
throw exception(PRODUCTS_DETAIL_NO_EXIST);
|
||||
throw new ServiceException(PRODUCTS_DETAIL_NO_EXIST);
|
||||
}
|
||||
|
||||
return productsDetailDO;
|
||||
@@ -128,7 +127,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
||||
AssertUtils.notEmpty(productsDO, PRODUCTS_NO_EXIST);
|
||||
|
||||
if (!productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())) {
|
||||
throw exception(PRODUCTS_NOT_NOLIST);
|
||||
throw new ServiceException(PRODUCTS_NOT_NOLIST);
|
||||
}
|
||||
|
||||
return productsDO;
|
||||
@@ -148,7 +147,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
||||
AssertUtils.notEmpty(productsDO, PRODUCTS_NO_EXIST);
|
||||
|
||||
if (productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())) {
|
||||
throw exception(PRODUCTS_DETAIL_NO_UPDATE);
|
||||
throw new ServiceException(PRODUCTS_DETAIL_NO_UPDATE);
|
||||
}
|
||||
|
||||
return productsDO;
|
||||
@@ -167,7 +166,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
||||
// 时长去重
|
||||
count = productDetailsMapper.selectCountByDuration(createReqVO.getProductId(), createReqVO.getId(), duration, durationUnit);
|
||||
if (count > 0) {
|
||||
throw ServiceExceptionUtil.exception(PRODUCTS_DETAIL_DURATION_EXIST, duration, ProductDurationUnitEnum.getDesc(durationUnit));
|
||||
throw new ServiceException(PRODUCTS_DETAIL_DURATION_EXIST, duration, ProductDurationUnitEnum.getDesc(durationUnit));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.service.funds.products;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -18,7 +19,6 @@ import jakarta.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ public class ProductsServiceImpl implements ProductsService {
|
||||
|
||||
// 当前状态是上架状态 && 目标状态不是下架 的操作提示已上架
|
||||
if (ProductStatusEnum.PRODUCT_UPDATES.getStatus().equals(status) && !ProductStatusEnum.isProductDelis(updateReqVOStatus)) {
|
||||
throw exception(PRODUCTS_NO_UPDATE);
|
||||
throw new ServiceException(PRODUCTS_NO_UPDATE);
|
||||
}
|
||||
ProductsDO productsDO = BeanUtils.toBean(updateReqVO, ProductsDO.class);
|
||||
productsMapper.updateById(productsDO);
|
||||
@@ -82,7 +82,7 @@ public class ProductsServiceImpl implements ProductsService {
|
||||
ProductsDO productsDO = validateProductPlateExists(id);
|
||||
|
||||
if(productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())){
|
||||
throw exception(PRODUCTS_NO_DELETE);
|
||||
throw new ServiceException(PRODUCTS_NO_DELETE);
|
||||
}
|
||||
|
||||
productsMapper.update(new LambdaUpdateWrapper<ProductsDO>()
|
||||
@@ -115,7 +115,7 @@ public class ProductsServiceImpl implements ProductsService {
|
||||
.eq(ProductsDO::getDeleted, false));
|
||||
|
||||
if (productsDO == null) {
|
||||
throw exception(PRODUCTS_NO_EXIST);
|
||||
throw new ServiceException(PRODUCTS_NO_EXIST);
|
||||
}
|
||||
return productsDO;
|
||||
}
|
||||
|
||||
+1
-2
@@ -8,7 +8,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
||||
@@ -249,7 +248,7 @@ public class PurchaseServiceImpl implements PurchaseService {
|
||||
.findFirst();
|
||||
|
||||
if (duplicateOpt.isPresent()) {
|
||||
throw ServiceExceptionUtil.exception(ORG_PRODUCT_PURCHASE_EXIST_ERROR, currProductMap.get(duplicateOpt.get().getProductId()));
|
||||
throw new ServiceException(ORG_PRODUCT_PURCHASE_EXIST_ERROR, currProductMap.get(duplicateOpt.get().getProductId()));
|
||||
}
|
||||
|
||||
// 5、删选出当前记录和入参列表中purchaseId不重复的,作为删除的部分
|
||||
|
||||
+8
-8
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.service.labeltemplate;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -14,7 +15,6 @@ import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.dal.mysql.labeltemplate.LabelTemplateMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -58,18 +58,18 @@ public class LabelTemplateServiceImpl implements LabelTemplateService {
|
||||
// 校验存在
|
||||
LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id);
|
||||
if (labelTemplateDO == null) {
|
||||
throw exception(LABEL_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(LABEL_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
Boolean isDefault = labelTemplateDO.getIsDefault();
|
||||
if(isDefault) {
|
||||
throw exception(DEFAULT_NOT_DELETED);
|
||||
throw new ServiceException(DEFAULT_NOT_DELETED);
|
||||
}
|
||||
labelTemplateMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateLabelTemplateExists(Long id) {
|
||||
if (labelTemplateMapper.selectById(id) == null) {
|
||||
throw exception(LABEL_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(LABEL_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,14 +90,14 @@ public class LabelTemplateServiceImpl implements LabelTemplateService {
|
||||
);
|
||||
if(CollUtil.isNotEmpty(labelTemplateDOS)) {
|
||||
if (labelTemplateDOS.size() > 1) {
|
||||
throw exception(DEFAULT_TEMPLATE_COUNT);
|
||||
throw new ServiceException(DEFAULT_TEMPLATE_COUNT);
|
||||
}
|
||||
LabelTemplateDO labelTemplateDO = labelTemplateDOS.get(0);
|
||||
labelTemplateDO.setTemplate(JsonUtils.unzipString(labelTemplateDO.getTemplate()));
|
||||
LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class);
|
||||
return labelTemplateRespVO;
|
||||
}
|
||||
throw exception(DEFAULT_LABEL_NOT_EXISTS);
|
||||
throw new ServiceException(DEFAULT_LABEL_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,14 +105,14 @@ public class LabelTemplateServiceImpl implements LabelTemplateService {
|
||||
public Boolean setDefaultTemplate(Long id) {
|
||||
LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id);
|
||||
if(Objects.isNull(labelTemplateDO)) {
|
||||
throw exception(LABEL_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(LABEL_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
List<LabelTemplateDO> labelTemplateDOS = labelTemplateMapper.selectList(new LambdaQueryWrapperX<LabelTemplateDO>()
|
||||
.eq(LabelTemplateDO::getIsDefault, Boolean.TRUE)
|
||||
.eq(LabelTemplateDO::getType, labelTemplateDO.getType())
|
||||
);
|
||||
// if(CollectionUtil.isEmpty(labelTemplateDOS) || labelTemplateDOS.size()>1) {
|
||||
// throw exception(DEFAULT_TEMPLATE_COUNT);
|
||||
// throw new ServiceException(DEFAULT_TEMPLATE_COUNT);
|
||||
// }
|
||||
if(!labelTemplateDOS.isEmpty()){
|
||||
LabelTemplateDO templateDO = new LabelTemplateDO();
|
||||
|
||||
+4
-4
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.lable;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.enums.UserSettingTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -27,7 +28,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseTree;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
@@ -90,7 +90,7 @@ public class LabelServiceImpl implements LabelService {
|
||||
.eq(MachineDO::getLabelId, id)
|
||||
);
|
||||
if(CollUtil.isNotEmpty(machineDOS)) {
|
||||
throw exception(MACHINE_USE_LABEL);
|
||||
throw new ServiceException(MACHINE_USE_LABEL);
|
||||
}
|
||||
|
||||
List<Long> labelId = new ArrayList<>();
|
||||
@@ -110,7 +110,7 @@ public class LabelServiceImpl implements LabelService {
|
||||
});
|
||||
|
||||
if (CollUtil.isNotEmpty(labelId) && labelId.contains(id)) {
|
||||
throw exception(LABEL_IS_USE_ERROR);
|
||||
throw new ServiceException(LABEL_IS_USE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class LabelServiceImpl implements LabelService {
|
||||
private LabelDO validateLabelExists(Long id) {
|
||||
LabelDO labelDO = labelMapper.selectById(id);
|
||||
if (labelDO == null) {
|
||||
throw exception(LABEL_NOT_EXISTS);
|
||||
throw new ServiceException(LABEL_NOT_EXISTS);
|
||||
}
|
||||
return labelDO;
|
||||
}
|
||||
|
||||
+17
-17
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.MachineTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -44,7 +45,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.*;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
@@ -95,13 +95,13 @@ public class MachineServiceImpl implements MachineService {
|
||||
MachineLimitDO machineLimitDO = machineLimitMapper.selectById(loginUser.getOrganId());
|
||||
|
||||
if(machineLimitDO == null){
|
||||
throw exception(MACHINE_DATA_ERROR);
|
||||
throw new ServiceException(MACHINE_DATA_ERROR);
|
||||
}
|
||||
|
||||
// 校验机台名称是否重复
|
||||
MachineDO machine = machineMapper.selectMachineName(createReqVO.getName(), createReqVO.getMachineType(), getUserOrganId());
|
||||
if (machine != null) {
|
||||
throw exception(MACHINE_NAME_ERROR);
|
||||
throw new ServiceException(MACHINE_NAME_ERROR);
|
||||
}
|
||||
|
||||
validateMachineNum(createReqVO.getMachineType(), loginUser.getOrganId());
|
||||
@@ -132,7 +132,7 @@ public class MachineServiceImpl implements MachineService {
|
||||
machineTemplateDO = machineTemplateMapper.selectMachine(createReqVO.getBrandId(), createReqVO.getMachineId());
|
||||
|
||||
if (machineTemplateDO == null) {
|
||||
throw exception(THE_MODEL_OF_THE_MACHINE_DOES_NOT_EXIST);
|
||||
throw new ServiceException(THE_MODEL_OF_THE_MACHINE_DOES_NOT_EXIST);
|
||||
}
|
||||
|
||||
// 创建新的机器对象
|
||||
@@ -349,11 +349,11 @@ public class MachineServiceImpl implements MachineService {
|
||||
// 校验存在
|
||||
MachineDO machineDO = machineMapper.selectById(id);
|
||||
if (machineDO == null) {
|
||||
throw exception(MACHINE_NOT_EXISTS);
|
||||
throw new ServiceException(MACHINE_NOT_EXISTS);
|
||||
}
|
||||
// 校验当前机台是否使用
|
||||
if (Boolean.TRUE.equals(orderPlanApi.getOrderPlan(id).getData())) {
|
||||
throw exception(THE_CURRENT_MACHINE_IS_ALREADY_IN_USE);
|
||||
throw new ServiceException(THE_CURRENT_MACHINE_IS_ALREADY_IN_USE);
|
||||
}
|
||||
|
||||
List<SystemConfigSchemeDO> systemConfigSchemeDOS = systemConfigSchemeMapper.selectOrganConfig(machineDO.getOrganId());
|
||||
@@ -374,7 +374,7 @@ public class MachineServiceImpl implements MachineService {
|
||||
}
|
||||
|
||||
if(machineIds.contains(id)){
|
||||
throw exception(MACHINE_USED_ALREADY);
|
||||
throw new ServiceException(MACHINE_USED_ALREADY);
|
||||
}
|
||||
|
||||
machineMapper.deleteById(id);
|
||||
@@ -384,7 +384,7 @@ public class MachineServiceImpl implements MachineService {
|
||||
public void batchDeleteCutting(List<Long> ids) {
|
||||
List<MachineDO> machineDOS = machineMapper.selectBatchIds(ids);
|
||||
if (CollUtil.isEmpty(machineDOS)) {
|
||||
throw exception(MACHINE_NOT_EXISTS);
|
||||
throw new ServiceException(MACHINE_NOT_EXISTS);
|
||||
}
|
||||
machineMapper.deleteBatchIds(ids);
|
||||
}
|
||||
@@ -394,7 +394,7 @@ public class MachineServiceImpl implements MachineService {
|
||||
MachineDO machineDO = machineMapper.selectById(id);
|
||||
|
||||
if (machineDO == null) {
|
||||
throw exception(MACHINE_ERROR);
|
||||
throw new ServiceException(MACHINE_ERROR);
|
||||
}
|
||||
// 对机台的配置进行解压
|
||||
machineDO.setSetting(JsonUtils.unzipString(machineDO.getSetting()));
|
||||
@@ -440,20 +440,20 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
OrganizationDO tenant = organMapper.selectById(vo.getOrganId());
|
||||
if (tenant == null) {
|
||||
throw exception(ORGAN_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||
}
|
||||
|
||||
MachineLimitDO machineLimit = machineLimitMapper.selectById(vo.getOrganId());
|
||||
|
||||
if (machineLimit != null) {
|
||||
throw exception(ORGAN_ALREADY_EXISTS);
|
||||
throw new ServiceException(ORGAN_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
Integer[] limits = {vo.getCutLimit(), vo.getDrillLimit(), vo.getLabelLimit(), vo.getSawLimit(), vo.getSealedgeLimit()};
|
||||
|
||||
for (Integer limit : limits) {
|
||||
if (limit > 127) {
|
||||
throw exception(MACHINE_NUM_DATA_ERROR);
|
||||
throw new ServiceException(MACHINE_NUM_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
OrganizationDO tenant = organMapper.selectById(vo.getOrganId());
|
||||
if (tenant == null) {
|
||||
throw exception(ORGAN_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||
}
|
||||
|
||||
|
||||
@@ -486,7 +486,7 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
for (Integer limit : limits) {
|
||||
if (limit > 127) {
|
||||
throw exception(MACHINE_NUM_DATA_ERROR);
|
||||
throw new ServiceException(MACHINE_NUM_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,12 +587,12 @@ public class MachineServiceImpl implements MachineService {
|
||||
private void validateExists(Long id, String name, Integer machineType, Long machineId) {
|
||||
MachineDO machineDO = machineMapper.selectById(id);
|
||||
if (machineDO == null) {
|
||||
throw exception(MACHINE_NOT_EXISTS);
|
||||
throw new ServiceException(MACHINE_NOT_EXISTS);
|
||||
}
|
||||
MachineDO machine = machineMapper.selectMachine(name, machineType, machineId, getUserOrganId());
|
||||
|
||||
if (machine != null) {
|
||||
throw exception(MACHINE_NAME_ERROR);
|
||||
throw new ServiceException(MACHINE_NAME_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,7 +613,7 @@ public class MachineServiceImpl implements MachineService {
|
||||
};
|
||||
|
||||
if (machineNum >= authMachineNum) {
|
||||
throw exception(MACHINE_NUM_ERROR);
|
||||
throw new ServiceException(MACHINE_NUM_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+13
-13
@@ -5,6 +5,7 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.MachineTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -34,7 +35,6 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -74,7 +74,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
|
||||
// todo 测试时的判断,测试完毕后删除
|
||||
if (reqVO.getNowBrandId() == null) {
|
||||
throw exception(THE_CURRENT_BRAND);
|
||||
throw new ServiceException(THE_CURRENT_BRAND);
|
||||
}
|
||||
|
||||
validateMachineTemplate(reqVO.getName(), reqVO.getMachineType());
|
||||
@@ -113,7 +113,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
|
||||
MachineBrandDO machineBrandDO = machineBrandMapper.selectById(reqVO.getNowBrandId());
|
||||
if (machineBrandDO == null) {
|
||||
throw exception(THE_CURRENT_BRAND);
|
||||
throw new ServiceException(THE_CURRENT_BRAND);
|
||||
}
|
||||
|
||||
// 校验机台模板是否存在和名称是否重复
|
||||
@@ -133,7 +133,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
public CuttingTemplateRespVO getCuttingTemplateById(String id) {
|
||||
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
||||
if (Objects.isNull(templateDO)) {
|
||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
templateDO.setSetting(unzipString(templateDO.getSetting()));
|
||||
return MachineTemplateConvert.convert1(templateDO);
|
||||
@@ -154,7 +154,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectByBrand(brandId);
|
||||
|
||||
if (!machineTemplateDOS.isEmpty()) {
|
||||
// throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
// throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
|
||||
List<Long> ids = machineTemplateDOS.stream().map(MachineTemplateDO::getId).toList();
|
||||
|
||||
@@ -252,7 +252,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
MachineBrandDO machineBrandDO = machineBrandMapper.selectBrand(reqVO.getBrand(), reqVO.getMachineType());
|
||||
|
||||
if (machineBrandDO != null) {
|
||||
throw exception(THE_CURRENT_BRAND_OF_THE_MACHINE_EXISTS);
|
||||
throw new ServiceException(THE_CURRENT_BRAND_OF_THE_MACHINE_EXISTS);
|
||||
}
|
||||
|
||||
MachineBrandDO machineBrand = MachineBrandDO.builder()
|
||||
@@ -288,7 +288,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
private MachineBrandDO validateBrandExistes(Long id) {
|
||||
MachineBrandDO machineBrandDO = machineBrandMapper.selectById(id);
|
||||
if (ObjectUtil.isNull(machineBrandDO)) {
|
||||
throw exception(THE_CURRENT_BRAND);
|
||||
throw new ServiceException(THE_CURRENT_BRAND);
|
||||
}
|
||||
return machineBrandDO;
|
||||
}
|
||||
@@ -381,7 +381,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
public Boolean deleteCuttingTemplate(Long id) {
|
||||
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
||||
if (Objects.isNull(templateDO)) {
|
||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
machineTemplateMapper.deleteById(id);
|
||||
@@ -458,7 +458,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
throw exception(LABELINGMACHINE_RELATED_DATA_ERROR);
|
||||
throw new ServiceException(LABELINGMACHINE_RELATED_DATA_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -509,7 +509,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
throw exception(DRILLMACHINE_RELATED_DATA_ERROR);
|
||||
throw new ServiceException(DRILLMACHINE_RELATED_DATA_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -523,13 +523,13 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
MachineTemplateDO machineTemplateDO = machineTemplateMapper.selectById(machineId);
|
||||
|
||||
if (machineTemplateDO == null) {
|
||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
MachineTemplateDO machineTemplate = machineTemplateMapper.selectMachineTemplate(name, machineType, machineId);
|
||||
|
||||
if (machineTemplate != null) {
|
||||
throw exception(MACHINETEMPLATE_NAME_ERROR);
|
||||
throw new ServiceException(MACHINETEMPLATE_NAME_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -541,7 +541,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
|
||||
|
||||
if (machineTemplateDO != null) {
|
||||
throw exception(MACHINETEMPLATE_NAME_ERROR);
|
||||
throw new ServiceException(MACHINETEMPLATE_NAME_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-5
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.service.mail;
|
||||
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
||||
@@ -18,8 +18,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 邮箱账号 Service 实现类
|
||||
*
|
||||
@@ -62,7 +60,7 @@ public class MailAccountServiceImpl implements MailAccountService {
|
||||
validateMailAccountExists(id);
|
||||
// 校验是否存在关联模版
|
||||
if (mailTemplateService.getMailTemplateCountByAccountId(id) > 0) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS);
|
||||
}
|
||||
|
||||
// 删除
|
||||
@@ -71,7 +69,7 @@ public class MailAccountServiceImpl implements MailAccountService {
|
||||
|
||||
private void validateMailAccountExists(Long id) {
|
||||
if (mailAccountMapper.selectById(id) == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -5,6 +5,7 @@ import cn.hutool.extra.mail.MailAccount;
|
||||
import cn.hutool.extra.mail.MailUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.convert.mail.MailAccountConvert;
|
||||
import com.cf.imes.module.system.dal.dataobject.mail.MailAccountDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||
@@ -13,7 +14,6 @@ import com.cf.imes.module.system.mq.message.mail.MailSendMessage;
|
||||
import com.cf.imes.module.system.mq.producer.mail.MailProducer;
|
||||
import com.cf.imes.module.system.service.member.MemberService;
|
||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -123,7 +123,7 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode);
|
||||
// 邮件模板不存在
|
||||
if (template == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
return template;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId);
|
||||
// 邮箱账号不存在
|
||||
if (account == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS);
|
||||
}
|
||||
return account;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
@VisibleForTesting
|
||||
String validateMail(String mail) {
|
||||
if (CharSequenceUtil.isEmpty(mail)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_SEND_MAIL_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.MAIL_SEND_MAIL_NOT_EXISTS);
|
||||
}
|
||||
return mail;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
template.getParams().forEach(key -> {
|
||||
Object value = templateParams.get(key);
|
||||
if (value == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_SEND_TEMPLATE_PARAM_MISS, key);
|
||||
throw new ServiceException(ErrorCodeConstants.MAIL_SEND_TEMPLATE_PARAM_MISS, key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+3
-5
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.mail;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO;
|
||||
@@ -25,8 +25,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 邮箱模版 Service 实现类
|
||||
*
|
||||
@@ -82,7 +80,7 @@ public class MailTemplateServiceImpl implements MailTemplateService {
|
||||
// 存在 template 记录的情况下
|
||||
if (id == null // 新增时,说明重复
|
||||
|| ObjectUtil.notEqual(id, template.getId())) { // 更新时,如果 id 不一致,说明重复
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_TEMPLATE_CODE_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.MAIL_TEMPLATE_CODE_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +97,7 @@ public class MailTemplateServiceImpl implements MailTemplateService {
|
||||
|
||||
private void validateMailTemplateExists(Long id) {
|
||||
if (mailTemplateMapper.selectById(id) == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-6
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.notice;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -20,7 +20,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.NOTICE_NAME_UNIQE_ERROR;
|
||||
|
||||
/**
|
||||
@@ -96,18 +95,18 @@ public class NoticeServiceImpl implements NoticeService {
|
||||
}
|
||||
NoticeDO notice = noticeMapper.selectById(id);
|
||||
if (notice == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
||||
throw new ServiceException(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
||||
}
|
||||
boolean superAdmin = SecurityFrameworkUtils.isSuperAdmin();
|
||||
// 公告和操作人非统一组织,只有超管可以编辑和删除
|
||||
if (NoticeSourceEnum.CUSTOM.equals(notice.getSource())
|
||||
&& !notice.getOrganId().equals(OrganContextHolder.getOrganId())
|
||||
&& !superAdmin) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
||||
throw new ServiceException(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
||||
}
|
||||
// 只有超管可以操作内置公告
|
||||
if (NoticeSourceEnum.SYSTEM.equals(notice.getSource()) && !superAdmin) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_BUILDIN_MODIFY_PERMISSION_ERROR);
|
||||
throw new ServiceException(ErrorCodeConstants.NOTICE_BUILDIN_MODIFY_PERMISSION_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +130,7 @@ public class NoticeServiceImpl implements NoticeService {
|
||||
wrapper.eq(NoticeDO::getOrganId, OrganContextHolder.getOrganId());
|
||||
}
|
||||
if (noticeMapper.exists(wrapper)) {
|
||||
throw exception(NOTICE_NAME_UNIQE_ERROR);
|
||||
throw new ServiceException(NOTICE_NAME_UNIQE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -2,8 +2,8 @@ package com.cf.imes.module.system.service.notify;
|
||||
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.dal.dataobject.notify.NotifyTemplateDO;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -77,7 +77,7 @@ public class NotifySendServiceImpl implements NotifySendService {
|
||||
NotifyTemplateDO template = notifyTemplateService.getNotifyTemplateByCodeFromCache(templateCode);
|
||||
// 站内信模板不存在
|
||||
if (template == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
||||
throw new ServiceException(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
||||
}
|
||||
return template;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class NotifySendServiceImpl implements NotifySendService {
|
||||
template.getParams().forEach(key -> {
|
||||
Object value = templateParams.get(key);
|
||||
if (value == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTIFY_SEND_TEMPLATE_PARAM_MISS, key);
|
||||
throw new ServiceException(ErrorCodeConstants.NOTIFY_SEND_TEMPLATE_PARAM_MISS, key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+4
-6
@@ -2,7 +2,7 @@ package com.cf.imes.module.system.service.notify;
|
||||
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO;
|
||||
@@ -23,8 +23,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 站内信模版 Service 实现类
|
||||
*
|
||||
@@ -87,7 +85,7 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService {
|
||||
|
||||
private void validateNotifyTemplateExists(Long id) {
|
||||
if (notifyTemplateMapper.selectById(id) == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTIFY_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.NOTIFY_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,10 +114,10 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的字典类型
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTIFY_TEMPLATE_CODE_DUPLICATE, code);
|
||||
throw new ServiceException(ErrorCodeConstants.NOTIFY_TEMPLATE_CODE_DUPLICATE, code);
|
||||
}
|
||||
if (!template.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTIFY_TEMPLATE_CODE_DUPLICATE, code);
|
||||
throw new ServiceException(ErrorCodeConstants.NOTIFY_TEMPLATE_CODE_DUPLICATE, code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -5,6 +5,7 @@ import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.common.util.string.StrUtils;
|
||||
@@ -23,7 +24,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ public class OAuth2ClientServiceImpl implements OAuth2ClientService {
|
||||
|
||||
private void validateOAuth2ClientExists(Long id) {
|
||||
if (oauth2ClientMapper.selectById(id) == null) {
|
||||
throw exception(OAUTH2_CLIENT_NOT_EXISTS);
|
||||
throw new ServiceException(OAUTH2_CLIENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,10 +86,10 @@ public class OAuth2ClientServiceImpl implements OAuth2ClientService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的客户端
|
||||
if (id == null) {
|
||||
throw exception(OAUTH2_CLIENT_EXISTS);
|
||||
throw new ServiceException(OAUTH2_CLIENT_EXISTS);
|
||||
}
|
||||
if (!client.getId().equals(id)) {
|
||||
throw exception(OAUTH2_CLIENT_EXISTS);
|
||||
throw new ServiceException(OAUTH2_CLIENT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,27 +116,27 @@ public class OAuth2ClientServiceImpl implements OAuth2ClientService {
|
||||
// 校验客户端存在、且开启
|
||||
OAuth2ClientDO client = getSelf().getOAuth2ClientFromCache(clientId);
|
||||
if (client == null) {
|
||||
throw exception(OAUTH2_CLIENT_NOT_EXISTS);
|
||||
throw new ServiceException(OAUTH2_CLIENT_NOT_EXISTS);
|
||||
}
|
||||
if (CommonStatusEnum.isDisable(client.getStatus())) {
|
||||
throw exception(OAUTH2_CLIENT_DISABLE);
|
||||
throw new ServiceException(OAUTH2_CLIENT_DISABLE);
|
||||
}
|
||||
|
||||
// 校验客户端密钥
|
||||
if (CharSequenceUtil.isNotEmpty(clientSecret) && ObjectUtil.notEqual(client.getSecret(), clientSecret)) {
|
||||
throw exception(OAUTH2_CLIENT_CLIENT_SECRET_ERROR);
|
||||
throw new ServiceException(OAUTH2_CLIENT_CLIENT_SECRET_ERROR);
|
||||
}
|
||||
// 校验授权方式
|
||||
if (CharSequenceUtil.isNotEmpty(authorizedGrantType) && !CollUtil.contains(client.getAuthorizedGrantTypes(), authorizedGrantType)) {
|
||||
throw exception(OAUTH2_CLIENT_AUTHORIZED_GRANT_TYPE_NOT_EXISTS);
|
||||
throw new ServiceException(OAUTH2_CLIENT_AUTHORIZED_GRANT_TYPE_NOT_EXISTS);
|
||||
}
|
||||
// 校验授权范围
|
||||
if (CollUtil.isNotEmpty(scopes) && !CollUtil.containsAll(client.getScopes(), scopes)) {
|
||||
throw exception(OAUTH2_CLIENT_SCOPE_OVER);
|
||||
throw new ServiceException(OAUTH2_CLIENT_SCOPE_OVER);
|
||||
}
|
||||
// 校验回调地址
|
||||
if (CharSequenceUtil.isNotEmpty(redirectUri) && !StrUtils.startWithAny(redirectUri, client.getRedirectUris())) {
|
||||
throw exception(OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH, redirectUri);
|
||||
throw new ServiceException(OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH, redirectUri);
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.service.oauth2;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.date.DateUtils;
|
||||
import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2CodeDO;
|
||||
import com.cf.imes.module.system.dal.mysql.oauth2.OAuth2CodeMapper;
|
||||
@@ -11,7 +12,6 @@ import jakarta.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.OAUTH2_CODE_EXPIRE;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.OAUTH2_CODE_NOT_EXISTS;
|
||||
|
||||
@@ -48,10 +48,10 @@ public class OAuth2CodeServiceImpl implements OAuth2CodeService {
|
||||
public OAuth2CodeDO consumeAuthorizationCode(String code) {
|
||||
OAuth2CodeDO codeDO = oauth2CodeMapper.selectByCode(code);
|
||||
if (codeDO == null) {
|
||||
throw exception(OAUTH2_CODE_NOT_EXISTS);
|
||||
throw new ServiceException(OAUTH2_CODE_NOT_EXISTS);
|
||||
}
|
||||
if (DateUtils.isExpired(codeDO.getExpiresTime())) {
|
||||
throw exception(OAUTH2_CODE_EXPIRE);
|
||||
throw new ServiceException(OAUTH2_CODE_EXPIRE);
|
||||
}
|
||||
oauth2CodeMapper.deleteById(codeDO.getId());
|
||||
return codeDO;
|
||||
|
||||
+4
-5
@@ -4,6 +4,7 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2CodeDO;
|
||||
@@ -16,8 +17,6 @@ import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* OAuth2 授予 Service 实现类
|
||||
*
|
||||
@@ -62,16 +61,16 @@ public class OAuth2GrantServiceImpl implements OAuth2GrantService {
|
||||
Assert.notNull(codeDO, "授权码不能为空"); // 防御性编程
|
||||
// 校验 clientId 是否匹配
|
||||
if (!CharSequenceUtil.equals(clientId, codeDO.getClientId())) {
|
||||
throw exception(ErrorCodeConstants.OAUTH2_GRANT_CLIENT_ID_MISMATCH);
|
||||
throw new ServiceException(ErrorCodeConstants.OAUTH2_GRANT_CLIENT_ID_MISMATCH);
|
||||
}
|
||||
// 校验 redirectUri 是否匹配
|
||||
if (!CharSequenceUtil.equals(redirectUri, codeDO.getRedirectUri())) {
|
||||
throw exception(ErrorCodeConstants.OAUTH2_GRANT_REDIRECT_URI_MISMATCH);
|
||||
throw new ServiceException(ErrorCodeConstants.OAUTH2_GRANT_REDIRECT_URI_MISMATCH);
|
||||
}
|
||||
// 校验 state 是否匹配
|
||||
state = CharSequenceUtil.nullToDefault(state, ""); // 数据库 state 为 null 时,会设置为 "" 空串
|
||||
if (!CharSequenceUtil.equals(state, codeDO.getState())) {
|
||||
throw exception(ErrorCodeConstants.OAUTH2_GRANT_STATE_MISMATCH);
|
||||
throw new ServiceException(ErrorCodeConstants.OAUTH2_GRANT_STATE_MISMATCH);
|
||||
}
|
||||
|
||||
/* Long organId = OrganContextHolder.getOrganId();
|
||||
|
||||
+12
-12
@@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||
@@ -78,7 +79,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.constants.StatisticsConstants.DATELIST_FIELD_NAME;
|
||||
import static com.cf.imes.framework.common.constants.StatisticsConstants.SERIES_FIELD_NAME;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray;
|
||||
import static com.cf.imes.framework.common.util.time.StatisticsChangeUtils.generateDateRangeAxis;
|
||||
import static com.cf.imes.framework.common.util.time.StatisticsChangeUtils.getDateList;
|
||||
@@ -171,13 +171,13 @@ public class OrganServiceImpl implements OrganService {
|
||||
public OrganizationDO validOrgan(Long id) {
|
||||
OrganizationDO organizationDO = getOrgan(id);
|
||||
if (organizationDO == null) {
|
||||
throw exception(ORGAN_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||
}
|
||||
if (organizationDO.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) {
|
||||
throw exception(ORGAN_DISABLE, organizationDO.getName());
|
||||
throw new ServiceException(ORGAN_DISABLE, organizationDO.getName());
|
||||
}
|
||||
if (DateUtils.isExpired(organizationDO.getExpireTime())) {
|
||||
throw exception(ORGAN_EXPIRE, organizationDO.getName());
|
||||
throw new ServiceException(ORGAN_EXPIRE, organizationDO.getName());
|
||||
}
|
||||
return organizationDO;
|
||||
}
|
||||
@@ -312,10 +312,10 @@ public class OrganServiceImpl implements OrganService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同名字的组织
|
||||
if (id == null) {
|
||||
throw exception(ORGAN_NAME_DUPLICATE, name);
|
||||
throw new ServiceException(ORGAN_NAME_DUPLICATE, name);
|
||||
}
|
||||
if (!tenant.getId().equals(id)) {
|
||||
throw exception(ORGAN_NAME_DUPLICATE, name);
|
||||
throw new ServiceException(ORGAN_NAME_DUPLICATE, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,10 +329,10 @@ public class OrganServiceImpl implements OrganService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同名字的组织
|
||||
if (id == null) {
|
||||
throw exception(ORGAN_WEBSITE_DUPLICATE, website);
|
||||
throw new ServiceException(ORGAN_WEBSITE_DUPLICATE, website);
|
||||
}
|
||||
if (!tenant.getId().equals(id)) {
|
||||
throw exception(ORGAN_WEBSITE_DUPLICATE, website);
|
||||
throw new ServiceException(ORGAN_WEBSITE_DUPLICATE, website);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ public class OrganServiceImpl implements OrganService {
|
||||
|
||||
|
||||
if(CollUtil.isNotEmpty(organizationDOS)){
|
||||
throw exception(ORGAN_CONTACTMOBILE_DUPLICATE,contactMobile);
|
||||
throw new ServiceException(ORGAN_CONTACTMOBILE_DUPLICATE,contactMobile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,18 +422,18 @@ public class OrganServiceImpl implements OrganService {
|
||||
*/
|
||||
private void checkCurrentWhenOperate(Long organId) {
|
||||
if (ObjectUtil.equal(organId, SecurityFrameworkUtils.getUserOrganId())) {
|
||||
throw exception(ORGAN_USER_OPER_NOT_ALLOW);
|
||||
throw new ServiceException(ORGAN_USER_OPER_NOT_ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
private OrganizationDO validateUpdateTenant(Long id) {
|
||||
OrganizationDO tenant = organMapper.selectById(id);
|
||||
if (tenant == null) {
|
||||
throw exception(ORGAN_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||
}
|
||||
// 内置组织,不允许删除
|
||||
/*if (isSystemTenant(tenant)) {
|
||||
throw exception(ORGAN_CAN_NOT_UPDATE_SYSTEM);
|
||||
throw new ServiceException(ORGAN_CAN_NOT_UPDATE_SYSTEM);
|
||||
}*/
|
||||
return tenant;
|
||||
}
|
||||
|
||||
+8
-8
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -28,7 +29,6 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
||||
TenantPackageDO tenantPackage = validateTenantPackageExists(updateReqVO.getId());
|
||||
if (Boolean.FALSE.equals(SecurityFrameworkUtils.isSuperAdmin()) &&
|
||||
(Objects.equals(tenantPackage.getId(), SYSTEM_ORGAN_PACKAGE_ID) || Objects.equals(tenantPackage.getId(), SYSTEM_SUPER_PACKAGE_ID))) {
|
||||
throw exception(TENANT_PACKAGE_DEPT_EXIT);
|
||||
throw new ServiceException(TENANT_PACKAGE_DEPT_EXIT);
|
||||
}
|
||||
|
||||
// 更新
|
||||
@@ -90,7 +90,7 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
||||
// 校验存在
|
||||
validateTenantPackageExists(id);
|
||||
if(Objects.equals(id, SYSTEM_ORGAN_PACKAGE_ID) || Objects.equals(id, SYSTEM_SUPER_PACKAGE_ID)) {
|
||||
throw exception(TENANT_PACKAGE_DELETED_EXIT);
|
||||
throw new ServiceException(TENANT_PACKAGE_DELETED_EXIT);
|
||||
}
|
||||
|
||||
// 校验正在使用
|
||||
@@ -102,7 +102,7 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
||||
private TenantPackageDO validateTenantPackageExists(Long id) {
|
||||
TenantPackageDO tenantPackage = tenantPackageMapper.selectById(id);
|
||||
if (tenantPackage == null) {
|
||||
throw exception(TENANT_PACKAGE_NOT_EXISTS);
|
||||
throw new ServiceException(TENANT_PACKAGE_NOT_EXISTS);
|
||||
}
|
||||
return tenantPackage;
|
||||
}
|
||||
@@ -118,13 +118,13 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
||||
wrapper.ne(TenantPackageDO::getId, packageId);
|
||||
}
|
||||
if (tenantPackageMapper.exists(wrapper)) {
|
||||
throw exception(TENANT_PACKAGE_NAME_UNIQE_ERROR);
|
||||
throw new ServiceException(TENANT_PACKAGE_NAME_UNIQE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateOrganUsed(Long id) {
|
||||
if (organService.getOrganCountByPackageId(id) > 0) {
|
||||
throw exception(TENANT_PACKAGE_USED);
|
||||
throw new ServiceException(TENANT_PACKAGE_USED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,10 +142,10 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
||||
public TenantPackageDO validTenantPackage(Long id) {
|
||||
TenantPackageDO tenantPackage = tenantPackageMapper.selectById(id);
|
||||
if (tenantPackage == null) {
|
||||
throw exception(TENANT_PACKAGE_NOT_EXISTS);
|
||||
throw new ServiceException(TENANT_PACKAGE_NOT_EXISTS);
|
||||
}
|
||||
if (tenantPackage.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) {
|
||||
throw exception(TENANT_PACKAGE_DISABLE, tenantPackage.getName());
|
||||
throw new ServiceException(TENANT_PACKAGE_DISABLE, tenantPackage.getName());
|
||||
}
|
||||
return tenantPackage;
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.parser;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.system.controller.admin.parser.vo.ParserReqVO;
|
||||
@@ -19,7 +20,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PARSER_NO_EXIST;
|
||||
|
||||
@@ -124,7 +124,7 @@ public class ParserServiceImpl implements ParserService{
|
||||
ParserDO parserDO = parserMapper.selectById(id);
|
||||
if (parserDO == null) {
|
||||
|
||||
throw exception(PARSER_NO_EXIST);
|
||||
throw new ServiceException(PARSER_NO_EXIST);
|
||||
}
|
||||
|
||||
return parserDO;
|
||||
|
||||
+2
-2
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.service.parser;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.system.controller.admin.parser.vo.ParserTemplateReqVO;
|
||||
@@ -22,7 +23,6 @@ import jakarta.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PARSER_TEMPLATE_NO_EXIST;
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ public class ParserTemplateServiceImpl implements ParserTemplateService{
|
||||
ParserTemplateDO parserTemplateDO = parserTemplateMapper.selectById(id);
|
||||
if (parserTemplateDO == null) {
|
||||
|
||||
throw exception(PARSER_TEMPLATE_NO_EXIST);
|
||||
throw new ServiceException(PARSER_TEMPLATE_NO_EXIST);
|
||||
}
|
||||
|
||||
return parserTemplateDO;
|
||||
|
||||
+9
-11
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.validation.ValidationUtils;
|
||||
import com.cf.imes.framework.id.core.util.SnowflakeSerialNoWorker3rd;
|
||||
@@ -62,7 +61,6 @@ import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORG_PRODUCT_PURCHASE_LOCK_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORG_PRODUCT_PURCHASE_WAIT_PAY_ERROR;
|
||||
@@ -343,7 +341,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
.eq(PayOrderDO::getDeleted, false)
|
||||
);
|
||||
if (ObjectUtils.isNull(payOrderDO)) {
|
||||
throw exception(PAY_ORDER_NOT_EXIST, outTradeNo);
|
||||
throw new ServiceException(PAY_ORDER_NOT_EXIST, outTradeNo);
|
||||
}
|
||||
// 订单已被更新成功,直接支付成功了
|
||||
if (PayOrderStatusEnum.SUCCESS.equals(payOrderDO.getStatus())) {
|
||||
@@ -414,7 +412,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
.eq(PayOrderDO::getId, outTradeNo));
|
||||
Long organId = order.getOrganId();
|
||||
if (ObjectUtil.isNull(order)) {
|
||||
throw exception(PAY_ORDER_NOT_EXIST, outTradeNo);
|
||||
throw new ServiceException(PAY_ORDER_NOT_EXIST, outTradeNo);
|
||||
}
|
||||
// 如果已经是成功,直接返回,不用重复更新
|
||||
if (PayOrderStatusEnum.isSuccess(order.getStatus().getStatus())) {
|
||||
@@ -422,7 +420,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
return;
|
||||
}
|
||||
if (!PayOrderStatusEnum.WAITING.equals(order.getStatus())) { // 校验状态,必须是待支付
|
||||
throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING);
|
||||
throw new ServiceException(PAY_ORDER_STATUS_IS_NOT_WAITING);
|
||||
}
|
||||
|
||||
// 2. 更新 PayOrderDO
|
||||
@@ -436,7 +434,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
.set(PayOrderDO::getChannelNotifyData, JsonUtils.zipString(JSON.toJSONString(notify))));
|
||||
|
||||
if (updateCounts == 0) { // 校验状态,必须是待支付
|
||||
throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING);
|
||||
throw new ServiceException(PAY_ORDER_STATUS_IS_NOT_WAITING);
|
||||
}
|
||||
log.debug("[notifyOrderSuccess][order({}) 更新为已支付]", order.getId());
|
||||
|
||||
@@ -446,7 +444,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
notifyProductPayOrderSuccess(order);
|
||||
break;
|
||||
default:
|
||||
throw ServiceExceptionUtil.exception(PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR, order.getTradeType());
|
||||
throw new ServiceException(PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR, order.getTradeType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,7 +504,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
.eq(PayOrderDO::getId, outTradeNo));
|
||||
Long organId = order.getOrganId();
|
||||
if (ObjectUtil.isNull(order)) {
|
||||
throw exception(PAY_ORDER_NOT_EXIST, outTradeNo);
|
||||
throw new ServiceException(PAY_ORDER_NOT_EXIST, outTradeNo);
|
||||
}
|
||||
|
||||
Integer orderStatus = order.getStatus().getStatus();
|
||||
@@ -520,7 +518,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.notEqual(orderStatus, PayOrderStatusEnum.WAITING.getStatus())) { // 校验状态,必须是待支付
|
||||
throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING);
|
||||
throw new ServiceException(PAY_ORDER_STATUS_IS_NOT_WAITING);
|
||||
}
|
||||
|
||||
// 2. 更新 PayOrderDO
|
||||
@@ -535,7 +533,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
.set(PayOrderDO::getChannelNotifyData, JsonUtils.zipString(JSON.toJSONString(notify))));
|
||||
|
||||
if (updateCounts == 0) { // 校验状态,必须是待支付
|
||||
throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING);
|
||||
throw new ServiceException(PAY_ORDER_STATUS_IS_NOT_WAITING);
|
||||
}
|
||||
log.debug("[notifyOrderClosed][order({}) 更新为支付关闭]", order.getId());
|
||||
|
||||
@@ -545,7 +543,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
notifyProductPayOrderFail(order);
|
||||
break;
|
||||
default:
|
||||
throw ServiceExceptionUtil.exception(PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR, order.getTradeType());
|
||||
throw new ServiceException(PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR, order.getTradeType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -6,7 +6,6 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.pay.config.ChenfengPayConfig;
|
||||
import com.cf.imes.module.system.controller.admin.funds.delay.vo.PreviouProductDelayRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.funds.delay.vo.ProductDelayRespVO;
|
||||
@@ -288,7 +287,7 @@ public class PayProductProcessorNew {
|
||||
}
|
||||
|
||||
if (endTime.isBefore(today)) {
|
||||
throw ServiceExceptionUtil.exception(PRODUCT_PURCHASE_ENDTIME_BEFORE_DELAYTIME_ERROR, LocalDateTimeUtil.format(endTime, DatePattern.NORM_DATE_PATTERN));
|
||||
throw new ServiceException(PRODUCT_PURCHASE_ENDTIME_BEFORE_DELAYTIME_ERROR, LocalDateTimeUtil.format(endTime, DatePattern.NORM_DATE_PATTERN));
|
||||
}
|
||||
|
||||
return endTime;
|
||||
|
||||
+9
-11
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
@@ -52,7 +51,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -116,7 +114,7 @@ public class MenuServiceImpl implements MenuService {
|
||||
// 校验更新的菜单是否存在
|
||||
MenuDO menuDO = menuMapper.selectById(updateReqVO.getId());
|
||||
if (menuDO == null) {
|
||||
throw exception(MENU_NOT_EXISTS);
|
||||
throw new ServiceException(MENU_NOT_EXISTS);
|
||||
}
|
||||
// 校验父菜单存在
|
||||
validateParentMenu(updateReqVO.getParentId(), updateReqVO.getId());
|
||||
@@ -145,12 +143,12 @@ public class MenuServiceImpl implements MenuService {
|
||||
public void deleteMenu(Long id) {
|
||||
// 校验是否还有子菜单
|
||||
if (menuMapper.selectCountByParentId(id) > 0) {
|
||||
throw exception(MENU_EXISTS_CHILDREN);
|
||||
throw new ServiceException(MENU_EXISTS_CHILDREN);
|
||||
}
|
||||
// 校验删除的菜单是否存在
|
||||
MenuDO menuDO = menuMapper.selectById(id);
|
||||
if (menuDO == null) {
|
||||
throw exception(MENU_NOT_EXISTS);
|
||||
throw new ServiceException(MENU_NOT_EXISTS);
|
||||
}
|
||||
// 校验管理端菜单增删改必须是晨丰组织下用户
|
||||
validateManageSourceTypeOperatePermission(menuDO.getSourceType());
|
||||
@@ -294,17 +292,17 @@ public class MenuServiceImpl implements MenuService {
|
||||
}
|
||||
// 不能设置自己为父菜单
|
||||
if (parentId.equals(childId)) {
|
||||
throw exception(MENU_PARENT_ERROR);
|
||||
throw new ServiceException(MENU_PARENT_ERROR);
|
||||
}
|
||||
MenuDO menu = menuMapper.selectById(parentId);
|
||||
// 父菜单不存在
|
||||
if (menu == null) {
|
||||
throw exception(MENU_PARENT_NOT_EXISTS);
|
||||
throw new ServiceException(MENU_PARENT_NOT_EXISTS);
|
||||
}
|
||||
// 父菜单必须是目录或者菜单类型
|
||||
if (!MenuTypeEnum.DIR.getType().equals(menu.getType())
|
||||
&& !MenuTypeEnum.MENU.getType().equals(menu.getType())) {
|
||||
throw exception(MENU_PARENT_NOT_DIR_OR_MENU);
|
||||
throw new ServiceException(MENU_PARENT_NOT_DIR_OR_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,10 +323,10 @@ public class MenuServiceImpl implements MenuService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的菜单
|
||||
if (id == null) {
|
||||
throw exception(MENU_NAME_DUPLICATE);
|
||||
throw new ServiceException(MENU_NAME_DUPLICATE);
|
||||
}
|
||||
if (!menu.getId().equals(id)) {
|
||||
throw exception(MENU_NAME_DUPLICATE);
|
||||
throw new ServiceException(MENU_NAME_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +396,7 @@ public class MenuServiceImpl implements MenuService {
|
||||
JSONObject obj = JSON.parseObject(transResult);
|
||||
String errorCode = obj.getString("error_code");
|
||||
if (StringUtils.isNotEmpty(errorCode)) {
|
||||
throw ServiceExceptionUtil.exception(MENU_TRANS_ERROR, errorCode);
|
||||
throw new ServiceException(MENU_TRANS_ERROR, errorCode);
|
||||
}
|
||||
JSONArray arr = obj.getJSONArray("trans_result");
|
||||
|
||||
|
||||
+1
-2
@@ -56,7 +56,6 @@ import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
@@ -552,7 +551,7 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
@CacheEvict(value = RedisKeyConstants.USER_ROLE_ID_LIST, allEntries = true)
|
||||
public void assignUserRole(Long userId, Set<Long> roleIds, Long organId) {
|
||||
if(Objects.equals(userId, SecurityFrameworkUtils.getLoginUserId())) {
|
||||
throw exception(ROLE_ME_ERROR);
|
||||
throw new ServiceException(ROLE_ME_ERROR);
|
||||
}
|
||||
// 获得用户拥有角色编号
|
||||
Set<Long> dbRoleIds = convertSet(userRoleMapper.selectListByUserId(userId),
|
||||
|
||||
+7
-8
@@ -37,7 +37,6 @@ import org.springframework.util.StringUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -194,12 +193,12 @@ public class RoleServiceImpl implements RoleService {
|
||||
void validateRoleDuplicate(String name, String code, Long id, Long organId) {
|
||||
// 0. 超级管理员,不允许创建
|
||||
if (RoleCodeEnum.isSuperAdmin(code)) {
|
||||
throw exception(ROLE_ADMIN_CODE_ERROR, code);
|
||||
throw new ServiceException(ROLE_ADMIN_CODE_ERROR, code);
|
||||
}
|
||||
// 1. 该 name 名字被其它角色所使用
|
||||
RoleDO role = roleMapper.selectByName(name, organId);
|
||||
if (role != null && !role.getId().equals(id)) {
|
||||
throw exception(ROLE_NAME_DUPLICATE, name);
|
||||
throw new ServiceException(ROLE_NAME_DUPLICATE, name);
|
||||
}
|
||||
// 2. 是否存在相同编码的角色
|
||||
if (!StringUtils.hasText(code)) {
|
||||
@@ -208,7 +207,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
// 该 code 编码被其它角色所使用
|
||||
role = roleMapper.selectByCode(code, organId);
|
||||
if (role != null && !role.getId().equals(id)) {
|
||||
throw exception(ROLE_CODE_DUPLICATE, code);
|
||||
throw new ServiceException(ROLE_CODE_DUPLICATE, code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,11 +223,11 @@ public class RoleServiceImpl implements RoleService {
|
||||
RoleDO roleDO = roleService.getRole(id);
|
||||
//RoleDO roleDO = roleMapper.selectOne(RoleDO::getId, id);
|
||||
if (roleDO == null) {
|
||||
throw exception(ROLE_NOT_EXISTS);
|
||||
throw new ServiceException(ROLE_NOT_EXISTS);
|
||||
}
|
||||
// 内置角色,不允许删除
|
||||
if (RoleTypeEnum.SYSTEM.getType().equals(roleDO.getType())) {
|
||||
throw exception(ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE);
|
||||
throw new ServiceException(ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,10 +335,10 @@ public class RoleServiceImpl implements RoleService {
|
||||
ids.forEach(id -> {
|
||||
RoleDO role = roleMap.get(id);
|
||||
if (role == null) {
|
||||
throw exception(ROLE_NOT_EXISTS);
|
||||
throw new ServiceException(ROLE_NOT_EXISTS);
|
||||
}
|
||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(role.getStatus())) {
|
||||
throw exception(ROLE_IS_DISABLE, role.getName());
|
||||
throw new ServiceException(ROLE_IS_DISABLE, role.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+10
-15
@@ -1,20 +1,18 @@
|
||||
package com.cf.imes.module.system.service.process;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.api.orderProcess.OrderProcessApi;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSimpleRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessGroupPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessGroupRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessGroupSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessListSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessRespVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.process.ProcessDO;
|
||||
import com.cf.imes.module.system.dal.mysql.process.ProcessMapper;
|
||||
import com.cf.imes.module.system.enums.process.ProcessTypeEnum;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -30,11 +28,8 @@ import com.cf.imes.module.system.dal.mysql.process.ProcessGroupMapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -66,7 +61,7 @@ public class ProcessGroupServiceImpl implements ProcessGroupService {
|
||||
int isCutting = 0;
|
||||
int isPacking = 0;
|
||||
if (createReqVO.getItems() == null) {
|
||||
throw exception(PROCESS_ITEM_NOT_EXISTS);
|
||||
throw new ServiceException(PROCESS_ITEM_NOT_EXISTS);
|
||||
}
|
||||
List<String> list = cuttingItems(createReqVO.getItems());
|
||||
if (!list.isEmpty()) {
|
||||
@@ -82,10 +77,10 @@ public class ProcessGroupServiceImpl implements ProcessGroupService {
|
||||
}
|
||||
|
||||
if (isCutting > 1){
|
||||
throw exception(PROCESS_GROUP_CUTTING_ERROR);
|
||||
throw new ServiceException(PROCESS_GROUP_CUTTING_ERROR);
|
||||
}
|
||||
if (isPacking > 1){
|
||||
throw exception(PROCESS_GROUP_PACKING_ERROR);
|
||||
throw new ServiceException(PROCESS_GROUP_PACKING_ERROR);
|
||||
}
|
||||
processGroupMapper.insert(processGroup);
|
||||
if (createReqVO.getIsDefault()) {
|
||||
@@ -102,7 +97,7 @@ public class ProcessGroupServiceImpl implements ProcessGroupService {
|
||||
.eq(ProcessGroupDO::getName, name)
|
||||
.eq(ProcessGroupDO::getDeleted, false)
|
||||
.eq(ProcessGroupDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||
throw exception(PROCESS_GROUP_NAME_EXISTS);
|
||||
throw new ServiceException(PROCESS_GROUP_NAME_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +111,7 @@ public class ProcessGroupServiceImpl implements ProcessGroupService {
|
||||
.eq(ProcessGroupDO::getName, name)
|
||||
.eq(ProcessGroupDO::getDeleted, false)
|
||||
.eq(ProcessGroupDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||
throw exception(PROCESS_GROUP_NAME_EXISTS);
|
||||
throw new ServiceException(PROCESS_GROUP_NAME_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,12 +145,12 @@ public class ProcessGroupServiceImpl implements ProcessGroupService {
|
||||
// 判断是否在生产中使用这个加工组
|
||||
private void checkProcessGroupUsed(Long id) {
|
||||
if (orderProcessApi.getOrderProcessByProcessGroupId(id).getData()){
|
||||
throw exception(PROCESS_GROUP_USED);
|
||||
throw new ServiceException(PROCESS_GROUP_USED);
|
||||
}
|
||||
}
|
||||
private void validateProcessGroupExists(Long id) {
|
||||
if (processGroupMapper.selectById(id) == null) {
|
||||
throw exception(PROCESS_GROUP_NOT_EXISTS);
|
||||
throw new ServiceException(PROCESS_GROUP_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,13 +235,13 @@ public class ProcessGroupServiceImpl implements ProcessGroupService {
|
||||
missingItemsBuilder.append(itemId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw exception(PROCESS_ID_IS_NULL);
|
||||
throw new ServiceException(PROCESS_ID_IS_NULL);
|
||||
}
|
||||
});
|
||||
|
||||
// 判断是否存在不存在的项,并一次性抛出异常
|
||||
if (missingItemsBuilder.length() > 0) {
|
||||
throw exception(PROCESS_NOT_EXISTS, "Items with IDs " + missingItemsBuilder.toString() + " do not exist.");
|
||||
throw new ServiceException(PROCESS_NOT_EXISTS, "Items with IDs " + missingItemsBuilder.toString() + " do not exist.");
|
||||
}
|
||||
|
||||
// 移除itemsBuilder最后的逗号
|
||||
|
||||
+9
-11
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.ProcessProcessingTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.process.*;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.processUser.ProcessAndUserRespVO;
|
||||
@@ -30,10 +31,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.CUSTOM_ORDER_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
|
||||
@@ -76,14 +74,14 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
ProcessAndUserSaveReqVO processAndUserSaveReqVO = new ProcessAndUserSaveReqVO();
|
||||
try{
|
||||
if (adminUserService.getUser(Long.parseLong(user)) == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
throw new ServiceException(USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
processAndUserSaveReqVO.setProcessId(processID);
|
||||
processAndUserSaveReqVO.setUserId(Long.parseLong(user));
|
||||
processUserService.createProcessUser(processAndUserSaveReqVO);
|
||||
}catch (Exception e){
|
||||
throw exception(ERR);
|
||||
throw new ServiceException(ERR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,7 +97,7 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
.eq(ProcessDO::getName, name)
|
||||
.eq(ProcessDO::getDeleted, false)
|
||||
.eq(ProcessDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||
throw exception(PROCESS_NAME_EXISTS);
|
||||
throw new ServiceException(PROCESS_NAME_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,7 +111,7 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
.eq(ProcessDO::getName, name)
|
||||
.eq(ProcessDO::getDeleted, false)
|
||||
.eq(ProcessDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||
throw exception(PROCESS_NAME_EXISTS);
|
||||
throw new ServiceException(PROCESS_NAME_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,7 +123,7 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
validateProcessExists(updateReqVO.getId());
|
||||
if (!updateReqVO.getIsEnabled()) {//调为禁用
|
||||
if (isProcessUsed(String.valueOf(updateReqVO.getId()))){
|
||||
throw exception(PROCESS_IS_ENABLED);
|
||||
throw new ServiceException(PROCESS_IS_ENABLED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +148,7 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
throw exception(ERR);
|
||||
throw new ServiceException(ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,7 +169,7 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
// 校验存在
|
||||
validateProcessExists(id);
|
||||
if (isProcessUsed(String.valueOf(id))){
|
||||
throw exception(PROCESS_IS_ENABLED);
|
||||
throw new ServiceException(PROCESS_IS_ENABLED);
|
||||
}
|
||||
// 删除
|
||||
processMapper.deleteById(id);
|
||||
@@ -180,7 +178,7 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
|
||||
private void validateProcessExists(Long id) {
|
||||
if (processMapper.selectById(id) == null) {
|
||||
throw exception(PROCESS_NOT_EXISTS);
|
||||
throw new ServiceException(PROCESS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.service.process;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.processUser.ProcessAndUserSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -12,7 +13,6 @@ import com.cf.imes.module.system.dal.mysql.process.ProcessUserMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PROCESS_USER_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PROCESS_USER_NOT_EXISTS;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ProcessUserServiceImpl implements ProcessUserService {
|
||||
public Long createProcessUser(ProcessAndUserSaveReqVO createReqVO) {
|
||||
// 判断是否有
|
||||
if (processUserMapper.selectById(createReqVO.getProcessId(), createReqVO.getUserId()).size() != 0) {
|
||||
throw exception(PROCESS_USER_EXISTS);
|
||||
throw new ServiceException(PROCESS_USER_EXISTS);
|
||||
}
|
||||
// 插入
|
||||
ProcessUserDO processUser = BeanUtils.toBean(createReqVO, ProcessUserDO.class);
|
||||
@@ -45,7 +45,7 @@ public class ProcessUserServiceImpl implements ProcessUserService {
|
||||
public void updateProcessUser(ProcessAndUserSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
if (processUserMapper.selectById(updateReqVO.getProcessId(), updateReqVO.getUserId()).size() != 0) {
|
||||
throw exception(PROCESS_USER_EXISTS);
|
||||
throw new ServiceException(PROCESS_USER_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
ProcessUserDO updateObj = BeanUtils.toBean(updateReqVO, ProcessUserDO.class);
|
||||
@@ -62,7 +62,7 @@ public class ProcessUserServiceImpl implements ProcessUserService {
|
||||
|
||||
private void validateProcessUserExists(Long id) {
|
||||
if (processUserMapper.selectByProcessId(id).size() == 0) {
|
||||
throw exception(PROCESS_USER_NOT_EXISTS);
|
||||
throw new ServiceException(PROCESS_USER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.sensitiveword;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -25,7 +26,6 @@ import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.filterList;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.getMaxValue;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SENSITIVE_WORD_EXISTS;
|
||||
@@ -184,16 +184,16 @@ public class SensitiveWordServiceImpl implements SensitiveWordService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的敏感词
|
||||
if (id == null) {
|
||||
throw exception(SENSITIVE_WORD_EXISTS);
|
||||
throw new ServiceException(SENSITIVE_WORD_EXISTS);
|
||||
}
|
||||
if (!word.getId().equals(id)) {
|
||||
throw exception(SENSITIVE_WORD_EXISTS);
|
||||
throw new ServiceException(SENSITIVE_WORD_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateSensitiveWordExists(Long id) {
|
||||
if (sensitiveWordMapper.selectById(id) == null) {
|
||||
throw exception(SENSITIVE_WORD_NOT_EXISTS);
|
||||
throw new ServiceException(SENSITIVE_WORD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.setting;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.enums.UserSettingTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.module.system.controller.admin.setting.vo.PackageConfigReqVO;
|
||||
@@ -12,7 +13,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CURRENTLY_NO_CONFIGURATION_AVAILABLE;
|
||||
@@ -56,7 +56,7 @@ public class SettingServiceImpl implements SettingService{
|
||||
// 更新
|
||||
PackageConfigDO packageConfigDO = packageConfigMapper.selectSetting(reqVO.getType(), loginUser.getId(), loginUser.getOrganId());
|
||||
if (packageConfigDO == null) {
|
||||
throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE,reqVO.getType() == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName());
|
||||
throw new ServiceException(CURRENTLY_NO_CONFIGURATION_AVAILABLE,reqVO.getType() == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName());
|
||||
}
|
||||
if(reqVO.getSetting() != null) {
|
||||
packageConfigDO.setSetting(JsonUtils.zipString(reqVO.getSetting().toJSONString()));
|
||||
@@ -77,7 +77,7 @@ public class SettingServiceImpl implements SettingService{
|
||||
PackageConfigDO packageConfigDO = packageConfigMapper.selectSetting(type, loginUser.getId(), loginUser.getOrganId());
|
||||
|
||||
if (packageConfigDO == null) {
|
||||
// throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE,type == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName());
|
||||
// throw new ServiceException(CURRENTLY_NO_CONFIGURATION_AVAILABLE,type == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+12
-13
@@ -14,7 +14,6 @@ import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.cf.imes.module.system.enums.sms.SmsSceneEnum;
|
||||
import com.cf.imes.module.system.framework.sms.config.SmsCodeProperties;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@@ -59,7 +58,7 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
}
|
||||
// 非修改手机号的场景时校验手机号是否存在
|
||||
if (ObjectUtil.isNull(user) && ObjectUtil.notEqual(SmsSceneEnum.USER_UPDATE_MOBILE.getScene(), reqDTO.getScene())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
}
|
||||
SmsSceneEnum sceneEnum = SmsSceneEnum.getCodeByScene(reqDTO.getScene());
|
||||
Assert.notNull(sceneEnum, "验证码场景({}) 查找不到配置", reqDTO.getScene());
|
||||
@@ -85,10 +84,10 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
if (ObjectUtil.isNotNull(user)) {
|
||||
if (ObjectUtil.equal(user.getId(), loginUser.getId())) {
|
||||
// 手机号没有改变无需验证码
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NO_CHANGE);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NO_CHANGE);
|
||||
} else {
|
||||
// 修改手机号的场景校验手机是否已存在
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_MOBILE_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_MOBILE_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,16 +111,16 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
// 限制手机号请求次数:10分钟5次
|
||||
boolean mobileCountRateLimit = slidingWindowRateLimit(redisMobileCountKey, sendWindowSizeMin.toMinutesPart(), sendMaxSendTimesPerWindow);
|
||||
if (!mobileCountRateLimit) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_SEND_TOO_FAST);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_CODE_SEND_TOO_FAST);
|
||||
}
|
||||
// 限制ip请求次数
|
||||
boolean ipCountRateLimit = slidingWindowRateLimit(redisIpCountKey, sendWindowSizeMin.toMinutesPart(), sendMaxSendTimesPerWindow);
|
||||
if (!ipCountRateLimit) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_SEND_TOO_FAST);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_CODE_SEND_TOO_FAST);
|
||||
}
|
||||
} else {
|
||||
// 验证码存在提示请勿重复发送
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_IS_VALID);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_CODE_IS_VALID);
|
||||
}
|
||||
|
||||
// 生成6位随机验证码
|
||||
@@ -166,7 +165,7 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
// 非修改手机号的场景时校验手机号是否存在
|
||||
AdminUserDO user = userService.getUserUniqueByUserName(reqDTO.getMobile());
|
||||
if (ObjectUtil.isNull(user) && ObjectUtil.notEqual(SmsSceneEnum.USER_UPDATE_MOBILE.getScene(), reqDTO.getScene())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
}
|
||||
String smsCodeKey = String.format(RedisKeyConstants.SMS_CAPTCHA_VERIFICATION, reqDTO.getMobile());
|
||||
Object keyObj = redisTemplate.opsForValue().get(smsCodeKey);
|
||||
@@ -174,14 +173,14 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
// 校验码存在
|
||||
if (ObjectUtil.notEqual(String.valueOf(keyObj), reqDTO.getCode())) {
|
||||
// 验证码不正确
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_CORRECT);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_CODE_NOT_CORRECT);
|
||||
} else {
|
||||
// 消耗验证码
|
||||
redisTemplate.delete(smsCodeKey);
|
||||
}
|
||||
} else {
|
||||
// 提示验证码不存在
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_FOUND);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_CODE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +190,7 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
// 非修改手机号的场景时校验手机号是否存在
|
||||
AdminUserDO user = userService.getUserUniqueByUserName(mobile);
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
}
|
||||
String smsCodeKey = String.format(RedisKeyConstants.SMS_CAPTCHA_VERIFICATION, mobile);
|
||||
Object keyObj = redisTemplate.opsForValue().get(smsCodeKey);
|
||||
@@ -199,11 +198,11 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
// 校验码存在
|
||||
if (ObjectUtil.notEqual(String.valueOf(keyObj), reqVO.getSmsCaptchaVerification())) {
|
||||
// 验证码不正确
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_CORRECT);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_CODE_NOT_CORRECT);
|
||||
}
|
||||
} else {
|
||||
// 提示验证码不存在
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_FOUND);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_CODE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@ import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.cf.imes.module.system.framework.sms.config.SmsCodeProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
@@ -78,7 +78,7 @@ public class SmsSendServiceImpl implements SmsSendService {
|
||||
SmsTemplateDO template = smsTemplateService.getSmsTemplateByCodeFromCache(templateCode);
|
||||
// 短信模板不存在
|
||||
if (template == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_SEND_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_SEND_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
return template;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class SmsSendServiceImpl implements SmsSendService {
|
||||
return template.getParams().stream().map(key -> {
|
||||
Object value = templateParams.get(key);
|
||||
if (value == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS, key);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS, key);
|
||||
}
|
||||
return new Pair<>(key, value);
|
||||
}).collect(Collectors.toList());
|
||||
@@ -106,7 +106,7 @@ public class SmsSendServiceImpl implements SmsSendService {
|
||||
@VisibleForTesting
|
||||
public String validateMobile(String mobile) {
|
||||
if (StringUtils.isEmpty(mobile)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_SEND_MOBILE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_SEND_MOBILE_NOT_EXISTS);
|
||||
}
|
||||
return mobile;
|
||||
}
|
||||
|
||||
+9
-9
@@ -5,7 +5,7 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
@@ -94,7 +94,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
||||
|
||||
private void validateSmsTemplateExists(Long id) {
|
||||
if (smsTemplateMapper.selectById(id) == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,10 +128,10 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的字典类型
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_CODE_DUPLICATE, code);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_CODE_DUPLICATE, code);
|
||||
}
|
||||
if (!template.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_CODE_DUPLICATE, code);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_CODE_DUPLICATE, code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,23 +145,23 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
||||
// 获得短信模板
|
||||
SmsClient smsClient = smsChannelService.getSmsClient();
|
||||
if (ObjectUtil.isNull(smsClient)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CHANNEL_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_CHANNEL_NOT_EXISTS);
|
||||
}
|
||||
SmsTemplateRespDTO template;
|
||||
try {
|
||||
template = smsClient.getSmsTemplate(apiTemplateId);
|
||||
} catch (Throwable ex) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_API_ERROR, ExceptionUtil.getRootCauseMessage(ex));
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_API_ERROR, ExceptionUtil.getRootCauseMessage(ex));
|
||||
}
|
||||
// 校验短信模版
|
||||
if (template == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_API_NOT_FOUND);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_API_NOT_FOUND);
|
||||
}
|
||||
if (Objects.equals(template.getAuditStatus(), SmsTemplateAuditStatusEnum.CHECKING.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_API_AUDIT_CHECKING);
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_API_AUDIT_CHECKING);
|
||||
}
|
||||
if (Objects.equals(template.getAuditStatus(), SmsTemplateAuditStatusEnum.FAIL.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_API_AUDIT_FAIL, template.getAuditReason());
|
||||
throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_API_AUDIT_FAIL, template.getAuditReason());
|
||||
}
|
||||
Assert.equals(template.getAuditStatus(), SmsTemplateAuditStatusEnum.SUCCESS.getStatus(),
|
||||
String.format("短信模板(%s) 审核状态(%d) 不正确", apiTemplateId, template.getAuditStatus()));
|
||||
|
||||
+5
-5
@@ -9,6 +9,7 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.cache.CacheUtils;
|
||||
import com.cf.imes.framework.common.util.http.HttpUtils;
|
||||
@@ -45,7 +46,6 @@ import jakarta.annotation.Resource;
|
||||
import java.time.Duration;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -130,7 +130,7 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
log.info("[getAuthUser][请求社交平台 type({}) request({}) response({})]", socialType,
|
||||
toJsonString(authCallback), toJsonString(authResponse));
|
||||
if (!authResponse.ok()) {
|
||||
throw exception(SOCIAL_USER_AUTH_FAILURE, authResponse.getMsg());
|
||||
throw new ServiceException(SOCIAL_USER_AUTH_FAILURE, authResponse.getMsg());
|
||||
}
|
||||
return (AuthUser) authResponse.getData();
|
||||
}
|
||||
@@ -223,7 +223,7 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
return service.getUserService().getPhoneNoInfo(phoneCode);
|
||||
} catch (WxErrorException e) {
|
||||
log.error("[getPhoneNoInfo][userType({}) phoneCode({}) 获得手机号失败]", userType, phoneCode, e);
|
||||
throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR);
|
||||
throw new ServiceException(SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
|
||||
private void validateSocialClientExists(Long id) {
|
||||
if (socialClientMapper.selectById(id) == null) {
|
||||
throw exception(SOCIAL_CLIENT_NOT_EXISTS);
|
||||
throw new ServiceException(SOCIAL_CLIENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
}
|
||||
if (id == null // 新增时,说明重复
|
||||
|| ObjectUtil.notEqual(id, client.getId())) { // 更新时,如果 id 不一致,说明重复
|
||||
throw exception(SOCIAL_CLIENT_UNIQUE);
|
||||
throw new ServiceException(SOCIAL_CLIENT_UNIQUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SOCIAL_USER_NOT_FOUND;
|
||||
@@ -88,7 +88,7 @@ public class SocialUserServiceImpl implements SocialUserService {
|
||||
// 获得 openid 对应的 SocialUserDO 社交用户
|
||||
SocialUserDO socialUser = socialUserMapper.selectByTypeAndOpenid(socialType, openid);
|
||||
if (socialUser == null) {
|
||||
throw exception(SOCIAL_USER_NOT_FOUND);
|
||||
throw new ServiceException(SOCIAL_USER_NOT_FOUND);
|
||||
}
|
||||
|
||||
// 获得对应的社交绑定关系
|
||||
|
||||
+11
-12
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
@@ -39,7 +38,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -128,7 +127,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
}
|
||||
CustomPlateNoRuleCodeEnum custBoardRuleCodeEnum = CustomPlateNoRuleCodeEnum.match(ruleCode);
|
||||
if (ObjectUtil.isNull(custBoardRuleCodeEnum)) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR, ruleCode);
|
||||
throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR, ruleCode);
|
||||
}
|
||||
return custBoardRuleCodeEnum;
|
||||
}
|
||||
@@ -143,7 +142,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.DATE, custBoardRuleCodeEnum) && StringUtils.isNotEmpty(format)) {
|
||||
Optional<DictDataDO> dateFormatDictDataOptional = dateTypeFormatDictList.stream().filter(d -> format.equals(d.getValue())).findAny();
|
||||
if (dateFormatDictDataOptional.isEmpty()) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR, format);
|
||||
throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR, format);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,7 +156,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
private void checkCustom(CustomPlateNoRuleCodeEnum custBoardRuleCodeEnum, JSONObject jsonObject) {
|
||||
if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.CUSTOM, custBoardRuleCodeEnum)) {
|
||||
if (ObjectUtil.isEmpty(jsonObject.get("strValue"))) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR, jsonObject.get("ruleCode"));
|
||||
throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR, jsonObject.get("ruleCode"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,10 +197,10 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
*/
|
||||
private void checkInt(Object intObj, String fieldName, String ruleName) {
|
||||
if (ObjectUtil.isEmpty(intObj)) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName);
|
||||
throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName);
|
||||
}
|
||||
if (!NumberUtil.isInteger(intObj.toString())) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR, ruleName, fieldName, intObj);
|
||||
throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR, ruleName, fieldName, intObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,10 +212,10 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
*/
|
||||
private void checkBol(Object bolObj, String fieldName, String ruleName) {
|
||||
if (ObjectUtil.isEmpty(bolObj)) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName);
|
||||
throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName);
|
||||
}
|
||||
if (!(bolObj instanceof Boolean)) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR, ruleName, fieldName, bolObj);
|
||||
throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR, ruleName, fieldName, bolObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +239,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
checkSuccess = ObjectUtil.equal(resetMode, ResetModeEnum.ORDER.getMode()) || ObjectUtil.equal(resetMode, ResetModeEnum.ROOM.getMode());
|
||||
}
|
||||
if (!checkSuccess) {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR, ruleCode, resetMode);
|
||||
throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR, ruleCode, resetMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +310,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
.eq(SystemConfigDO::getId, id)
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
if (CommonStatusEnum.ENABLE.getStatus().equals(status)) {
|
||||
@@ -358,7 +357,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
.eq(SystemConfigDO::getId, id)
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigDO;
|
||||
|
||||
+5
-4
@@ -4,6 +4,7 @@ package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -23,7 +24,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
@@ -103,7 +104,7 @@ public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandle
|
||||
.eq(SystemConfigDataDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigDataDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
@@ -186,7 +187,7 @@ public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandle
|
||||
.eq(SystemConfigDataDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigDataDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigDataDO;
|
||||
@@ -214,7 +215,7 @@ public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandle
|
||||
}
|
||||
|
||||
if(optimizationConfigIds.contains(id)){
|
||||
throw exception(OPTIMIZATION_CONFIG_USED_ALREADY);
|
||||
throw new ServiceException(OPTIMIZATION_CONFIG_USED_ALREADY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-3
@@ -4,6 +4,7 @@ package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -20,7 +21,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.THIS_CONFIG_NAME_IS_EXISTS;
|
||||
@@ -101,7 +102,7 @@ public class IntellectBranchingService extends AbstractSystemConfigServiceHandle
|
||||
.eq(SystemConfigFilterDO::getId, id)
|
||||
.eq(SystemConfigFilterDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigFilterDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
@@ -190,7 +191,7 @@ public class IntellectBranchingService extends AbstractSystemConfigServiceHandle
|
||||
.eq(SystemConfigFilterDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigFilterDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigFilterDO;
|
||||
|
||||
+5
-5
@@ -5,6 +5,7 @@ import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -25,7 +26,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
@@ -137,7 +137,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand
|
||||
Boolean data = orderPlanApi.getOrderProcessScheme(reqVO.getId()).getCheckedData();
|
||||
|
||||
if(Boolean.TRUE.equals(data)){
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN);
|
||||
throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN);
|
||||
}
|
||||
|
||||
systemConfigSchemeMapper.deleteConfig(reqVO.getId(),getUserOrganId());
|
||||
@@ -156,7 +156,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand
|
||||
.eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigSchemeDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
@@ -236,7 +236,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand
|
||||
private void checkValueIsNotNull(String value,String error) {
|
||||
|
||||
if(CharSequenceUtil.isBlank(value)){
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_DATA_ERROR,error);
|
||||
throw new ServiceException(SYSTEM_PROCESS_SCHEME_DATA_ERROR,error);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -256,7 +256,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand
|
||||
.eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigSchemeDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigSchemeDO;
|
||||
|
||||
+4
-4
@@ -4,6 +4,7 @@ package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -23,7 +24,6 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
@@ -103,7 +103,7 @@ public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceH
|
||||
.eq(SystemConfigProcessDO::getId, id)
|
||||
.eq(SystemConfigProcessDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigProcessDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
@@ -185,7 +185,7 @@ public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceH
|
||||
.eq(SystemConfigProcessDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigProcessDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigProcessDO;
|
||||
@@ -212,7 +212,7 @@ public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceH
|
||||
}
|
||||
|
||||
if(processLineConfigIds.contains(id)){
|
||||
throw exception(PROCESS_CONFIG_USED_ALREADY);
|
||||
throw new ServiceException(PROCESS_CONFIG_USED_ALREADY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-9
@@ -24,7 +24,6 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
|
||||
@@ -71,7 +70,7 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
String widthValue = jsonObject.getString("widthValue");
|
||||
|
||||
if(StringUtils.isEmpty(widthMin) || StringUtils.isEmpty(widthMax) || StringUtils.isEmpty(widthValue) ){
|
||||
throw exception(SEALEDGE_CONFIG_NOT_EXISTS,(i+1));
|
||||
throw new ServiceException(SEALEDGE_CONFIG_NOT_EXISTS,(i+1));
|
||||
}
|
||||
|
||||
BigDecimal widthMin2 = BigDecimal.valueOf(Double.parseDouble(widthMin));
|
||||
@@ -82,24 +81,24 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
|
||||
|
||||
if(widthMin2.scale() > 3 || widthMax2.scale() > 3 || widthValue2.scale() > 3 ){
|
||||
throw exception(DECIMAL_PLACES_MAX_TWO,(i+1));
|
||||
throw new ServiceException(DECIMAL_PLACES_MAX_TWO,(i+1));
|
||||
}
|
||||
|
||||
|
||||
if( widthMin2.compareTo(BigDecimal.ZERO) != 1 ){
|
||||
throw exception(SEALEDGE_CONFIG_MIN_VALUE_GREATER_THAN_ZERO,(i+1),widthMin2.stripTrailingZeros().toPlainString());
|
||||
throw new ServiceException(SEALEDGE_CONFIG_MIN_VALUE_GREATER_THAN_ZERO,(i+1),widthMin2.stripTrailingZeros().toPlainString());
|
||||
}
|
||||
|
||||
if( widthMax2.compareTo(BigDecimal.ZERO) != 1 ){
|
||||
throw exception(SEALEDGE_CONFIG_MAX_VALUE_GREATER_THAN_ZERO,(i+1),widthMax2.stripTrailingZeros().toPlainString());
|
||||
throw new ServiceException(SEALEDGE_CONFIG_MAX_VALUE_GREATER_THAN_ZERO,(i+1),widthMax2.stripTrailingZeros().toPlainString());
|
||||
}
|
||||
|
||||
if( widthMax2.compareTo(widthMin2) == -1 ){
|
||||
throw exception(SEALEDGE_CONFIG_VALUE_DATA_ERROR,(i+1));
|
||||
throw new ServiceException(SEALEDGE_CONFIG_VALUE_DATA_ERROR,(i+1));
|
||||
}
|
||||
|
||||
if( widthValue2.compareTo(widthMax2) == -1 ){
|
||||
throw exception(SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR,(i+1),widthValue2.stripTrailingZeros().toPlainString(),widthMax2.stripTrailingZeros().toPlainString());
|
||||
throw new ServiceException(SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR,(i+1),widthValue2.stripTrailingZeros().toPlainString(),widthMax2.stripTrailingZeros().toPlainString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -159,7 +158,7 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
.eq(SystemConfigSealedgeDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigDO;
|
||||
@@ -210,7 +209,7 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
.eq(SystemConfigSealedgeDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigSealedgeDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigSealedgeDO;
|
||||
|
||||
+12
-12
@@ -4,6 +4,7 @@ package com.cf.imes.module.system.service.tokenconfig;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.date.DateUtils;
|
||||
@@ -36,7 +37,6 @@ import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -120,7 +120,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{
|
||||
List<Integer> appTypes = tokenConfigMapper.selectAppTypeByOrganId(organId);
|
||||
|
||||
if(appTypes.contains(reqVO.getAppType())){
|
||||
throw exception(TOKEN_APP_TYPE_EXIST);
|
||||
throw new ServiceException(TOKEN_APP_TYPE_EXIST);
|
||||
}
|
||||
|
||||
String token = generateBaseToken(organId, organizationDO.getContactMobile(), reqVO.getAppType(), jwtConfig.getSecret());
|
||||
@@ -157,7 +157,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{
|
||||
TokenConfigDO tokenConfigDO = validateTokenConfigExists(reqVO.getId());
|
||||
|
||||
if(!tokenConfigDO.getAppType().equals(reqVO.getAppType())){
|
||||
throw exception(TOKEN_APP_TYPE_NO_UPDATE);
|
||||
throw new ServiceException(TOKEN_APP_TYPE_NO_UPDATE);
|
||||
}
|
||||
|
||||
LocalDateTime adjustedTime = null;
|
||||
@@ -172,7 +172,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{
|
||||
if(adjustedTime != null){
|
||||
|
||||
if(DateUtils.isExpired(adjustedTime)){
|
||||
throw exception(TOKEN_EXPIRES_TIME_DATA_ERROR);
|
||||
throw new ServiceException(TOKEN_EXPIRES_TIME_DATA_ERROR);
|
||||
}
|
||||
|
||||
tokenConfigDO.setExpiresTime(adjustedTime);
|
||||
@@ -195,7 +195,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{
|
||||
TokenConfigDO tokenConfigDO = tokenConfigMapper.selectById(id);
|
||||
|
||||
if(ObjectUtil.isNull(tokenConfigDO)){
|
||||
throw exception(TOKEN_DATA_IS_NULL);
|
||||
throw new ServiceException(TOKEN_DATA_IS_NULL);
|
||||
}
|
||||
|
||||
tokenConfigMapper.deleteTokenConfig(id);
|
||||
@@ -211,11 +211,11 @@ public class TokenConfigServiceImpl implements TokenConfigService{
|
||||
TokenConfigDO tokenConfigDO = tokenConfigMapper.selectByToken(token.substring(5));
|
||||
|
||||
if(tokenConfigDO == null){
|
||||
throw exception(TOKEN_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(TOKEN_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
if (DateUtils.isExpired(tokenConfigDO.getExpiresTime())) {
|
||||
throw exception(TOKEN_TIME_IS_EXPIRES);
|
||||
throw new ServiceException(TOKEN_TIME_IS_EXPIRES);
|
||||
}
|
||||
|
||||
Long organId = tokenConfigDO.getOrganId();
|
||||
@@ -223,15 +223,15 @@ public class TokenConfigServiceImpl implements TokenConfigService{
|
||||
OrganizationDO organizationDO = organMapper.selectById(organId);
|
||||
|
||||
if (organizationDO == null) {
|
||||
throw exception(ORGAN_NOT_EXISTS);
|
||||
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||
}
|
||||
|
||||
if (organizationDO.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) {
|
||||
throw exception(ORGAN_DISABLE, organizationDO.getName());
|
||||
throw new ServiceException(ORGAN_DISABLE, organizationDO.getName());
|
||||
}
|
||||
|
||||
if (DateUtils.isExpired(organizationDO.getExpireTime())) {
|
||||
throw exception(ORGAN_EXPIRE, organizationDO.getName());
|
||||
throw new ServiceException(ORGAN_EXPIRE, organizationDO.getName());
|
||||
}
|
||||
|
||||
return organId;
|
||||
@@ -275,7 +275,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{
|
||||
TokenConfigDO tokenConfigDO = tokenConfigMapper.selectById(id);
|
||||
|
||||
if (ObjectUtil.isNull(tokenConfigDO)) {
|
||||
throw exception(TOKEN_CONFIG_NOT_EXISTS);
|
||||
throw new ServiceException(TOKEN_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return tokenConfigDO;
|
||||
@@ -333,7 +333,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{
|
||||
|
||||
log.error("token二次处理失败"+e.getMessage());
|
||||
|
||||
throw exception(INSERT_TOKEN_DATA_ERROR);
|
||||
throw new ServiceException(INSERT_TOKEN_DATA_ERROR);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+24
-26
@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
@@ -71,7 +70,6 @@ import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static com.cf.imes.framework.common.util.time.StatisticsChangeUtils.generateDateRangeAxis;
|
||||
import static com.cf.imes.framework.common.util.time.StatisticsChangeUtils.getDateList;
|
||||
@@ -142,7 +140,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
organService.handleOrganInfo(organ -> {
|
||||
long count = userMapper.selectCount(new LambdaQueryWrapperX<AdminUserDO>().eq(AdminUserDO::getOrganId, organId));
|
||||
if (count >= organ.getAccountCount()) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_COUNT_MAX, organ.getAccountCount());
|
||||
throw new ServiceException(ErrorCodeConstants.USER_COUNT_MAX, organ.getAccountCount());
|
||||
}
|
||||
}, organId);
|
||||
|
||||
@@ -191,7 +189,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
// 当手机号(账号)发生改变时,只允许密码为空的通过(还没有使用验证码来设置过密码)
|
||||
if (ObjectUtil.isNotNull(adminUserDO) && !StringUtils.equals(adminUserDO.getUsername(), mobile)) {
|
||||
if(StringUtils.isNotEmpty(adminUserDO.getPassword())) {
|
||||
throw ServiceExceptionUtil.exception(USER_MOBILE_UPDATE_NOT_ALLOW_ERROR);
|
||||
throw new ServiceException(USER_MOBILE_UPDATE_NOT_ALLOW_ERROR);
|
||||
} else {
|
||||
updateObj.setUsername(mobile);
|
||||
}
|
||||
@@ -472,10 +470,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
ids.forEach(id -> {
|
||||
AdminUserDO user = userMap.get(id);
|
||||
if (user == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
}
|
||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(user.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_IS_DISABLE, user.getNickname());
|
||||
throw new ServiceException(ErrorCodeConstants.USER_IS_DISABLE, user.getNickname());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -522,27 +520,27 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
// 检查密码长度
|
||||
if (!Pattern.matches(LENGTH_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
}
|
||||
// 检查是否包含大写字母
|
||||
if (!Pattern.matches(UPPER_LETTER_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
}
|
||||
// 检查是否包含小写字母
|
||||
if (!Pattern.matches(LOWER_LETTER_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
}
|
||||
// 检查是否包含数字
|
||||
if (!Pattern.matches(DIGIT_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
}
|
||||
// 检查是否包含特殊字符
|
||||
if (!Pattern.matches(SPECIAL_CHARACTER_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
}
|
||||
// 检查是否只包含字母、数字和特殊字符
|
||||
if (!Pattern.matches(VALID_CHAR_PATTERN, password)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -554,7 +552,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
AdminUserDO user = userMapper.selectById(id);
|
||||
if (user == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
@@ -563,7 +561,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
private AdminUserDO validateUserNameExists(String userName) {
|
||||
AdminUserDO user = userMapper.selectByUsernameUnique(userName);
|
||||
if (user == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
@@ -580,10 +578,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的用户
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_USERNAME_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_USERNAME_EXISTS);
|
||||
}
|
||||
if (!user.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_USERNAME_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_USERNAME_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,10 +596,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的用户
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_EMAIL_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_EMAIL_EXISTS);
|
||||
}
|
||||
if (!user.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_EMAIL_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_EMAIL_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,10 +612,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的用户
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_MOBILE_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_MOBILE_EXISTS);
|
||||
}
|
||||
if (!user.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_MOBILE_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_MOBILE_EXISTS);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
@@ -632,10 +630,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
void validateOldPassword(Long id, String oldPassword) {
|
||||
AdminUserDO user = userMapper.selectById(id);
|
||||
if (user == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||
}
|
||||
if (!isPasswordMatch(oldPassword, user.getPassword())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_PASSWORD_FAILED);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_PASSWORD_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,7 +641,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport, Long organId) {
|
||||
if (CollUtil.isEmpty(importUsers)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_IMPORT_LIST_IS_EMPTY);
|
||||
throw new ServiceException(ErrorCodeConstants.USER_IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
UserImportRespVO respVO = UserImportRespVO.builder().createUsernames(new ArrayList<>())
|
||||
.updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build();
|
||||
@@ -721,7 +719,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
AdminUserDO adminUserDO = validateMobileUnique(id, mobile);
|
||||
// 手机号没有改变无需请求
|
||||
if (ObjectUtil.isNotNull(adminUserDO) && ObjectUtil.equal(id, adminUserDO.getId())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NO_CHANGE);
|
||||
throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NO_CHANGE);
|
||||
}
|
||||
|
||||
// 新手机号入库 -> setUsername
|
||||
@@ -751,13 +749,13 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
*/
|
||||
private void checkCurrentWhenOperate(Long userId) {
|
||||
if (ObjectUtil.equal(userId, SecurityFrameworkUtils.getLoginUserId())) {
|
||||
throw exception(USER_ME_ERROR);
|
||||
throw new ServiceException(USER_ME_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCurrentWhenOperateStatus(Long userId, Integer status) {
|
||||
if (ObjectUtil.equal(userId, SecurityFrameworkUtils.getLoginUserId()) && Objects.equals(CommonStatusEnum.DISABLE.getStatus(), status)) {
|
||||
throw exception(USER_OPERATE_SELF_STATUS_ERROR);
|
||||
throw new ServiceException(USER_OPERATE_SELF_STATUS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ spring:
|
||||
repositories:
|
||||
enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度
|
||||
messages:
|
||||
basename: message
|
||||
basename: message,message_errorcode
|
||||
trans:
|
||||
config:
|
||||
appId: 20251110002494620
|
||||
|
||||
@@ -99,4 +99,5 @@ global.error.no.permission=没有该操作权限
|
||||
global.error.no.permission.to.visit.org=您无权访问该组织的数据
|
||||
global.error.request.organId.notExist=请求的组织标识未传递,请进行排查
|
||||
global.org.product.not.exist=账号登录异常,套餐信息不存在,请重新登陆
|
||||
global.org.product.expired=组织产品套餐已过期,请续费后继续使用
|
||||
global.org.product.expired=组织产品套餐已过期,请续费后继续使用
|
||||
global.not.login=账号未登录
|
||||
@@ -99,4 +99,5 @@ global.error.no.permission=您沒有該操作的權限
|
||||
global.error.no.permission.to.visit.org=您無權訪問該組織的數據
|
||||
global.error.request.organId.notExist=請求的組織標識未傳遞,請進行排查
|
||||
global.org.product.not.exist=帳號登入異常,套餐資訊不存在,請重新登入
|
||||
global.org.product.expired=組織產品套餐已過期,請續費後繼續使用
|
||||
global.org.product.expired=組織產品套餐已過期,請續費後繼續使用
|
||||
global.not.login=賬號未登錄
|
||||
@@ -99,4 +99,5 @@ global.error.no.permission=You do not have permission to perform this action
|
||||
global.error.no.permission.to.visit.org=You do not have permission to access this organization’s data
|
||||
global.error.request.organId.notExist=The requested organization ID was not provided, please check
|
||||
global.org.product.not.exist=Account login exception: product package does not exist, please log in again
|
||||
global.org.product.expired=The organization's product package has expired, please renew before continuing to use the service
|
||||
global.org.product.expired=The organization's product package has expired, please renew before continuing to use the service
|
||||
global.not.login=The account is not logged in
|
||||
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user