|
|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
package cn.iocoder.mall.system.biz.config;
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
|
|
|
|
import cn.iocoder.mall.system.biz.bo.errorcode.ErrorCodeBO;
|
|
|
|
|
import cn.iocoder.mall.system.biz.enums.SystemErrorCodeEnum;
|
|
|
|
|
import cn.iocoder.mall.system.biz.service.errorcode.ErrorCodeService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
@ -9,8 +8,6 @@ import org.springframework.boot.context.event.ApplicationReadyEvent;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.context.event.EventListener;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
public class ServiceExceptionConfiguration {
|
|
|
|
|
|
|
|
|
|
@ -20,14 +17,16 @@ public class ServiceExceptionConfiguration {
|
|
|
|
|
|
|
|
|
|
@EventListener(ApplicationReadyEvent.class) // 可参考 https://www.cnblogs.com/ssslinppp/p/7607509.html
|
|
|
|
|
public void initMessages() {
|
|
|
|
|
errorCodeService.deleteSyStemErrorCode(SystemErrorCodeEnum.ADMIN_NOT_FOUND.getGroup());
|
|
|
|
|
errorCodeService.addSystemErrorCodeList(SystemErrorCodeEnum.values());
|
|
|
|
|
// TODO FROM 芋艿 to 芋艿:暂时注释掉,有问题的。
|
|
|
|
|
// errorCodeService.deleteSyStemErrorCode(SystemErrorCodeEnum.ADMIN_NOT_FOUND.getGroup());
|
|
|
|
|
// errorCodeService.addSystemErrorCodeList(SystemErrorCodeEnum.values());
|
|
|
|
|
for (SystemErrorCodeEnum item : SystemErrorCodeEnum.values()) {
|
|
|
|
|
ServiceExceptionUtil.put(item.getCode(), item.getMessage());
|
|
|
|
|
}
|
|
|
|
|
for (ErrorCodeBO bo : errorCodeService.getErrorCodeByGroup(SystemErrorCodeEnum.ADMIN_NOT_FOUND.getGroup())) {
|
|
|
|
|
ServiceExceptionUtil.put(bo.getCode(),bo.getMessage());
|
|
|
|
|
}
|
|
|
|
|
// TODO FROM 芋艿 to 芋艿:暂时注释掉,有问题的。
|
|
|
|
|
// for (ErrorCodeBO bo : errorCodeService.getErrorCodeByGroup(SystemErrorCodeEnum.ADMIN_NOT_FOUND.getGroup())) {
|
|
|
|
|
// ServiceExceptionUtil.put(bo.getCode(),bo.getMessage());
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|