1、统一抛出ServiceException带占位符的填充方式,不再使用ServiceExceptionUtils;2、新增System服务ErrorCode的国际化;3、Webcad异步导入移除分布式锁,导入解析事务完善;

This commit is contained in:
gaoqr
2025-11-20 11:12:21 +08:00
parent f051e6466b
commit ab4ec08078
139 changed files with 1005 additions and 1193 deletions
@@ -10,118 +10,118 @@ import com.cf.imes.framework.common.exception.ErrorCode;
public class ErrorCodeConstants {
// ========== AUTH 模块 1-002-000-000 ==========
public static final ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_002_000_000, "登录失败,账号密码不正确");
public static final ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1_002_000_001, "登录失败,账号被禁用");
public static final ErrorCode AUTH_LOGIN_CAPTCHA_CODE_ERROR = new ErrorCode(1_002_000_004, "验证码不正确,原因:{}");
public static final ErrorCode AUTH_THIRD_LOGIN_NOT_BIND = new ErrorCode(1_002_000_005, "未绑定账号,需要进行绑定");
public static final ErrorCode AUTH_MOBILE_NOT_EXISTS = new ErrorCode(1_002_000_006, "手机号不存在");
public static final ErrorCode AUTH_MOBILE_NO_CHANGE = new ErrorCode(1_002_000_007, "手机号未发生改变,无需修改");
public static final ErrorCode AUTH_MANAGEENDPOINT_LOGIN_PERMISSION_ERROR = new ErrorCode(1_002_000_008, "登录失败,管理端账号不存在");
public static final ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_002_000_000, "auth.login.bad_credentials");
public static final ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1_002_000_001, "auth.login.user_disabled");
public static final ErrorCode AUTH_LOGIN_CAPTCHA_CODE_ERROR = new ErrorCode(1_002_000_004, "auth.login.captcha_code_error");
public static final ErrorCode AUTH_THIRD_LOGIN_NOT_BIND = new ErrorCode(1_002_000_005, "auth.login.third_not_bind");
public static final ErrorCode AUTH_MOBILE_NOT_EXISTS = new ErrorCode(1_002_000_006, "auth.mobile.not_exists");
public static final ErrorCode AUTH_MOBILE_NO_CHANGE = new ErrorCode(1_002_000_007, "auth.mobile.no_change");
public static final ErrorCode AUTH_MANAGEENDPOINT_LOGIN_PERMISSION_ERROR = new ErrorCode(1_002_000_008, "auth.manage_endpoint.login_permission_error");
// ========== 菜单模块 1-002-001-000 ==========
public static final ErrorCode MENU_NAME_DUPLICATE = new ErrorCode(1_002_001_000, "已经存在该名字的菜单");
public static final ErrorCode MENU_PARENT_NOT_EXISTS = new ErrorCode(1_002_001_001, "父菜单不存在");
public static final ErrorCode MENU_PARENT_ERROR = new ErrorCode(1_002_001_002, "不能设置自己为父菜单");
public static final ErrorCode MENU_NOT_EXISTS = new ErrorCode(1_002_001_003, "菜单不存在");
public static final ErrorCode MENU_EXISTS_CHILDREN = new ErrorCode(1_002_001_004, "存在子菜单,无法删除");
public static final ErrorCode MENU_PARENT_NOT_DIR_OR_MENU = new ErrorCode(1_002_001_005, "父菜单的类型必须是目录或者菜单");
public static final ErrorCode MANAGEMENT_MENU_OPERATION_PERMISSION_ERROR = new ErrorCode(1_002_001_006, "管理端菜单操作权限不足");
public static final ErrorCode MENU_TRANS_ERROR = new ErrorCode(1_002_001_007, "菜单翻译异常,error_code :{}");
public static final ErrorCode MENU_NAME_DUPLICATE = new ErrorCode(1_002_001_000, "menu.name.duplicate");
public static final ErrorCode MENU_PARENT_NOT_EXISTS = new ErrorCode(1_002_001_001, "menu.parent.not_exists");
public static final ErrorCode MENU_PARENT_ERROR = new ErrorCode(1_002_001_002, "menu.parent.error");
public static final ErrorCode MENU_NOT_EXISTS = new ErrorCode(1_002_001_003, "menu.not_exists");
public static final ErrorCode MENU_EXISTS_CHILDREN = new ErrorCode(1_002_001_004, "menu.exists_children");
public static final ErrorCode MENU_PARENT_NOT_DIR_OR_MENU = new ErrorCode(1_002_001_005, "menu.parent.not_dir_or_menu");
public static final ErrorCode MANAGEMENT_MENU_OPERATION_PERMISSION_ERROR = new ErrorCode(1_002_001_006, "menu.operation_permission_error");
public static final ErrorCode MENU_TRANS_ERROR = new ErrorCode(1_002_001_007, "menu.trans_error");
// ========== 角色模块 1-002-002-000 ==========
public static final ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1_002_002_000, "角色不存在");
public static final ErrorCode ROLE_NAME_DUPLICATE = new ErrorCode(1_002_002_001, "已经存在名为【{}】的角色");
public static final ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1_002_002_002, "已经存在编码为【{}】的角色");
public static final ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1_002_002_003, "不能操作类型为系统内置的角色");
public static final ErrorCode ROLE_IS_DISABLE = new ErrorCode(1_002_002_004, "名字为【{}】的角色已被禁用");
public static final ErrorCode ROLE_ADMIN_CODE_ERROR = new ErrorCode(1_002_002_005, "编码【{}】不能使用");
public static final ErrorCode ROLE_ME_ERROR = new ErrorCode(1_002_002_006, "不可为自身分配角色");
public static final ErrorCode ROLE_NOT_SUPERADMIN_NO_ORGAN_ID_OPER_ERROR = new ErrorCode(1_002_002_007, "非超管分配权限");
public static final ErrorCode BUILDIN_ROLE_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_002_008, "修改内置角色下菜单权限的权限不足");
public static final ErrorCode SELF_ROLE_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_002_009, "无法修改自身的角色菜单权限");
public static final ErrorCode SELF_ROLE_MODIFY_ERROR = new ErrorCode(1_002_002_010, "无法修改自身的角色");
public static final ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1_002_002_000, "role.not_exists");
public static final ErrorCode ROLE_NAME_DUPLICATE = new ErrorCode(1_002_002_001, "role.name.duplicate");
public static final ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1_002_002_002, "role.code.duplicate");
public static final ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1_002_002_003, "role.can_not_update_system_type");
public static final ErrorCode ROLE_IS_DISABLE = new ErrorCode(1_002_002_004, "role.is_disable");
public static final ErrorCode ROLE_ADMIN_CODE_ERROR = new ErrorCode(1_002_002_005, "role.admin_code_error");
public static final ErrorCode ROLE_ME_ERROR = new ErrorCode(1_002_002_006, "role.me_error");
public static final ErrorCode ROLE_NOT_SUPERADMIN_NO_ORGAN_ID_OPER_ERROR = new ErrorCode(1_002_002_007, "role.not_superadmin_no_organ_id_oper_error");
public static final ErrorCode BUILDIN_ROLE_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_002_008, "role.buildin.modify_permission_error");
public static final ErrorCode SELF_ROLE_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_002_009, "role.self.modify_permission_error");
public static final ErrorCode SELF_ROLE_MODIFY_ERROR = new ErrorCode(1_002_002_010, "role.self.modify_error");
// ========== 用户模块 1-002-003-000 ==========
public static final ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "手机号已经存在");
public static final ErrorCode USER_MOBILE_EXISTS = new ErrorCode(1_002_003_001, "手机号已经存在");
public static final ErrorCode USER_EMAIL_EXISTS = new ErrorCode(1_002_003_002, "邮箱已经存在");
public static final ErrorCode USER_NOT_EXISTS = new ErrorCode(1_002_003_003, "用户不存在");
public static final ErrorCode USER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_003_004, "导入用户数据不能为空!");
public static final ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1_002_003_005, "用户密码校验失败");
public static final ErrorCode USER_IS_DISABLE = new ErrorCode(1_002_003_006, "名字为【{}】的用户已被禁用");
public static final ErrorCode USER_COUNT_MAX = new ErrorCode(1_002_003_008, "超过组织用户配额({}),创建用户失败!");
public static final ErrorCode USER_ME_ERROR = new ErrorCode(1_002_003_009, "不允许操作用户自身");
public static final ErrorCode THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS = new ErrorCode(1_002_003_010, "密码长度不少于8位,且包含大小写字母、数字和特殊字符");
public static final ErrorCode USERNAME_MULTIPLE_ERROR = new ErrorCode(1_002_003_011,"存在【{}】重复用户,请联系系统管理员");
public static final ErrorCode USER_OPERATE_SELF_STATUS_ERROR = new ErrorCode(1_002_003_012, "不允许操作用户自身状态");
public static final ErrorCode USER_MOBILE_UPDATE_NOT_ALLOW_ERROR = new ErrorCode(1_002_003_013, "该用户已通过手机号认证,如需修改手机号请前往个人中心");
public static final ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "user.username.exists");
public static final ErrorCode USER_MOBILE_EXISTS = new ErrorCode(1_002_003_001, "user.mobile.exists");
public static final ErrorCode USER_EMAIL_EXISTS = new ErrorCode(1_002_003_002, "user.email.exists");
public static final ErrorCode USER_NOT_EXISTS = new ErrorCode(1_002_003_003, "user.not_exists");
public static final ErrorCode USER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_003_004, "user.import.empty");
public static final ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1_002_003_005, "user.password.failed");
public static final ErrorCode USER_IS_DISABLE = new ErrorCode(1_002_003_006, "user.is_disable");
public static final ErrorCode USER_COUNT_MAX = new ErrorCode(1_002_003_008, "user.count.max");
public static final ErrorCode USER_ME_ERROR = new ErrorCode(1_002_003_009, "user.me.error");
public static final ErrorCode THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS = new ErrorCode(1_002_003_010, "user.password.length_at_least_8");
public static final ErrorCode USERNAME_MULTIPLE_ERROR = new ErrorCode(1_002_003_011, "user.username.multiple_error");
public static final ErrorCode USER_OPERATE_SELF_STATUS_ERROR = new ErrorCode(1_002_003_012, "user.operate_self_status_error");
public static final ErrorCode USER_MOBILE_UPDATE_NOT_ALLOW_ERROR = new ErrorCode(1_002_003_013, "user.mobile_update_not_allow");
// ========== 部门模块 1-002-004-000 ==========
public static final ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "已经存在该名字的部门");
public static final ErrorCode DEPT_PARENT_NOT_EXITS = new ErrorCode(1_002_004_001,"父级部门不存在");
public static final ErrorCode DEPT_NOT_FOUND = new ErrorCode(1_002_004_002, "当前部门不存在");
public static final ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1_002_004_003, "存在子部门,无法删除");
public static final ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1_002_004_004, "不能设置自己为父部门");
public static final ErrorCode DEPT_EXISTS_USER = new ErrorCode(1_002_004_005, "部门中存在员工,无法删除");
public static final ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1_002_004_007, "不能设置自己的子部门为父部门");
public static final ErrorCode DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_008, "不允许操作用户自身部门");
public static final ErrorCode PARENT_DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_009, "不允许操作用户自身部门及其上级部门");
public static final ErrorCode DEPT_DISABLE = new ErrorCode(1_002_004_010, "部门({})已被禁用");
public static final ErrorCode DEPT_NOT_ALLOWED_LOGIN = new ErrorCode(1_002_004_011, "部门({})已被禁用,无法登录");
public static final ErrorCode PARENT_DEPT_DISABLE = new ErrorCode(1_002_004_012, "上级部门({})已被禁用,请开启后操作或选择其他上级部门");
public static final ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "dept.name.duplicate");
public static final ErrorCode DEPT_PARENT_NOT_EXITS = new ErrorCode(1_002_004_001, "dept.parent.not_exists");
public static final ErrorCode DEPT_NOT_FOUND = new ErrorCode(1_002_004_002, "dept.not_found");
public static final ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1_002_004_003, "dept.exists_children");
public static final ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1_002_004_004, "dept.parent.error");
public static final ErrorCode DEPT_EXISTS_USER = new ErrorCode(1_002_004_005, "dept.exists_user");
public static final ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1_002_004_007, "dept.parent_is_child");
public static final ErrorCode DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_008, "dept.user_oper_not_allow");
public static final ErrorCode PARENT_DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_009, "dept.parent_user_oper_not_allow");
public static final ErrorCode DEPT_DISABLE = new ErrorCode(1_002_004_010, "dept.disable");
public static final ErrorCode DEPT_NOT_ALLOWED_LOGIN = new ErrorCode(1_002_004_011, "dept.not_allowed_login");
public static final ErrorCode PARENT_DEPT_DISABLE = new ErrorCode(1_002_004_012, "dept.parent_disable");
// ========== 字典类型 1-002-006-000 ==========
public static final ErrorCode DICT_TYPE_NOT_EXISTS = new ErrorCode(1_002_006_001, "当前字典类型不存在");
public static final ErrorCode DICT_TYPE_NOT_ENABLE = new ErrorCode(1_002_006_002, "字典类型处于关闭状态,不允许新增或编辑");
public static final ErrorCode DICT_TYPE_NAME_DUPLICATE = new ErrorCode(1_002_006_003, "已经存在该名字的字典类型");
public static final ErrorCode DICT_TYPE_TYPE_DUPLICATE = new ErrorCode(1_002_006_004, "已经存在该类型的字典类型");
public static final ErrorCode DICT_TYPE_HAS_CHILDREN = new ErrorCode(1_002_006_005, "无法删除,该字典类型还有字典数据");
public static final ErrorCode DICT_TYPE_NOT_EXISTS = new ErrorCode(1_002_006_001, "dict_type.not_exists");
public static final ErrorCode DICT_TYPE_NOT_ENABLE = new ErrorCode(1_002_006_002, "dict_type.not_enable");
public static final ErrorCode DICT_TYPE_NAME_DUPLICATE = new ErrorCode(1_002_006_003, "dict_type.name.duplicate");
public static final ErrorCode DICT_TYPE_TYPE_DUPLICATE = new ErrorCode(1_002_006_004, "dict_type.type.duplicate");
public static final ErrorCode DICT_TYPE_HAS_CHILDREN = new ErrorCode(1_002_006_005, "dict_type.has_children");
// ========== 字典数据 1-002-007-000 ==========
public static final ErrorCode DICT_DATA_NOT_EXISTS = new ErrorCode(1_002_007_001, "当前字典数据不存在");
public static final ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1_002_007_002, "字典数据({})不处于开启状态,不允许选择");
public static final ErrorCode DICT_DATA_VALUE_DUPLICATE = new ErrorCode(1_002_007_003, "已经存在该值的字典数据");
public static final ErrorCode DICT_DATA_TRANS_ERROR = new ErrorCode(1_002_007_004, "字典数据标签翻译异常,error_code :{}");
public static final ErrorCode DICT_DATA_NOT_EXISTS = new ErrorCode(1_002_007_001, "dict_data.not_exists");
public static final ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1_002_007_002, "dict_data.not_enable");
public static final ErrorCode DICT_DATA_VALUE_DUPLICATE = new ErrorCode(1_002_007_003, "dict_data.value.duplicate");
public static final ErrorCode DICT_DATA_TRANS_ERROR = new ErrorCode(1_002_007_004, "dict_data.trans_error");
// ========== 通知公告 1-002-008-000 ==========
public static final ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "当前通知公告不存在");
public static final ErrorCode NOTICE_NAME_UNIQE_ERROR = new ErrorCode(1_002_008_002, "公告标题已存在,请编辑后重试");
public static final ErrorCode NOTICE_BUILDIN_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_008_003, "内置通知公告编辑权限不足");
public static final ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "notice.not_found");
public static final ErrorCode NOTICE_NAME_UNIQE_ERROR = new ErrorCode(1_002_008_002, "notice.name_unique_error");
public static final ErrorCode NOTICE_BUILDIN_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_008_003, "notice.buildin.modify_permission_error");
// ========== 短信渠道 1-002-011-000 ==========
public static final ErrorCode SMS_CHANNEL_NOT_EXISTS = new ErrorCode(1_002_011_000, "短信渠道不存在");
public static final ErrorCode SMS_CHANNEL_NOT_EXISTS = new ErrorCode(1_002_011_000, "sms.channel.not_exists");
// ========== 短信模板 1-002-012-000 ==========
public static final ErrorCode SMS_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_012_000, "短信模板不存在");
public static final ErrorCode SMS_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_012_001, "已经存在编码为【{}】的短信模板");
public static final ErrorCode SMS_TEMPLATE_API_ERROR = new ErrorCode(1_002_012_002, "短信 API 模板调用失败,原因是:{}");
public static final ErrorCode SMS_TEMPLATE_API_AUDIT_CHECKING = new ErrorCode(1_002_012_003, "短信 API 模版无法使用,原因:审批中");
public static final ErrorCode SMS_TEMPLATE_API_AUDIT_FAIL = new ErrorCode(1_002_012_004, "短信 API 模版无法使用,原因:审批不通过,{}");
public static final ErrorCode SMS_TEMPLATE_API_NOT_FOUND = new ErrorCode(1_002_012_005, "短信 API 模版无法使用,原因:模版不存在");
public static final ErrorCode SMS_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_012_000, "sms.template.not_exists");
public static final ErrorCode SMS_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_012_001, "sms.template.code.duplicate");
public static final ErrorCode SMS_TEMPLATE_API_ERROR = new ErrorCode(1_002_012_002, "sms.template.api_error");
public static final ErrorCode SMS_TEMPLATE_API_AUDIT_CHECKING = new ErrorCode(1_002_012_003, "sms.template.api.audit_checking");
public static final ErrorCode SMS_TEMPLATE_API_AUDIT_FAIL = new ErrorCode(1_002_012_004, "sms.template.api.audit_fail");
public static final ErrorCode SMS_TEMPLATE_API_NOT_FOUND = new ErrorCode(1_002_012_005, "sms.template.api.not_found");
// ========== 短信发送 1-002-013-000 ==========
public static final ErrorCode SMS_SEND_MOBILE_NOT_EXISTS = new ErrorCode(1_002_013_000, "手机号不存在");
public static final ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_013_001, "短信模板参数({})缺失");
public static final ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_013_002, "短信模板不存在");
public static final ErrorCode SMS_SEND_MOBILE_NOT_EXISTS = new ErrorCode(1_002_013_000, "sms.send.mobile.not_exists");
public static final ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_013_001, "sms.send.mobile.template_param_miss");
public static final ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_013_002, "sms.send.template.not_exists");
// ========== 短信验证码 1-002-014-000 ==========
public static final ErrorCode SMS_CODE_NOT_FOUND = new ErrorCode(1_002_014_000, "验证码不存在,请点击获取");
public static final ErrorCode SMS_CODE_NOT_CORRECT = new ErrorCode(1_002_014_001, "验证码不正确");
public static final ErrorCode SMS_CODE_SEND_TOO_FAST = new ErrorCode(1_002_014_002, "短信发送过于频率");
public static final ErrorCode SMS_CODE_IS_VALID = new ErrorCode(1_002_014_003, "验证码在有效期内,5分钟内请勿重复发送!");
public static final ErrorCode SMS_CODE_NOT_FOUND = new ErrorCode(1_002_014_000, "sms.code.not_found");
public static final ErrorCode SMS_CODE_NOT_CORRECT = new ErrorCode(1_002_014_001, "sms.code.not_correct");
public static final ErrorCode SMS_CODE_SEND_TOO_FAST = new ErrorCode(1_002_014_002, "sms.code.send_too_fast");
public static final ErrorCode SMS_CODE_IS_VALID = new ErrorCode(1_002_014_003, "sms.code.is_valid");
// ========== 组织信息 1-002-015-000 ==========
public static final ErrorCode ORGAN_NOT_EXISTS = new ErrorCode(1_002_015_000, "组织不存在");
public static final ErrorCode ORGAN_DISABLE = new ErrorCode(1_002_015_001, "【{}】组织已被禁用");
public static final ErrorCode ORGAN_EXPIRE = new ErrorCode(1_002_015_002, "【{}】组织已过期");
public static final ErrorCode ORGAN_CAN_NOT_UPDATE_SYSTEM = new ErrorCode(1_002_015_003, "系统组织不能进行修改、删除等操作!");
public static final ErrorCode ORGAN_NAME_DUPLICATE = new ErrorCode(1_002_015_004, "名字为【{}】的组织已存在");
public static final ErrorCode ORGAN_WEBSITE_DUPLICATE = new ErrorCode(1_002_015_005, "域名为【{}】的组织已存在");
public static final ErrorCode ORGAN_DATA_CODE_NOT_EXISTS = new ErrorCode(1_002_015_006, "组织未配置数据源标识");
public static final ErrorCode ORGAN_ALREADY_EXISTS = new ErrorCode(1_002_015_007, "该新增组织已授权机台数量无需重复新增!");
public static final ErrorCode ORGAN_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_015_008, "不允许操作用户自身组织");
public static final ErrorCode ORGAN_CONTACTMOBILE_DUPLICATE = new ErrorCode(1_002_015_009, "手机号为【{}】的组织已存在");
public static final ErrorCode ORGAN_EXPIRETIME_PRODUCTID_LACK = new ErrorCode(1_002_015_010, "请选择要购买的产品");
public static final ErrorCode ORGAN_NOT_EXISTS = new ErrorCode(1_002_015_000, "organ.not_exists");
public static final ErrorCode ORGAN_DISABLE = new ErrorCode(1_002_015_001, "organ.disable");
public static final ErrorCode ORGAN_EXPIRE = new ErrorCode(1_002_015_002, "organ.expire");
public static final ErrorCode ORGAN_CAN_NOT_UPDATE_SYSTEM = new ErrorCode(1_002_015_003, "organ.can_not_update_system");
public static final ErrorCode ORGAN_NAME_DUPLICATE = new ErrorCode(1_002_015_004, "organ.name.duplicate");
public static final ErrorCode ORGAN_WEBSITE_DUPLICATE = new ErrorCode(1_002_015_005, "organ.website.duplicate");
public static final ErrorCode ORGAN_DATA_CODE_NOT_EXISTS = new ErrorCode(1_002_015_006, "organ.data_code.not_exists");
public static final ErrorCode ORGAN_ALREADY_EXISTS = new ErrorCode(1_002_015_007, "organ.already_exists");
public static final ErrorCode ORGAN_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_015_008, "organ.user_oper.not_allow");
public static final ErrorCode ORGAN_CONTACTMOBILE_DUPLICATE = new ErrorCode(1_002_015_009, "organ.contact_mobile.duplicate");
public static final ErrorCode ORGAN_EXPIRETIME_PRODUCTID_LACK = new ErrorCode(1_002_015_010, "organ.expiretime.product_id_lack");
// ========== 组织套餐 1-002-016-000 ==========
public static final ErrorCode TENANT_PACKAGE_NOT_EXISTS = new ErrorCode(1_002_016_000, "组织套餐不存在");
@@ -178,13 +178,13 @@ public class ErrorCodeConstants {
public static final ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1_002_025_001, "邮箱不存在");
// ========== 站内信模版 1-002-026-000 ==========
public static final ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_026_000, "站内信模版不存在");
public static final ErrorCode NOTIFY_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_026_001, "已经存在编码为【{}】的站内信模板");
public static final ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_026_000, "notify.template.not.exists");
public static final ErrorCode NOTIFY_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_026_001, "notify.template.code.duplicate");
// ========== 站内信模版 1-002-027-000 ==========
// ========== 站内信发送 1-002-028-000 ==========
public static final ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "站内信模板参数({})缺失");
public static final ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "notify.send.template.param.miss");
//=========== 工序信息 1-002-027-000 ============
@@ -194,35 +194,35 @@ public class ErrorCodeConstants {
public static final ErrorCode PROCESS_NAME_EXISTS = new ErrorCode(1_002_027_003, "工序名称已存在");
// ========== 机台 1-002-029-000 ==========
public static final ErrorCode MACHINE_NOT_EXISTS = new ErrorCode(1_002_029_000, "机台不存在");
public static final ErrorCode MACHINE_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_029_001, "机台模板不存在");
public static final ErrorCode DEFAULT_TEMPLATE_COUNT = new ErrorCode(1_002_029_002, "默认模板数量异常");
public static final ErrorCode THE_CURRENT_MACHINE_IS_ALREADY_IN_USE = new ErrorCode(1_002_029_006, "当前机台已使用,禁止删除");
public static final ErrorCode MACHINE_ERROR = new ErrorCode(1_002_029_007, "当前机台错误,请重新选择机台");
public static final ErrorCode THE_CURRENT_BRAND_OF_THE_MACHINE_EXISTS = new ErrorCode(1_002_029_008, "当前机台配置的模板中,该品牌已存在,请重新输入品牌名称");
public static final ErrorCode THE_MODEL_OF_THE_MACHINE_DOES_NOT_EXIST = new ErrorCode(1_002_029_009, "该型号的机台模板不存在,请进行配置");
public static final ErrorCode THE_CURRENT_BRAND = new ErrorCode(1_002_029_010, "品牌ID错误,或品牌不存在");
public static final ErrorCode MACHINE_NUM_ERROR = new ErrorCode(1_002_029_011, "当前组织该类型的机台创建已达到最大值,无法继续创建");
public static final ErrorCode MACHINE_NAME_ERROR = new ErrorCode(1_002_029_012, "当前机台名称已存在,请重新输入机台名称");
public static final ErrorCode MACHINETEMPLATE_NAME_ERROR = new ErrorCode(1_002_029_013, "当前机台模板的名称已存在,请重新输入机台模板名称");
public static final ErrorCode LABELINGMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_014, "当前机台关联的贴标机数据有误,请在高级配置中重新配置贴标机或选择其他模板");
public static final ErrorCode DRILLMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_015, "当前机台关联的钻孔机数据有误,请在钻孔模块中重新配置钻孔机或选择其他模板");
public static final ErrorCode MACHINE_DATA_ERROR = new ErrorCode(1_002_029_016, "当前组织还未进行机台授权,请联系组织管理员在基础管理里对当前组织进行机台授权,或联系客服进行授权");
public static final ErrorCode MACHINE_NUM_DATA_ERROR = new ErrorCode(1_002_029_017, "组织授权的机台数量不能超过127台");
public static final ErrorCode MACHINE_USED_ALREADY = new ErrorCode(1_002_029_018, "当前机台在加工方案组中已使用,无法删除");
public static final ErrorCode MACHINE_NOT_EXISTS = new ErrorCode(1_002_029_000, "machine.not.exists");
public static final ErrorCode MACHINE_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_029_001, "machine.template.not.exists");
public static final ErrorCode DEFAULT_TEMPLATE_COUNT = new ErrorCode(1_002_029_002, "default.template.count");
public static final ErrorCode THE_CURRENT_MACHINE_IS_ALREADY_IN_USE = new ErrorCode(1_002_029_006, "the.current.machine.is.already.in.use");
public static final ErrorCode MACHINE_ERROR = new ErrorCode(1_002_029_007, "machine.error");
public static final ErrorCode THE_CURRENT_BRAND_OF_THE_MACHINE_EXISTS = new ErrorCode(1_002_029_008, "the.current.brand.of.the.machine.exists");
public static final ErrorCode THE_MODEL_OF_THE_MACHINE_DOES_NOT_EXIST = new ErrorCode(1_002_029_009, "the.model.of.the.machine.does.not.exist");
public static final ErrorCode THE_CURRENT_BRAND = new ErrorCode(1_002_029_010, "the.current.brand");
public static final ErrorCode MACHINE_NUM_ERROR = new ErrorCode(1_002_029_011, "machine.num.error");
public static final ErrorCode MACHINE_NAME_ERROR = new ErrorCode(1_002_029_012, "machine.name.error");
public static final ErrorCode MACHINETEMPLATE_NAME_ERROR = new ErrorCode(1_002_029_013, "machinetemplate.name.error");
public static final ErrorCode LABELINGMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_014, "labelingmachine.related.data.error");
public static final ErrorCode DRILLMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_015, "drillmachine.related.data.error");
public static final ErrorCode MACHINE_DATA_ERROR = new ErrorCode(1_002_029_016, "machine.data.error");
public static final ErrorCode MACHINE_NUM_DATA_ERROR = new ErrorCode(1_002_029_017, "machine.num.data.error");
public static final ErrorCode MACHINE_USED_ALREADY = new ErrorCode(1_002_029_018, "machine.used.already");
// ========== 标签模板 1-002-300-000 ==========
public static final ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_300_000, "标签模板不存在");
public static final ErrorCode LABEL_NOT_EXISTS = new ErrorCode(1_002_300_001, "标签不存在");
public static final ErrorCode DEFAULT_LABEL_NOT_EXISTS = new ErrorCode(1_002_300_002, "该类型标签默认模板不存在");
public static final ErrorCode MACHINE_USE_LABEL = new ErrorCode(1_002_300_003, "当前标签已有机台使用,无法删除");
public static final ErrorCode DEFAULT_NOT_DELETED = new ErrorCode(1_002_300_004, "默认标签模板无法删除");
public static final ErrorCode LABEL_IS_USE_ERROR = new ErrorCode(1_002_300_006, "当前标签打包设置中已有用户使用,无法删除");
public static final ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_300_000, "label.template.not.exists");
public static final ErrorCode LABEL_NOT_EXISTS = new ErrorCode(1_002_300_001, "label.not.exists");
public static final ErrorCode DEFAULT_LABEL_NOT_EXISTS = new ErrorCode(1_002_300_002, "default.label.not.exists");
public static final ErrorCode MACHINE_USE_LABEL = new ErrorCode(1_002_300_003, "machine.use.label");
public static final ErrorCode DEFAULT_NOT_DELETED = new ErrorCode(1_002_300_004, "default.not.deleted");
public static final ErrorCode LABEL_IS_USE_ERROR = new ErrorCode(1_002_300_006, "label.is.use.error");
// ========== 系统数据源 1_002_301_000 ==========
public static final ErrorCode DATA_SOURCE_NOT_EXISTS = new ErrorCode(1_002_301_000, "系统数据源不存在");
public static final ErrorCode DATA_SOURCE_NOT_EXISTS = new ErrorCode(1_002_301_000, "data.source.not.exists");
//=========== 工序组信息 1-002-032-000 ============
public static final ErrorCode PROCESS_GROUP_NOT_EXISTS = new ErrorCode(1_002_032_001, "工序组不存在");
@@ -237,131 +237,131 @@ public class ErrorCodeConstants {
public static final ErrorCode PROCESS_USER_EXISTS = new ErrorCode(1_002_034_002, "工序用户存在");
// ========== 配件信息 1-002-035-000 ==========
public static final ErrorCode ORDER_PARTS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_035_002, "生产配件导入数据不可以为空");
public static final ErrorCode ORDER_PARTS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_035_002, "order.parts.import.list.is.empty");
//=========== 应用信息 1-002-037-000 ============
public static final ErrorCode ERR = new ErrorCode(1_002_038_001, "未知错误");
public static final ErrorCode DATA_ERR = new ErrorCode(1_002_038_002, "数据错误,需要清除数据重新导入");
public static final ErrorCode REMAIN_PLATE_STATUS_USED = new ErrorCode(1_002_038_003, "余料板正在使用中,禁止修改");
public static final ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_004, "余料板未使用");
public static final ErrorCode REMAIN_PLATE_USR_TYPE = new ErrorCode(1_002_038_005, "余料板使用类型为不可核销类型");
public static final ErrorCode REMAIN_PLATE_ID_NOT_EXISTS = new ErrorCode(1_002_038_006, "未选中余料板,请选择余料板");
public static final ErrorCode REMAIN_PLATE_STATUS_USED = new ErrorCode(1_002_038_003, "remain.plate.status.used");
public static final ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_004, "remain.plate.status.no.used");
public static final ErrorCode REMAIN_PLATE_USR_TYPE = new ErrorCode(1_002_038_005, "remain.plate.usr.type");
public static final ErrorCode REMAIN_PLATE_ID_NOT_EXISTS = new ErrorCode(1_002_038_006, "remain.plate.id.not.exists");
public static final ErrorCode APPLICATION_NOT_EXISTS = new ErrorCode(1_002_038_007, "应用信息不存在");
public static final ErrorCode APPLICATION_LOGIN_USER_DISABLED = new ErrorCode(1_002_038_008, "应用登陆失败");
public static final ErrorCode REMAIN_PLATE_COUNT_MAX = new ErrorCode(1_002_038_009, "每次新增余料板数量,最大为999");
public static final ErrorCode REMAIN_PLATE_COUNT_MAX = new ErrorCode(1_002_038_009, "remain.plate.count.max");
//=========== 用户的系统配置 1-002-039-000 ============
public static final ErrorCode CURRENTLY_NO_CONFIGURATION_AVAILABLE = new ErrorCode(1_002_039_001, "当前没有{}配置信息,请前往设置配置");
public static final ErrorCode CURRENTLY_NO_CONFIGURATION_AVAILABLE = new ErrorCode(1_002_039_001, "currently.no.configuration.available");
//=========== 系统配置 1-002-040-000 ============
public static final ErrorCode SYSTEM_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_001, "系统配置不存在");
public static final ErrorCode SYSTEM_CONFIG_TYPE_NOT_SUPPORT = new ErrorCode(1_002_040_002, "不支持的系统配置类型");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_SAVE_CHECK_ERROR = new ErrorCode(1_002_040_003, "自定义板编号配置:自定义板编号保存格式错误,请检查配置规则");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_RESET_NOT_SUPPORT = new ErrorCode(1_002_040_004, "自定义板编号配置:该规则不支持手动复位/清零");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_FIND = new ErrorCode(1_002_040_005, "自定义板编号配置:找不到对应的规则项进行手动复位/清零");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR = new ErrorCode(1_002_040_006, "自定义板编号配置:手动复位/清零生产单下序号失败,请联系客服");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_EMPTY_ERROR = new ErrorCode(1_002_040_007, "规则编码不能为空");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR = new ErrorCode(1_002_040_008, "规则编码【{}】不合法,请检查配置规则");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR = new ErrorCode(1_002_040_009, "时间格式【{}】不合法,请检查配置规则");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR = new ErrorCode(1_002_040_010, "自定义字符值不能为空,请检查配置规则");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR = new ErrorCode(1_002_040_011, "规则【{}】复位/清零模式不合法,请检查配置规则");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY = new ErrorCode(1_002_040_012, "【{}】下的【{}】不能为空,请检查配置规则");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR = new ErrorCode(1_002_040_013, "【{}】下的数值类型参数{}:【{}】转换异常,请检查配置规则");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR = new ErrorCode(1_002_040_014, "【{}】下的布尔类型参数{}:【{}】转换异常,请检查配置规则");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_DATA_ERROR = new ErrorCode(1_002_040_015, "加工方案组的:{} 为空,无法保存,请进行配置");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_016, "加工方案组的:{} 为空,请检查配置信息");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR = new ErrorCode(1_002_040_017, "当前方案组的配置异常,请重新配置");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN = new ErrorCode(1_002_040_018, "当前方案组已在排单中使用,无法删除");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_MACHINE_LABEL = new ErrorCode(1_002_040_019, "当前方案组对应的解析器的机台的标签数据为空,请检查机台的标签配置信息");
public static final ErrorCode THIS_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_020, "当前系统配置的数据有误,请重新尝试排序");
public static final ErrorCode PROCESS_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_021, "当前加工分线配置在加工方案组中已使用,无法删除");
public static final ErrorCode OPTIMIZATION_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_022, "当前数据处理配置在加工方案组中已使用,无法删除");
public static final ErrorCode SEALEDGE_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_023, "第 {} 条配置中,有字段值为空,请添加数据");
public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR = new ErrorCode(1_002_040_025, "第 {} 条配置中,{} 要大于等于 {},请修改数据");
public static final ErrorCode SEALEDGE_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_026, "当前封边条配置有误,请重新检查后新增");
public static final ErrorCode THIS_CONFIG_NAME_IS_EXISTS = new ErrorCode(1_002_040_027, "当前配置的名称已存在,请重新命名");
public static final ErrorCode DECIMAL_PLACES_MAX_TWO = new ErrorCode(1_002_040_028, "第 {} 条配置中,小数位数最大为 3 位,请进行修改");
public static final ErrorCode SEALEDGE_CONFIG_MIN_VALUE_GREATER_THAN_ZERO = new ErrorCode(1_002_040_029, "第 {} 条配置中,宽最小值:{} 要大于0,请修改数据");
public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_GREATER_THAN_ZERO = new ErrorCode(1_002_040_030, "第 {} 条配置中,宽最大值:{} 要大于0,请修改数据");
public static final ErrorCode SEALEDGE_CONFIG_VALUE_DATA_ERROR = new ErrorCode(1_002_040_031, "第 {} 条配置中,宽最大值 要大于 宽最小值,请修改数据");
public static final ErrorCode SYSTEM_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_001, "system.config.not_exists");
public static final ErrorCode SYSTEM_CONFIG_TYPE_NOT_SUPPORT = new ErrorCode(1_002_040_002, "system.config.type_not_support");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_SAVE_CHECK_ERROR = new ErrorCode(1_002_040_003, "system.config.custom_plate_no.rule_save_format_error");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_RESET_NOT_SUPPORT = new ErrorCode(1_002_040_004, "system.config.custom_plate_no.rule_reset_not_support");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_FIND = new ErrorCode(1_002_040_005, "system.config.custom_plate_no.rule_item_not_found");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR = new ErrorCode(1_002_040_006, "system.config.custom_plate_no.rule_order_reset_failed");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_EMPTY_ERROR = new ErrorCode(1_002_040_007, "custom.plate_no.rule.code_empty");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR = new ErrorCode(1_002_040_008, "custom.plate_no.rule.code_not_match");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR = new ErrorCode(1_002_040_009, "custom.plate_no.rule.date_format_error");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR = new ErrorCode(1_002_040_010, "custom.plate_no.rule.custom_value_empty");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR = new ErrorCode(1_002_040_011, "custom.plate_no.rule.reset_mode_error");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY = new ErrorCode(1_002_040_012, "custom.plate_no.rule.int_type_empty");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR = new ErrorCode(1_002_040_013, "custom.plate_no.rule.int_type_convert_error");
public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR = new ErrorCode(1_002_040_014, "custom.plate_no.rule.bool_type_convert_error");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_DATA_ERROR = new ErrorCode(1_002_040_015, "process.scheme.data_empty");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_016, "process.scheme.config.data_empty");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR = new ErrorCode(1_002_040_017, "process.scheme.config.field_error");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN = new ErrorCode(1_002_040_018, "process.scheme.config.in_use");
public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_MACHINE_LABEL = new ErrorCode(1_002_040_019, "process.scheme.config.machine_label_empty");
public static final ErrorCode THIS_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_020, "config.data_error");
public static final ErrorCode PROCESS_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_021, "process.config.used_already");
public static final ErrorCode OPTIMIZATION_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_022, "optimization.config.used_already");
public static final ErrorCode SEALEDGE_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_023, "sealedge.config.item_empty");
public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR = new ErrorCode(1_002_040_025, "sealedge.config.max_value_error");
public static final ErrorCode SEALEDGE_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_026, "sealedge.config.data_error");
public static final ErrorCode THIS_CONFIG_NAME_IS_EXISTS = new ErrorCode(1_002_040_027, "sealedge.config.name_exists");
public static final ErrorCode DECIMAL_PLACES_MAX_TWO = new ErrorCode(1_002_040_028, "sealedge.config.decimal_places_max_three");
public static final ErrorCode SEALEDGE_CONFIG_MIN_VALUE_GREATER_THAN_ZERO = new ErrorCode(1_002_040_029, "sealedge.config.min_value_gt_zero");
public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_GREATER_THAN_ZERO = new ErrorCode(1_002_040_030, "sealedge.config.max_value_gt_zero");
public static final ErrorCode SEALEDGE_CONFIG_VALUE_DATA_ERROR = new ErrorCode(1_002_040_031, "sealedge.config.value_range_error");
//=========== token管理 1-002-042-000 ============
public static final ErrorCode TOKEN_APP_TYPE_EXIST = new ErrorCode(1_002_042_001, "当前应用以存在token配置,无法继续新增");
public static final ErrorCode TOKEN_CONFIG_NOT_EXISTS = new ErrorCode(1_002_042_002, "当前应用的token配置不存在");
public static final ErrorCode TOKEN_TIME_IS_EXPIRES = new ErrorCode(1_002_042_003, "当前token已过期,请重新配置或延长时间");
public static final ErrorCode TOKEN_APP_TYPE_NO_UPDATE = new ErrorCode(1_002_042_004, "应用名称不允许更改");
public static final ErrorCode TOKEN_DATA_IS_NULL = new ErrorCode(1_002_042_005, "当前token的配置为空,无需删除");
public static final ErrorCode TOKEN_EXPIRES_TIME_IS_NULL = new ErrorCode(1_002_042_006, "当前未选择有效时间,请选择再进行新增");
public static final ErrorCode TOKEN_EXPIRES_TIME_DATA_ERROR = new ErrorCode(1_002_042_007, "当前选择的有效时间已过期,请增加有效时间");
public static final ErrorCode INSERT_TOKEN_DATA_ERROR = new ErrorCode(1_002_042_008, "token新增失败,请重新尝试");
public static final ErrorCode TOKEN_APP_TYPE_EXIST = new ErrorCode(1_002_042_001, "token.app_type.exist");
public static final ErrorCode TOKEN_CONFIG_NOT_EXISTS = new ErrorCode(1_002_042_002, "token.config.not_exists");
public static final ErrorCode TOKEN_TIME_IS_EXPIRES = new ErrorCode(1_002_042_003, "token.time.is_expires");
public static final ErrorCode TOKEN_APP_TYPE_NO_UPDATE = new ErrorCode(1_002_042_004, "token.app_type.no_update");
public static final ErrorCode TOKEN_DATA_IS_NULL = new ErrorCode(1_002_042_005, "token.data.is_null");
public static final ErrorCode TOKEN_EXPIRES_TIME_IS_NULL = new ErrorCode(1_002_042_006, "token.expires_time.is_null");
public static final ErrorCode TOKEN_EXPIRES_TIME_DATA_ERROR = new ErrorCode(1_002_042_007, "token.expires_time.data_error");
public static final ErrorCode INSERT_TOKEN_DATA_ERROR = new ErrorCode(1_002_042_008, "token.insert.data_error");
//=========== 资金管理 1-002-043-000 ============
public static final ErrorCode INVOICE_NO_EXIST = new ErrorCode(1_002_043_002, "当前发票记录有误,请重新查看");
public static final ErrorCode INVOICING_REJECT_REASON = new ErrorCode(1_002_043_003, "请填写拒绝开票原因");
public static final ErrorCode PURCHASE_RECORD_NO_EXIST = new ErrorCode(1_002_043_004, "当前发票对应的购买记录有误,请退回组织后重新申请开票");
public static final ErrorCode THIS_INVOICE_IS_FAIL = new ErrorCode(1_002_043_005, "当前发票已开票,无法再次进行开票");
public static final ErrorCode PRODUCTS_IS_EXIST = new ErrorCode(1_002_043_006, "产品【{}】已存在,请修改产品名称后再次操作");
public static final ErrorCode PRODUCTS_NO_DELETE = new ErrorCode(1_002_043_007, "当前产品已上架,无法删除,请下架后再删除");
public static final ErrorCode PRODUCTS_NO_UPDATE = new ErrorCode(1_002_043_008, "当前产品已上架,无法进行修改");
public static final ErrorCode PRODUCTS_DETAIL_NO_UPDATE = new ErrorCode(1_002_043_009, "定价规则对应的产品已上架,无法进行修改");
public static final ErrorCode ADVERTISEMENT_TIME_ERROR = new ErrorCode(1_002_043_010, "投放时间错误,结束时间应大于开始时间");
public static final ErrorCode ADVERTISEMENT_NAME_IS_EXIST = new ErrorCode(1_002_043_011, "当前广告名称已存在,请重新命名");
public static final ErrorCode ADVERTISEMENT_NO_DELETE = new ErrorCode(1_002_043_012, "当前广告已经发布,无法删除,请结束发布后再删除");
public static final ErrorCode PRODUCT_PROMOTION_ACTIVE_NAME_IS_EXIST = new ErrorCode(1_002_043_013, "当前优惠活动名称已存在,请修改");
public static final ErrorCode PRODUCT_PROMOTION_PURCHASEDURATION_IS_EXIST = new ErrorCode(1_002_043_014, "当前所选产品下{}{}购买时长的优惠活动已存在,请修改");
public static final ErrorCode INVOICE_TITLE_NOT_EXISTS_ERROR = new ErrorCode(1_002_043_017, "发票抬头不存在,请先创建发票抬头");
public static final ErrorCode ORG_INVOICE_PURCHASE_RECORD_UPDATE_NUM_NOT_MATCH_ERROR = new ErrorCode(1_002_043_018, "当前勾选的购买记录中部分可能已开票,请查询后重新勾选提交开票");
public static final ErrorCode ORG_INVOICE_AGREE_FILE_NULL_ERROR = new ErrorCode(1_002_043_019, "确认开票发票附件不能为空,请上传后再提交");
public static final ErrorCode INVOICE_TITLE_ORG_EXISTS_ERROR = new ErrorCode(1_002_043_020, "组织下已存在发票抬头,请刷新后编辑抬头内容");
public static final ErrorCode INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR = new ErrorCode(1_002_043_021, "统一社会信用代码已存在,请检查");
public static final ErrorCode PRODUCTS_NOT_NOLIST = new ErrorCode(1_002_043_022, "当前产品未上架");
public static final ErrorCode ORG_PRODUCT_PURCHASE_LOCK_ERROR = new ErrorCode(1_002_043_023, "组织下存在购买中的产品操作,请稍后再试");
public static final ErrorCode INVOICE_TITLE_ENTERPRISE_TAXNUMBER_EMPTY_ERROR = new ErrorCode(1_002_043_024, "企业统一信用代码不能为空");
public static final ErrorCode INVOICE_AMOUNT_ZERO_ERROR = new ErrorCode(1_002_043_025, "可开票金额为,请检查购买记录");
public static final ErrorCode INVOICE_APPLY_UNINVOICEABLE_EXIST = new ErrorCode(1_002_043_026, "当前提交记录中存在不可开票记录,请刷新列表后重新选择提交");
public static final ErrorCode INVOICE_NO_EXIST = new ErrorCode(1_002_043_002, "invoice.no_exist");
public static final ErrorCode INVOICING_REJECT_REASON = new ErrorCode(1_002_043_003, "invoicing.reject_reason");
public static final ErrorCode PURCHASE_RECORD_NO_EXIST = new ErrorCode(1_002_043_004, "purchase_record.no_exist");
public static final ErrorCode THIS_INVOICE_IS_FAIL = new ErrorCode(1_002_043_005, "invoice.is_fail");
public static final ErrorCode PRODUCTS_IS_EXIST = new ErrorCode(1_002_043_006, "products.is_exist");
public static final ErrorCode PRODUCTS_NO_DELETE = new ErrorCode(1_002_043_007, "products.no_delete");
public static final ErrorCode PRODUCTS_NO_UPDATE = new ErrorCode(1_002_043_008, "products.no_update");
public static final ErrorCode PRODUCTS_DETAIL_NO_UPDATE = new ErrorCode(1_002_043_009, "products.detail.no_update");
public static final ErrorCode ADVERTISEMENT_TIME_ERROR = new ErrorCode(1_002_043_010, "advertisement.time_error");
public static final ErrorCode ADVERTISEMENT_NAME_IS_EXIST = new ErrorCode(1_002_043_011, "advertisement.name.is_exist");
public static final ErrorCode ADVERTISEMENT_NO_DELETE = new ErrorCode(1_002_043_012, "advertisement.no_delete");
public static final ErrorCode PRODUCT_PROMOTION_ACTIVE_NAME_IS_EXIST = new ErrorCode(1_002_043_013, "product_promotion.active.name.is_exist");
public static final ErrorCode PRODUCT_PROMOTION_PURCHASEDURATION_IS_EXIST = new ErrorCode(1_002_043_014, "product_promotion.purchaseduration.is_exist");
public static final ErrorCode INVOICE_TITLE_NOT_EXISTS_ERROR = new ErrorCode(1_002_043_017, "invoice_title.not_exists");
public static final ErrorCode ORG_INVOICE_PURCHASE_RECORD_UPDATE_NUM_NOT_MATCH_ERROR = new ErrorCode(1_002_043_018, "org_invoice.purchase_record.update_num.not_match");
public static final ErrorCode ORG_INVOICE_AGREE_FILE_NULL_ERROR = new ErrorCode(1_002_043_019, "org_invoice.agree_file.null");
public static final ErrorCode INVOICE_TITLE_ORG_EXISTS_ERROR = new ErrorCode(1_002_043_020, "invoice_title.org.exists");
public static final ErrorCode INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR = new ErrorCode(1_002_043_021, "invoice_title.taxpayerid.exists");
public static final ErrorCode PRODUCTS_NOT_NOLIST = new ErrorCode(1_002_043_022, "products.not_nolist");
public static final ErrorCode ORG_PRODUCT_PURCHASE_LOCK_ERROR = new ErrorCode(1_002_043_023, "org_product.purchase.lock");
public static final ErrorCode INVOICE_TITLE_ENTERPRISE_TAXNUMBER_EMPTY_ERROR = new ErrorCode(1_002_043_024, "invoice_title.enterprise.taxnumber.empty");
public static final ErrorCode INVOICE_AMOUNT_ZERO_ERROR = new ErrorCode(1_002_043_025, "invoice.amount.zero");
public static final ErrorCode INVOICE_APPLY_UNINVOICEABLE_EXIST = new ErrorCode(1_002_043_026, "invoice.apply.uninvoiceable.exist");
//=========== 支付相关 1-002-048-000 ============
public static final ErrorCode PAY_CHANNEL_NOT_SUPPORT = new ErrorCode(1_002_048_000, "暂不支持的支付渠道,请使用其他支付渠道");
public static final ErrorCode PAY_ORDER_NOT_EXIST = new ErrorCode(1_002_048_001, "支付订单不存在,支付编号:{},请重新发起支付");
public static final ErrorCode PAY_ORDER_CHANNEL_QUERY_NOT_EXIST = new ErrorCode(1_002_048_002, "如果您已确认扫码支付,请稍后刷新页面,支付平台可能存在延迟到账");
public static final ErrorCode PAY_ORDER_NOTIFY_DATA_PARSE_ERROR = new ErrorCode(1_002_048_003, "解析支付回调数据异常");
public static final ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1_002_048_004, "支付订单不处于待支付");
public static final ErrorCode PAY_ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_002_048_005, "发起渠道支付异常,请联系客服");
public static final ErrorCode PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR = new ErrorCode(1_002_048_006, "不支持的支付回调tradeType:【{}】,请检查支付渠道");
public static final ErrorCode PAY_CHANNEL_NOT_SUPPORT = new ErrorCode(1_002_048_000, "pay.channel_not_support");
public static final ErrorCode PAY_ORDER_NOT_EXIST = new ErrorCode(1_002_048_001, "pay.order_not_exist");
public static final ErrorCode PAY_ORDER_CHANNEL_QUERY_NOT_EXIST = new ErrorCode(1_002_048_002, "pay.order_channel_query_not_exist");
public static final ErrorCode PAY_ORDER_NOTIFY_DATA_PARSE_ERROR = new ErrorCode(1_002_048_003, "pay.order_notify_data_parse_error");
public static final ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1_002_048_004, "pay.order_status_is_not_waiting");
public static final ErrorCode PAY_ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_002_048_005, "pay.order_submit_channel_error");
public static final ErrorCode PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR = new ErrorCode(1_002_048_006, "pay.notify_passback_tradetype_not_support_error");
//=========== 产品相关 1-002-045-000 ============
public static final ErrorCode PRODUCTS_NO_EXIST = new ErrorCode(1_002_045_001, "当前产品不存在");
public static final ErrorCode PRODUCTS_DETAIL_NO_EXIST = new ErrorCode(1_002_045_002, "当前产品的规则不存在");
public static final ErrorCode PRODUCTS_DETAIL_DURATION_EXIST = new ErrorCode(1_002_045_003, "当前产品下已存在产品时长:{}/{}的定价规则,请修改后重新操作");
public static final ErrorCode PRODUCT_PROMOTION_NO_EXIST = new ErrorCode(1_002_045_004, "当前优惠活动不存在");
public static final ErrorCode PRODUCTS_DETAIL_DURATION_UNIT_NOT_SUPPORT = new ErrorCode(1_002_045_005, "不支持的时长单位,请检查该定价规则的时长单位");
public static final ErrorCode ORG_PRODUCT_PURCHASE_WAIT_PAY_ERROR = new ErrorCode(1_002_045_006, "组织下存在当前产品的待支付记录,请确认或取消支付后再次发起软件购买");
public static final ErrorCode PRODUCT_PRICE_NULL_ERROR = new ErrorCode(1_002_045_007, "产品建议价格为空,请联系客服");
public static final ErrorCode ORG_PRODUCT_PURCHASE_NOT_EXIST_ERROR = new ErrorCode(1_002_045_008, "组织订购记录不存在,请检查数据");
public static final ErrorCode ORG_PRODUCT_PURCHASE_EXIST_ERROR = new ErrorCode(1_002_045_009, "组织[{}]订购记录已存在,请勿重复定义订购机构");
public static final ErrorCode PRODUCTS_NO_EXIST = new ErrorCode(1_002_045_001, "product.no_exist");
public static final ErrorCode PRODUCTS_DETAIL_NO_EXIST = new ErrorCode(1_002_045_002, "product.detail_no_exist");
public static final ErrorCode PRODUCTS_DETAIL_DURATION_EXIST = new ErrorCode(1_002_045_003, "product.detail_duration_exist");
public static final ErrorCode PRODUCT_PROMOTION_NO_EXIST = new ErrorCode(1_002_045_004, "product.promotion_no_exist");
public static final ErrorCode PRODUCTS_DETAIL_DURATION_UNIT_NOT_SUPPORT = new ErrorCode(1_002_045_005, "product.detail_duration_unit_not_support");
public static final ErrorCode ORG_PRODUCT_PURCHASE_WAIT_PAY_ERROR = new ErrorCode(1_002_045_006, "org.product_purchase_wait_pay_error");
public static final ErrorCode PRODUCT_PRICE_NULL_ERROR = new ErrorCode(1_002_045_007, "product.price_null_error");
public static final ErrorCode ORG_PRODUCT_PURCHASE_NOT_EXIST_ERROR = new ErrorCode(1_002_045_008, "org.product_purchase_not_exist_error");
public static final ErrorCode ORG_PRODUCT_PURCHASE_EXIST_ERROR = new ErrorCode(1_002_045_009, "org.product_purchase_exist_error");
//=========== 广告相关 1-002-046-000 ============
public static final ErrorCode ADVERTISEMENT_NO_EXIST = new ErrorCode(1_002_046_001, "广告不存在");
public static final ErrorCode ADVERTISEMENT_STATUS_ENDTIME_EXPIRED = new ErrorCode(1_002_046_002, "当前广告投放结束时间已超期,请重新发布选择投放时间或重新编辑投放时间");
public static final ErrorCode ADVERTISEMENT_IMAGE_EMPTY_ERROR = new ErrorCode(1_002_046_003, "广告图片文件为空,请重新上传");
public static final ErrorCode ADVERTISEMENT_IMAGE_UPLOAD_FAIL = new ErrorCode(1_002_046_004, "广告图片上传失败,请稍后再试");
public static final ErrorCode ADVERTISEMENT_UPDATE_STATUS_ERROR = new ErrorCode(1_002_046_005, "当前广告已经发布,若要编辑请先结束发布");
public static final ErrorCode ADVERTISEMENT_NO_EXIST = new ErrorCode(1_002_046_001, "advertisement.no_exist");
public static final ErrorCode ADVERTISEMENT_STATUS_ENDTIME_EXPIRED = new ErrorCode(1_002_046_002, "advertisement.status_endtime_expired");
public static final ErrorCode ADVERTISEMENT_IMAGE_EMPTY_ERROR = new ErrorCode(1_002_046_003, "advertisement.image_empty_error");
public static final ErrorCode ADVERTISEMENT_IMAGE_UPLOAD_FAIL = new ErrorCode(1_002_046_004, "advertisement.image_upload_fail");
public static final ErrorCode ADVERTISEMENT_UPDATE_STATUS_ERROR = new ErrorCode(1_002_046_005, "advertisement.update_status_error");
//=========== 解析器管理 1-002-044-000 ============
public static final ErrorCode PARSER_NO_EXIST = new ErrorCode(1_002_044_001, "当前解析器不存在,请重新选择");
public static final ErrorCode PARSER_TEMPLATE_NO_EXIST = new ErrorCode(1_002_044_002, "当前解析器模板不存在,请重新选择");
public static final ErrorCode PARSER_NO_EXIST = new ErrorCode(1_002_044_001, "parser.no_exist");
public static final ErrorCode PARSER_TEMPLATE_NO_EXIST = new ErrorCode(1_002_044_002, "parser.template_no_exist");
//=========== 产品延期管理 1-002-049-000 ============
public static final ErrorCode PRODUCT_PURCHASE_NO_EXIST = new ErrorCode(1_002_049_001, "当前购买记录不存在,请检查");
public static final ErrorCode PRODUCT_PURCHASE_ENDTIME_BEFORE_DELAYTIME_ERROR = new ErrorCode(1_002_049_002, "当前产品订购有效期{}未超过当前日期,请调整订购时长");
public static final ErrorCode PRODUCT_PURCHASE_NO_EXIST = new ErrorCode(1_002_049_001, "product_purchase.no_exist");
public static final ErrorCode PRODUCT_PURCHASE_ENDTIME_BEFORE_DELAYTIME_ERROR = new ErrorCode(1_002_049_002, "product_purchase.endtime_before_delaytime_error");
}
@@ -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);
@@ -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,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);
}
@@ -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,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);
@@ -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,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中获取产品
@@ -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));
}
@@ -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());
@@ -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);
@@ -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);
}
@@ -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());
@@ -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());
}
}
@@ -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;
}
@@ -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);
}
}
@@ -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);
}
@@ -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");
@@ -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;
}
@@ -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);
}
}
@@ -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);
}
}
}
@@ -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;
}
@@ -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;
@@ -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));
}
}
@@ -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;
}
@@ -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不重复的,作为删除的部分
@@ -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();
@@ -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;
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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,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,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);
}
}
@@ -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);
}
}
@@ -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);
}
});
}
@@ -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);
}
}
@@ -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;
}
@@ -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,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();
@@ -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;
}
@@ -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,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;
@@ -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,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());
}
}
@@ -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;
@@ -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");
@@ -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),
@@ -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());
}
});
}
@@ -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最后的逗号
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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;
}
@@ -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);
}
}
@@ -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;
}
@@ -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()));
@@ -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);
}
}
@@ -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);
}
// 获得对应的社交绑定关系
@@ -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;
@@ -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,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,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,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);
}
@@ -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;
@@ -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);
}
@@ -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 organizations 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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long