mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、统一抛出ServiceException带占位符的填充方式,不再使用ServiceExceptionUtils;2、新增System服务ErrorCode的国际化;3、Webcad异步导入移除分布式锁,导入解析事务完善;
This commit is contained in:
+7
-1
@@ -22,15 +22,21 @@ public final class ServiceException extends RuntimeException {
|
|||||||
*/
|
*/
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 占位参数
|
||||||
|
*/
|
||||||
|
private transient Object[] args;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 空构造方法,避免反序列化问题
|
* 空构造方法,避免反序列化问题
|
||||||
*/
|
*/
|
||||||
public ServiceException() {
|
public ServiceException() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceException(ErrorCode errorCode) {
|
public ServiceException(ErrorCode errorCode, Object... args) {
|
||||||
this.code = errorCode.getCode();
|
this.code = errorCode.getCode();
|
||||||
this.message = errorCode.getMsg();
|
this.message = errorCode.getMsg();
|
||||||
|
this.args = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceException(Integer code, String message) {
|
public ServiceException(Integer code, String message) {
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ public class GlobalErrorCodeConstants {
|
|||||||
public static final ErrorCode REQUEST_ORGAN_ID_NOT_EXIST = new ErrorCode(400, "global.error.request.organId.notExist");
|
public static final ErrorCode REQUEST_ORGAN_ID_NOT_EXIST = new ErrorCode(400, "global.error.request.organId.notExist");
|
||||||
public static final ErrorCode NO_PERMISSION_TO_VISIT_ORG = new ErrorCode(400, "global.error.no.permission.to.visit.org");
|
public static final ErrorCode NO_PERMISSION_TO_VISIT_ORG = new ErrorCode(400, "global.error.no.permission.to.visit.org");
|
||||||
public static final ErrorCode REQUEST_PARAM_TYPE_ERROR = new ErrorCode(400, "global.error.request.param.type.error");
|
public static final ErrorCode REQUEST_PARAM_TYPE_ERROR = new ErrorCode(400, "global.error.request.param.type.error");
|
||||||
public static final ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录");
|
public static final ErrorCode UNAUTHORIZED = new ErrorCode(401, "global.not.login");
|
||||||
public static final ErrorCode FORBIDDEN = new ErrorCode(403, "global.error.no.permission");
|
public static final ErrorCode FORBIDDEN = new ErrorCode(403, "global.error.no.permission");
|
||||||
public static final ErrorCode REQUEST_PARAM_MISSING = new ErrorCode(403, "global.error.request.param.missing");
|
public static final ErrorCode REQUEST_PARAM_MISSING = new ErrorCode(403, "global.error.request.param.missing");
|
||||||
public static final ErrorCode NOT_FOUND = new ErrorCode(404, "global.error.request.not.found");
|
public static final ErrorCode NOT_FOUND = new ErrorCode(404, "global.error.request.not.found");
|
||||||
|
|||||||
+15
-15
@@ -3,13 +3,13 @@ package com.cf.imes.framework.common.util.Assert;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -31,81 +31,81 @@ public class AssertUtils {
|
|||||||
* */
|
* */
|
||||||
public static void notEmpty(List<?> array, ErrorCode errorCode) {
|
public static void notEmpty(List<?> array, ErrorCode errorCode) {
|
||||||
if (ObjectUtils.isEmpty(array)) {
|
if (ObjectUtils.isEmpty(array)) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void empty(List<?> array, ErrorCode errorCode) {
|
public static void empty(List<?> array, ErrorCode errorCode) {
|
||||||
if (!ObjectUtils.isEmpty(array)) {
|
if (!ObjectUtils.isEmpty(array)) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void empty(List<?> array, ErrorCode errorCode, Object... params) {
|
public static void empty(List<?> array, ErrorCode errorCode, Object... params) {
|
||||||
if (!ObjectUtils.isEmpty(array)) {
|
if (!ObjectUtils.isEmpty(array)) {
|
||||||
throw ServiceExceptionUtil.exception(errorCode, params);
|
throw new ServiceException(errorCode, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void empty(Object object, ErrorCode errorCode) {
|
public static void empty(Object object, ErrorCode errorCode) {
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void empty(Object object, ErrorCode errorCode, Object... params) {
|
public static void empty(Object object, ErrorCode errorCode, Object... params) {
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
throw ServiceExceptionUtil.exception(errorCode, params);
|
throw new ServiceException(errorCode, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void notEmpty(Object object, ErrorCode errorCode) {
|
public static void notEmpty(Object object, ErrorCode errorCode) {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void notEmpty(List<?> array ,Object object, ErrorCode errorCode) {
|
public static void notEmpty(List<?> array ,Object object, ErrorCode errorCode) {
|
||||||
if (object == null || ObjectUtils.isEmpty(array)) {
|
if (object == null || ObjectUtils.isEmpty(array)) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void notEmpty(List<?> array, ErrorCode errorCode,Object object) {
|
public static void notEmpty(List<?> array, ErrorCode errorCode,Object object) {
|
||||||
if (ObjectUtils.isEmpty(array)) {
|
if (ObjectUtils.isEmpty(array)) {
|
||||||
throw exception(errorCode,object);
|
throw new ServiceException(errorCode,object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void notEmpty(String str, ErrorCode errorCode) {
|
public static void notEmpty(String str, ErrorCode errorCode) {
|
||||||
if (StringUtils.isEmpty(str)) {
|
if (StringUtils.isEmpty(str)) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void notEquals(Object obj1, Object obj2, ErrorCode errorCode) {
|
public static void notEquals(Object obj1, Object obj2, ErrorCode errorCode) {
|
||||||
if (ObjectUtil.notEqual(obj1, obj2)) {
|
if (ObjectUtil.notEqual(obj1, obj2)) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void equals(Object obj1, Object obj2, ErrorCode errorCode) {
|
public static void equals(Object obj1, Object obj2, ErrorCode errorCode) {
|
||||||
if (ObjectUtil.equal(obj1, obj2)) {
|
if (ObjectUtil.equal(obj1, obj2)) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void isFalse(boolean expression, ErrorCode errorCode) {
|
public static void isFalse(boolean expression, ErrorCode errorCode) {
|
||||||
if (!expression) {
|
if (!expression) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void isTrue(boolean expression, ErrorCode errorCode) {
|
public static void isTrue(boolean expression, ErrorCode errorCode) {
|
||||||
if (expression) {
|
if (expression) {
|
||||||
throw exception(errorCode);
|
throw new ServiceException(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -27,6 +27,6 @@ public class I18nUtils {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getMessage(String code, Object... args) {
|
public String getMessage(String code, Object... args) {
|
||||||
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
|
return messageSource.getMessage(code, args, code, LocaleContextHolder.getLocale());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -8,7 +8,6 @@ import cn.hutool.http.HttpStatus;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import com.cf.imes.framework.ip.core.enums.ErrorCodeConstants;
|
import com.cf.imes.framework.ip.core.enums.ErrorCodeConstants;
|
||||||
import com.cf.imes.framework.ip.core.property.IPQueryProperties;
|
import com.cf.imes.framework.ip.core.property.IPQueryProperties;
|
||||||
import com.cf.imes.framework.ip.core.service.IPQueryService;
|
import com.cf.imes.framework.ip.core.service.IPQueryService;
|
||||||
@@ -46,11 +45,11 @@ public class IPQueryServiceImpl implements IPQueryService {
|
|||||||
String appCode = ipQueryProperties.getAppCode();
|
String appCode = ipQueryProperties.getAppCode();
|
||||||
if (CharSequenceUtil.isEmpty(apiUrl)) {
|
if (CharSequenceUtil.isEmpty(apiUrl)) {
|
||||||
log.error("[IPQueryService][querySource]request apiUrl为空");
|
log.error("[IPQueryService][querySource]request apiUrl为空");
|
||||||
throw ServiceExceptionUtil.exception(queryError);
|
throw new ServiceException(queryError);
|
||||||
}
|
}
|
||||||
if (CharSequenceUtil.isEmpty(appCode)) {
|
if (CharSequenceUtil.isEmpty(appCode)) {
|
||||||
log.error("[IPQueryService][querySource]request appCode为空");
|
log.error("[IPQueryService][querySource]request appCode为空");
|
||||||
throw ServiceExceptionUtil.exception(queryError);
|
throw new ServiceException(queryError);
|
||||||
}
|
}
|
||||||
log.info("[IPQueryService][querySource]request url:{}", apiUrl);
|
log.info("[IPQueryService][querySource]request url:{}", apiUrl);
|
||||||
log.info("[IPQueryService][querySource]request param, appCode: {}, ip: {}", appCode, ip);
|
log.info("[IPQueryService][querySource]request param, appCode: {}, ip: {}", appCode, ip);
|
||||||
@@ -63,7 +62,7 @@ public class IPQueryServiceImpl implements IPQueryService {
|
|||||||
data.setIp(ip);
|
data.setIp(ip);
|
||||||
return data;
|
return data;
|
||||||
} else {
|
} else {
|
||||||
ServiceException serviceException = ServiceExceptionUtil.exception(queryError);
|
ServiceException serviceException = new ServiceException(queryError);
|
||||||
log.error(serviceException.getMessage() + ",状态【{}】,异常:{}", ipQueryRespDTO.getRet(), respBody);
|
log.error(serviceException.getMessage() + ",状态【{}】,异常:{}", ipQueryRespDTO.getRet(), respBody);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -83,11 +83,10 @@ public class ChenfengOrganAutoConfiguration {
|
|||||||
public FilterRegistrationBean<OrganSecurityWebFilter> organSecurityWebFilter(OrganProperties tenantProperties,
|
public FilterRegistrationBean<OrganSecurityWebFilter> organSecurityWebFilter(OrganProperties tenantProperties,
|
||||||
WebProperties webProperties,
|
WebProperties webProperties,
|
||||||
GlobalExceptionHandler globalExceptionHandler,
|
GlobalExceptionHandler globalExceptionHandler,
|
||||||
OrganFrameworkService organFrameworkService,
|
OrganFrameworkService organFrameworkService) {
|
||||||
I18nUtils i18nUtils) {
|
|
||||||
FilterRegistrationBean<OrganSecurityWebFilter> registrationBean = new FilterRegistrationBean<>();
|
FilterRegistrationBean<OrganSecurityWebFilter> registrationBean = new FilterRegistrationBean<>();
|
||||||
registrationBean.setFilter(new OrganSecurityWebFilter(tenantProperties, webProperties,
|
registrationBean.setFilter(new OrganSecurityWebFilter(tenantProperties, webProperties,
|
||||||
globalExceptionHandler, organFrameworkService, i18nUtils));
|
globalExceptionHandler, organFrameworkService));
|
||||||
registrationBean.setOrder(WebFilterOrderEnum.TENANT_SECURITY_FILTER);
|
registrationBean.setOrder(WebFilterOrderEnum.TENANT_SECURITY_FILTER);
|
||||||
return registrationBean;
|
return registrationBean;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -6,8 +6,8 @@ import com.cf.imes.framework.common.enums.UserTypeEnum;
|
|||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
|
||||||
import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils;
|
import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils;
|
||||||
|
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
||||||
import com.cf.imes.framework.security.core.LoginUser;
|
import com.cf.imes.framework.security.core.LoginUser;
|
||||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.cf.imes.framework.organ.config.OrganProperties;
|
import com.cf.imes.framework.organ.config.OrganProperties;
|
||||||
@@ -18,6 +18,7 @@ import com.cf.imes.framework.web.core.filter.ApiRequestFilter;
|
|||||||
import com.cf.imes.framework.web.core.handler.GlobalExceptionHandler;
|
import com.cf.imes.framework.web.core.handler.GlobalExceptionHandler;
|
||||||
import com.cf.imes.framework.web.core.util.WebFrameworkUtils;
|
import com.cf.imes.framework.web.core.util.WebFrameworkUtils;
|
||||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.util.AntPathMatcher;
|
import org.springframework.util.AntPathMatcher;
|
||||||
|
|
||||||
@@ -52,19 +53,18 @@ public class OrganSecurityWebFilter extends ApiRequestFilter {
|
|||||||
private final GlobalExceptionHandler globalExceptionHandler;
|
private final GlobalExceptionHandler globalExceptionHandler;
|
||||||
private final OrganFrameworkService organFrameworkService;
|
private final OrganFrameworkService organFrameworkService;
|
||||||
|
|
||||||
private final I18nUtils i18nUtils;
|
@Resource
|
||||||
|
private I18nUtils i18nUtils;
|
||||||
|
|
||||||
public OrganSecurityWebFilter(OrganProperties organProperties,
|
public OrganSecurityWebFilter(OrganProperties organProperties,
|
||||||
WebProperties webProperties,
|
WebProperties webProperties,
|
||||||
GlobalExceptionHandler globalExceptionHandler,
|
GlobalExceptionHandler globalExceptionHandler,
|
||||||
OrganFrameworkService organFrameworkService,
|
OrganFrameworkService organFrameworkService) {
|
||||||
I18nUtils i18nUtils) {
|
|
||||||
super(webProperties);
|
super(webProperties);
|
||||||
this.organProperties = organProperties;
|
this.organProperties = organProperties;
|
||||||
this.pathMatcher = new AntPathMatcher();
|
this.pathMatcher = new AntPathMatcher();
|
||||||
this.globalExceptionHandler = globalExceptionHandler;
|
this.globalExceptionHandler = globalExceptionHandler;
|
||||||
this.organFrameworkService = organFrameworkService;
|
this.organFrameworkService = organFrameworkService;
|
||||||
this.i18nUtils = i18nUtils;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-2
@@ -4,7 +4,6 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
|||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import com.cf.imes.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import com.cf.imes.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import com.cf.imes.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
import com.cf.imes.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
||||||
import com.cf.imes.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
import com.cf.imes.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
||||||
@@ -171,7 +170,7 @@ public abstract class AbstractAlipayClientTest extends BaseMockitoUnitTest {
|
|||||||
public void testUnifiedRefund_throwServiceException() throws AlipayApiException {
|
public void testUnifiedRefund_throwServiceException() throws AlipayApiException {
|
||||||
// mock 方法
|
// mock 方法
|
||||||
when(defaultAlipayClient.execute(argThat((ArgumentMatcher<AlipayTradeRefundRequest>) request -> true)))
|
when(defaultAlipayClient.execute(argThat((ArgumentMatcher<AlipayTradeRefundRequest>) request -> true)))
|
||||||
.thenThrow(ServiceExceptionUtil.exception(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR));
|
.thenThrow(new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR));
|
||||||
// 准备请求参数
|
// 准备请求参数
|
||||||
String notifyUrl = randomURL();
|
String notifyUrl = randomURL();
|
||||||
PayRefundUnifiedReqDTO refundReqDTO = randomPojo(PayRefundUnifiedReqDTO.class, o -> o.setNotifyUrl(notifyUrl));
|
PayRefundUnifiedReqDTO refundReqDTO = randomPojo(PayRefundUnifiedReqDTO.class, o -> o.setNotifyUrl(notifyUrl));
|
||||||
|
|||||||
+1
-2
@@ -2,7 +2,6 @@ package com.cf.imes.framework.pay.core.client.impl.alipay;
|
|||||||
|
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import com.cf.imes.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
import com.cf.imes.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
||||||
import com.cf.imes.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import com.cf.imes.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import com.cf.imes.framework.common.exception.PayException;
|
import com.cf.imes.framework.common.exception.PayException;
|
||||||
@@ -135,7 +134,7 @@ public class AlipayQrPayClientTest extends AbstractAlipayClientTest {
|
|||||||
when(defaultAlipayClient.execute(argThat((ArgumentMatcher<AlipayTradePrecreateRequest>) request -> {
|
when(defaultAlipayClient.execute(argThat((ArgumentMatcher<AlipayTradePrecreateRequest>) request -> {
|
||||||
assertEquals(notifyUrl, request.getNotifyUrl());
|
assertEquals(notifyUrl, request.getNotifyUrl());
|
||||||
return true;
|
return true;
|
||||||
}))).thenThrow(ServiceExceptionUtil.exception(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR));
|
}))).thenThrow(new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR));
|
||||||
// 准备请求参数
|
// 准备请求参数
|
||||||
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.framework.security.core.aop;
|
package com.cf.imes.framework.security.core.aop;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.security.core.annotations.PreAuthenticated;
|
import com.cf.imes.framework.security.core.annotations.PreAuthenticated;
|
||||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -8,7 +9,6 @@ import org.aspectj.lang.annotation.Around;
|
|||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED;
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED;
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
|
|
||||||
@Aspect
|
@Aspect
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -17,7 +17,7 @@ public class PreAuthenticatedAspect {
|
|||||||
@Around("@annotation(preAuthenticated)")
|
@Around("@annotation(preAuthenticated)")
|
||||||
public Object around(ProceedingJoinPoint joinPoint, PreAuthenticated preAuthenticated) throws Throwable {
|
public Object around(ProceedingJoinPoint joinPoint, PreAuthenticated preAuthenticated) throws Throwable {
|
||||||
if (SecurityFrameworkUtils.getLoginUser() == null) {
|
if (SecurityFrameworkUtils.getLoginUser() == null) {
|
||||||
throw exception(UNAUTHORIZED);
|
throw new ServiceException(UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
return joinPoint.proceed();
|
return joinPoint.proceed();
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -2,7 +2,9 @@ package com.cf.imes.framework.security.core.handler;
|
|||||||
|
|
||||||
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils;
|
||||||
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
@@ -25,11 +27,13 @@ import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConsta
|
|||||||
@SuppressWarnings("JavadocReference") // 忽略文档引用报错
|
@SuppressWarnings("JavadocReference") // 忽略文档引用报错
|
||||||
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
|
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private I18nUtils i18nUtils;
|
||||||
@Override
|
@Override
|
||||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) {
|
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) {
|
||||||
log.debug("[commence][访问 URL({}) 时,没有登录]", request.getRequestURI(), e);
|
log.debug("[commence][访问 URL({}) 时,没有登录]", request.getRequestURI(), e);
|
||||||
// 返回 401
|
// 返回 401
|
||||||
ServletUtils.writeJSON(response, CommonResult.error(UNAUTHORIZED));
|
ServletUtils.writeJSON(response, CommonResult.error(UNAUTHORIZED.getCode(), i18nUtils.getMessage(UNAUTHORIZED.getMsg())));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ public class ChenfengWebAutoConfiguration implements WebMvcConfigurer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public GlobalExceptionHandler globalExceptionHandler(ApiErrorLogApi apiErrorLogApi, I18nUtils i18nUtils) {
|
public GlobalExceptionHandler globalExceptionHandler(ApiErrorLogApi apiErrorLogApi) {
|
||||||
return new GlobalExceptionHandler(applicationName, apiErrorLogApi);
|
return new GlobalExceptionHandler(applicationName, apiErrorLogApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -235,7 +235,7 @@ public class GlobalExceptionHandler {
|
|||||||
} else {
|
} else {
|
||||||
log.error(String.format("==========[serviceExceptionHandler]==========,%s:%s", ex.getCode(), ex.getMessage()));
|
log.error(String.format("==========[serviceExceptionHandler]==========,%s:%s", ex.getCode(), ex.getMessage()));
|
||||||
}
|
}
|
||||||
return CommonResult.error(ex.getCode(), ex.getMessage());
|
return CommonResult.error(ex.getCode(), ex.getMessage(), ex.getArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.infra.controller.admin.config;
|
package com.cf.imes.module.infra.controller.admin.config;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.framework.common.pojo.PageParam;
|
import com.cf.imes.framework.common.pojo.PageParam;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
@@ -25,7 +26,7 @@ import jakarta.validation.Valid;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
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.common.pojo.CommonResult.success;
|
||||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ public class ConfigController {
|
|||||||
return success(null);
|
return success(null);
|
||||||
}
|
}
|
||||||
if (!config.getVisible()) {
|
if (!config.getVisible()) {
|
||||||
throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
|
throw new ServiceException(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
|
||||||
}
|
}
|
||||||
return success(config.getValue());
|
return success(config.getValue());
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-16
@@ -2,6 +2,7 @@ package com.cf.imes.module.infra.service.codegen;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.module.infra.controller.admin.codegen.vo.CodegenCreateListReqVO;
|
import com.cf.imes.module.infra.controller.admin.codegen.vo.CodegenCreateListReqVO;
|
||||||
@@ -30,7 +31,7 @@ import java.util.*;
|
|||||||
import java.util.function.BiPredicate;
|
import java.util.function.BiPredicate;
|
||||||
import java.util.stream.Collectors;
|
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.convertMap;
|
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.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.*;
|
||||||
@@ -84,7 +85,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
// 校验是否已经存在
|
// 校验是否已经存在
|
||||||
if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(),
|
if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(),
|
||||||
dataSourceConfigId) != null) {
|
dataSourceConfigId) != null) {
|
||||||
throw exception(CODEGEN_TABLE_EXISTS);
|
throw new ServiceException(CODEGEN_TABLE_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建 CodegenTableDO 对象,插入到 DB 中
|
// 构建 CodegenTableDO 对象,插入到 DB 中
|
||||||
@@ -108,17 +109,17 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void validateTableInfo(TableInfo tableInfo) {
|
void validateTableInfo(TableInfo tableInfo) {
|
||||||
if (tableInfo == null) {
|
if (tableInfo == null) {
|
||||||
throw exception(CODEGEN_IMPORT_TABLE_NULL);
|
throw new ServiceException(CODEGEN_IMPORT_TABLE_NULL);
|
||||||
}
|
}
|
||||||
if (CharSequenceUtil.isEmpty(tableInfo.getComment())) {
|
if (CharSequenceUtil.isEmpty(tableInfo.getComment())) {
|
||||||
throw exception(CODEGEN_TABLE_INFO_TABLE_COMMENT_IS_NULL);
|
throw new ServiceException(CODEGEN_TABLE_INFO_TABLE_COMMENT_IS_NULL);
|
||||||
}
|
}
|
||||||
if (CollUtil.isEmpty(tableInfo.getFields())) {
|
if (CollUtil.isEmpty(tableInfo.getFields())) {
|
||||||
throw exception(CODEGEN_IMPORT_COLUMNS_NULL);
|
throw new ServiceException(CODEGEN_IMPORT_COLUMNS_NULL);
|
||||||
}
|
}
|
||||||
tableInfo.getFields().forEach(field -> {
|
tableInfo.getFields().forEach(field -> {
|
||||||
if (CharSequenceUtil.isEmpty(field.getComment())) {
|
if (CharSequenceUtil.isEmpty(field.getComment())) {
|
||||||
throw exception(CODEGEN_TABLE_INFO_COLUMN_COMMENT_IS_NULL, field.getName());
|
throw new ServiceException(CODEGEN_TABLE_INFO_COLUMN_COMMENT_IS_NULL, field.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -128,16 +129,16 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
public void updateCodegen(CodegenUpdateReqVO updateReqVO) {
|
public void updateCodegen(CodegenUpdateReqVO updateReqVO) {
|
||||||
// 校验是否已经存在
|
// 校验是否已经存在
|
||||||
if (codegenTableMapper.selectById(updateReqVO.getTable().getId()) == null) {
|
if (codegenTableMapper.selectById(updateReqVO.getTable().getId()) == null) {
|
||||||
throw exception(CODEGEN_TABLE_NOT_EXISTS);
|
throw new ServiceException(CODEGEN_TABLE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 校验主表字段存在
|
// 校验主表字段存在
|
||||||
if (Objects.equals(updateReqVO.getTable().getTemplateType(), CodegenTemplateTypeEnum.SUB.getType())) {
|
if (Objects.equals(updateReqVO.getTable().getTemplateType(), CodegenTemplateTypeEnum.SUB.getType())) {
|
||||||
if (codegenTableMapper.selectById(updateReqVO.getTable().getMasterTableId()) == null) {
|
if (codegenTableMapper.selectById(updateReqVO.getTable().getMasterTableId()) == null) {
|
||||||
throw exception(CODEGEN_MASTER_TABLE_NOT_EXISTS, updateReqVO.getTable().getMasterTableId());
|
throw new ServiceException(CODEGEN_MASTER_TABLE_NOT_EXISTS, updateReqVO.getTable().getMasterTableId());
|
||||||
}
|
}
|
||||||
if (CollUtil.findOne(updateReqVO.getColumns(), // 关联主表的字段不存在
|
if (CollUtil.findOne(updateReqVO.getColumns(), // 关联主表的字段不存在
|
||||||
column -> column.getId().equals(updateReqVO.getTable().getSubJoinColumnId())) == null) {
|
column -> column.getId().equals(updateReqVO.getTable().getSubJoinColumnId())) == null) {
|
||||||
throw exception(CODEGEN_SUB_COLUMN_NOT_EXISTS, updateReqVO.getTable().getSubJoinColumnId());
|
throw new ServiceException(CODEGEN_SUB_COLUMN_NOT_EXISTS, updateReqVO.getTable().getSubJoinColumnId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +156,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
// 校验是否已经存在
|
// 校验是否已经存在
|
||||||
CodegenTableDO table = codegenTableMapper.selectById(tableId);
|
CodegenTableDO table = codegenTableMapper.selectById(tableId);
|
||||||
if (table == null) {
|
if (table == null) {
|
||||||
throw exception(CODEGEN_TABLE_NOT_EXISTS);
|
throw new ServiceException(CODEGEN_TABLE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 从数据库中,获得数据库表结构
|
// 从数据库中,获得数据库表结构
|
||||||
TableInfo tableInfo = databaseTableService.getTable(table.getDataSourceConfigId(), table.getTableName());
|
TableInfo tableInfo = databaseTableService.getTable(table.getDataSourceConfigId(), table.getTableName());
|
||||||
@@ -192,7 +193,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
// 移除已经存在的字段
|
// 移除已经存在的字段
|
||||||
tableFields.removeIf(column -> codegenColumnNames.contains(column.getColumnName()) && (!modifyFieldNames.contains(column.getColumnName())));
|
tableFields.removeIf(column -> codegenColumnNames.contains(column.getColumnName()) && (!modifyFieldNames.contains(column.getColumnName())));
|
||||||
if (CollUtil.isEmpty(tableFields) && CollUtil.isEmpty(deleteColumnIds)) {
|
if (CollUtil.isEmpty(tableFields) && CollUtil.isEmpty(deleteColumnIds)) {
|
||||||
throw exception(CODEGEN_SYNC_NONE_CHANGE);
|
throw new ServiceException(CODEGEN_SYNC_NONE_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4.1 插入新增的字段
|
// 4.1 插入新增的字段
|
||||||
@@ -209,7 +210,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
public void deleteCodegen(Long tableId) {
|
public void deleteCodegen(Long tableId) {
|
||||||
// 校验是否已经存在
|
// 校验是否已经存在
|
||||||
if (codegenTableMapper.selectById(tableId) == null) {
|
if (codegenTableMapper.selectById(tableId) == null) {
|
||||||
throw exception(CODEGEN_TABLE_NOT_EXISTS);
|
throw new ServiceException(CODEGEN_TABLE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除 table 表定义
|
// 删除 table 表定义
|
||||||
@@ -243,11 +244,11 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
// 校验是否已经存在
|
// 校验是否已经存在
|
||||||
CodegenTableDO table = codegenTableMapper.selectById(tableId);
|
CodegenTableDO table = codegenTableMapper.selectById(tableId);
|
||||||
if (table == null) {
|
if (table == null) {
|
||||||
throw exception(CODEGEN_TABLE_NOT_EXISTS);
|
throw new ServiceException(CODEGEN_TABLE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
List<CodegenColumnDO> columns = codegenColumnMapper.selectListByTableId(tableId);
|
List<CodegenColumnDO> columns = codegenColumnMapper.selectListByTableId(tableId);
|
||||||
if (CollUtil.isEmpty(columns)) {
|
if (CollUtil.isEmpty(columns)) {
|
||||||
throw exception(CODEGEN_COLUMN_NOT_EXISTS);
|
throw new ServiceException(CODEGEN_COLUMN_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果是主子表,则加载对应的子表信息
|
// 如果是主子表,则加载对应的子表信息
|
||||||
@@ -258,14 +259,14 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
subTables = codegenTableMapper.selectListByTemplateTypeAndMasterTableId(
|
subTables = codegenTableMapper.selectListByTemplateTypeAndMasterTableId(
|
||||||
CodegenTemplateTypeEnum.SUB.getType(), tableId);
|
CodegenTemplateTypeEnum.SUB.getType(), tableId);
|
||||||
if (CollUtil.isEmpty(subTables)) {
|
if (CollUtil.isEmpty(subTables)) {
|
||||||
throw exception(CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_TABLE);
|
throw new ServiceException(CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_TABLE);
|
||||||
}
|
}
|
||||||
// 校验子表的关联字段存在
|
// 校验子表的关联字段存在
|
||||||
subColumnsList = new ArrayList<>();
|
subColumnsList = new ArrayList<>();
|
||||||
for (CodegenTableDO subTable : subTables) {
|
for (CodegenTableDO subTable : subTables) {
|
||||||
List<CodegenColumnDO> subColumns = codegenColumnMapper.selectListByTableId(subTable.getId());
|
List<CodegenColumnDO> subColumns = codegenColumnMapper.selectListByTableId(subTable.getId());
|
||||||
if (CollUtil.findOne(subColumns, column -> column.getId().equals(subTable.getSubJoinColumnId())) == null) {
|
if (CollUtil.findOne(subColumns, column -> column.getId().equals(subTable.getSubJoinColumnId())) == null) {
|
||||||
throw exception(CODEGEN_SUB_COLUMN_NOT_EXISTS, subTable.getId());
|
throw new ServiceException(CODEGEN_SUB_COLUMN_NOT_EXISTS, subTable.getId());
|
||||||
}
|
}
|
||||||
subColumnsList.add(subColumns);
|
subColumnsList.add(subColumns);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-5
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.infra.service.config;
|
package com.cf.imes.module.infra.service.config;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.module.infra.controller.admin.config.vo.ConfigPageReqVO;
|
import com.cf.imes.module.infra.controller.admin.config.vo.ConfigPageReqVO;
|
||||||
import com.cf.imes.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
import com.cf.imes.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||||
@@ -14,7 +15,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,7 +59,7 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
ConfigDO config = validateConfigExists(id);
|
ConfigDO config = validateConfigExists(id);
|
||||||
// 内置配置,不允许删除
|
// 内置配置,不允许删除
|
||||||
if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
|
if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
|
||||||
throw exception(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
|
throw new ServiceException(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
configMapper.deleteById(id);
|
configMapper.deleteById(id);
|
||||||
@@ -86,7 +87,7 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
}
|
}
|
||||||
ConfigDO config = configMapper.selectById(id);
|
ConfigDO config = configMapper.selectById(id);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
throw exception(CONFIG_NOT_EXISTS);
|
throw new ServiceException(CONFIG_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@@ -99,10 +100,10 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
}
|
}
|
||||||
// 如果 id 为空,说明不用比较是否为相同 id 的参数配置
|
// 如果 id 为空,说明不用比较是否为相同 id 的参数配置
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw exception(CONFIG_KEY_DUPLICATE);
|
throw new ServiceException(CONFIG_KEY_DUPLICATE);
|
||||||
}
|
}
|
||||||
if (!config.getId().equals(id)) {
|
if (!config.getId().equals(id)) {
|
||||||
throw exception(CONFIG_KEY_DUPLICATE);
|
throw new ServiceException(CONFIG_KEY_DUPLICATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
package com.cf.imes.module.infra.service.db;
|
package com.cf.imes.module.infra.service.db;
|
||||||
|
|
||||||
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.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.mybatis.core.util.JdbcUtils;
|
import com.cf.imes.framework.mybatis.core.util.JdbcUtils;
|
||||||
import com.cf.imes.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
|
import com.cf.imes.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
|
||||||
@@ -16,7 +16,7 @@ import jakarta.annotation.Resource;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源配置 Service 实现类
|
* 数据源配置 Service 实现类
|
||||||
@@ -65,7 +65,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
|
|||||||
|
|
||||||
private void validateDataSourceConfigExists(Long id) {
|
private void validateDataSourceConfigExists(Long id) {
|
||||||
if (dataSourceConfigMapper.selectById(id) == null) {
|
if (dataSourceConfigMapper.selectById(id) == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
|
|||||||
private void validateConnectionOK(DataSourceConfigDO config) {
|
private void validateConnectionOK(DataSourceConfigDO config) {
|
||||||
boolean success = JdbcUtils.isConnectionOK(config.getUrl(), config.getUsername(), config.getPassword());
|
boolean success = JdbcUtils.isConnectionOK(config.getUrl(), config.getUsername(), config.getPassword());
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_OK);
|
throw new ServiceException(ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -2,6 +2,7 @@ package com.cf.imes.module.infra.service.file;
|
|||||||
|
|
||||||
import cn.hutool.core.io.resource.ResourceUtil;
|
import cn.hutool.core.io.resource.ResourceUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.common.util.validation.ValidationUtils;
|
import com.cf.imes.framework.common.util.validation.ValidationUtils;
|
||||||
@@ -28,7 +29,7 @@ import java.time.Duration;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache;
|
import static com.cf.imes.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache;
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_CONFIG_DELETE_FAIL_MASTER;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_CONFIG_DELETE_FAIL_MASTER;
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_CONFIG_NOT_EXISTS;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_CONFIG_NOT_EXISTS;
|
||||||
@@ -125,7 +126,7 @@ public class FileConfigServiceImpl implements FileConfigService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
FileConfigDO config = validateFileConfigExists(id);
|
FileConfigDO config = validateFileConfigExists(id);
|
||||||
if (Boolean.TRUE.equals(config.getMaster())) {
|
if (Boolean.TRUE.equals(config.getMaster())) {
|
||||||
throw exception(FILE_CONFIG_DELETE_FAIL_MASTER);
|
throw new ServiceException(FILE_CONFIG_DELETE_FAIL_MASTER);
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
fileConfigMapper.deleteById(id);
|
fileConfigMapper.deleteById(id);
|
||||||
@@ -152,7 +153,7 @@ public class FileConfigServiceImpl implements FileConfigService {
|
|||||||
private FileConfigDO validateFileConfigExists(Long id) {
|
private FileConfigDO validateFileConfigExists(Long id) {
|
||||||
FileConfigDO config = fileConfigMapper.selectById(id);
|
FileConfigDO config = fileConfigMapper.selectById(id);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
throw exception(FILE_CONFIG_NOT_EXISTS);
|
throw new ServiceException(FILE_CONFIG_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -2,6 +2,7 @@ package com.cf.imes.module.infra.service.file;
|
|||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.io.FileUtils;
|
import com.cf.imes.framework.common.util.io.FileUtils;
|
||||||
@@ -18,7 +19,7 @@ import jakarta.annotation.Resource;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_REMOVE_FAIL;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_REMOVE_FAIL;
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ public class FileServiceImpl implements FileService {
|
|||||||
private FileDO validateFileExists(Long id) {
|
private FileDO validateFileExists(Long id) {
|
||||||
FileDO fileDO = fileMapper.selectById(id);
|
FileDO fileDO = fileMapper.selectById(id);
|
||||||
if (fileDO == null) {
|
if (fileDO == null) {
|
||||||
throw exception(FILE_NOT_EXISTS);
|
throw new ServiceException(FILE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return fileDO;
|
return fileDO;
|
||||||
}
|
}
|
||||||
@@ -149,7 +150,7 @@ public class FileServiceImpl implements FileService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
FileDO fileDO = fileMapper.selectOne(new LambdaQueryWrapperX<FileDO>().eq(FileDO::getPath, path));
|
FileDO fileDO = fileMapper.selectOne(new LambdaQueryWrapperX<FileDO>().eq(FileDO::getPath, path));
|
||||||
if(Objects.isNull(fileDO)) {
|
if(Objects.isNull(fileDO)) {
|
||||||
throw exception(FILE_NOT_EXISTS);
|
throw new ServiceException(FILE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 从文件存储器中删除
|
// 从文件存储器中删除
|
||||||
FileClient client = fileConfigService.getFileClient(fileDO.getConfigId());
|
FileClient client = fileConfigService.getFileClient(fileDO.getConfigId());
|
||||||
@@ -157,7 +158,7 @@ public class FileServiceImpl implements FileService {
|
|||||||
try {
|
try {
|
||||||
client.delete(path);
|
client.delete(path);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw exception(FILE_REMOVE_FAIL);
|
throw new ServiceException(FILE_REMOVE_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除记录
|
// 删除记录
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.infra.service.logger;
|
package com.cf.imes.module.infra.service.logger;
|
||||||
|
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
@@ -17,7 +18,6 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.infra.dal.dataobject.logger.ApiErrorLogDO.REQUEST_PARAMS_MAX_LENGTH;
|
import static com.cf.imes.module.infra.dal.dataobject.logger.ApiErrorLogDO.REQUEST_PARAMS_MAX_LENGTH;
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED;
|
||||||
@@ -57,10 +57,10 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
|
|||||||
public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) {
|
public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) {
|
||||||
ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id);
|
ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id);
|
||||||
if (errorLog == null) {
|
if (errorLog == null) {
|
||||||
throw exception(API_ERROR_LOG_NOT_FOUND);
|
throw new ServiceException(API_ERROR_LOG_NOT_FOUND);
|
||||||
}
|
}
|
||||||
if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) {
|
if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) {
|
||||||
throw exception(API_ERROR_LOG_PROCESSED);
|
throw new ServiceException(API_ERROR_LOG_PROCESSED);
|
||||||
}
|
}
|
||||||
// 标记处理
|
// 标记处理
|
||||||
apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus)
|
apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus)
|
||||||
|
|||||||
+2
-3
@@ -54,7 +54,6 @@ import java.util.*;
|
|||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.framework.common.pojo.CommonResult.error;
|
import static com.cf.imes.framework.common.pojo.CommonResult.error;
|
||||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
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.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
@@ -175,7 +174,7 @@ public class OrderController {
|
|||||||
public CommonResult<Boolean> deleteOrder(@RequestParam("orderId") Long orderId) {
|
public CommonResult<Boolean> deleteOrder(@RequestParam("orderId") Long orderId) {
|
||||||
Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.DELETED.getStatus());
|
Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.DELETED.getStatus());
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
throw exception(ORDER_DELETED_ERR);
|
throw new ServiceException(ORDER_DELETED_ERR);
|
||||||
}
|
}
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
@@ -188,7 +187,7 @@ public class OrderController {
|
|||||||
Long orderId = jsonObject.getLong("orderId");
|
Long orderId = jsonObject.getLong("orderId");
|
||||||
Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.NOT_DELETED.getStatus());
|
Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
throw exception(ORDER_RESTORE_ERR);
|
throw new ServiceException(ORDER_RESTORE_ERR);
|
||||||
}
|
}
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||||
@@ -80,7 +80,7 @@ public class BodyNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRuleS
|
|||||||
} else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) {
|
} else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) {
|
||||||
generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDO);
|
generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDO);
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
throw new ServiceException(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||||
}
|
}
|
||||||
return generateConfig;
|
return generateConfig;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||||
@@ -131,7 +131,7 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
|
|||||||
} else if (ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
} else if (ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
||||||
orderNoSeq = resetByDay(orderNoSeq, orgCustomPlateNoSeqRespDTO, plateNoRule);
|
orderNoSeq = resetByDay(orderNoSeq, orgCustomPlateNoSeqRespDTO, plateNoRule);
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
throw new ServiceException(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||||
}
|
}
|
||||||
return orderNoSeq;
|
return orderNoSeq;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||||
@@ -82,7 +82,7 @@ public class PlateNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
|
|||||||
} else if (ObjectUtil.equal(ResetModeEnum.YEAR, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.MONTH, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
} else if (ObjectUtil.equal(ResetModeEnum.YEAR, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.MONTH, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
||||||
return generateNoByDateResetMode(resetModeEnum, plateNoRule, generateConfig, plateDO);
|
return generateNoByDateResetMode(resetModeEnum, plateNoRule, generateConfig, plateDO);
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
throw new ServiceException(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -2,7 +2,6 @@
|
|||||||
//
|
//
|
||||||
//import cn.hutool.core.collection.CollUtil;
|
//import cn.hutool.core.collection.CollUtil;
|
||||||
//import cn.hutool.core.util.ObjectUtil;
|
//import cn.hutool.core.util.ObjectUtil;
|
||||||
//import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
//import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
//import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||||
//import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoGenerateConfigVO;
|
//import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoGenerateConfigVO;
|
||||||
//import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoRuleDTO;
|
//import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoRuleDTO;
|
||||||
@@ -47,7 +46,7 @@
|
|||||||
// } else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) {
|
// } else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) {
|
||||||
// generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDOList);
|
// generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDOList);
|
||||||
// } else {
|
// } else {
|
||||||
// throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_PROCESSGROUP_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
// throw new ServiceException(CUSTOM_PLATENO_GENERATE_PROCESSGROUP_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||||
// }
|
// }
|
||||||
// return generateConfig;
|
// return generateConfig;
|
||||||
// }
|
// }
|
||||||
|
|||||||
+6
-5
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.executor.service.goods;
|
package com.cf.imes.module.executor.service.goods;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.managePlate.ManagePlateDO;
|
import com.cf.imes.module.executor.dal.dataobject.managePlate.ManagePlateDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||||
import com.cf.imes.module.executor.dal.mysql.managePlate.ManagePlateMapper;
|
import com.cf.imes.module.executor.dal.mysql.managePlate.ManagePlateMapper;
|
||||||
@@ -21,7 +22,7 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
|||||||
|
|
||||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,16 +55,16 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
List<Long> longs = new ArrayList<>();
|
List<Long> longs = new ArrayList<>();
|
||||||
// 校验生产单是否存在
|
// 校验生产单是否存在
|
||||||
if (orderMapper.selectOne(OrderDO::getId, createReqVOS.get(0).getOrderId()) == null) {
|
if (orderMapper.selectOne(OrderDO::getId, createReqVOS.get(0).getOrderId()) == null) {
|
||||||
throw exception(GOODS_NOT_EXISTS);
|
throw new ServiceException(GOODS_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
createReqVOS.forEach(createReqVO -> {
|
createReqVOS.forEach(createReqVO -> {
|
||||||
// 校验商品是否存在
|
// 校验商品是否存在
|
||||||
if (plateMapper.selectOne(ManagePlateDO::getId, createReqVO.getGoodsId()) == null) {
|
if (plateMapper.selectOne(ManagePlateDO::getId, createReqVO.getGoodsId()) == null) {
|
||||||
throw exception(PLATE_NOT_EXISTS);
|
throw new ServiceException(PLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 校验
|
// 校验
|
||||||
if (rawGoodsService.getRawGoods(createReqVO.getRawGoodsId()) == null) {
|
if (rawGoodsService.getRawGoods(createReqVO.getRawGoodsId()) == null) {
|
||||||
throw exception(RAW_GOODS_NOT_USED_IN_ORDER);
|
throw new ServiceException(RAW_GOODS_NOT_USED_IN_ORDER);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 一次性插入数据库
|
// 一次性插入数据库
|
||||||
@@ -93,7 +94,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
|
|
||||||
private void validateGoodsExists(Long id) {
|
private void validateGoodsExists(Long id) {
|
||||||
if (goodsMapper.selectById(id) == null) {
|
if (goodsMapper.selectById(id) == null) {
|
||||||
throw exception(GOODS_NOT_EXISTS);
|
throw new ServiceException(GOODS_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||||
import com.cf.imes.framework.common.enums.*;
|
import com.cf.imes.framework.common.enums.*;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
@@ -49,7 +50,6 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
||||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE;
|
||||||
@@ -325,7 +325,7 @@ public class PackServiceImpl implements PackService {
|
|||||||
|
|
||||||
|
|
||||||
if(reqVO.getAddPartsIdList().isEmpty() && reqVO.getAddPlateIdList().isEmpty() && reqVO.getDeletePartsIdList().isEmpty()){
|
if(reqVO.getAddPartsIdList().isEmpty() && reqVO.getAddPlateIdList().isEmpty() && reqVO.getDeletePartsIdList().isEmpty()){
|
||||||
throw exception(PART_PACK_DATA_ERROR);
|
throw new ServiceException(PART_PACK_DATA_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -447,7 +447,7 @@ public class PackServiceImpl implements PackService {
|
|||||||
|
|
||||||
|
|
||||||
if(packageVO.getAddPlateIdList().isEmpty() && packageVO.getAddPartsIdList().isEmpty() && packageVO.getDeletePlateIdList().isEmpty()){
|
if(packageVO.getAddPlateIdList().isEmpty() && packageVO.getAddPartsIdList().isEmpty() && packageVO.getDeletePlateIdList().isEmpty()){
|
||||||
throw exception(PART_PACK_DATA_ERROR);
|
throw new ServiceException(PART_PACK_DATA_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -676,7 +676,7 @@ public class PackServiceImpl implements PackService {
|
|||||||
|
|
||||||
OrderPackageDO orderPackageDO = orderPackageMapper.selectByPackNo(reqVO.getPackNo(), getUserOrganId());
|
OrderPackageDO orderPackageDO = orderPackageMapper.selectByPackNo(reqVO.getPackNo(), getUserOrganId());
|
||||||
if (orderPackageDO.getType() != OrderPackageTypeEnum.OTHER_ACCESSORIES.getType().longValue()) {
|
if (orderPackageDO.getType() != OrderPackageTypeEnum.OTHER_ACCESSORIES.getType().longValue()) {
|
||||||
throw exception(THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT);
|
throw new ServiceException(THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -749,7 +749,7 @@ public class PackServiceImpl implements PackService {
|
|||||||
|
|
||||||
if (setting == null) {
|
if (setting == null) {
|
||||||
|
|
||||||
throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE, UserSettingTypeEnum.PREPACKAGED.getName());
|
throw new ServiceException(CURRENTLY_NO_CONFIGURATION_AVAILABLE, UserSettingTypeEnum.PREPACKAGED.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonNode settingParse = JsonUtils.parseTree(JsonUtils.unzipString(setting));
|
JsonNode settingParse = JsonUtils.parseTree(JsonUtils.unzipString(setting));
|
||||||
@@ -929,7 +929,7 @@ public class PackServiceImpl implements PackService {
|
|||||||
ordersMapper.selectOrderIdsFalse(order.getCreateTime().toString(), getUserOrganId(), order.getId());
|
ordersMapper.selectOrderIdsFalse(order.getCreateTime().toString(), getUserOrganId(), order.getId());
|
||||||
|
|
||||||
if (packRespVOList.isEmpty()) {
|
if (packRespVOList.isEmpty()) {
|
||||||
throw exception(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, Boolean.TRUE.equals(isUp) ? "第" : "最后");
|
throw new ServiceException(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, Boolean.TRUE.equals(isUp) ? "第" : "最后");
|
||||||
}
|
}
|
||||||
packRespVOS.setRecords(packRespVOList);
|
packRespVOS.setRecords(packRespVOList);
|
||||||
|
|
||||||
|
|||||||
+7
-10
@@ -13,9 +13,7 @@ import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsCadPage
|
|||||||
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO;
|
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO;
|
||||||
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsPageReqVO;
|
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsPageReqVO;
|
||||||
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsSaveReqVO;
|
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsSaveReqVO;
|
||||||
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateImportExcelVO;
|
|
||||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
|
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
|
|
||||||
import com.cf.imes.module.executor.dal.mysql.orderParts.PartsBatchMapper;
|
import com.cf.imes.module.executor.dal.mysql.orderParts.PartsBatchMapper;
|
||||||
import com.cf.imes.module.executor.dal.mysql.orderParts.PartsMapper;
|
import com.cf.imes.module.executor.dal.mysql.orderParts.PartsMapper;
|
||||||
import com.cf.imes.module.executor.enums.manage.parts.CategoryEnum;
|
import com.cf.imes.module.executor.enums.manage.parts.CategoryEnum;
|
||||||
@@ -44,7 +42,6 @@ import java.util.function.Consumer;
|
|||||||
import java.util.stream.Collectors;
|
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.getLoginUser;
|
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
import static com.cf.imes.module.executor.framework.executor.config.ExecutorThreadPoolConfiguration.EXECUTOR_IMPOT_THREAD_POOL_TASK_EXECUTOR;
|
import static com.cf.imes.module.executor.framework.executor.config.ExecutorThreadPoolConfiguration.EXECUTOR_IMPOT_THREAD_POOL_TASK_EXECUTOR;
|
||||||
@@ -97,7 +94,7 @@ public class PartsServiceImpl implements PartsService {
|
|||||||
partsDO.setOrganId(organId).setIsComposite(createReqVO.getIsComposite() != null && createReqVO.getIsComposite());
|
partsDO.setOrganId(organId).setIsComposite(createReqVO.getIsComposite() != null && createReqVO.getIsComposite());
|
||||||
// 判断是否存在--- goodsId
|
// 判断是否存在--- goodsId
|
||||||
if (validateExistsByGoodsId(partsDO.getGoodsId(), organId)) {
|
if (validateExistsByGoodsId(partsDO.getGoodsId(), organId)) {
|
||||||
throw exception(PARTS_GOOD_ID_EXISTS);
|
throw new ServiceException(PARTS_GOOD_ID_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
partsMapper.insert(partsDO);
|
partsMapper.insert(partsDO);
|
||||||
@@ -117,12 +114,12 @@ public class PartsServiceImpl implements PartsService {
|
|||||||
boolean index = validateExistsById(updateReqVO.getId(), organId);
|
boolean index = validateExistsById(updateReqVO.getId(), organId);
|
||||||
|
|
||||||
if (!index) {
|
if (!index) {
|
||||||
throw exception(PARTS_NOT_EXISTS);
|
throw new ServiceException(PARTS_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验goodsId是否存在
|
// 校验goodsId是否存在
|
||||||
if (!validateExistsExceptGoodsId(updateReqVO.getId(), updateReqVO.getGoodsId(), organId)) {
|
if (!validateExistsExceptGoodsId(updateReqVO.getId(), updateReqVO.getGoodsId(), organId)) {
|
||||||
throw exception(PARTS_GOOD_ID_EXISTS);
|
throw new ServiceException(PARTS_GOOD_ID_EXISTS);
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
updateReqVO.setOrganId(organId).setIsComposite(updateReqVO.getIsComposite() != null && updateReqVO.getIsComposite());
|
updateReqVO.setOrganId(organId).setIsComposite(updateReqVO.getIsComposite() != null && updateReqVO.getIsComposite());
|
||||||
@@ -157,7 +154,7 @@ public class PartsServiceImpl implements PartsService {
|
|||||||
public void delete(Long id, Long organId) {
|
public void delete(Long id, Long organId) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
if (!validateExistsById(id, getOrganId(BASE_PARTS_DELETE_PERMISSION, getLoginUser().getId(), organId))) {
|
if (!validateExistsById(id, getOrganId(BASE_PARTS_DELETE_PERMISSION, getLoginUser().getId(), organId))) {
|
||||||
throw exception(PARTS_NOT_EXISTS);
|
throw new ServiceException(PARTS_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
@@ -429,7 +426,7 @@ public class PartsServiceImpl implements PartsService {
|
|||||||
private void validateOrganExists(Long organId) {
|
private void validateOrganExists(Long organId) {
|
||||||
CommonResult<Boolean> index = organApi.validOrgan(organId);
|
CommonResult<Boolean> index = organApi.validOrgan(organId);
|
||||||
if (!index.isSuccess()) {
|
if (!index.isSuccess()) {
|
||||||
throw exception(ErrorCodeConstants.ORGAN_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.ORGAN_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,11 +451,11 @@ public class PartsServiceImpl implements PartsService {
|
|||||||
private void validateFieldExists(PartsSaveReqVO partsSaveReqVO) {
|
private void validateFieldExists(PartsSaveReqVO partsSaveReqVO) {
|
||||||
if (!CategoryEnum.OTHER.getValue().equals(partsSaveReqVO.getCategory())) { // 不为其他
|
if (!CategoryEnum.OTHER.getValue().equals(partsSaveReqVO.getCategory())) { // 不为其他
|
||||||
if (partsSaveReqVO.getUnit() == null || partsSaveReqVO.getUnit().isEmpty()) {
|
if (partsSaveReqVO.getUnit() == null || partsSaveReqVO.getUnit().isEmpty()) {
|
||||||
throw exception(PARTS_UNIT_NOT_NULL);
|
throw new ServiceException(PARTS_UNIT_NOT_NULL);
|
||||||
}
|
}
|
||||||
if (CategoryEnum.EDGING.getValue().equals(partsSaveReqVO.getCategory())) { // 为封边
|
if (CategoryEnum.EDGING.getValue().equals(partsSaveReqVO.getCategory())) { // 为封边
|
||||||
if (partsSaveReqVO.getColor() == null || partsSaveReqVO.getWidth() == null || partsSaveReqVO.getThickness() == null) {
|
if (partsSaveReqVO.getColor() == null || partsSaveReqVO.getWidth() == null || partsSaveReqVO.getThickness() == null) {
|
||||||
throw exception(PARTS_EDGE_NOT_NULL);
|
throw new ServiceException(PARTS_EDGE_NOT_NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-7
@@ -41,7 +41,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
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.getLoginUserId;
|
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_ATTR_GROUP_EXISTS;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_ATTR_GROUP_EXISTS;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_EXISTS;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_EXISTS;
|
||||||
@@ -110,14 +109,14 @@ public class PlateManageServiceImpl implements PlateManageService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
Long organId = getOrganId(BASE_PLATE_UPDATE_PERMISSION, getLoginUserId(), updateReqVO.getOrganId());
|
Long organId = getOrganId(BASE_PLATE_UPDATE_PERMISSION, getLoginUserId(), updateReqVO.getOrganId());
|
||||||
if (updateReqVO.getId() == null) {
|
if (updateReqVO.getId() == null) {
|
||||||
throw exception(PLATE_ID_NULL_ERROR);
|
throw new ServiceException(PLATE_ID_NULL_ERROR);
|
||||||
}
|
}
|
||||||
validatePlateExists(updateReqVO.getId(), organId);
|
validatePlateExists(updateReqVO.getId(), organId);
|
||||||
PlateGoodDO updateObj = BeanUtils.toBean(updateReqVO, PlateGoodDO.class);
|
PlateGoodDO updateObj = BeanUtils.toBean(updateReqVO, PlateGoodDO.class);
|
||||||
|
|
||||||
// 校验板材goods_id是否相同
|
// 校验板材goods_id是否相同
|
||||||
if (plateGoodMapper.isByGoodIDAndId(updateReqVO.getGoodsId(), organId, Long.valueOf(updateReqVO.getId()))) {
|
if (plateGoodMapper.isByGoodIDAndId(updateReqVO.getGoodsId(), organId, Long.valueOf(updateReqVO.getId()))) {
|
||||||
throw exception(PLATE_GOODS_ID_NOT_SAME);
|
throw new ServiceException(PLATE_GOODS_ID_NOT_SAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验板材名称、材质、颜色、厚度、品牌在组织内唯一
|
// 校验板材名称、材质、颜色、厚度、品牌在组织内唯一
|
||||||
@@ -140,7 +139,7 @@ public class PlateManageServiceImpl implements PlateManageService {
|
|||||||
.eqIfPresent(PlateGoodDO::getBrand, plate.getBrand())
|
.eqIfPresent(PlateGoodDO::getBrand, plate.getBrand())
|
||||||
.neIfPresent(PlateGoodDO::getId, plate.getId()));
|
.neIfPresent(PlateGoodDO::getId, plate.getId()));
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw exception(PLATE_ATTR_GROUP_EXISTS);
|
throw new ServiceException(PLATE_ATTR_GROUP_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +156,7 @@ public class PlateManageServiceImpl implements PlateManageService {
|
|||||||
|
|
||||||
private void validatePlateExists(Long id, Long organId) {
|
private void validatePlateExists(Long id, Long organId) {
|
||||||
if (plateGoodMapper.selectOneById(id, organId) == null) {
|
if (plateGoodMapper.selectOneById(id, organId) == null) {
|
||||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,14 +406,14 @@ public class PlateManageServiceImpl implements PlateManageService {
|
|||||||
private void validateOrganExists(Long organId) {
|
private void validateOrganExists(Long organId) {
|
||||||
CommonResult<Boolean> index = organApi.validOrgan(organId);
|
CommonResult<Boolean> index = organApi.validOrgan(organId);
|
||||||
if (!index.isSuccess()) {
|
if (!index.isSuccess()) {
|
||||||
throw exception(ErrorCodeConstants.ORGAN_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.ORGAN_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前组织中板材是否存在
|
// 当前组织中板材是否存在
|
||||||
private void validateGoodExists(String goodsId, Long organId) {
|
private void validateGoodExists(String goodsId, Long organId) {
|
||||||
if (plateGoodMapper.selectByGoodID(goodsId, organId, false) != null) {
|
if (plateGoodMapper.selectByGoodID(goodsId, organId, false) != null) {
|
||||||
throw exception(PLATE_EXISTS);
|
throw new ServiceException(PLATE_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.executor.service.manage.remainplaten;
|
package com.cf.imes.module.executor.service.manage.remainplaten;
|
||||||
|
|
||||||
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
@@ -20,7 +21,6 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_COUNT_MAX;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_COUNT_MAX;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_ID_NOT_EXISTS;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_ID_NOT_EXISTS;
|
||||||
@@ -46,7 +46,7 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
|||||||
List<RemainPlateDO> remainPlates = new ArrayList<>();
|
List<RemainPlateDO> remainPlates = new ArrayList<>();
|
||||||
// 限制新增数量不能超过999
|
// 限制新增数量不能超过999
|
||||||
if (createReqVO.getCount() > MAX_NUM) {
|
if (createReqVO.getCount() > MAX_NUM) {
|
||||||
throw exception(REMAIN_PLATE_COUNT_MAX);
|
throw new ServiceException(REMAIN_PLATE_COUNT_MAX);
|
||||||
}
|
}
|
||||||
// 插入
|
// 插入
|
||||||
if (createReqVO.getCount() >= 1) {
|
if (createReqVO.getCount() >= 1) {
|
||||||
@@ -101,14 +101,14 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void revertRemainPlateStatus(Set<Long> ids, Integer status) {
|
public void revertRemainPlateStatus(Set<Long> ids, Integer status) {
|
||||||
if (ids == null) {
|
if (ids == null) {
|
||||||
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
|
throw new ServiceException(REMAIN_PLATE_ID_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 判断余料的状态是否存在使用中
|
// 判断余料的状态是否存在使用中
|
||||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.UNUSED.getStatus());
|
validateRemainPlateStatus(ids, RemainPlateStatusEnum.UNUSED.getStatus());
|
||||||
// 判断使用类型是否为核销
|
// 判断使用类型是否为核销
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
if (!validateRemainPlateUseType(id).equals(RemainPlateUseTypeEnum.TYPE_ONE.getStatus())) {
|
if (!validateRemainPlateUseType(id).equals(RemainPlateUseTypeEnum.TYPE_ONE.getStatus())) {
|
||||||
throw exception(REMAIN_PLATE_USR_TYPE);
|
throw new ServiceException(REMAIN_PLATE_USR_TYPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
remainPlateMapper.updateRemainPlateStatus(ids, status, null, OrganContextHolder.getOrganId(), 0L);
|
remainPlateMapper.updateRemainPlateStatus(ids, status, null, OrganContextHolder.getOrganId(), 0L);
|
||||||
@@ -120,7 +120,7 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
|||||||
validateRemainPlateExists(updateReqVO.getId());
|
validateRemainPlateExists(updateReqVO.getId());
|
||||||
// 是否使用
|
// 是否使用
|
||||||
if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.USED.getStatus()) {
|
if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.USED.getStatus()) {
|
||||||
throw exception(REMAIN_PLATE_STATUS_USED);
|
throw new ServiceException(REMAIN_PLATE_STATUS_USED);
|
||||||
}
|
}
|
||||||
// 判断是否为开料添加
|
// 判断是否为开料添加
|
||||||
RemainPlateDO updateObj = validateRemainPlateIsCutting(updateReqVO.getId());
|
RemainPlateDO updateObj = validateRemainPlateIsCutting(updateReqVO.getId());
|
||||||
@@ -136,7 +136,7 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteRemainPlate(Set<Long> ids) {
|
public void deleteRemainPlate(Set<Long> ids) {
|
||||||
if (ids == null) {
|
if (ids == null) {
|
||||||
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
|
throw new ServiceException(REMAIN_PLATE_ID_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 余料存在判断
|
// 余料存在判断
|
||||||
validateRemainPlateExists(ids);
|
validateRemainPlateExists(ids);
|
||||||
@@ -151,21 +151,21 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
|||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
if (validateRemainPlateStatus(id) == status) {
|
if (validateRemainPlateStatus(id) == status) {
|
||||||
if (status == RemainPlateStatusEnum.USED.getStatus())
|
if (status == RemainPlateStatusEnum.USED.getStatus())
|
||||||
throw exception(REMAIN_PLATE_STATUS_USED);
|
throw new ServiceException(REMAIN_PLATE_STATUS_USED);
|
||||||
if (status == RemainPlateStatusEnum.UNUSED.getStatus())
|
if (status == RemainPlateStatusEnum.UNUSED.getStatus())
|
||||||
throw exception(REMAIN_PLATE_STATUS_NO_USED);
|
throw new ServiceException(REMAIN_PLATE_STATUS_NO_USED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateRemainPlateExists(Long id) {
|
private void validateRemainPlateExists(Long id) {
|
||||||
if (remainPlateMapper.selectById(id) == null) {
|
if (remainPlateMapper.selectById(id) == null) {
|
||||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void validateRemainPlateExists(Set<Long> id) {
|
private void validateRemainPlateExists(Set<Long> id) {
|
||||||
if (remainPlateMapper.selectBatchIds(id).isEmpty()) {
|
if (remainPlateMapper.selectBatchIds(id).isEmpty()) {
|
||||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private RemainPlateDO validateRemainPlateIsCutting(Long id) {
|
private RemainPlateDO validateRemainPlateIsCutting(Long id) {
|
||||||
|
|||||||
+2
-4
@@ -1,20 +1,18 @@
|
|||||||
package com.cf.imes.module.executor.service.module;
|
package com.cf.imes.module.executor.service.module;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import com.cf.imes.module.executor.controller.admin.module.vo.*;
|
import com.cf.imes.module.executor.controller.admin.module.vo.*;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.module.ModuleDO;
|
import com.cf.imes.module.executor.dal.dataobject.module.ModuleDO;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.pojo.PageParam;
|
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
import com.cf.imes.module.executor.dal.mysql.module.ModuleMapper;
|
import com.cf.imes.module.executor.dal.mysql.module.ModuleMapper;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +55,7 @@ public class ModuleServiceImpl implements ModuleService {
|
|||||||
|
|
||||||
private void validateModuleExists(Long id) {
|
private void validateModuleExists(Long id) {
|
||||||
if (moduleMapper.selectById(id) == null) {
|
if (moduleMapper.selectById(id) == null) {
|
||||||
throw exception(MODULE_NOT_EXISTS);
|
throw new ServiceException(MODULE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-14
@@ -30,7 +30,6 @@ import com.cf.imes.framework.common.enums.OrderStatusEnum;
|
|||||||
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||||
import com.cf.imes.framework.common.enums.PlanTypeEnum;
|
import com.cf.imes.framework.common.enums.PlanTypeEnum;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -89,12 +88,10 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR;
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR;
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR;
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR;
|
||||||
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.common.util.json.JsonUtils.*;
|
||||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author there
|
* @author there
|
||||||
@@ -180,7 +177,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
public Boolean addRemain(AddRemainReqVO vo) {
|
public Boolean addRemain(AddRemainReqVO vo) {
|
||||||
PlanDO planDO = planMapper.selectById(vo.getPlanId());
|
PlanDO planDO = planMapper.selectById(vo.getPlanId());
|
||||||
if (Objects.isNull(planDO)) {
|
if (Objects.isNull(planDO)) {
|
||||||
throw exception(PLAN_NOT_EXISTS);
|
throw new ServiceException(PLAN_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
RemainPlateDO remainPlateDO = RemainPlateDO.builder()
|
RemainPlateDO remainPlateDO = RemainPlateDO.builder()
|
||||||
.width(vo.getWidth())
|
.width(vo.getWidth())
|
||||||
@@ -246,7 +243,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw exception(PLAN_PLATE_OPTIMIZE_DATA_ERROR);
|
throw new ServiceException(PLAN_PLATE_OPTIMIZE_DATA_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssertUtils.notEmpty(remainBoardInfos,ORDER_PLAN_OPTIMIZE_ERROR);
|
AssertUtils.notEmpty(remainBoardInfos,ORDER_PLAN_OPTIMIZE_ERROR);
|
||||||
@@ -279,7 +276,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
@Override
|
@Override
|
||||||
public OrderSource getOrderSource(Long orderId, Long planId, Long machineId) {
|
public OrderSource getOrderSource(Long orderId, Long planId, Long machineId) {
|
||||||
if (!Objects.isNull(orderId) && !Objects.isNull(planId)) {
|
if (!Objects.isNull(orderId) && !Objects.isNull(planId)) {
|
||||||
throw exception(ORDER_PLAN_ID_IS_ONE);
|
throw new ServiceException(ORDER_PLAN_ID_IS_ONE);
|
||||||
}
|
}
|
||||||
OrderSource orderSource;
|
OrderSource orderSource;
|
||||||
if (ObjectUtil.isNotNull(orderId)) {
|
if (ObjectUtil.isNotNull(orderId)) {
|
||||||
@@ -292,7 +289,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
return orderSource;
|
return orderSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw exception(ErrorCodeConstants.SOURCE_NOT_EXITS_ERROR);
|
throw new ServiceException(ErrorCodeConstants.SOURCE_NOT_EXITS_ERROR);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,7 +480,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR);
|
AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR);
|
||||||
|
|
||||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
if(planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||||
throw exception(THIS_PLAN_OPTIMIZE_DATA_ERROR);
|
throw new ServiceException(THIS_PLAN_OPTIMIZE_DATA_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -583,7 +580,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
if(!planDO.getProcessId().equals(processId)){
|
if(!planDO.getProcessId().equals(processId)){
|
||||||
|
|
||||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||||
throw exception(THIS_PLAN_PLATE_IS_CUT);
|
throw new ServiceException(THIS_PLAN_PLATE_IS_CUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存排单对应的加工方案组的配置信息
|
// 保存排单对应的加工方案组的配置信息
|
||||||
@@ -786,7 +783,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
.eq(PlateDO::getPlanId, 0)
|
.eq(PlateDO::getPlanId, 0)
|
||||||
.eq(PlateDO::getDeleted, false));
|
.eq(PlateDO::getDeleted, false));
|
||||||
if (planCreatePlateThreshold < unplanPlateNum) {
|
if (planCreatePlateThreshold < unplanPlateNum) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_PLAN_CREATE_PLATE_NUM_REACH_THRESHOLD_ERROR, planCreatePlateThreshold);
|
throw new ServiceException(ORDER_PLAN_CREATE_PLATE_NUM_REACH_THRESHOLD_ERROR, planCreatePlateThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PlateDetailRespVO> plateDetailRespVOS = plateMapper.selectNoPlanPlate(orderIds, orderGoodsIds, getUserOrganId());
|
List<PlateDetailRespVO> plateDetailRespVOS = plateMapper.selectNoPlanPlate(orderIds, orderGoodsIds, getUserOrganId());
|
||||||
@@ -1288,7 +1285,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
Boolean isOptimized = optimizeBoardModelDO.getIsOptimized();
|
Boolean isOptimized = optimizeBoardModelDO.getIsOptimized();
|
||||||
|
|
||||||
if(Boolean.FALSE.equals(isOptimized)){
|
if(Boolean.FALSE.equals(isOptimized)){
|
||||||
throw exception(ORDER_PLAN_NO_OPTIMIZE_UPDATE_ERROR);
|
throw new ServiceException(ORDER_PLAN_NO_OPTIMIZE_UPDATE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1312,7 +1309,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
|
|
||||||
|
|
||||||
if (Boolean.FALSE.equals(isArray)) {
|
if (Boolean.FALSE.equals(isArray)) {
|
||||||
throw exception(ORDER_PLAN_OPTIMIZE_ERROR);
|
throw new ServiceException(ORDER_PLAN_OPTIMIZE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1701,7 +1698,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
private void validatePlanStatus(PlanDO planDO,List<Boolean> isLocks){
|
private void validatePlanStatus(PlanDO planDO,List<Boolean> isLocks){
|
||||||
|
|
||||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||||
throw exception(THIS_PLAN_PLATE_IS_CUT);
|
throw new ServiceException(THIS_PLAN_PLATE_IS_CUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
@@ -1710,7 +1707,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
|||||||
Boolean data = permissionApi.hasAnyPermissions(loginUser.getId(), "placeorder:list").getCheckedData();
|
Boolean data = permissionApi.hasAnyPermissions(loginUser.getId(), "placeorder:list").getCheckedData();
|
||||||
|
|
||||||
if(Boolean.TRUE.equals(planDO.getIsScheduled()) && isLocks.contains(true) && Boolean.FALSE.equals(data)){
|
if(Boolean.TRUE.equals(planDO.getIsScheduled()) && isLocks.contains(true) && Boolean.FALSE.equals(data)){
|
||||||
throw exception(THIS_PLAN_PROCESS_SCHEME_IS_LOCK);
|
throw new ServiceException(THIS_PLAN_PROCESS_SCHEME_IS_LOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-22
@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
|||||||
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
||||||
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
||||||
import com.cf.imes.framework.common.enums.OrderPackageTypeEnum;
|
import com.cf.imes.framework.common.enums.OrderPackageTypeEnum;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.PageParam;
|
import com.cf.imes.framework.common.pojo.PageParam;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
@@ -96,7 +96,6 @@ import java.util.regex.Pattern;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
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.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
||||||
@@ -266,7 +265,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
|
|
||||||
// 判断是否存在排单
|
// 判断是否存在排单
|
||||||
if (planDO == null) {
|
if (planDO == null) {
|
||||||
throw exception(PLAN_NOT_EXISTS);
|
throw new ServiceException(PLAN_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> orderIds = JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class);
|
List<Long> orderIds = JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class);
|
||||||
@@ -463,7 +462,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
if (order != null) {
|
if (order != null) {
|
||||||
//判断是否已经导入
|
//判断是否已经导入
|
||||||
// if (!validateOrderNoExists(order.getApiOrderId(), OrganContextHolder.getOrganId())) {
|
// if (!validateOrderNoExists(order.getApiOrderId(), OrganContextHolder.getOrganId())) {
|
||||||
// throw exception(ORDER_EXISTS);
|
// throw new ServiceException(ORDER_EXISTS);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
validateCustomOrderNoExists(order.getCustomOrderNo());
|
validateCustomOrderNoExists(order.getCustomOrderNo());
|
||||||
@@ -613,7 +612,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
outputStream.write(buffer);
|
outputStream.write(buffer);
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw exception(FILE_NOT_EXISTS);
|
throw new ServiceException(FILE_NOT_EXISTS);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -623,7 +622,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
// 查询生产单
|
// 查询生产单
|
||||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, OrganContextHolder.getOrganId());
|
OrderDO orderDO = orderMapper.selectOrderOne(orderId, OrganContextHolder.getOrganId());
|
||||||
if (orderDO == null) {
|
if (orderDO == null) {
|
||||||
throw exception(ORDER_NOT_EXISTS);
|
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return getDataByOrderIdAndType(orderDO, type, OrderDeletedEnum.NOT_DELETED.getStatus());
|
return getDataByOrderIdAndType(orderDO, type, OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||||
// return getDataByOrderIdAndTypeDetail(orderDO, type, OrderDeletedEnum.NOT_DELETED.getStatus());
|
// return getDataByOrderIdAndTypeDetail(orderDO, type, OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||||
@@ -691,11 +690,11 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, getUserOrganId(), index);
|
OrderDO orderDO = orderMapper.selectOrderOne(orderId, getUserOrganId(), index);
|
||||||
if (orderDO == null)
|
if (orderDO == null)
|
||||||
throw exception(ORDER_NOT_EXISTS);
|
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||||
// 状态排除
|
// 状态排除
|
||||||
if (!Objects.equals(orderDO.getStatus(), OrderStatusEnum.EMPTY.getStatus()) &&
|
if (!Objects.equals(orderDO.getStatus(), OrderStatusEnum.EMPTY.getStatus()) &&
|
||||||
!Objects.equals(orderDO.getStatus(), OrderStatusEnum.NEW_ORDER.getStatus()))
|
!Objects.equals(orderDO.getStatus(), OrderStatusEnum.NEW_ORDER.getStatus()))
|
||||||
throw exception(ORDER_NOT_CANCEL);
|
throw new ServiceException(ORDER_NOT_CANCEL);
|
||||||
return orderMapper.updateOrderDeleted(orderId, deleted, getUserOrganId());
|
return orderMapper.updateOrderDeleted(orderId, deleted, getUserOrganId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,7 +726,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
private void validateOrderExists(Long id, Long organId, Integer deleted) {
|
private void validateOrderExists(Long id, Long organId, Integer deleted) {
|
||||||
OrderDO orderDO = orderMapper.selectOrderOne(id, organId, deleted);
|
OrderDO orderDO = orderMapper.selectOrderOne(id, organId, deleted);
|
||||||
if (orderDO == null) {
|
if (orderDO == null) {
|
||||||
throw exception(ORDER_NOT_EXISTS);
|
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,7 +743,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
|
|
||||||
// 判断手机号是否匹配正则表达式
|
// 判断手机号是否匹配正则表达式
|
||||||
if (!matcher.matches()) {
|
if (!matcher.matches()) {
|
||||||
throw exception(PHONE_NOT_LAWFUL);
|
throw new ServiceException(PHONE_NOT_LAWFUL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -757,7 +756,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
.eq(OrderDO::getCustomOrderNo, customOrderNo)
|
.eq(OrderDO::getCustomOrderNo, customOrderNo)
|
||||||
.eq(OrderDO::getDeleted, false)
|
.eq(OrderDO::getDeleted, false)
|
||||||
.eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
.eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||||
throw exception(CUSTOM_ORDER_EXISTS);
|
throw new ServiceException(CUSTOM_ORDER_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -771,7 +770,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
.eq(OrderDO::getCustomOrderNo, customOrderNo)
|
.eq(OrderDO::getCustomOrderNo, customOrderNo)
|
||||||
.eq(OrderDO::getDeleted, false)
|
.eq(OrderDO::getDeleted, false)
|
||||||
.eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
.eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||||
throw exception(CUSTOM_ORDER_EXISTS);
|
throw new ServiceException(CUSTOM_ORDER_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -794,7 +793,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
.eqIfPresent(OrderBodyDO::getId, bodyId));
|
.eqIfPresent(OrderBodyDO::getId, bodyId));
|
||||||
|
|
||||||
if (bodyCount == 0) {
|
if (bodyCount == 0) {
|
||||||
throw exception(ORDER_BODY_NOT_EXISTS);
|
throw new ServiceException(ORDER_BODY_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyIds.add(bodyId);
|
bodyIds.add(bodyId);
|
||||||
@@ -849,7 +848,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
// } else if (plateGoodDOS != null && !plateGoodDOS.isEmpty()) { // 存在板材
|
// } else if (plateGoodDOS != null && !plateGoodDOS.isEmpty()) { // 存在板材
|
||||||
// goodsDO.setGoodsId(plateGoodDOS.get(0).getGoodsId());
|
// goodsDO.setGoodsId(plateGoodDOS.get(0).getGoodsId());
|
||||||
// } else { // 不存在板材
|
// } else { // 不存在板材
|
||||||
//// throw exception(ORDER_MATCH_NOT);
|
//// throw new ServiceException(ORDER_MATCH_NOT);
|
||||||
// long plateNo = idWorker.nextId();
|
// long plateNo = idWorker.nextId();
|
||||||
// long obtainingTime = idWorker.obtainingTime();
|
// long obtainingTime = idWorker.obtainingTime();
|
||||||
//
|
//
|
||||||
@@ -893,7 +892,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
if (plateGoodDOs != null && !plateGoodDOs.isEmpty()) {//存在板材
|
if (plateGoodDOs != null && !plateGoodDOs.isEmpty()) {//存在板材
|
||||||
goodsDO.setGoodsId(plateGoodDOs.get(0).getGoodsId());
|
goodsDO.setGoodsId(plateGoodDOs.get(0).getGoodsId());
|
||||||
} else { // 不存在板材
|
} else { // 不存在板材
|
||||||
throw exception(PLATE_ATTRIBUTE_NOT_EXIST, goodsDO.getGoodsId() == null ? "" : goodsDO.getGoodsId(), goodsDO.getGoodsName(), goodsDO.getMaterial(), goodsDO.getColor(), goodsDO.getThickness());
|
throw new ServiceException(PLATE_ATTRIBUTE_NOT_EXIST, goodsDO.getGoodsId() == null ? "" : goodsDO.getGoodsId(), goodsDO.getGoodsName(), goodsDO.getMaterial(), goodsDO.getColor(), goodsDO.getThickness());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1111,7 +1110,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
map.put(plateCountKey, plateMapper.countPlateByOrderId(orderDO.getId(), OrganContextHolder.getOrganId(), deleted));
|
map.put(plateCountKey, plateMapper.countPlateByOrderId(orderDO.getId(), OrganContextHolder.getOrganId(), deleted));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw exception(FILE_TYPE_ERR);
|
throw new ServiceException(FILE_TYPE_ERR);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -1153,7 +1152,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
map.put(plateCountKey, plateMapper.countPlateByOrderId(orderDO.getId(), OrganContextHolder.getOrganId(), deleted));
|
map.put(plateCountKey, plateMapper.countPlateByOrderId(orderDO.getId(), OrganContextHolder.getOrganId(), deleted));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw exception(FILE_TYPE_ERR);
|
throw new ServiceException(FILE_TYPE_ERR);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -1241,11 +1240,11 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, organId);
|
OrderDO orderDO = orderMapper.selectOrderOne(orderId, organId);
|
||||||
if (orderDO == null)
|
if (orderDO == null)
|
||||||
throw exception(ORDER_NOT_EXISTS);
|
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||||
|
|
||||||
|
|
||||||
if (ObjectUtils.isEmpty(roomIds) && ObjectUtils.isEmpty(bodyId)) {
|
if (ObjectUtils.isEmpty(roomIds) && ObjectUtils.isEmpty(bodyId)) {
|
||||||
throw exception(ORDER_ERROR);
|
throw new ServiceException(ORDER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断小板是否已开料,已开料不允许删除
|
// 判断小板是否已开料,已开料不允许删除
|
||||||
@@ -1444,7 +1443,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
// 如果是补板校验生产单存在
|
// 如果是补板校验生产单存在
|
||||||
Long orderId = importAsyncReqVO.getOrderId();
|
Long orderId = importAsyncReqVO.getOrderId();
|
||||||
if (ObjectUtil.isNotNull(orderId)) {
|
if (ObjectUtil.isNotNull(orderId)) {
|
||||||
Optional.ofNullable(getOrder(orderId)).orElseThrow(() -> ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_NOT_EXISTS, orderId));
|
Optional.ofNullable(getOrder(orderId)).orElseThrow(() -> new ServiceException(ORDER_IMPORT_ORDER_NOT_EXISTS, orderId));
|
||||||
}
|
}
|
||||||
// 准备前置数据,准备完成发送消息消费解析临时表
|
// 准备前置数据,准备完成发送消息消费解析临时表
|
||||||
orderImportHandler.prepareAndConvert(importAsyncReqVO, file);
|
orderImportHandler.prepareAndConvert(importAsyncReqVO, file);
|
||||||
@@ -1458,11 +1457,11 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
|
|
||||||
|
|
||||||
if (Objects.isNull(orderId) && Objects.isNull(planId)) {
|
if (Objects.isNull(orderId) && Objects.isNull(planId)) {
|
||||||
throw exception(ORDER_PLAN_ID_NOT_NULL);
|
throw new ServiceException(ORDER_PLAN_ID_NOT_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Objects.isNull(orderId) && !Objects.isNull(planId)) {
|
if (!Objects.isNull(orderId) && !Objects.isNull(planId)) {
|
||||||
throw exception(ORDER_PLAN_ID_IS_ONE);
|
throw new ServiceException(ORDER_PLAN_ID_IS_ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Long organId = getUserOrganId();
|
Long organId = getUserOrganId();
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
package com.cf.imes.module.executor.service.orderImport.factory;
|
package com.cf.imes.module.executor.service.orderImport.factory;
|
||||||
|
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import com.cf.imes.module.executor.enums.ErrorCodeConstants;
|
import com.cf.imes.module.executor.enums.ErrorCodeConstants;
|
||||||
import com.cf.imes.module.executor.enums.OrderImportTypeEnum;
|
import com.cf.imes.module.executor.enums.OrderImportTypeEnum;
|
||||||
import com.cf.imes.module.executor.service.orderImport.OrderImportHandler;
|
import com.cf.imes.module.executor.service.orderImport.OrderImportHandler;
|
||||||
@@ -45,7 +44,7 @@ public class OrderImportHandlerFactory {
|
|||||||
if (StringUtils.isEmpty(factoryName)) {
|
if (StringUtils.isEmpty(factoryName)) {
|
||||||
factoryName = "default";
|
factoryName = "default";
|
||||||
}
|
}
|
||||||
ServiceException typeNotSupportException = ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_IMPORT_TYPE_NOT_SUPPORT, type);
|
ServiceException typeNotSupportException = new ServiceException(ErrorCodeConstants.ORDER_IMPORT_TYPE_NOT_SUPPORT, type);
|
||||||
switch (importTypeEnum) {
|
switch (importTypeEnum) {
|
||||||
case EXCEL:
|
case EXCEL:
|
||||||
return Optional.ofNullable(getExcelHandler(factoryName)).orElseThrow(() -> typeNotSupportException);
|
return Optional.ofNullable(getExcelHandler(factoryName)).orElseThrow(() -> typeNotSupportException);
|
||||||
|
|||||||
+2
-11
@@ -3,9 +3,6 @@ package com.cf.imes.module.executor.service.orderImport.handler.xml;
|
|||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
import com.cf.imes.framework.redis.config.ChenfengCacheProperties;
|
|
||||||
import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
|
||||||
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
|
||||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderImportAsyncReqVO;
|
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderImportAsyncReqVO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.orderImport.OrderImportTaskDO;
|
import com.cf.imes.module.executor.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||||
import com.cf.imes.module.executor.dal.mysql.orderImport.OrderImportTaskMapper;
|
import com.cf.imes.module.executor.dal.mysql.orderImport.OrderImportTaskMapper;
|
||||||
@@ -21,15 +18,14 @@ import org.springframework.amqp.core.Message;
|
|||||||
import org.springframework.amqp.core.MessageBuilder;
|
import org.springframework.amqp.core.MessageBuilder;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.support.TransactionSynchronization;
|
import org.springframework.transaction.support.TransactionSynchronization;
|
||||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_FILE_ANALYZE_ERROR;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_FILE_ANALYZE_ERROR;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gqr
|
* @author Gqr
|
||||||
@@ -53,12 +49,6 @@ public class DefaultXmlOrderImportHandler implements AbstractXmlOrderImportHandl
|
|||||||
@Resource
|
@Resource
|
||||||
private RabbitTemplate rabbitTemplate;
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RedisLockUtil redisLockUtil;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ChenfengCacheProperties chenfengCacheProperties;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PlateGoodMapper plateGoodMapper;
|
private PlateGoodMapper plateGoodMapper;
|
||||||
|
|
||||||
@@ -68,6 +58,7 @@ public class DefaultXmlOrderImportHandler implements AbstractXmlOrderImportHandl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void prepareAndConvert(OrderImportAsyncReqVO importAsyncReqVO, MultipartFile file) {
|
public void prepareAndConvert(OrderImportAsyncReqVO importAsyncReqVO, MultipartFile file) {
|
||||||
// 创建任务
|
// 创建任务
|
||||||
Long taskId = createImportTask(file.getOriginalFilename());
|
Long taskId = createImportTask(file.getOriginalFilename());
|
||||||
|
|||||||
+2
-8
@@ -4,14 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils;
|
|
||||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
|
||||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateTermsPageReqVO;
|
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateTermsPageReqVO;
|
||||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -24,12 +20,10 @@ import java.util.*;
|
|||||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.*;
|
import com.cf.imes.module.executor.controller.admin.orderParts.vo.*;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.pojo.PageParam;
|
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
|
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
|
||||||
|
|
||||||
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.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
@@ -73,7 +67,7 @@ public class OrderPartsServiceImpl implements OrderPartsService {
|
|||||||
|
|
||||||
private void validateOrderPartsExists(Long id) {
|
private void validateOrderPartsExists(Long id) {
|
||||||
if (orderPartsMapper.selectById(id) == null) {
|
if (orderPartsMapper.selectById(id) == null) {
|
||||||
throw exception(ORDER_PARTS_NOT_EXISTS);
|
throw new ServiceException(ORDER_PARTS_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +85,7 @@ public class OrderPartsServiceImpl implements OrderPartsService {
|
|||||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||||
public OrderPartsImportRespVO importOrderPartsList(List<OrderPartsSaveReqVO> importOrderParts, Long orderId) {
|
public OrderPartsImportRespVO importOrderPartsList(List<OrderPartsSaveReqVO> importOrderParts, Long orderId) {
|
||||||
if (CollUtil.isEmpty(importOrderParts)) {
|
if (CollUtil.isEmpty(importOrderParts)) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_PARTS_IMPORT_LIST_IS_EMPTY);
|
throw new ServiceException(ErrorCodeConstants.ORDER_PARTS_IMPORT_LIST_IS_EMPTY);
|
||||||
}
|
}
|
||||||
OrderPartsImportRespVO respVO = OrderPartsImportRespVO.builder().createOrderParts(new ArrayList<OrderPartsSaveReqVO>())
|
OrderPartsImportRespVO respVO = OrderPartsImportRespVO.builder().createOrderParts(new ArrayList<OrderPartsSaveReqVO>())
|
||||||
.updateOrderParts(new ArrayList<>()).failureOrderParts(new LinkedHashMap<>()).build();
|
.updateOrderParts(new ArrayList<>()).failureOrderParts(new LinkedHashMap<>()).build();
|
||||||
|
|||||||
+15
-17
@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||||
import com.cf.imes.framework.common.enums.*;
|
import com.cf.imes.framework.common.enums.*;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -71,7 +70,6 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR;
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR;
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR;
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR;
|
||||||
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.parseArray;
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||||
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
||||||
@@ -199,7 +197,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
planDOS.forEach(f-> processSchemeModelDOS.forEach(p->{
|
planDOS.forEach(f-> processSchemeModelDOS.forEach(p->{
|
||||||
@@ -226,7 +224,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
if(updateReqVO.getProcessId() != null){
|
if(updateReqVO.getProcessId() != null){
|
||||||
|
|
||||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||||
throw exception(THIS_PLAN_PLATE_IS_CUT);
|
throw new ServiceException(THIS_PLAN_PLATE_IS_CUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
planDO.setProcessId(updateReqVO.getProcessId());
|
planDO.setProcessId(updateReqVO.getProcessId());
|
||||||
@@ -281,7 +279,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
// 获取排单下的订单号集合
|
// 获取排单下的订单号集合
|
||||||
planDOS.forEach(f->{
|
planDOS.forEach(f->{
|
||||||
if ( f.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || f.getStatus().equals(PlanStatusEnum.OPENED.getStatus()) ) {
|
if ( f.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || f.getStatus().equals(PlanStatusEnum.OPENED.getStatus()) ) {
|
||||||
throw exception(PLAN_NOT_ALLOW_DELETE,f.getId());
|
throw new ServiceException(PLAN_NOT_ALLOW_DELETE,f.getId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -365,7 +363,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||||
.set(GoodsDO::getVersion, version + 1));
|
.set(GoodsDO::getVersion, version + 1));
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -684,7 +682,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
if(planDOS.size() != planIds.size()){
|
if(planDOS.size() != planIds.size()){
|
||||||
planDOS.forEach(f->{
|
planDOS.forEach(f->{
|
||||||
if(!planIds.contains(f.getId())){
|
if(!planIds.contains(f.getId())){
|
||||||
throw exception(PLAN_NOT_DATA_EXISTS,f.getId());
|
throw new ServiceException(PLAN_NOT_DATA_EXISTS,f.getId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -760,7 +758,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
PlanDO planDO = planMapper.selectById(planId);
|
PlanDO planDO = planMapper.selectById(planId);
|
||||||
|
|
||||||
if(planDO == null){
|
if(planDO == null){
|
||||||
throw exception(PLAN_NOT_DATA_EXISTS,planId);
|
throw new ServiceException(PLAN_NOT_DATA_EXISTS,planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
sorts.add(planDO.getSort());
|
sorts.add(planDO.getSort());
|
||||||
@@ -960,7 +958,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw exception(PLAN_PLATE_OPTIMIZE_DATA_ERROR);
|
throw new ServiceException(PLAN_PLATE_OPTIMIZE_DATA_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1016,7 +1014,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
for (Long planId : planIds) {
|
for (Long planId : planIds) {
|
||||||
PlanDO planDO = planMapper.selectById(planId);
|
PlanDO planDO = planMapper.selectById(planId);
|
||||||
if(ObjectUtils.isEmpty(planDO)){
|
if(ObjectUtils.isEmpty(planDO)){
|
||||||
throw exception(PLAN_NOT_DATA_EXISTS,planId);
|
throw new ServiceException(PLAN_NOT_DATA_EXISTS,planId);
|
||||||
}
|
}
|
||||||
planDOS.add(planDO);
|
planDOS.add(planDO);
|
||||||
}
|
}
|
||||||
@@ -1144,16 +1142,16 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
List<Long> processIds = new ArrayList<>();
|
List<Long> processIds = new ArrayList<>();
|
||||||
planDOS.forEach(f->{
|
planDOS.forEach(f->{
|
||||||
if (f.getStatus().equals(PlanStatusEnum.OPENED.getStatus())) {
|
if (f.getStatus().equals(PlanStatusEnum.OPENED.getStatus())) {
|
||||||
throw exception(PLAN_PLATE_IS_ALL_CUT,f.getId());
|
throw new ServiceException(PLAN_PLATE_IS_ALL_CUT,f.getId());
|
||||||
}
|
}
|
||||||
processIds.add(Optional.ofNullable(f.getProcessId()).orElseThrow(() -> exception(PLAN_PROCESS_CONFIG_IS_NULL,f.getId())));
|
processIds.add(Optional.ofNullable(f.getProcessId()).orElseThrow(() -> new ServiceException(PLAN_PROCESS_CONFIG_IS_NULL,f.getId())));
|
||||||
});
|
});
|
||||||
|
|
||||||
Integer processSize = systemConfigApi.getProcessSizeByIds(processIds).getCheckedData();
|
Integer processSize = systemConfigApi.getProcessSizeByIds(processIds).getCheckedData();
|
||||||
|
|
||||||
for (PlanDO planDO : planDOS) {
|
for (PlanDO planDO : planDOS) {
|
||||||
if (planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())) {
|
if (planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())) {
|
||||||
throw exception(PLAN_PLATE_IS_ALL_CUT,planDO.getId());
|
throw new ServiceException(PLAN_PLATE_IS_ALL_CUT,planDO.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1393,7 +1391,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||||
.set(GoodsDO::getVersion, version + 1));
|
.set(GoodsDO::getVersion, version + 1));
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1447,7 +1445,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||||
.set(GoodsDO::getVersion, version + 1));
|
.set(GoodsDO::getVersion, version + 1));
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1974,7 +1972,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||||
.set(GoodsDO::getVersion, version + 1));
|
.set(GoodsDO::getVersion, version + 1));
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
throw new ServiceException(ErrorCodeConstants.CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2012,7 +2010,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
}
|
}
|
||||||
int update = orderMapper.update(updateWrapper);
|
int update = orderMapper.update(updateWrapper);
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CREATE_PLAN_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
throw new ServiceException(ErrorCodeConstants.CREATE_PLAN_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-15
@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||||
import com.cf.imes.framework.common.enums.*;
|
import com.cf.imes.framework.common.enums.*;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -44,7 +43,6 @@ import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
|||||||
import com.cf.imes.module.executor.enums.OrderItemType;
|
import com.cf.imes.module.executor.enums.OrderItemType;
|
||||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||||
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -59,11 +57,10 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||||
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.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.ORDER_PLATE_MODEL;
|
import static com.cf.imes.module.executor.enums.EsIndexEnum.ORDER_PLATE_MODEL;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
|
||||||
/**
|
/**
|
||||||
* 生产单板件 Service 实现类
|
* 生产单板件 Service 实现类
|
||||||
*
|
*
|
||||||
@@ -155,12 +152,12 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
for (PlateDO plateDO : plateDOS) {
|
for (PlateDO plateDO : plateDOS) {
|
||||||
|
|
||||||
if(!plateDO.getType().equals(OrderPlateTypeEnum.SELFINCREASINGBOARD.getType())){
|
if(!plateDO.getType().equals(OrderPlateTypeEnum.SELFINCREASINGBOARD.getType())){
|
||||||
throw exception(PLATE_IS_SOURCE,plateDO.getPlateNo());
|
throw new ServiceException(PLATE_IS_SOURCE,plateDO.getPlateNo());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!plateDO.getIsCutted().equals(OrderPlateCutStatusEnum.NOCUTTING.getStatus())){
|
if(!plateDO.getIsCutted().equals(OrderPlateCutStatusEnum.NOCUTTING.getStatus())){
|
||||||
|
|
||||||
throw exception(THIS_PLATE_IS_OPTIMIZE,plateDO.getPlateNo());
|
throw new ServiceException(THIS_PLATE_IS_OPTIMIZE,plateDO.getPlateNo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +226,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||||
.set(GoodsDO::getVersion, version + 1));
|
.set(GoodsDO::getVersion, version + 1));
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,7 +264,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
}
|
}
|
||||||
int update = orderMapper.update(updateWrapper);
|
int update = orderMapper.update(updateWrapper);
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -299,7 +296,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
|
|
||||||
private void validatePlateExists(Long id) {
|
private void validatePlateExists(Long id) {
|
||||||
if (plateMapper.selectById(id) == null) {
|
if (plateMapper.selectById(id) == null) {
|
||||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +433,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||||
public PlateImportRespVO importPlatesList(List<PlateSaveReqVO> importPlates, Long orderId) {
|
public PlateImportRespVO importPlatesList(List<PlateSaveReqVO> importPlates, Long orderId) {
|
||||||
if (CollUtil.isEmpty(importPlates)) {
|
if (CollUtil.isEmpty(importPlates)) {
|
||||||
throw ServiceExceptionUtil.exception(RAW_GOODS_IMPORT_LIST_IS_EMPTY);
|
throw new ServiceException(RAW_GOODS_IMPORT_LIST_IS_EMPTY);
|
||||||
}
|
}
|
||||||
PlateImportRespVO respVO = PlateImportRespVO.builder().createPlates(new ArrayList<PlateSaveReqVO>())
|
PlateImportRespVO respVO = PlateImportRespVO.builder().createPlates(new ArrayList<PlateSaveReqVO>())
|
||||||
.updatePlates(new ArrayList<>()).failurePlates(new LinkedHashMap<>()).build();
|
.updatePlates(new ArrayList<>()).failurePlates(new LinkedHashMap<>()).build();
|
||||||
@@ -532,7 +529,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
|
|
||||||
List<OrderModelDO> orderPlateModelDOS = new ArrayList<>();
|
List<OrderModelDO> orderPlateModelDOS = new ArrayList<>();
|
||||||
|
|
||||||
Long planId = Optional.ofNullable(reqVO.get(0).getPlanId()).orElseThrow(()-> exception(ORDER_PLAN_PLATE_ERROR));
|
Long planId = Optional.ofNullable(reqVO.get(0).getPlanId()).orElseThrow(()-> new ServiceException(ORDER_PLAN_PLATE_ERROR));
|
||||||
|
|
||||||
PlanDO planDO = planMapper.selectById(planId);
|
PlanDO planDO = planMapper.selectById(planId);
|
||||||
AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR);
|
AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR);
|
||||||
@@ -694,7 +691,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
.set(OrderDO::getVersion, version + 1);
|
.set(OrderDO::getVersion, version + 1);
|
||||||
int update = orderMapper.update(updateWrapper);
|
int update = orderMapper.update(updateWrapper);
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -721,7 +718,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
.set(GoodsDO::getPlateNum, goodsPlateNumAndAreaPlanInfo.getNum() + goodsDO.getPlateNum())
|
.set(GoodsDO::getPlateNum, goodsPlateNumAndAreaPlanInfo.getNum() + goodsDO.getPlateNum())
|
||||||
.set(GoodsDO::getVersion, version + 1));
|
.set(GoodsDO::getVersion, version + 1));
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -781,7 +778,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
|
|
||||||
|
|
||||||
if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){
|
if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){
|
||||||
throw exception(PLAN_IS_MIXED_ERROR);
|
throw new ServiceException(PLAN_IS_MIXED_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 相同材质和厚度
|
// 相同材质和厚度
|
||||||
@@ -822,7 +819,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){
|
if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){
|
||||||
|
|
||||||
if(!planDO.getStatus().equals(PlanStatusEnum.NOCUTTING.getStatus())){
|
if(!planDO.getStatus().equals(PlanStatusEnum.NOCUTTING.getStatus())){
|
||||||
throw exception(PLAN_PLATE_IS_CUTTING);
|
throw new ServiceException(PLAN_PLATE_IS_CUTTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 相同材质和厚度 混单
|
// 相同材质和厚度 混单
|
||||||
|
|||||||
+6
-8
@@ -2,8 +2,8 @@ package com.cf.imes.module.executor.service.process;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
|
||||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||||
@@ -42,10 +42,8 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
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.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
import static com.cf.imes.module.executor.enums.ProcessTypeEnum.TYPE_EIGHT;
|
|
||||||
import static com.cf.imes.module.executor.enums.ProcessTypeEnum.TYPE_SEVEN;
|
import static com.cf.imes.module.executor.enums.ProcessTypeEnum.TYPE_SEVEN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,11 +91,11 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
|||||||
OrderDO order = orderMapper.selectOrderOne(orderId, organId, status);
|
OrderDO order = orderMapper.selectOrderOne(orderId, organId, status);
|
||||||
// 当生产不为删除时,校验生产单存在
|
// 当生产不为删除时,校验生产单存在
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
throw exception(ORDER_NOT_EXISTS);
|
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||||
}else {
|
}else {
|
||||||
// 校验生产单状态
|
// 校验生产单状态
|
||||||
if (order.getStatus() != OrderStatusEnum.NEW_ORDER.getStatus()) {
|
if (order.getStatus() != OrderStatusEnum.NEW_ORDER.getStatus()) {
|
||||||
throw exception(ORDER_STATUS_CONFLICT);
|
throw new ServiceException(ORDER_STATUS_CONFLICT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,14 +103,14 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
|||||||
// 校验工序组存在
|
// 校验工序组存在
|
||||||
private void checkProcessGroup(Long id) {
|
private void checkProcessGroup(Long id) {
|
||||||
if (!processGroupApi.getProcessGroup(id)) {
|
if (!processGroupApi.getProcessGroup(id)) {
|
||||||
throw exception(PROCESS_GROUP_NOT_EXISTS);
|
throw new ServiceException(PROCESS_GROUP_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验是否已经存在该生产单对应的工序组
|
// 校验是否已经存在该生产单对应的工序组
|
||||||
private void checkOrderProcessExists(Long orderId, Long organId) {
|
private void checkOrderProcessExists(Long orderId, Long organId) {
|
||||||
if (orderProcessMapper.getOrderProcess(orderId, organId)) {
|
if (orderProcessMapper.getOrderProcess(orderId, organId)) {
|
||||||
throw exception(ORDER_PROCESS_EXISTS);
|
throw new ServiceException(ORDER_PROCESS_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +290,7 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
|||||||
|
|
||||||
private void validateOrderProcessExists(Long id) {
|
private void validateOrderProcessExists(Long id) {
|
||||||
if (orderProcessMapper.selectById(id) == null) {
|
if (orderProcessMapper.selectById(id) == null) {
|
||||||
throw exception(ORDER_PROCESS_NOT_EXISTS);
|
throw new ServiceException(ORDER_PROCESS_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-6
@@ -9,14 +9,9 @@ import java.util.*;
|
|||||||
import com.cf.imes.module.executor.controller.admin.processStep.vo.*;
|
import com.cf.imes.module.executor.controller.admin.processStep.vo.*;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.processStep.ProcessStepDO;
|
import com.cf.imes.module.executor.dal.dataobject.processStep.ProcessStepDO;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.pojo.PageParam;
|
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
import com.cf.imes.module.executor.dal.mysql.processStep.ProcessStepMapper;
|
import com.cf.imes.module.executor.dal.mysql.processStep.ProcessStepMapper;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产单工序步骤 Service 实现类
|
* 生产单工序步骤 Service 实现类
|
||||||
*
|
*
|
||||||
@@ -60,7 +55,7 @@ public class ProcessStepServiceImpl implements ProcessStepService {
|
|||||||
|
|
||||||
private void validateProcessStepExists(Long id) {
|
private void validateProcessStepExists(Long id) {
|
||||||
if (processStepMapper.selectById(id) == null) {
|
if (processStepMapper.selectById(id) == null) {
|
||||||
// throw exception(PROCESS_STEP_NOT_EXISTS);
|
// throw new ServiceException(PROCESS_STEP_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -2,7 +2,6 @@ package com.cf.imes.module.executor.service.rawgoods;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO;
|
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO;
|
||||||
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsPageReqVO;
|
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsPageReqVO;
|
||||||
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsSaveReqVO;
|
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsSaveReqVO;
|
||||||
@@ -19,7 +18,6 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
|||||||
|
|
||||||
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
|
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
|
||||||
|
|
||||||
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.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.RAW_GOODS_IMPORT_LIST_IS_EMPTY;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.RAW_GOODS_IMPORT_LIST_IS_EMPTY;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.RAW_GOODS_NOT_EXISTS;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.RAW_GOODS_NOT_EXISTS;
|
||||||
@@ -64,7 +62,7 @@ public class RawGoodsServiceImpl implements RawGoodsService {
|
|||||||
|
|
||||||
private void validateRawGoodsExists(Long id) {
|
private void validateRawGoodsExists(Long id) {
|
||||||
if (rawGoodsMapper.selectById(id) == null) {
|
if (rawGoodsMapper.selectById(id) == null) {
|
||||||
throw exception(RAW_GOODS_NOT_EXISTS);
|
throw new ServiceException(RAW_GOODS_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +80,7 @@ public class RawGoodsServiceImpl implements RawGoodsService {
|
|||||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||||
public RawGoodsImportRespVO importRawGoodsList(List<RawGoodsSaveReqVO> importRawGoods, Long orderId) {
|
public RawGoodsImportRespVO importRawGoodsList(List<RawGoodsSaveReqVO> importRawGoods, Long orderId) {
|
||||||
if (CollUtil.isEmpty(importRawGoods)) {
|
if (CollUtil.isEmpty(importRawGoods)) {
|
||||||
throw ServiceExceptionUtil.exception(RAW_GOODS_IMPORT_LIST_IS_EMPTY);
|
throw new ServiceException(RAW_GOODS_IMPORT_LIST_IS_EMPTY);
|
||||||
}
|
}
|
||||||
RawGoodsImportRespVO respVO = RawGoodsImportRespVO.builder().createRawGoods(new ArrayList<>())
|
RawGoodsImportRespVO respVO = RawGoodsImportRespVO.builder().createRawGoods(new ArrayList<>())
|
||||||
.updateRawGoods(new ArrayList<>()).failureRawGoods(new LinkedHashMap<>()).build();
|
.updateRawGoods(new ArrayList<>()).failureRawGoods(new LinkedHashMap<>()).build();
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.executor.service.remainplate;
|
package com.cf.imes.module.executor.service.remainplate;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||||
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
|
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -12,7 +13,6 @@ import com.cf.imes.framework.common.pojo.PageResult;
|
|||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +55,7 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
|||||||
|
|
||||||
private void validateRemainPlateExists(Long id) {
|
private void validateRemainPlateExists(Long id) {
|
||||||
if (remainPlateMapper.selectById(id) == null) {
|
if (remainPlateMapper.selectById(id) == null) {
|
||||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -8,7 +8,6 @@ import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPl
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.util.ResourceUtils;
|
import org.springframework.util.ResourceUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import jakarta.servlet.ServletOutputStream;
|
import jakarta.servlet.ServletOutputStream;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@@ -17,7 +16,7 @@ import java.io.InputStream;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* excel 文件写入
|
* excel 文件写入
|
||||||
|
|||||||
+7
-6
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.executor.util.file;
|
package com.cf.imes.module.executor.util.file;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@@ -10,7 +11,7 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ public class FileHelperUtil {
|
|||||||
outputStream.write(buffer);
|
outputStream.write(buffer);
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw exception(FILE_NOT_EXISTS);
|
throw new ServiceException(FILE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,16 +50,16 @@ public class FileHelperUtil {
|
|||||||
public static boolean checkFile(MultipartFile file,
|
public static boolean checkFile(MultipartFile file,
|
||||||
Long fileSize) {
|
Long fileSize) {
|
||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
throw exception(FILE_NULL);
|
throw new ServiceException(FILE_NULL);
|
||||||
}
|
}
|
||||||
if (!(file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls"))) {
|
if (!(file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls"))) {
|
||||||
throw exception(FILE_FORMAT_ERROR);
|
throw new ServiceException(FILE_FORMAT_ERROR);
|
||||||
}
|
}
|
||||||
if (file.getSize() > fileSize) {
|
if (file.getSize() > fileSize) {
|
||||||
throw exception(FILE_EXCEED_SIZE);
|
throw new ServiceException(FILE_EXCEED_SIZE);
|
||||||
}
|
}
|
||||||
if (file.getSize() == 0) {
|
if (file.getSize() == 0) {
|
||||||
throw exception(FILE_CONTENT_NULL);
|
throw new ServiceException(FILE_CONTENT_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+17
-17
@@ -2,6 +2,7 @@ package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.module.system.api.application.ApplicationApi;
|
import com.cf.imes.module.system.api.application.ApplicationApi;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
@@ -14,7 +15,6 @@ import java.time.format.DateTimeFormatter;
|
|||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@ public class ApiDataAchieve {
|
|||||||
JSONObject json = apiDataProduction.getApiTokenMessage(appId, appSecret);
|
JSONObject json = apiDataProduction.getApiTokenMessage(appId, appSecret);
|
||||||
if (!json.getString(ERR_MSG_KEY).equals("success")) {
|
if (!json.getString(ERR_MSG_KEY).equals("success")) {
|
||||||
log.error(APP_TOKEN_ERROR.getMsg());
|
log.error(APP_TOKEN_ERROR.getMsg());
|
||||||
throw exception(API_MES_ERR, "身份认证-" + json.getString(ERR_MSG_KEY));
|
throw new ServiceException(API_MES_ERR, "身份认证-" + json.getString(ERR_MSG_KEY));
|
||||||
// throw exception(APP_TOKEN_ERROR);
|
// throw new ServiceException(APP_TOKEN_ERROR);
|
||||||
}
|
}
|
||||||
return new AsyncResult<>(json);
|
return new AsyncResult<>(json);
|
||||||
}
|
}
|
||||||
@@ -79,8 +79,8 @@ public class ApiDataAchieve {
|
|||||||
JSONObject parts = apiDataProduction.getApiOrderPartsMessage(token, jsonParts);
|
JSONObject parts = apiDataProduction.getApiOrderPartsMessage(token, jsonParts);
|
||||||
if (!parts.getString(ERR_CODE_KEY).equals("0")) {
|
if (!parts.getString(ERR_CODE_KEY).equals("0")) {
|
||||||
log.error("N" + orderNo + "配件数据获取错误:" + parts.getString(ERR_MSG_KEY));
|
log.error("N" + orderNo + "配件数据获取错误:" + parts.getString(ERR_MSG_KEY));
|
||||||
throw exception(API_MES_ERR, "配件信息获取-" + parts.getString(ERR_MSG_KEY));
|
throw new ServiceException(API_MES_ERR, "配件信息获取-" + parts.getString(ERR_MSG_KEY));
|
||||||
// throw exception(PARTS_DATA_ERROR);
|
// throw new ServiceException(PARTS_DATA_ERROR);
|
||||||
}
|
}
|
||||||
if (parts.getJSONObject(VALUE_KEY).getJSONArray("List") == null || parts.getJSONObject(VALUE_KEY).getJSONArray("List").isEmpty()) {
|
if (parts.getJSONObject(VALUE_KEY).getJSONArray("List") == null || parts.getJSONObject(VALUE_KEY).getJSONArray("List").isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -99,8 +99,8 @@ public class ApiDataAchieve {
|
|||||||
JSONObject body = apiDataProduction.getApiOrderBodyMessage(token, jsonBody);
|
JSONObject body = apiDataProduction.getApiOrderBodyMessage(token, jsonBody);
|
||||||
if (!body.getString(ERR_CODE_KEY).equals("0")) {
|
if (!body.getString(ERR_CODE_KEY).equals("0")) {
|
||||||
log.error("N" + orderNo + "柜体数据获取错误:" + body.getString(ERR_MSG_KEY));
|
log.error("N" + orderNo + "柜体数据获取错误:" + body.getString(ERR_MSG_KEY));
|
||||||
throw exception(API_MES_ERR, "柜体信息获取-" + body.getString(ERR_MSG_KEY));
|
throw new ServiceException(API_MES_ERR, "柜体信息获取-" + body.getString(ERR_MSG_KEY));
|
||||||
// throw exception(BODY_DATA_ERROR);
|
// throw new ServiceException(BODY_DATA_ERROR);
|
||||||
}
|
}
|
||||||
JSONObject dataBody = new JSONObject();
|
JSONObject dataBody = new JSONObject();
|
||||||
for (int i = 1; i <= body.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) {
|
for (int i = 1; i <= body.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) {
|
||||||
@@ -123,8 +123,8 @@ public class ApiDataAchieve {
|
|||||||
JSONObject goods = apiDataProduction.getApiOrderGoodsMessage(token, jsonGoods);
|
JSONObject goods = apiDataProduction.getApiOrderGoodsMessage(token, jsonGoods);
|
||||||
if (!goods.getString(ERR_CODE_KEY).equals("0")) {
|
if (!goods.getString(ERR_CODE_KEY).equals("0")) {
|
||||||
log.error("N" + orderNo + "商品信息转换失败:" + goods.getString(ERR_MSG_KEY));
|
log.error("N" + orderNo + "商品信息转换失败:" + goods.getString(ERR_MSG_KEY));
|
||||||
throw exception(API_MES_ERR, "商品信息获取-" + goods.getString(ERR_MSG_KEY));
|
throw new ServiceException(API_MES_ERR, "商品信息获取-" + goods.getString(ERR_MSG_KEY));
|
||||||
// throw exception(GOODS_DATA_ERROR);
|
// throw new ServiceException(GOODS_DATA_ERROR);
|
||||||
}
|
}
|
||||||
JSONObject dataGoods = new JSONObject();
|
JSONObject dataGoods = new JSONObject();
|
||||||
for (int i = 1; i <= goods.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) {
|
for (int i = 1; i <= goods.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) {
|
||||||
@@ -143,8 +143,8 @@ public class ApiDataAchieve {
|
|||||||
JSONObject plates = apiDataProduction.getApiBlocksDataMessage(token, jsonPlates);
|
JSONObject plates = apiDataProduction.getApiBlocksDataMessage(token, jsonPlates);
|
||||||
if (!plates.getString(ERR_CODE_KEY).equals("0")) {
|
if (!plates.getString(ERR_CODE_KEY).equals("0")) {
|
||||||
log.error("N" + orderNo + "板材明细信息获取错误" + plates.getString(ERR_MSG_KEY));
|
log.error("N" + orderNo + "板材明细信息获取错误" + plates.getString(ERR_MSG_KEY));
|
||||||
throw exception(API_MES_ERR, "板材明细信息获取-" + plates.getString(ERR_MSG_KEY));
|
throw new ServiceException(API_MES_ERR, "板材明细信息获取-" + plates.getString(ERR_MSG_KEY));
|
||||||
// throw exception(PLATE_DATA_ERROR);
|
// throw new ServiceException(PLATE_DATA_ERROR);
|
||||||
}
|
}
|
||||||
if (plates.getJSONObject(VALUE_KEY).getJSONArray("List") == null || plates.getJSONObject(VALUE_KEY).getJSONArray("List").isEmpty()) {
|
if (plates.getJSONObject(VALUE_KEY).getJSONArray("List") == null || plates.getJSONObject(VALUE_KEY).getJSONArray("List").isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -172,7 +172,7 @@ public class ApiDataAchieve {
|
|||||||
JSONObject blocks = apiDataProduction.getApiBlocksMessage(token, jsonBlocks);
|
JSONObject blocks = apiDataProduction.getApiBlocksMessage(token, jsonBlocks);
|
||||||
if (!blocks.getString(ERR_CODE_KEY).equals("0")) {
|
if (!blocks.getString(ERR_CODE_KEY).equals("0")) {
|
||||||
log.error("N" + orderNo + "板材数据获取错误" + blocks.getString(ERR_MSG_KEY));
|
log.error("N" + orderNo + "板材数据获取错误" + blocks.getString(ERR_MSG_KEY));
|
||||||
throw exception(API_MES_ERR, "板材数据信息获取-" + blocks.getString(ERR_MSG_KEY));
|
throw new ServiceException(API_MES_ERR, "板材数据信息获取-" + blocks.getString(ERR_MSG_KEY));
|
||||||
}
|
}
|
||||||
JSONObject block = new JSONObject();
|
JSONObject block = new JSONObject();
|
||||||
for (int i = 1; i <= blocks.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) {
|
for (int i = 1; i <= blocks.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) {
|
||||||
@@ -193,7 +193,7 @@ public class ApiDataAchieve {
|
|||||||
JSONObject good = apiDataProduction.getApiGoods(token, jsonGoods);
|
JSONObject good = apiDataProduction.getApiGoods(token, jsonGoods);
|
||||||
if (!good.getString(ERR_CODE_KEY).equals("0")) {
|
if (!good.getString(ERR_CODE_KEY).equals("0")) {
|
||||||
log.error(id + "配件数据获取错误" + good.getString(ERR_MSG_KEY));
|
log.error(id + "配件数据获取错误" + good.getString(ERR_MSG_KEY));
|
||||||
throw exception(API_MES_ERR, "配件数据信息获取-" + good.getString(ERR_MSG_KEY));
|
throw new ServiceException(API_MES_ERR, "配件数据信息获取-" + good.getString(ERR_MSG_KEY));
|
||||||
|
|
||||||
}
|
}
|
||||||
return new AsyncResult<>(good);
|
return new AsyncResult<>(good);
|
||||||
@@ -213,7 +213,7 @@ public class ApiDataAchieve {
|
|||||||
if (!order.getString(ProduceApiConstants.CODE).equals("0") ||
|
if (!order.getString(ProduceApiConstants.CODE).equals("0") ||
|
||||||
order.getJSONArray(ProduceApiConstants.DATA) == null ||
|
order.getJSONArray(ProduceApiConstants.DATA) == null ||
|
||||||
order.getJSONArray(ProduceApiConstants.DATA).isEmpty()) {
|
order.getJSONArray(ProduceApiConstants.DATA).isEmpty()) {
|
||||||
throw exception(ORDER_NOT_FOUND);
|
throw new ServiceException(ORDER_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
return order;
|
return order;
|
||||||
@@ -230,13 +230,13 @@ public class ApiDataAchieve {
|
|||||||
LocalDate endTime = LocalDate.parse(createDateMax, formatter);
|
LocalDate endTime = LocalDate.parse(createDateMax, formatter);
|
||||||
long daysBetweenSimple = ChronoUnit.DAYS.between(startTime, endTime);
|
long daysBetweenSimple = ChronoUnit.DAYS.between(startTime, endTime);
|
||||||
if (daysBetweenSimple > 30) {
|
if (daysBetweenSimple > 30) {
|
||||||
throw exception(ORDER_DATE_ERR);
|
throw new ServiceException(ORDER_DATE_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonOrders.put("create_date_min", createDateMin + " 00:00:00");
|
jsonOrders.put("create_date_min", createDateMin + " 00:00:00");
|
||||||
jsonOrders.put("create_date_max", createDateMax + " 23:59:59");
|
jsonOrders.put("create_date_max", createDateMax + " 23:59:59");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw exception(ORDER_TIME_ERR);
|
throw new ServiceException(ORDER_TIME_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 订单列表
|
// 订单列表
|
||||||
@@ -260,7 +260,7 @@ public class ApiDataAchieve {
|
|||||||
|
|
||||||
JSONObject orders = apiDataProduction.getApiOrderList(token, jsonOrders);
|
JSONObject orders = apiDataProduction.getApiOrderList(token, jsonOrders);
|
||||||
if (!orders.getString(ERR_CODE_KEY).equals("0")) {
|
if (!orders.getString(ERR_CODE_KEY).equals("0")) {
|
||||||
throw exception(ORDER_READ_ERR);
|
throw new ServiceException(ORDER_READ_ERR);
|
||||||
}
|
}
|
||||||
JSONObject order = new JSONObject();
|
JSONObject order = new JSONObject();
|
||||||
int countPage = divideWithPlusOne(orders.getInteger("count"), PARTS_PAGE_MAX);
|
int countPage = divideWithPlusOne(orders.getInteger("count"), PARTS_PAGE_MAX);
|
||||||
|
|||||||
+11
-11
@@ -3,6 +3,7 @@ package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;//packa
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
|
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.dto.Point;
|
import com.cf.imes.module.executor.controller.admin.plan.dto.Point;
|
||||||
@@ -30,7 +31,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_DETAIL_DATE_ERR;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_DETAIL_DATE_ERR;
|
||||||
|
|
||||||
@@ -117,8 +117,8 @@ public class ApiTypeRealize {
|
|||||||
|
|
||||||
// 判断生产数据是否可以为空
|
// 判断生产数据是否可以为空
|
||||||
if (!platesData.getMapPlatesInfos().isEmpty() && plateDetailData.getMapPlateDetails().isEmpty() ) {
|
if (!platesData.getMapPlatesInfos().isEmpty() && plateDetailData.getMapPlateDetails().isEmpty() ) {
|
||||||
throw exception(ORDER_DETAIL_DATE_ERR);
|
throw new ServiceException(ORDER_DETAIL_DATE_ERR);
|
||||||
// throw exception(API_MES_ERR, "生产数据信息获取-小板缺少生产数据,导致无法正常导单");
|
// throw new ServiceException(API_MES_ERR, "生产数据信息获取-小板缺少生产数据,导致无法正常导单");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 小板数据补充,order_goods_id添加造型相关数据判断获取,以及配件中添加goods_id
|
// 小板数据补充,order_goods_id添加造型相关数据判断获取,以及配件中添加goods_id
|
||||||
@@ -219,15 +219,15 @@ public class ApiTypeRealize {
|
|||||||
// 第一步判断是否存在需要进行数据添加的小板
|
// 第一步判断是否存在需要进行数据添加的小板
|
||||||
if (mapPlatesInfos == null || mapPlatesInfos.isEmpty()) {
|
if (mapPlatesInfos == null || mapPlatesInfos.isEmpty()) {
|
||||||
log.error("小板信息:{}" , PLATE_DATA_ERROR);
|
log.error("小板信息:{}" , PLATE_DATA_ERROR);
|
||||||
// throw exception(PLATE_DATA_ERROR);
|
// throw new ServiceException(PLATE_DATA_ERROR);
|
||||||
}
|
}
|
||||||
if (mapPlateDetails == null || mapPlateDetails.isEmpty()) {
|
if (mapPlateDetails == null || mapPlateDetails.isEmpty()) {
|
||||||
log.error("小板信息:{}" , PLATE_PRODUCE_DATA_ERROR);
|
log.error("小板信息:{}" , PLATE_PRODUCE_DATA_ERROR);
|
||||||
// throw exception(PLATE_PRODUCE_DATA_ERROR);
|
// throw new ServiceException(PLATE_PRODUCE_DATA_ERROR);
|
||||||
}
|
}
|
||||||
if (mapGoodsDO == null || mapGoodsDO.isEmpty()) {
|
if (mapGoodsDO == null || mapGoodsDO.isEmpty()) {
|
||||||
log.error("板材信息:{}" , GOODS_DATA_ERROR);
|
log.error("板材信息:{}" , GOODS_DATA_ERROR);
|
||||||
// throw exception(GOODS_DATA_ERROR);
|
// throw new ServiceException(GOODS_DATA_ERROR);
|
||||||
}
|
}
|
||||||
mapPlatesInfos.forEach((k, v) -> {
|
mapPlatesInfos.forEach((k, v) -> {
|
||||||
// 判断是否有造型数据可以进行整合
|
// 判断是否有造型数据可以进行整合
|
||||||
@@ -250,7 +250,7 @@ public class ApiTypeRealize {
|
|||||||
// 获取小板对应的造型信息
|
// 获取小板对应的造型信息
|
||||||
PlateDetail plateDetail = mapPlateDetails.get(k);
|
PlateDetail plateDetail = mapPlateDetails.get(k);
|
||||||
if (plateDetail == null) {
|
if (plateDetail == null) {
|
||||||
throw exception(ORDER_DETAIL_DATE_ERR);
|
throw new ServiceException(ORDER_DETAIL_DATE_ERR);
|
||||||
}
|
}
|
||||||
plateDetail.setPlateId(v.getId())
|
plateDetail.setPlateId(v.getId())
|
||||||
.setExtraRemark(mapPlateDetailsRemarks.get(k).getExtraRemark())
|
.setExtraRemark(mapPlateDetailsRemarks.get(k).getExtraRemark())
|
||||||
@@ -439,7 +439,7 @@ public class ApiTypeRealize {
|
|||||||
|
|
||||||
// if (bodyLists == null || bodyLists.isEmpty()) {
|
// if (bodyLists == null || bodyLists.isEmpty()) {
|
||||||
// log.error("{}房间柜体信息获取失败",orderNo);
|
// log.error("{}房间柜体信息获取失败",orderNo);
|
||||||
// throw exception(ORDER_BODY_NOT_EXISTS);
|
// throw new ServiceException(ORDER_BODY_NOT_EXISTS);
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -947,12 +947,12 @@ public class ApiTypeRealize {
|
|||||||
|
|
||||||
if (platesJSONObject == null || platesJSONObject.isEmpty()) {
|
if (platesJSONObject == null || platesJSONObject.isEmpty()) {
|
||||||
log.error("获取板件明细数据失败");
|
log.error("获取板件明细数据失败");
|
||||||
throw exception(PLATE_PLAN_DATA_ERROR);
|
throw new ServiceException(PLATE_PLAN_DATA_ERROR);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (blocksJSONObject == null || blocksJSONObject.isEmpty()) {
|
if (blocksJSONObject == null || blocksJSONObject.isEmpty()) {
|
||||||
log.error("获取板材数据失败");
|
log.error("获取板材数据失败");
|
||||||
throw exception(PLATE_GOOD_DATA_NULL);
|
throw new ServiceException(PLATE_GOOD_DATA_NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
// 板材数据
|
// 板材数据
|
||||||
@@ -1516,7 +1516,7 @@ public class ApiTypeRealize {
|
|||||||
|
|
||||||
if (map == null || map.isEmpty()) {
|
if (map == null || map.isEmpty()) {
|
||||||
log.error("明细信息:{}" , CHANGE_DETAILS_ITEM_ERROR);
|
log.error("明细信息:{}" , CHANGE_DETAILS_ITEM_ERROR);
|
||||||
// throw exception(CHANGE_DETAILS_ITEM_ERROR);
|
// throw new ServiceException(CHANGE_DETAILS_ITEM_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理第一个 Map
|
// 处理第一个 Map
|
||||||
|
|||||||
+23
-24
@@ -10,7 +10,6 @@ import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
|
|||||||
import com.alibaba.excel.util.ListUtils;
|
import com.alibaba.excel.util.ListUtils;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
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.json.JsonUtils;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
@@ -290,7 +289,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
*/
|
*/
|
||||||
private void validCustomOrderNo(String key, String val) {
|
private void validCustomOrderNo(String key, String val) {
|
||||||
if (StringUtils.isNotEmpty(val) && !orderService.customOrderNoIsExists(val)) {
|
if (StringUtils.isNotEmpty(val) && !orderService.customOrderNoIsExists(val)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val);
|
throw new ServiceException(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +301,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
*/
|
*/
|
||||||
private void validOrderInfoEmpty(String key, String val) {
|
private void validOrderInfoEmpty(String key, String val) {
|
||||||
if (StringUtils.isEmpty(val)) {
|
if (StringUtils.isEmpty(val)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_EMPTY, key);
|
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_EMPTY, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +314,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
*/
|
*/
|
||||||
private void validOrderInfoLength(String key, String val, int length) {
|
private void validOrderInfoLength(String key, String val, int length) {
|
||||||
if (StringUtils.isNotEmpty(val) && length < val.length()) {
|
if (StringUtils.isNotEmpty(val) && length < val.length()) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length);
|
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +326,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
*/
|
*/
|
||||||
private void validOrderInfoPhone(String key, String val) {
|
private void validOrderInfoPhone(String key, String val) {
|
||||||
if (StringUtils.isNotEmpty(val) && Boolean.FALSE.equals(ToolUtil.validatePhoneNumber(val))) {
|
if (StringUtils.isNotEmpty(val) && Boolean.FALSE.equals(ToolUtil.validatePhoneNumber(val))) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key);
|
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +340,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
try {
|
try {
|
||||||
return LocalDateTimeUtil.parseDate(val, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
return LocalDateTimeUtil.parseDate(val, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key);
|
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,7 +645,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectUtil.isNull(plateGoodDO)) {
|
if (ObjectUtil.isNull(plateGoodDO)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, rowIndex + 1);
|
throw new ServiceException(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, rowIndex + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,11 +661,11 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
// 判断非空,字典值判断
|
// 判断非空,字典值判断
|
||||||
public void isNotEmptyAndDict(String value, String dictType, String errValue) {
|
public void isNotEmptyAndDict(String value, String dictType, String errValue) {
|
||||||
if (StringUtils.isEmpty(value)) {
|
if (StringUtils.isEmpty(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||||
} else {
|
} else {
|
||||||
DictDataRespDTO dictDataRespDTO = dictDataApi.parseDictData(dictType, value).getData();
|
DictDataRespDTO dictDataRespDTO = dictDataApi.parseDictData(dictType, value).getData();
|
||||||
if (dictDataRespDTO == null) {
|
if (dictDataRespDTO == null) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -674,12 +673,12 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
// 非空判断,错误填入
|
// 非空判断,错误填入
|
||||||
private void isEmpty(String value, String errValue, int length) {
|
private void isEmpty(String value, String errValue, int length) {
|
||||||
if (StringUtils.isEmpty(value)) {
|
if (StringUtils.isEmpty(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||||
} else {
|
} else {
|
||||||
// 字符串长度检查
|
// 字符串长度检查
|
||||||
int size = value.length();
|
int size = value.length();
|
||||||
if (size > length) {
|
if (size > length) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -688,7 +687,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
// 判断非零,错误返回;不为空时,判断是否符合枚举类
|
// 判断非零,错误返回;不为空时,判断是否符合枚举类
|
||||||
private void isNotEmptyAndBack(String value, Class<? extends Enum<?>> enumClass, String errValue, int length) {
|
private void isNotEmptyAndBack(String value, Class<? extends Enum<?>> enumClass, String errValue, int length) {
|
||||||
if (StringUtils.isEmpty(value)) {
|
if (StringUtils.isEmpty(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||||
} else {
|
} else {
|
||||||
isEmptyAndSize(value, length, errValue);
|
isEmptyAndSize(value, length, errValue);
|
||||||
try {
|
try {
|
||||||
@@ -705,10 +704,10 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
||||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -729,13 +728,13 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
if (Boolean.TRUE.equals(ToolUtil.convertToType(value, targetType))) {
|
if (Boolean.TRUE.equals(ToolUtil.convertToType(value, targetType))) {
|
||||||
if (Boolean.TRUE.equals(ToolUtil.checkNumber(value))) {
|
if (Boolean.TRUE.equals(ToolUtil.checkNumber(value))) {
|
||||||
if (!ToolUtil.checkPrecision(value, length, decimalLength)) {
|
if (!ToolUtil.checkPrecision(value, length, decimalLength)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + POSITIVE_ERR);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + POSITIVE_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -754,13 +753,13 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
if (Boolean.TRUE.equals(ToolUtil.convertToType(value, targetType))) {
|
if (Boolean.TRUE.equals(ToolUtil.convertToType(value, targetType))) {
|
||||||
if (Boolean.TRUE.equals(checkPositiveNumber(value))) {
|
if (Boolean.TRUE.equals(checkPositiveNumber(value))) {
|
||||||
if (!ToolUtil.checkPrecision(value, length, decimalLength)) {
|
if (!ToolUtil.checkPrecision(value, length, decimalLength)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "必须大于0");
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "必须大于0");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -768,7 +767,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
// 判断非零,错误返回
|
// 判断非零,错误返回
|
||||||
private void isNotEmptyAndBack(String value, String errValue) {
|
private void isNotEmptyAndBack(String value, String errValue) {
|
||||||
if (StringUtils.isEmpty(value)) {
|
if (StringUtils.isEmpty(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,7 +776,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
if (StringUtils.isNotEmpty(value)) {
|
if (StringUtils.isNotEmpty(value)) {
|
||||||
int size = value.length();
|
int size = value.length();
|
||||||
if (size > length) {
|
if (size > length) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -786,10 +785,10 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
|||||||
public void isEmptyAndPositiveNumber(String value, Class<?> targetType, String errValue) {
|
public void isEmptyAndPositiveNumber(String value, Class<?> targetType, String errValue) {
|
||||||
if (StringUtils.isNotEmpty(value)) {
|
if (StringUtils.isNotEmpty(value)) {
|
||||||
if (Boolean.FALSE.equals(ToolUtil.convertToType(value, targetType))) {
|
if (Boolean.FALSE.equals(ToolUtil.convertToType(value, targetType))) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
||||||
} else {
|
} else {
|
||||||
if (Boolean.FALSE.equals(checkPositiveNumber(value))) {
|
if (Boolean.FALSE.equals(checkPositiveNumber(value))) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "数量必须大于0");
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "数量必须大于0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-28
@@ -7,7 +7,7 @@ import cn.hutool.core.util.NumberUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.excel.util.ListUtils;
|
import com.alibaba.excel.util.ListUtils;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.dict.core.util.DictFrameworkUtils;
|
import com.cf.imes.framework.dict.core.util.DictFrameworkUtils;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
@@ -442,7 +442,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
// 从标签属性生成order对象
|
// 从标签属性生成order对象
|
||||||
OrderXmlVO orderXmlVO = getJavaBeanFromXmlAttr(OrderXmlVO.class, attributes);
|
OrderXmlVO orderXmlVO = getJavaBeanFromXmlAttr(OrderXmlVO.class, attributes);
|
||||||
if (ObjectUtil.isNull(orderXmlVO)) {
|
if (ObjectUtil.isNull(orderXmlVO)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, "生产单内容为空");
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, "生产单内容为空");
|
||||||
}
|
}
|
||||||
// 校验属性
|
// 校验属性
|
||||||
validOrderInfo(orderXmlVO);
|
validOrderInfo(orderXmlVO);
|
||||||
@@ -705,7 +705,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
if (ObjectUtil.isNotNull(plateGoodDO)) {
|
if (ObjectUtil.isNotNull(plateGoodDO)) {
|
||||||
plate.setItemCode(plateGoodDO.getGoodsId());
|
plate.setItemCode(plateGoodDO.getGoodsId());
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, location.getLineNumber());
|
throw new ServiceException(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, location.getLineNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1067,7 +1067,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
// 校验point数量
|
// 校验point数量
|
||||||
if (inGroove) {
|
if (inGroove) {
|
||||||
if (CollUtil.isEmpty(points)) {
|
if (CollUtil.isEmpty(points)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, "原始造型(外)轮廓点阵列表不能为空");
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, "原始造型(外)轮廓点阵列表不能为空");
|
||||||
}
|
}
|
||||||
grooveOutlineXmlVO.setPointXmlVOList(ListUtil.toList(points));
|
grooveOutlineXmlVO.setPointXmlVOList(ListUtil.toList(points));
|
||||||
} else {
|
} else {
|
||||||
@@ -1343,7 +1343,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
private void endPoints() {
|
private void endPoints() {
|
||||||
// 校验point数量
|
// 校验point数量
|
||||||
if (ObjectUtil.isNotNull(pointXmlVOS) && CollUtil.isEmpty(points)) {
|
if (ObjectUtil.isNotNull(pointXmlVOS) && CollUtil.isEmpty(points)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, inIslet ? "孤岛点阵列表不可为空" : "槽点坐标列表不可为空");
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, inIslet ? "孤岛点阵列表不可为空" : "槽点坐标列表不可为空");
|
||||||
}
|
}
|
||||||
if (inGroove) {
|
if (inGroove) {
|
||||||
groovePointXmlVOS.setPointXmlVOList(ListUtil.toList(points));
|
groovePointXmlVOS.setPointXmlVOList(ListUtil.toList(points));
|
||||||
@@ -1597,7 +1597,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(pointXmlVO.getItemCode())) {
|
if (StringUtils.isEmpty(pointXmlVO.getItemCode())) {
|
||||||
if (StringUtils.isEmpty(pointXmlVO.getEdgingColor()) || StringUtils.isEmpty(pointXmlVO.getEdgingMaterial())) {
|
if (StringUtils.isEmpty(pointXmlVO.getEdgingColor()) || StringUtils.isEmpty(pointXmlVO.getEdgingMaterial())) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, "当封边条没有物料编码时,封边条颜色、材质不可为空");
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, "当封边条没有物料编码时,封边条颜色、材质不可为空");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingThickness, pointXmlVO::setEdgingThickness, "0", Double.class, "edgingThickness");
|
isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingThickness, pointXmlVO::setEdgingThickness, "0", Double.class, "edgingThickness");
|
||||||
@@ -1718,7 +1718,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
|
|
||||||
// 检查roomCode
|
// 检查roomCode
|
||||||
if (!bodyEmpty) {
|
if (!bodyEmpty) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_BODYCODE_NOT_EXIST_VALID_ERROR, se, boxCode);
|
throw new ServiceException(ORDER_IMPORT_BODYCODE_NOT_EXIST_VALID_ERROR, se, boxCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
String roomName = NOT_ASSIGNED;
|
String roomName = NOT_ASSIGNED;
|
||||||
@@ -1729,7 +1729,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
} else {
|
} else {
|
||||||
// 检查roomCode
|
// 检查roomCode
|
||||||
if (!roomEmpty) {
|
if (!roomEmpty) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ROOMCODE_NOT_EXIST_VALID_ERROR, se, roomCode);
|
throw new ServiceException(ORDER_IMPORT_ROOMCODE_NOT_EXIST_VALID_ERROR, se, roomCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1768,7 +1768,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(groupCodes) && !groupCodeSet.contains(groupCodes)) {
|
if (StringUtils.isNotEmpty(groupCodes) && !groupCodeSet.contains(groupCodes)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_GROUPCODE_NOT_EXIST_VALID_ERROR, se, groupCodes);
|
throw new ServiceException(ORDER_IMPORT_GROUPCODE_NOT_EXIST_VALID_ERROR, se, groupCodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1793,7 +1793,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
*/
|
*/
|
||||||
private void validCustomOrderNo(String key, String val) {
|
private void validCustomOrderNo(String key, String val) {
|
||||||
if (StringUtils.isNotEmpty(val) && !orderService.customOrderNoIsExists(val)) {
|
if (StringUtils.isNotEmpty(val) && !orderService.customOrderNoIsExists(val)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val);
|
throw new ServiceException(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1805,7 +1805,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
*/
|
*/
|
||||||
private void validOrderInfoEmpty(String key, String val) {
|
private void validOrderInfoEmpty(String key, String val) {
|
||||||
if (StringUtils.isEmpty(val)) {
|
if (StringUtils.isEmpty(val)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_EMPTY, key);
|
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_EMPTY, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1818,7 +1818,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
*/
|
*/
|
||||||
private void validOrderInfoLength(String key, String val, int length) {
|
private void validOrderInfoLength(String key, String val, int length) {
|
||||||
if (StringUtils.isNotEmpty(val) && length < val.length()) {
|
if (StringUtils.isNotEmpty(val) && length < val.length()) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length);
|
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1830,7 +1830,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
*/
|
*/
|
||||||
private void validOrderInfoPhone(String key, String val) {
|
private void validOrderInfoPhone(String key, String val) {
|
||||||
if (StringUtils.isNotEmpty(val) && Boolean.FALSE.equals(ToolUtil.validatePhoneNumber(val))) {
|
if (StringUtils.isNotEmpty(val) && Boolean.FALSE.equals(ToolUtil.validatePhoneNumber(val))) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key);
|
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1844,7 +1844,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
try {
|
try {
|
||||||
return LocalDateTimeUtil.parseDate(val, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
return LocalDateTimeUtil.parseDate(val, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key);
|
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1872,10 +1872,10 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
private void positiveNumber(String value, String name, Class<?> targetType) {
|
private void positiveNumber(String value, String name, Class<?> targetType) {
|
||||||
if (ToolUtil.convertToType(value, targetType)) {
|
if (ToolUtil.convertToType(value, targetType)) {
|
||||||
if (!ToolUtil.checkNumber(value)) {
|
if (!ToolUtil.checkNumber(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1924,13 +1924,13 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
if (ToolUtil.convertToType(value, targetType)) {
|
if (ToolUtil.convertToType(value, targetType)) {
|
||||||
if (ToolUtil.checkNumber(value)) {
|
if (ToolUtil.checkNumber(value)) {
|
||||||
if (!ToolUtil.checkPrecision(value, length, decimalLength)) {
|
if (!ToolUtil.checkPrecision(value, length, decimalLength)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + LONG_ERR, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + LONG_ERR, name));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1967,7 +1967,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
setter.accept(defaultValue);
|
setter.accept(defaultValue);
|
||||||
} else {
|
} else {
|
||||||
if (!ToolUtil.convertToType(value.trim(), targetType)) {
|
if (!ToolUtil.convertToType(value.trim(), targetType)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1981,7 +1981,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
private void isEmptyAndBack(Supplier<String> getter, String name) {
|
private void isEmptyAndBack(Supplier<String> getter, String name) {
|
||||||
String value = getter.get();
|
String value = getter.get();
|
||||||
if (StringUtils.isEmpty(value)) {
|
if (StringUtils.isEmpty(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2001,7 +2001,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
} else {
|
} else {
|
||||||
String dictData = DictFrameworkUtils.parseDictDataValue(dictTypeConstants, value.trim());
|
String dictData = DictFrameworkUtils.parseDictDataValue(dictTypeConstants, value.trim());
|
||||||
if (StringUtils.isEmpty(dictData)) {
|
if (StringUtils.isEmpty(dictData)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2017,7 +2017,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
private void isEmptyAndPositiveNumber(Supplier<String> getter, String name, Consumer<String> setter, Class<?> targetType, Integer length, Integer decimalLength) {
|
private void isEmptyAndPositiveNumber(Supplier<String> getter, String name, Consumer<String> setter, Class<?> targetType, Integer length, Integer decimalLength) {
|
||||||
String value = getter.get();
|
String value = getter.get();
|
||||||
if (StringUtils.isEmpty(value)) {
|
if (StringUtils.isEmpty(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||||
} else {
|
} else {
|
||||||
positiveNumberSize(value, setter, targetType, name, length, decimalLength);
|
positiveNumberSize(value, setter, targetType, name, length, decimalLength);
|
||||||
}
|
}
|
||||||
@@ -2048,7 +2048,7 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
private void isEmptyBackAndPositiveNumber(Supplier<String> getter, String name, Class<?> targetType) {
|
private void isEmptyBackAndPositiveNumber(Supplier<String> getter, String name, Class<?> targetType) {
|
||||||
String value = getter.get();
|
String value = getter.get();
|
||||||
if (StringUtils.isEmpty(value)) {
|
if (StringUtils.isEmpty(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||||
} else {
|
} else {
|
||||||
positiveNumber(value, name, targetType);
|
positiveNumber(value, name, targetType);
|
||||||
}
|
}
|
||||||
@@ -2064,10 +2064,10 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
private void isEmptyBackAndNumber(Supplier<String> getter, Class<?> targetType, String name) {
|
private void isEmptyBackAndNumber(Supplier<String> getter, Class<?> targetType, String name) {
|
||||||
String value = getter.get();
|
String value = getter.get();
|
||||||
if (StringUtils.isEmpty(value)) {
|
if (StringUtils.isEmpty(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||||
} else {
|
} else {
|
||||||
if (!ToolUtil.convertToType(value.trim(), targetType)) {
|
if (!ToolUtil.convertToType(value.trim(), targetType)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2082,11 +2082,11 @@ public class DefaultOrderImportXmlParserHandler {
|
|||||||
private void isEmptyBackAndInvalid(Supplier<String> getter, String dictTypeConstants, String name) {
|
private void isEmptyBackAndInvalid(Supplier<String> getter, String dictTypeConstants, String name) {
|
||||||
String value = getter.get();
|
String value = getter.get();
|
||||||
if (com.alibaba.nacos.common.utils.StringUtils.isEmpty(value)) {
|
if (com.alibaba.nacos.common.utils.StringUtils.isEmpty(value)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||||
} else {
|
} else {
|
||||||
String dictData = DictFrameworkUtils.parseDictDataValue(dictTypeConstants, value.trim());
|
String dictData = DictFrameworkUtils.parseDictDataValue(dictTypeConstants, value.trim());
|
||||||
if (StringUtils.isEmpty(dictData)) {
|
if (StringUtils.isEmpty(dictData)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name));
|
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@ package com.cf.imes.module.executor.util.fileConversion.admin.files.xml;
|
|||||||
|
|
||||||
import com.alibaba.nacos.common.utils.StringUtils;
|
import com.alibaba.nacos.common.utils.StringUtils;
|
||||||
import com.alibaba.nacos.shaded.com.google.common.base.Function;
|
import com.alibaba.nacos.shaded.com.google.common.base.Function;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
|
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
|
||||||
@@ -108,7 +108,7 @@ public class XMLUtil {
|
|||||||
writer.write(xmlStr);
|
writer.write(xmlStr);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw ServiceExceptionUtil.exception(FILE_OUTPUT_ERROR, name);
|
throw new ServiceException(FILE_OUTPUT_ERROR, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||||
@@ -80,7 +80,7 @@ public class BodyNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRuleS
|
|||||||
} else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) {
|
} else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) {
|
||||||
generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDO);
|
generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDO);
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
throw new ServiceException(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||||
}
|
}
|
||||||
return generateConfig;
|
return generateConfig;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||||
@@ -131,7 +131,7 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
|
|||||||
} else if (ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
} else if (ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
||||||
orderNoSeq = resetByDay(orderNoSeq, orgCustomPlateNoSeqRespDTO, plateNoRule);
|
orderNoSeq = resetByDay(orderNoSeq, orgCustomPlateNoSeqRespDTO, plateNoRule);
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
throw new ServiceException(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||||
}
|
}
|
||||||
return orderNoSeq;
|
return orderNoSeq;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||||
@@ -82,7 +82,7 @@ public class PlateNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
|
|||||||
} else if (ObjectUtil.equal(ResetModeEnum.YEAR, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.MONTH, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
} else if (ObjectUtil.equal(ResetModeEnum.YEAR, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.MONTH, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
||||||
return generateNoByDateResetMode(resetModeEnum, plateNoRule, generateConfig, plateDO);
|
return generateNoByDateResetMode(resetModeEnum, plateNoRule, generateConfig, plateDO);
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
throw new ServiceException(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-16
@@ -7,22 +7,6 @@ import com.cf.imes.module.plan.dal.dataobject.orderImport.OrderImportTaskDO;
|
|||||||
* @since 2025/5/13 16:41
|
* @since 2025/5/13 16:41
|
||||||
*/
|
*/
|
||||||
public interface OrderImportTaskService {
|
public interface OrderImportTaskService {
|
||||||
/**
|
|
||||||
* 更新业务异常状态
|
|
||||||
*
|
|
||||||
* @param taskId
|
|
||||||
* @param organId
|
|
||||||
* @param serviceExceptionMessage
|
|
||||||
*/
|
|
||||||
void updateServiceExceptionTaskStatus(Long taskId, Long organId, String serviceExceptionMessage);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新异常状态
|
|
||||||
*
|
|
||||||
* @param taskId
|
|
||||||
* @param organId
|
|
||||||
*/
|
|
||||||
void updateExceptionTaskStatus(Long taskId, Long organId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认导入任务,更新任务状态
|
* 确认导入任务,更新任务状态
|
||||||
|
|||||||
-22
@@ -13,8 +13,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gqr
|
* @author Gqr
|
||||||
* @since 2025/5/13 16:41
|
* @since 2025/5/13 16:41
|
||||||
@@ -25,26 +23,6 @@ public class OrderImportTaskServiceImpl implements OrderImportTaskService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderImportTaskMapper orderImportTaskMapper;
|
private OrderImportTaskMapper orderImportTaskMapper;
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
|
||||||
public void updateServiceExceptionTaskStatus(Long taskId, Long organId, String serviceExceptionMessage) {
|
|
||||||
orderImportTaskMapper.update(new LambdaUpdateWrapper<OrderImportTaskDO>().eq(OrderImportTaskDO::getId, taskId)
|
|
||||||
.set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CONSUME_SUCCESS.getStatus())
|
|
||||||
.set(OrderImportTaskDO::getImportStatus, OrderImportStatusEnum.IMPORT_FAIL.getStatus())
|
|
||||||
.set(OrderImportTaskDO::getOrganId, organId)
|
|
||||||
.set(OrderImportTaskDO::getResult, serviceExceptionMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
|
||||||
public void updateExceptionTaskStatus(Long taskId, Long organId) {
|
|
||||||
orderImportTaskMapper.update(new LambdaUpdateWrapper<OrderImportTaskDO>().eq(OrderImportTaskDO::getId, taskId)
|
|
||||||
.set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CONSUME_SUCCESS.getStatus())
|
|
||||||
.set(OrderImportTaskDO::getImportStatus, OrderImportStatusEnum.IMPORT_FAIL.getStatus())
|
|
||||||
.set(OrderImportTaskDO::getOrganId, organId)
|
|
||||||
.set(OrderImportTaskDO::getResult, ORDER_IMPORT_FAIL.getMsg()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||||
public OrderImportTaskDO confirmOrderImport(Long taskId) {
|
public OrderImportTaskDO confirmOrderImport(Long taskId) {
|
||||||
|
|||||||
+7
-46
@@ -8,7 +8,6 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||||
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
@@ -47,10 +46,8 @@ import org.springframework.amqp.core.Message;
|
|||||||
import org.springframework.amqp.core.MessageBuilder;
|
import org.springframework.amqp.core.MessageBuilder;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.TransactionStatus;
|
|
||||||
import org.springframework.transaction.support.TransactionSynchronization;
|
import org.springframework.transaction.support.TransactionSynchronization;
|
||||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -61,7 +58,6 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_FAILED;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_FAILED;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORGANID_EMPTY_ERROR;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORGANID_EMPTY_ERROR;
|
||||||
@@ -110,9 +106,6 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
@Resource
|
@Resource
|
||||||
private RawGoodsMapper rawGoodsMapper;
|
private RawGoodsMapper rawGoodsMapper;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private DataSourceTransactionManager transactionManager;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SystemConfigApi systemConfigApi;
|
private SystemConfigApi systemConfigApi;
|
||||||
|
|
||||||
@@ -131,6 +124,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
private WebCadImportProperties webCadImportProperties;
|
private WebCadImportProperties webCadImportProperties;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean webCadOrderImport(MultipartFile file) {
|
public boolean webCadOrderImport(MultipartFile file) {
|
||||||
Long organId = OrganContextHolder.getOrganId();
|
Long organId = OrganContextHolder.getOrganId();
|
||||||
|
|
||||||
@@ -138,13 +132,9 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
throw new ServiceException(WEBCAD_ORDER_IMPORT_ORGANID_EMPTY_ERROR);
|
throw new ServiceException(WEBCAD_ORDER_IMPORT_ORGANID_EMPTY_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransactionStatus transactionStatus = transactionManager.getTransaction(TransactionDefinition.withDefaults());
|
|
||||||
// 是否同步处理
|
// 是否同步处理
|
||||||
boolean sync = true;
|
boolean sync = true;
|
||||||
|
|
||||||
// 异步发送是否成功,没有成功需要把锁解开
|
|
||||||
boolean initAsyncSuccess = false;
|
|
||||||
|
|
||||||
Long taskId = null;
|
Long taskId = null;
|
||||||
OrderDO orderDO = null;
|
OrderDO orderDO = null;
|
||||||
JsonFactory factory = new JsonFactory();
|
JsonFactory factory = new JsonFactory();
|
||||||
@@ -193,14 +183,9 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
// 缓存请求,创建导入任务
|
// 缓存请求,创建导入任务
|
||||||
taskId = initiateTask(node, organId, orderDO.getId(), fileName);
|
taskId = initiateTask(node, organId, orderDO.getId(), fileName);
|
||||||
|
|
||||||
// 上锁
|
|
||||||
addAsyncLock(taskId);
|
|
||||||
|
|
||||||
// 发送异步消息
|
// 发送异步消息
|
||||||
sendMessage(taskId);
|
sendMessage(taskId);
|
||||||
|
|
||||||
initAsyncSuccess = true;
|
|
||||||
|
|
||||||
// 跳过当前 blockData 解析步骤
|
// 跳过当前 blockData 解析步骤
|
||||||
parser.skipChildren(); // 忽略 blockData
|
parser.skipChildren(); // 忽略 blockData
|
||||||
}
|
}
|
||||||
@@ -208,18 +193,12 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
parser.skipChildren(); // 忽略其他字段
|
parser.skipChildren(); // 忽略其他字段
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 事务提交
|
|
||||||
transactionManager.commit(transactionStatus);
|
|
||||||
} catch (ServiceException se) {
|
} catch (ServiceException se) {
|
||||||
// 事务回滚
|
|
||||||
transactionManager.rollback(transactionStatus);
|
|
||||||
// 移除临时文件
|
// 移除临时文件
|
||||||
removeCacheFileWhenException(sync, taskId);
|
removeCacheFileWhenException(sync, taskId);
|
||||||
|
|
||||||
throw se;
|
throw se;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 事务回滚
|
|
||||||
transactionManager.rollback(transactionStatus);
|
|
||||||
// 移除临时文件
|
// 移除临时文件
|
||||||
removeCacheFileWhenException(sync, taskId);
|
removeCacheFileWhenException(sync, taskId);
|
||||||
|
|
||||||
@@ -227,7 +206,8 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
log.error(webcadOrderImportFailed.getMsg(), e);
|
log.error(webcadOrderImportFailed.getMsg(), e);
|
||||||
throw new ServiceException(webcadOrderImportFailed);
|
throw new ServiceException(webcadOrderImportFailed);
|
||||||
} finally {
|
} finally {
|
||||||
unlock(sync, initAsyncSuccess, organId, taskId);
|
// 同步解锁
|
||||||
|
unlock(sync, organId);
|
||||||
}
|
}
|
||||||
return sync;
|
return sync;
|
||||||
}
|
}
|
||||||
@@ -244,7 +224,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
.eq(OrderDO::getOrganId, organId)
|
.eq(OrderDO::getOrganId, organId)
|
||||||
.eq(OrderDO::getDeleted, false));
|
.eq(OrderDO::getDeleted, false));
|
||||||
if (ObjectUtil.isNull(orderDOFromOrderNo)) {
|
if (ObjectUtil.isNull(orderDOFromOrderNo)) {
|
||||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
throw new ServiceException(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
||||||
} else {
|
} else {
|
||||||
Integer status = orderDOFromOrderNo.getStatus();
|
Integer status = orderDOFromOrderNo.getStatus();
|
||||||
// 更新生产单来源为webcad
|
// 更新生产单来源为webcad
|
||||||
@@ -332,32 +312,13 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 加异步导入锁
|
|
||||||
*
|
|
||||||
* @param taskId
|
|
||||||
*/
|
|
||||||
private void addAsyncLock(Long taskId) {
|
|
||||||
String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, getUserOrganId());
|
|
||||||
// 检查机构导入锁
|
|
||||||
boolean lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout());
|
|
||||||
if (!lockResult) {
|
|
||||||
throw new ServiceException(ORDER_IMPORT_ORGAN_LOCK_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解锁
|
* 解锁
|
||||||
*/
|
*/
|
||||||
private void unlock(boolean sync, boolean initAsyncSuccess, Long organId, Long taskId) {
|
private void unlock(boolean sync, Long organId) {
|
||||||
if(sync) {
|
if (sync) {
|
||||||
// 解同步锁
|
// 解同步锁
|
||||||
redisLockUtil.releaseLock(String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId), REDIS_UNIQUEKEY);
|
redisLockUtil.releaseLock(String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId), REDIS_UNIQUEKEY);
|
||||||
} else {
|
|
||||||
// 异步发送消息失败了,解开异步锁
|
|
||||||
if (!initAsyncSuccess && ObjectUtil.isNotNull(taskId)) {
|
|
||||||
redisLockUtil.releaseLock(String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId), String.valueOf(taskId));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -53,7 +53,6 @@ import java.time.LocalDate;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORDER_NOT_EXISTS;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORDER_NOT_EXISTS;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
||||||
@@ -144,14 +143,14 @@ public class DefaultExcelOrderImportConsumer {
|
|||||||
|
|
||||||
organId = OrganContextHolder.getOrganId();
|
organId = OrganContextHolder.getOrganId();
|
||||||
if (ObjectUtil.isNull(organId)) {
|
if (ObjectUtil.isNull(organId)) {
|
||||||
throw exception(ORDER_IMPORT_ORGANID_NOT_EXISTS);
|
throw new ServiceException(ORDER_IMPORT_ORGANID_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查机构导入锁
|
// 检查机构导入锁
|
||||||
String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId);
|
String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId);
|
||||||
lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout());
|
lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout());
|
||||||
if (!lockResult) {
|
if (!lockResult) {
|
||||||
throw exception(ORDER_IMPORT_ORGAN_LOCK_ERROR);
|
throw new ServiceException(ORDER_IMPORT_ORGAN_LOCK_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确认任务,更新状态为消费成功,没有找到任务中断后续消费
|
// 确认任务,更新状态为消费成功,没有找到任务中断后续消费
|
||||||
@@ -225,7 +224,7 @@ public class DefaultExcelOrderImportConsumer {
|
|||||||
Long existOrderId = orderImportTempDataDO.getOrderId();
|
Long existOrderId = orderImportTempDataDO.getOrderId();
|
||||||
// 校验生产单id
|
// 校验生产单id
|
||||||
OrderDO orderDO = orderMapper.selectById(existOrderId);
|
OrderDO orderDO = orderMapper.selectById(existOrderId);
|
||||||
Optional.ofNullable(orderDO).orElseThrow(() -> exception(ORDER_IMPORT_ORDER_NOT_EXISTS, existOrderId));
|
Optional.ofNullable(orderDO).orElseThrow(() -> new ServiceException(ORDER_IMPORT_ORDER_NOT_EXISTS, existOrderId));
|
||||||
// 更新补板生产单属性
|
// 更新补板生产单属性
|
||||||
updateOrder(orderDO);
|
updateOrder(orderDO);
|
||||||
return orderDO;
|
return orderDO;
|
||||||
|
|||||||
+4
-5
@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
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.json.JsonUtils;
|
||||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||||
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
||||||
@@ -53,7 +52,7 @@ import java.time.LocalDate;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORDER_NOT_EXISTS;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORDER_NOT_EXISTS;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
||||||
@@ -141,14 +140,14 @@ public class DefaultXmlOrderImportConsumer {
|
|||||||
|
|
||||||
organId = OrganContextHolder.getOrganId();
|
organId = OrganContextHolder.getOrganId();
|
||||||
if (ObjectUtil.isNull(organId)) {
|
if (ObjectUtil.isNull(organId)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORGANID_NOT_EXISTS);
|
throw new ServiceException(ORDER_IMPORT_ORGANID_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查机构导入锁
|
// 检查机构导入锁
|
||||||
String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId);
|
String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId);
|
||||||
lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout());
|
lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout());
|
||||||
if (!lockResult) {
|
if (!lockResult) {
|
||||||
throw exception(ORDER_IMPORT_ORGAN_LOCK_ERROR);
|
throw new ServiceException(ORDER_IMPORT_ORGAN_LOCK_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确认任务,更新状态为消费成功,没有找到任务中断后续消费
|
// 确认任务,更新状态为消费成功,没有找到任务中断后续消费
|
||||||
@@ -222,7 +221,7 @@ public class DefaultXmlOrderImportConsumer {
|
|||||||
Long existOrderId = orderImportTempDataDO.getOrderId();
|
Long existOrderId = orderImportTempDataDO.getOrderId();
|
||||||
// 校验生产单id
|
// 校验生产单id
|
||||||
OrderDO orderDO = orderMapper.selectById(existOrderId);
|
OrderDO orderDO = orderMapper.selectById(existOrderId);
|
||||||
Optional.ofNullable(orderDO).orElseThrow(() -> ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_NOT_EXISTS, existOrderId));
|
Optional.ofNullable(orderDO).orElseThrow(() -> new ServiceException(ORDER_IMPORT_ORDER_NOT_EXISTS, existOrderId));
|
||||||
// 更新补板生产单属性
|
// 更新补板生产单属性
|
||||||
updateOrder(orderDO);
|
updateOrder(orderDO);
|
||||||
return orderDO;
|
return orderDO;
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ package com.cf.imes.module.plan.service.orderImport.consumer;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
||||||
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
||||||
@@ -57,7 +57,7 @@ public class OrderImportDeadLetterConsumer {
|
|||||||
channel.basicAck(deliveryTag, false);
|
channel.basicAck(deliveryTag, false);
|
||||||
|
|
||||||
if (StringUtils.isEmpty(peek)) {
|
if (StringUtils.isEmpty(peek)) {
|
||||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR);
|
throw new ServiceException(WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR);
|
||||||
} else {
|
} else {
|
||||||
DynamicDataSourceContextHolder.push(peek);
|
DynamicDataSourceContextHolder.push(peek);
|
||||||
}
|
}
|
||||||
|
|||||||
+43
-83
@@ -2,13 +2,12 @@ package com.cf.imes.module.plan.service.orderImport.consumer;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
|
import com.cf.imes.framework.redis.config.ChenfengCacheProperties;
|
||||||
import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
||||||
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
||||||
import com.cf.imes.module.executor.enums.OrderImportStatusEnum;
|
import com.cf.imes.module.executor.enums.OrderImportStatusEnum;
|
||||||
@@ -33,15 +32,14 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|||||||
import org.springframework.amqp.support.AmqpHeaders;
|
import org.springframework.amqp.support.AmqpHeaders;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|
||||||
import org.springframework.messaging.handler.annotation.Header;
|
import org.springframework.messaging.handler.annotation.Header;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
|
||||||
import org.springframework.transaction.TransactionStatus;
|
|
||||||
import org.thymeleaf.util.StringUtils;
|
import org.thymeleaf.util.StringUtils;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_ORGANID_NOT_EXISTS;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_ORGANID_NOT_EXISTS;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR;
|
||||||
@@ -107,7 +105,7 @@ public class WebCadOrderImportConsumer {
|
|||||||
private WebCadImportProperties webCadImportProperties;
|
private WebCadImportProperties webCadImportProperties;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DataSourceTransactionManager transactionManager;
|
private ChenfengCacheProperties chenfengCacheProperties;
|
||||||
|
|
||||||
@RabbitListener(queues = "#{@orderImportWebCadQueueName}")
|
@RabbitListener(queues = "#{@orderImportWebCadQueueName}")
|
||||||
public void orderImport(String message,
|
public void orderImport(String message,
|
||||||
@@ -118,27 +116,36 @@ public class WebCadOrderImportConsumer {
|
|||||||
|
|
||||||
Long organId = null;
|
Long organId = null;
|
||||||
Long taskId = Long.parseLong(message);
|
Long taskId = Long.parseLong(message);
|
||||||
boolean nackSent = false;
|
boolean lockResult = true;
|
||||||
TransactionStatus transactionStatus = null;
|
OrderImportTaskDO orderImportTaskDO = null;
|
||||||
try {
|
try {
|
||||||
|
// 手动确认消息接收
|
||||||
|
channel.basicAck(deliveryTag, false);
|
||||||
|
|
||||||
organId = OrganContextHolder.getOrganId();
|
organId = OrganContextHolder.getOrganId();
|
||||||
if (ObjectUtil.isNull(organId)) {
|
if (ObjectUtil.isNull(organId)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORGANID_NOT_EXISTS);
|
throw new ServiceException(ORDER_IMPORT_ORGANID_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isEmpty(peek)) {
|
if (StringUtils.isEmpty(peek)) {
|
||||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR);
|
throw new ServiceException(WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR);
|
||||||
} else {
|
} else {
|
||||||
DynamicDataSourceContextHolder.push(peek);
|
DynamicDataSourceContextHolder.push(peek);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取事务
|
// 检查机构导入锁
|
||||||
transactionStatus = transactionManager.getTransaction(TransactionDefinition.withDefaults());
|
String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId);
|
||||||
|
lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout());
|
||||||
|
if (!lockResult) {
|
||||||
|
throw new ServiceException(ORDER_IMPORT_ORGAN_LOCK_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
// 确认任务,更新状态为消费成功,没有找到任务中断后续消费
|
// 确认任务,更新状态为消费成功,没有找到任务中断后续消费
|
||||||
OrderImportTaskDO orderImportTaskDO = confirmOrderImport(taskId, organId);
|
orderImportTaskDO = orderImportTaskService.confirmOrderImport(taskId);
|
||||||
if (ObjectUtil.isNull(orderImportTaskDO)) {
|
if (ObjectUtil.isNull(orderImportTaskDO)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("====================【webcad异步拆单处理临时数据开始】====================");
|
log.info("====================【webcad异步拆单处理临时数据开始】====================");
|
||||||
WebCadOrderImportAsyncFactory webCadOrderImportAsyncFactory =
|
WebCadOrderImportAsyncFactory webCadOrderImportAsyncFactory =
|
||||||
new WebCadOrderImportAsyncFactory(organId, orderMapper, snowFlakeGenerator, orderBodyMapper, plateMapper, orderGroupMapper, idWorker,
|
new WebCadOrderImportAsyncFactory(organId, orderMapper, snowFlakeGenerator, orderBodyMapper, plateMapper, orderGroupMapper, idWorker,
|
||||||
@@ -146,89 +153,42 @@ public class WebCadOrderImportConsumer {
|
|||||||
webCadOrderImportAsyncFactory.analyzeTempData(taskId, webCadImportProperties.getTempFilePath());
|
webCadOrderImportAsyncFactory.analyzeTempData(taskId, webCadImportProperties.getTempFilePath());
|
||||||
log.info("====================【webcad异步拆单处理临时数据结束】====================");
|
log.info("====================【webcad异步拆单处理临时数据结束】====================");
|
||||||
|
|
||||||
// 提交事务
|
|
||||||
transactionManager.commit(transactionStatus);
|
|
||||||
} catch (ServiceException se) {
|
|
||||||
String seMessage = se.getMessage();
|
|
||||||
log.error(seMessage);
|
|
||||||
// 回滚事务
|
|
||||||
if (transactionStatus != null) {
|
|
||||||
transactionManager.rollback(transactionStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新任务状态
|
|
||||||
orderImportTaskService.updateServiceExceptionTaskStatus(taskId, organId, seMessage);
|
|
||||||
|
|
||||||
nackSent = true;
|
|
||||||
// 确认消息进入死信队列
|
|
||||||
channel.basicNack(deliveryTag, false, false);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(ORDER_IMPORT_FAIL.getMsg(), e);
|
log.error(ORDER_IMPORT_FAIL.getMsg(), e);
|
||||||
// 回滚事务
|
updateImportTaskFail(orderImportTaskDO, e);
|
||||||
if (transactionStatus != null) {
|
throw e;
|
||||||
transactionManager.rollback(transactionStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新任务状态
|
|
||||||
orderImportTaskService.updateExceptionTaskStatus(taskId, organId);
|
|
||||||
|
|
||||||
nackSent = true;
|
|
||||||
// 确认消息进入死信队列
|
|
||||||
channel.basicNack(deliveryTag, false, false);
|
|
||||||
} finally {
|
} finally {
|
||||||
// 手动确认消息接收
|
if (lockResult) {
|
||||||
if (!nackSent) {
|
// 导入锁解锁
|
||||||
channel.basicAck(deliveryTag, false);
|
redisLockUtil.releaseLock(String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId), message);
|
||||||
}
|
}
|
||||||
// 导入锁解锁
|
|
||||||
redisLockUtil.releaseLock(String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId), message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认导入任务,更新任务状态
|
* 更新导入任务为失败
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param orderImportTaskDO
|
||||||
|
* @param ex
|
||||||
*/
|
*/
|
||||||
private OrderImportTaskDO confirmOrderImport(Long taskId, Long organId) {
|
public void updateImportTaskFail(OrderImportTaskDO orderImportTaskDO, Exception ex) {
|
||||||
boolean taskExist = false;
|
if (orderImportTaskDO == null) {
|
||||||
OrderImportTaskDO orderImportTaskDO = null;
|
return;
|
||||||
// 线程每1s查询一次,查三次没有就提示任务不存在
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
orderImportTaskDO = orderImportTaskMapper.selectOne(new LambdaQueryWrapper<OrderImportTaskDO>()
|
|
||||||
.eq(OrderImportTaskDO::getId, taskId)
|
|
||||||
.eq(OrderImportTaskDO::getOrganId, organId));
|
|
||||||
if (ObjectUtil.isNotNull(orderImportTaskDO)) {
|
|
||||||
taskExist = true;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
log.error("====================【线程中断异常】====================");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (taskExist) {
|
String msg;
|
||||||
// 更新状态为消费成功
|
if (ex instanceof ServiceException) {
|
||||||
orderImportTaskMapper.update(new LambdaUpdateWrapper<OrderImportTaskDO>()
|
msg = ex.getMessage();
|
||||||
.eq(OrderImportTaskDO::getId, taskId)
|
|
||||||
.eq(OrderImportTaskDO::getOrganId, organId)
|
|
||||||
.set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CONSUME_SUCCESS.getStatus()));
|
|
||||||
} else {
|
} else {
|
||||||
String taskNotExistNotify = String.format("%s不存在的导入任务,消费中止", taskId);
|
msg = ORDER_IMPORT_FAIL.getMsg();
|
||||||
// 更新状态为消费成功,导入失败
|
|
||||||
orderImportTaskMapper.update(
|
|
||||||
new LambdaUpdateWrapper<OrderImportTaskDO>()
|
|
||||||
.eq(OrderImportTaskDO::getId, taskId)
|
|
||||||
.eq(OrderImportTaskDO::getOrganId, organId)
|
|
||||||
.set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CONSUME_SUCCESS.getStatus())
|
|
||||||
.set(OrderImportTaskDO::getImportStatus, OrderImportStatusEnum.IMPORT_FAIL.getStatus())
|
|
||||||
.set(OrderImportTaskDO::getResult, taskNotExistNotify)
|
|
||||||
);
|
|
||||||
log.error(String.format("====================【%s】====================", taskNotExistNotify));
|
|
||||||
}
|
}
|
||||||
return orderImportTaskDO;
|
orderImportTaskMapper.update(
|
||||||
|
new LambdaUpdateWrapper<OrderImportTaskDO>()
|
||||||
|
.eq(OrderImportTaskDO::getId, orderImportTaskDO.getId())
|
||||||
|
.set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CREATE_RECEIVE.getStatus())
|
||||||
|
.set(OrderImportTaskDO::getImportStatus, OrderImportStatusEnum.IMPORT_FAIL.getStatus())
|
||||||
|
.set(OrderImportTaskDO::getResult, msg)
|
||||||
|
.set(OrderImportTaskDO::getRetryCount, orderImportTaskDO.getRetryCount() + 1)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.cf.imes.framework.common.enums.OrderPlateTypeEnum;
|
import com.cf.imes.framework.common.enums.OrderPlateTypeEnum;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
@@ -816,7 +816,7 @@ public class DefaultExcelOrderImportFactory {
|
|||||||
// 查询大板id用于小板轮廓goodsId
|
// 查询大板id用于小板轮廓goodsId
|
||||||
GoodsDO goodsDO = goodsMapper.selectById(goodsId);
|
GoodsDO goodsDO = goodsMapper.selectById(goodsId);
|
||||||
if (ObjectUtil.isNull(goodsDO)) {
|
if (ObjectUtil.isNull(goodsDO)) {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId);
|
throw new ServiceException(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId);
|
||||||
}
|
}
|
||||||
orderModelDO.setGoodsId(goodsDO.getGoodsId());
|
orderModelDO.setGoodsId(goodsDO.getGoodsId());
|
||||||
orderModelDO.setPlateGoodsId(goodsId);
|
orderModelDO.setPlateGoodsId(goodsId);
|
||||||
@@ -955,7 +955,7 @@ public class DefaultExcelOrderImportFactory {
|
|||||||
// // 查询大板id用于小板轮廓goodsId
|
// // 查询大板id用于小板轮廓goodsId
|
||||||
// GoodsDO goodsDO = goodsMapper.selectById(goodsId);
|
// GoodsDO goodsDO = goodsMapper.selectById(goodsId);
|
||||||
// if (ObjectUtil.isNull(goodsDO)) {
|
// if (ObjectUtil.isNull(goodsDO)) {
|
||||||
// throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId);
|
// throw new ServiceException(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId);
|
||||||
// }
|
// }
|
||||||
// orderModelDO.setGoodsId(goodsDO.getGoodsId());
|
// orderModelDO.setGoodsId(goodsDO.getGoodsId());
|
||||||
// orderModelDO.setPlateGoodsId(goodsId);
|
// orderModelDO.setPlateGoodsId(goodsId);
|
||||||
@@ -1332,7 +1332,7 @@ public class DefaultExcelOrderImportFactory {
|
|||||||
// 存在大板
|
// 存在大板
|
||||||
goodsDO.setGoodsId(plateGoodDO.getGoodsId());
|
goodsDO.setGoodsId(plateGoodDO.getGoodsId());
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOMATCH_ERROR, goodsId, goodsName, material, color, thickness, brand);
|
throw new ServiceException(ORDER_IMPORT_PLATE_GOODS_NOMATCH_ERROR, goodsId, goodsName, material, color, thickness, brand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1400,7 +1400,7 @@ public class DefaultExcelOrderImportFactory {
|
|||||||
.set(OrderDO::getArea, currentPlateArea)
|
.set(OrderDO::getArea, currentPlateArea)
|
||||||
.set(OrderDO::getVersion, version + 1));
|
.set(OrderDO::getVersion, version + 1));
|
||||||
if (updated == 0) {
|
if (updated == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.dict.core.util.DictFrameworkUtils;
|
import com.cf.imes.framework.dict.core.util.DictFrameworkUtils;
|
||||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||||
@@ -660,7 +660,7 @@ public class DefaultXmlOrderImportFactory {
|
|||||||
|
|
||||||
// 查询大板id用于小板轮廓goodsId
|
// 查询大板id用于小板轮廓goodsId
|
||||||
GoodsDO goodsDO = goodsMapper.selectById(goodsId);
|
GoodsDO goodsDO = goodsMapper.selectById(goodsId);
|
||||||
Optional.ofNullable(goodsDO).orElseThrow(() -> ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId));
|
Optional.ofNullable(goodsDO).orElseThrow(() -> new ServiceException(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId));
|
||||||
orderModelDO.setGoodsId(goodsDO.getGoodsId());
|
orderModelDO.setGoodsId(goodsDO.getGoodsId());
|
||||||
orderModelDO.setPlateGoodsId(goodsId);
|
orderModelDO.setPlateGoodsId(goodsId);
|
||||||
orderModelDO.setOrganId(organId);
|
orderModelDO.setOrganId(organId);
|
||||||
@@ -1956,7 +1956,7 @@ public class DefaultXmlOrderImportFactory {
|
|||||||
.set(OrderDO::getArea, currentPlateArea)
|
.set(OrderDO::getArea, currentPlateArea)
|
||||||
.set(OrderDO::getVersion, version + 1));
|
.set(OrderDO::getVersion, version + 1));
|
||||||
if (updated == 0) {
|
if (updated == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -15,7 +15,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
@@ -347,10 +347,10 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ErrorCode webcadOrderImportOrgSealedgeAnalyzeError = WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
|
ErrorCode webcadOrderImportOrgSealedgeAnalyzeError = WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
|
||||||
log.error(webcadOrderImportOrgSealedgeAnalyzeError.getMsg(), e);
|
log.error(webcadOrderImportOrgSealedgeAnalyzeError.getMsg(), e);
|
||||||
throw ServiceExceptionUtil.exception(webcadOrderImportOrgSealedgeAnalyzeError);
|
throw new ServiceException(webcadOrderImportOrgSealedgeAnalyzeError);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR);
|
throw new ServiceException(WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
.eq(OrderDO::getOrganId, organId)
|
.eq(OrderDO::getOrganId, organId)
|
||||||
.eq(OrderDO::getDeleted, false));
|
.eq(OrderDO::getDeleted, false));
|
||||||
if (ObjectUtil.isNull(orderDOFromOrderNo)) {
|
if (ObjectUtil.isNull(orderDOFromOrderNo)) {
|
||||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
throw new ServiceException(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
||||||
} else {
|
} else {
|
||||||
Integer status = orderDOFromOrderNo.getStatus();
|
Integer status = orderDOFromOrderNo.getStatus();
|
||||||
// 更新生产单来源为webcad
|
// 更新生产单来源为webcad
|
||||||
@@ -389,7 +389,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
);
|
);
|
||||||
// cadImportPlateNumThreshold片阻止继续拆单
|
// cadImportPlateNumThreshold片阻止继续拆单
|
||||||
if (existPlateCount >= cadImportPlateNumThreshold) {
|
if (existPlateCount >= cadImportPlateNumThreshold) {
|
||||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR, orderId, cadImportPlateNumThreshold);
|
throw new ServiceException(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR, orderId, cadImportPlateNumThreshold);
|
||||||
} else {
|
} else {
|
||||||
currentPlateNum = existPlateCount.intValue();
|
currentPlateNum = existPlateCount.intValue();
|
||||||
// 统计当前板件总面积
|
// 统计当前板件总面积
|
||||||
@@ -2150,7 +2150,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
.set(OrderDO::getArea, currentPlateArea)
|
.set(OrderDO::getArea, currentPlateArea)
|
||||||
.set(OrderDO::getVersion, version + 1));
|
.set(OrderDO::getVersion, version + 1));
|
||||||
if (updated == 0) {
|
if (updated == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2182,7 +2182,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
.set(GoodsDO::getPlateNum, updateDo.getPlateNum())
|
.set(GoodsDO::getPlateNum, updateDo.getPlateNum())
|
||||||
.set(GoodsDO::getVersion, updateDo.getVersion() + 1));
|
.set(GoodsDO::getVersion, updateDo.getVersion() + 1));
|
||||||
if (updated == 0) {
|
if (updated == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR, updateDo.getId());
|
throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR, updateDo.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -13,7 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
@@ -267,7 +267,7 @@ public class WebCadOrderImportFactory {
|
|||||||
customPlateNoGenerateService.updateCustomPlateNoGenerateConfig(plateNoGenerateConfigVO, orderDO);
|
customPlateNoGenerateService.updateCustomPlateNoGenerateConfig(plateNoGenerateConfigVO, orderDO);
|
||||||
|
|
||||||
if (plateNumReachThreshold) {
|
if (plateNumReachThreshold) {
|
||||||
log.warn(ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_REACH_THRESHOLD_ERROR, orderId, cadImportPlateNumThreshold).getMessage());
|
log.warn(new ServiceException(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_REACH_THRESHOLD_ERROR, orderId, cadImportPlateNumThreshold).getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -313,10 +313,10 @@ public class WebCadOrderImportFactory {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ErrorCode webcadOrderImportOrgSealedgeAnalyzeError = WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
|
ErrorCode webcadOrderImportOrgSealedgeAnalyzeError = WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
|
||||||
log.error(webcadOrderImportOrgSealedgeAnalyzeError.getMsg(), e);
|
log.error(webcadOrderImportOrgSealedgeAnalyzeError.getMsg(), e);
|
||||||
throw ServiceExceptionUtil.exception(webcadOrderImportOrgSealedgeAnalyzeError);
|
throw new ServiceException(webcadOrderImportOrgSealedgeAnalyzeError);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR);
|
throw new ServiceException(WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ public class WebCadOrderImportFactory {
|
|||||||
);
|
);
|
||||||
// cadImportPlateNumThreshold万片阻止继续拆单
|
// cadImportPlateNumThreshold万片阻止继续拆单
|
||||||
if (existPlateCount >= cadImportPlateNumThreshold) {
|
if (existPlateCount >= cadImportPlateNumThreshold) {
|
||||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR, orderId, cadImportPlateNumThreshold);
|
throw new ServiceException(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR, orderId, cadImportPlateNumThreshold);
|
||||||
} else {
|
} else {
|
||||||
currentPlateNum = existPlateCount.intValue();
|
currentPlateNum = existPlateCount.intValue();
|
||||||
// 统计当前板件总面积
|
// 统计当前板件总面积
|
||||||
@@ -2015,7 +2015,7 @@ public class WebCadOrderImportFactory {
|
|||||||
.set(OrderDO::getArea, currentPlateArea)
|
.set(OrderDO::getArea, currentPlateArea)
|
||||||
.set(OrderDO::getVersion, version + 1));
|
.set(OrderDO::getVersion, version + 1));
|
||||||
if (updated == 0) {
|
if (updated == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2047,7 +2047,7 @@ public class WebCadOrderImportFactory {
|
|||||||
.set(GoodsDO::getPlateNum, updateDo.getPlateNum())
|
.set(GoodsDO::getPlateNum, updateDo.getPlateNum())
|
||||||
.set(GoodsDO::getVersion, updateDo.getVersion() + 1));
|
.set(GoodsDO::getVersion, updateDo.getVersion() + 1));
|
||||||
if (updated == 0) {
|
if (updated == 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR, updateDo.getId());
|
throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR, updateDo.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.report.service.dataset;
|
package com.cf.imes.module.report.service.dataset;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@@ -18,7 +19,6 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_NOT_EXISTS;
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_NOT_EXISTS;
|
||||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR;
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR;
|
||||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASOURCE_NOT_EXISTS;
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASOURCE_NOT_EXISTS;
|
||||||
@@ -82,7 +82,7 @@ public class ReportDatasetServiceImpl implements ReportDatasetService {
|
|||||||
private ReportDatasetDO validateDatasetExists(Long id) {
|
private ReportDatasetDO validateDatasetExists(Long id) {
|
||||||
ReportDatasetDO reportDatasetDO = datasetMapper.selectById(id);
|
ReportDatasetDO reportDatasetDO = datasetMapper.selectById(id);
|
||||||
if (ObjectUtil.isNull(reportDatasetDO)) {
|
if (ObjectUtil.isNull(reportDatasetDO)) {
|
||||||
throw exception(DATASET_NOT_EXISTS);
|
throw new ServiceException(DATASET_NOT_EXISTS);
|
||||||
} else {
|
} else {
|
||||||
return reportDatasetDO;
|
return reportDatasetDO;
|
||||||
}
|
}
|
||||||
@@ -103,11 +103,11 @@ public class ReportDatasetServiceImpl implements ReportDatasetService {
|
|||||||
reportDatasourceDO = reportDatasourceMapper.selectNormalDatasourceById(datasourceId, SecurityFrameworkUtils.getUserOrganId());
|
reportDatasourceDO = reportDatasourceMapper.selectNormalDatasourceById(datasourceId, SecurityFrameworkUtils.getUserOrganId());
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNull(reportDatasourceDO)) {
|
if (ObjectUtil.isNull(reportDatasourceDO)) {
|
||||||
throw exception(DATASOURCE_NOT_EXISTS);
|
throw new ServiceException(DATASOURCE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 非超管不能操作内置模板
|
// 非超管不能操作内置模板
|
||||||
if (ReportTemplateTypeEnum.SYSTEM.equals(reportDatasourceDO.getBuildinType()) && Boolean.FALSE.equals(superAdmin)) {
|
if (ReportTemplateTypeEnum.SYSTEM.equals(reportDatasourceDO.getBuildinType()) && Boolean.FALSE.equals(superAdmin)) {
|
||||||
throw exception(DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR);
|
throw new ServiceException(DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR);
|
||||||
}
|
}
|
||||||
return reportDatasourceDO;
|
return reportDatasourceDO;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-8
@@ -15,7 +15,6 @@ import com.bstek.ureport.definition.dataset.Parameter;
|
|||||||
import com.bstek.ureport.definition.dataset.SqlDatasetDefinition;
|
import com.bstek.ureport.definition.dataset.SqlDatasetDefinition;
|
||||||
import com.bstek.ureport.utils.ProcedureUtils;
|
import com.bstek.ureport.utils.ProcedureUtils;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
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.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@@ -54,7 +53,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_GET_FIELDS_ERROR;
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_GET_FIELDS_ERROR;
|
||||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_SQL_INJECTION_RISK;
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_SQL_INJECTION_RISK;
|
||||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_SQL_REQUIRED;
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_SQL_REQUIRED;
|
||||||
@@ -214,10 +212,10 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService {
|
|||||||
}
|
}
|
||||||
} catch (BeansException e) {
|
} catch (BeansException e) {
|
||||||
log.error("[ReportDatasourceService][loadBeanMethods]获取bean失败", e);
|
log.error("[ReportDatasourceService][loadBeanMethods]获取bean失败", e);
|
||||||
throw ServiceExceptionUtil.exception(DATASOURCE_SPRINGBEAN_GET_FAIL, beanId);
|
throw new ServiceException(DATASOURCE_SPRINGBEAN_GET_FAIL, beanId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[ReportDatasourceService][loadBeanMethods]方法列表获取异常", e);
|
log.error("[ReportDatasourceService][loadBeanMethods]方法列表获取异常", e);
|
||||||
throw ServiceExceptionUtil.exception(DATASOURCE_SPRINGBEAN_METHODS_GET_FAIL);
|
throw new ServiceException(DATASOURCE_SPRINGBEAN_METHODS_GET_FAIL);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -230,7 +228,7 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService {
|
|||||||
DataSourceInfo info = previewParams.getInfo();
|
DataSourceInfo info = previewParams.getInfo();
|
||||||
try {
|
try {
|
||||||
if (StringUtils.isEmpty(sql)) {
|
if (StringUtils.isEmpty(sql)) {
|
||||||
throw exception(DATASET_SQL_REQUIRED);
|
throw new ServiceException(DATASET_SQL_REQUIRED);
|
||||||
}
|
}
|
||||||
// 获取数据库连接
|
// 获取数据库连接
|
||||||
conn = MultipleJdbcTemplate.buildConnection(info);
|
conn = MultipleJdbcTemplate.buildConnection(info);
|
||||||
@@ -238,7 +236,7 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService {
|
|||||||
for (Parameter parameter : parameters) {
|
for (Parameter parameter : parameters) {
|
||||||
// mybatis-plus util检查参数
|
// mybatis-plus util检查参数
|
||||||
if (SqlInjectionUtils.check(parameter.getDefaultValue())) {
|
if (SqlInjectionUtils.check(parameter.getDefaultValue())) {
|
||||||
throw exception(DATASET_SQL_INJECTION_RISK);
|
throw new ServiceException(DATASET_SQL_INJECTION_RISK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 准备sql执行参数
|
// 准备sql执行参数
|
||||||
@@ -317,7 +315,7 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService {
|
|||||||
private ReportDatasourceDO validateDatasourceExists(Long id) {
|
private ReportDatasourceDO validateDatasourceExists(Long id) {
|
||||||
ReportDatasourceDO reportDatasourceDO = datasourceMapper.selectNormalDatasourceById(id, SecurityFrameworkUtils.getUserOrganId());
|
ReportDatasourceDO reportDatasourceDO = datasourceMapper.selectNormalDatasourceById(id, SecurityFrameworkUtils.getUserOrganId());
|
||||||
if (reportDatasourceDO == null) {
|
if (reportDatasourceDO == null) {
|
||||||
throw exception(DATASOURCE_NOT_EXISTS);
|
throw new ServiceException(DATASOURCE_NOT_EXISTS);
|
||||||
} else {
|
} else {
|
||||||
return reportDatasourceDO;
|
return reportDatasourceDO;
|
||||||
}
|
}
|
||||||
@@ -331,7 +329,7 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService {
|
|||||||
private void validateSystemDatasource(Integer buildinType) {
|
private void validateSystemDatasource(Integer buildinType) {
|
||||||
// 非超管不能操作内置模板
|
// 非超管不能操作内置模板
|
||||||
if (ReportTemplateTypeEnum.SYSTEM.getType().equals(buildinType) && Boolean.FALSE.equals(SecurityFrameworkUtils.isSuperAdmin())) {
|
if (ReportTemplateTypeEnum.SYSTEM.getType().equals(buildinType) && Boolean.FALSE.equals(SecurityFrameworkUtils.isSuperAdmin())) {
|
||||||
throw exception(DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR);
|
throw new ServiceException(DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-14
@@ -41,7 +41,6 @@ import com.bstek.ureport.parser.ReportParser;
|
|||||||
import com.bstek.ureport.utils.ToolUtils;
|
import com.bstek.ureport.utils.ToolUtils;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@@ -87,7 +86,6 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_BUILDIN_OPERATION_PERMISSION_ERROR;
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_BUILDIN_OPERATION_PERMISSION_ERROR;
|
||||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_IMPORT_CONTENT_EMPTY_ERROR;
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_IMPORT_CONTENT_EMPTY_ERROR;
|
||||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_NAME_UNIQE_ERROR;
|
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_NAME_UNIQE_ERROR;
|
||||||
@@ -258,7 +256,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
boolean isSuperAdmin = SecurityFrameworkUtils.isSuperAdmin();
|
boolean isSuperAdmin = SecurityFrameworkUtils.isSuperAdmin();
|
||||||
// 非超管不能操作内置模板
|
// 非超管不能操作内置模板
|
||||||
if (ReportTemplateTypeEnum.SYSTEM.equals(templateDO.getType()) && !isSuperAdmin) {
|
if (ReportTemplateTypeEnum.SYSTEM.equals(templateDO.getType()) && !isSuperAdmin) {
|
||||||
throw exception(TEMPLATE_BUILDIN_OPERATION_PERMISSION_ERROR);
|
throw new ServiceException(TEMPLATE_BUILDIN_OPERATION_PERMISSION_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +278,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
reportTemplateDO = templateMapper.selectNormalTemplateById(id, loginUser.getOrganId());
|
reportTemplateDO = templateMapper.selectNormalTemplateById(id, loginUser.getOrganId());
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNull(reportTemplateDO)) {
|
if (ObjectUtil.isNull(reportTemplateDO)) {
|
||||||
throw exception(TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(TEMPLATE_NOT_EXISTS);
|
||||||
} else {
|
} else {
|
||||||
return reportTemplateDO;
|
return reportTemplateDO;
|
||||||
}
|
}
|
||||||
@@ -304,7 +302,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
wrapper.eq(ReportTemplateDO::getType, ReportTemplateTypeEnum.SYSTEM);
|
wrapper.eq(ReportTemplateDO::getType, ReportTemplateTypeEnum.SYSTEM);
|
||||||
}
|
}
|
||||||
if (templateMapper.exists(wrapper)) {
|
if (templateMapper.exists(wrapper)) {
|
||||||
throw exception(TEMPLATE_NAME_UNIQE_ERROR, name);
|
throw new ServiceException(TEMPLATE_NAME_UNIQE_ERROR, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,7 +416,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
for (Map.Entry<String, Object> entry : queryMap.entrySet()) {
|
for (Map.Entry<String, Object> entry : queryMap.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
if (ObjectUtils.isEmpty(entry.getValue()) && ObjectUtil.notEqual(key, DATASETIDS_FIELD_NAME) && ObjectUtil.notEqual(key, DATASOURCEIDS_FIELD_NAME)) {
|
if (ObjectUtils.isEmpty(entry.getValue()) && ObjectUtil.notEqual(key, DATASETIDS_FIELD_NAME) && ObjectUtil.notEqual(key, DATASOURCEIDS_FIELD_NAME)) {
|
||||||
throw ServiceExceptionUtil.exception(TEMPLATE_PREIVEW_QUERYPARAM_EMPTY, key);
|
throw new ServiceException(TEMPLATE_PREIVEW_QUERYPARAM_EMPTY, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,12 +515,12 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
// 查询模板
|
// 查询模板
|
||||||
ReportTemplateDO reportTemplateDO = validateTemplateExists(reqVO.getTemplateId());
|
ReportTemplateDO reportTemplateDO = validateTemplateExists(reqVO.getTemplateId());
|
||||||
if (ObjectUtil.isNull(reportTemplateDO)) {
|
if (ObjectUtil.isNull(reportTemplateDO)) {
|
||||||
throw exception(TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 检查模板内容
|
// 检查模板内容
|
||||||
String content = reportTemplateDO.getContent();
|
String content = reportTemplateDO.getContent();
|
||||||
if (StringUtils.isEmpty(content)) {
|
if (StringUtils.isEmpty(content)) {
|
||||||
throw exception(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR);
|
throw new ServiceException(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR);
|
||||||
}
|
}
|
||||||
// 自定义请求vo转ureport对象
|
// 自定义请求vo转ureport对象
|
||||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||||
@@ -574,7 +572,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
if (inputComponent instanceof TextInputComponent) {
|
if (inputComponent instanceof TextInputComponent) {
|
||||||
Object bindValue = parameters.get(bindParameter);
|
Object bindValue = parameters.get(bindParameter);
|
||||||
if (parameters.containsKey(bindParameter) && ObjectUtil.isNotNull(bindValue) && StringUtils.isEmpty(String.valueOf(bindValue))) {
|
if (parameters.containsKey(bindParameter) && ObjectUtil.isNotNull(bindValue) && StringUtils.isEmpty(String.valueOf(bindValue))) {
|
||||||
throw ServiceExceptionUtil.exception(TEMPLATE_PREIVEW_QUERYPARAM_EMPTY, bindParameter);
|
throw new ServiceException(TEMPLATE_PREIVEW_QUERYPARAM_EMPTY, bindParameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -625,12 +623,12 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
// 查询模板
|
// 查询模板
|
||||||
ReportTemplateDO reportTemplateDO = validateTemplateExists(reqVO.getTemplateId());
|
ReportTemplateDO reportTemplateDO = validateTemplateExists(reqVO.getTemplateId());
|
||||||
if (ObjectUtil.isNull(reportTemplateDO)) {
|
if (ObjectUtil.isNull(reportTemplateDO)) {
|
||||||
throw exception(TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 检查模板内容
|
// 检查模板内容
|
||||||
String content = reportTemplateDO.getContent();
|
String content = reportTemplateDO.getContent();
|
||||||
if (StringUtils.isEmpty(content)) {
|
if (StringUtils.isEmpty(content)) {
|
||||||
throw exception(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR);
|
throw new ServiceException(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR);
|
||||||
}
|
}
|
||||||
// 自定义请求vo转ureport对象
|
// 自定义请求vo转ureport对象
|
||||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||||
@@ -711,12 +709,12 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
// 查询模板
|
// 查询模板
|
||||||
ReportTemplateDO reportTemplateDO = validateTemplateExists(reqVO.getTemplateId());
|
ReportTemplateDO reportTemplateDO = validateTemplateExists(reqVO.getTemplateId());
|
||||||
if (ObjectUtil.isNull(reportTemplateDO)) {
|
if (ObjectUtil.isNull(reportTemplateDO)) {
|
||||||
throw exception(TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 检查模板内容
|
// 检查模板内容
|
||||||
String content = reportTemplateDO.getContent();
|
String content = reportTemplateDO.getContent();
|
||||||
if (StringUtils.isEmpty(content)) {
|
if (StringUtils.isEmpty(content)) {
|
||||||
throw exception(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR);
|
throw new ServiceException(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR);
|
||||||
}
|
}
|
||||||
// 自定义请求vo转ureport对象
|
// 自定义请求vo转ureport对象
|
||||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||||
@@ -758,7 +756,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
|||||||
public void exportTemplate(Long templateId, HttpServletResponse response) {
|
public void exportTemplate(Long templateId, HttpServletResponse response) {
|
||||||
ReportTemplateDO reportTemplateDO = validateTemplateExists(templateId);
|
ReportTemplateDO reportTemplateDO = validateTemplateExists(templateId);
|
||||||
if (ObjectUtil.isNull(reportTemplateDO)) {
|
if (ObjectUtil.isNull(reportTemplateDO)) {
|
||||||
throw exception(TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
PrintWriter writer = null;
|
PrintWriter writer = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
+207
-207
@@ -10,118 +10,118 @@ import com.cf.imes.framework.common.exception.ErrorCode;
|
|||||||
public class ErrorCodeConstants {
|
public class ErrorCodeConstants {
|
||||||
|
|
||||||
// ========== AUTH 模块 1-002-000-000 ==========
|
// ========== 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_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, "登录失败,账号被禁用");
|
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, "验证码不正确,原因:{}");
|
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, "未绑定账号,需要进行绑定");
|
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, "手机号不存在");
|
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, "手机号未发生改变,无需修改");
|
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, "登录失败,管理端账号不存在");
|
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 ==========
|
// ========== 菜单模块 1-002-001-000 ==========
|
||||||
public static final ErrorCode MENU_NAME_DUPLICATE = new ErrorCode(1_002_001_000, "已经存在该名字的菜单");
|
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, "父菜单不存在");
|
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, "不能设置自己为父菜单");
|
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, "菜单不存在");
|
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, "存在子菜单,无法删除");
|
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, "父菜单的类型必须是目录或者菜单");
|
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, "管理端菜单操作权限不足");
|
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, "菜单翻译异常,error_code :{}");
|
public static final ErrorCode MENU_TRANS_ERROR = new ErrorCode(1_002_001_007, "menu.trans_error");
|
||||||
|
|
||||||
// ========== 角色模块 1-002-002-000 ==========
|
// ========== 角色模块 1-002-002-000 ==========
|
||||||
public static final ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1_002_002_000, "角色不存在");
|
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, "已经存在名为【{}】的角色");
|
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, "已经存在编码为【{}】的角色");
|
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, "不能操作类型为系统内置的角色");
|
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, "名字为【{}】的角色已被禁用");
|
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, "编码【{}】不能使用");
|
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, "不可为自身分配角色");
|
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, "非超管分配权限");
|
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, "修改内置角色下菜单权限的权限不足");
|
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, "无法修改自身的角色菜单权限");
|
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, "无法修改自身的角色");
|
public static final ErrorCode SELF_ROLE_MODIFY_ERROR = new ErrorCode(1_002_002_010, "role.self.modify_error");
|
||||||
|
|
||||||
// ========== 用户模块 1-002-003-000 ==========
|
// ========== 用户模块 1-002-003-000 ==========
|
||||||
public static final ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "手机号已经存在");
|
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, "手机号已经存在");
|
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, "邮箱已经存在");
|
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, "用户不存在");
|
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, "导入用户数据不能为空!");
|
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, "用户密码校验失败");
|
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, "名字为【{}】的用户已被禁用");
|
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, "超过组织用户配额({}),创建用户失败!");
|
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, "不允许操作用户自身");
|
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, "密码长度不少于8位,且包含大小写字母、数字和特殊字符");
|
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,"存在【{}】重复用户,请联系系统管理员");
|
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, "不允许操作用户自身状态");
|
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, "该用户已通过手机号认证,如需修改手机号请前往个人中心");
|
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 ==========
|
// ========== 部门模块 1-002-004-000 ==========
|
||||||
public static final ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "已经存在该名字的部门");
|
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,"父级部门不存在");
|
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, "当前部门不存在");
|
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, "存在子部门,无法删除");
|
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, "不能设置自己为父部门");
|
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, "部门中存在员工,无法删除");
|
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, "不能设置自己的子部门为父部门");
|
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, "不允许操作用户自身部门");
|
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, "不允许操作用户自身部门及其上级部门");
|
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, "部门({})已被禁用");
|
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, "部门({})已被禁用,无法登录");
|
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, "上级部门({})已被禁用,请开启后操作或选择其他上级部门");
|
public static final ErrorCode PARENT_DEPT_DISABLE = new ErrorCode(1_002_004_012, "dept.parent_disable");
|
||||||
|
|
||||||
// ========== 字典类型 1-002-006-000 ==========
|
// ========== 字典类型 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_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, "字典类型处于关闭状态,不允许新增或编辑");
|
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, "已经存在该名字的字典类型");
|
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, "已经存在该类型的字典类型");
|
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, "无法删除,该字典类型还有字典数据");
|
public static final ErrorCode DICT_TYPE_HAS_CHILDREN = new ErrorCode(1_002_006_005, "dict_type.has_children");
|
||||||
|
|
||||||
// ========== 字典数据 1-002-007-000 ==========
|
// ========== 字典数据 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_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, "字典数据({})不处于开启状态,不允许选择");
|
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, "已经存在该值的字典数据");
|
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, "字典数据标签翻译异常,error_code :{}");
|
public static final ErrorCode DICT_DATA_TRANS_ERROR = new ErrorCode(1_002_007_004, "dict_data.trans_error");
|
||||||
|
|
||||||
// ========== 通知公告 1-002-008-000 ==========
|
// ========== 通知公告 1-002-008-000 ==========
|
||||||
public static final ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "当前通知公告不存在");
|
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, "公告标题已存在,请编辑后重试");
|
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, "内置通知公告编辑权限不足");
|
public static final ErrorCode NOTICE_BUILDIN_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_008_003, "notice.buildin.modify_permission_error");
|
||||||
|
|
||||||
// ========== 短信渠道 1-002-011-000 ==========
|
// ========== 短信渠道 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 ==========
|
// ========== 短信模板 1-002-012-000 ==========
|
||||||
public static final ErrorCode SMS_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_012_000, "短信模板不存在");
|
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, "已经存在编码为【{}】的短信模板");
|
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, "短信 API 模板调用失败,原因是:{}");
|
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, "短信 API 模版无法使用,原因:审批中");
|
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, "短信 API 模版无法使用,原因:审批不通过,{}");
|
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, "短信 API 模版无法使用,原因:模版不存在");
|
public static final ErrorCode SMS_TEMPLATE_API_NOT_FOUND = new ErrorCode(1_002_012_005, "sms.template.api.not_found");
|
||||||
|
|
||||||
// ========== 短信发送 1-002-013-000 ==========
|
// ========== 短信发送 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_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, "短信模板参数({})缺失");
|
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, "短信模板不存在");
|
public static final ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_013_002, "sms.send.template.not_exists");
|
||||||
|
|
||||||
// ========== 短信验证码 1-002-014-000 ==========
|
// ========== 短信验证码 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_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, "验证码不正确");
|
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, "短信发送过于频率");
|
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, "验证码在有效期内,5分钟内请勿重复发送!");
|
public static final ErrorCode SMS_CODE_IS_VALID = new ErrorCode(1_002_014_003, "sms.code.is_valid");
|
||||||
|
|
||||||
// ========== 组织信息 1-002-015-000 ==========
|
// ========== 组织信息 1-002-015-000 ==========
|
||||||
public static final ErrorCode ORGAN_NOT_EXISTS = new ErrorCode(1_002_015_000, "组织不存在");
|
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, "【{}】组织已被禁用");
|
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, "【{}】组织已过期");
|
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, "系统组织不能进行修改、删除等操作!");
|
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, "名字为【{}】的组织已存在");
|
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, "域名为【{}】的组织已存在");
|
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, "组织未配置数据源标识");
|
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, "该新增组织已授权机台数量无需重复新增!");
|
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, "不允许操作用户自身组织");
|
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, "手机号为【{}】的组织已存在");
|
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, "请选择要购买的产品");
|
public static final ErrorCode ORGAN_EXPIRETIME_PRODUCTID_LACK = new ErrorCode(1_002_015_010, "organ.expiretime.product_id_lack");
|
||||||
|
|
||||||
// ========== 组织套餐 1-002-016-000 ==========
|
// ========== 组织套餐 1-002-016-000 ==========
|
||||||
public static final ErrorCode TENANT_PACKAGE_NOT_EXISTS = new ErrorCode(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, "邮箱不存在");
|
public static final ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1_002_025_001, "邮箱不存在");
|
||||||
|
|
||||||
// ========== 站内信模版 1-002-026-000 ==========
|
// ========== 站内信模版 1-002-026-000 ==========
|
||||||
public static final ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_026_000, "站内信模版不存在");
|
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, "已经存在编码为【{}】的站内信模板");
|
public static final ErrorCode NOTIFY_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_026_001, "notify.template.code.duplicate");
|
||||||
|
|
||||||
// ========== 站内信模版 1-002-027-000 ==========
|
// ========== 站内信模版 1-002-027-000 ==========
|
||||||
|
|
||||||
// ========== 站内信发送 1-002-028-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 ============
|
//=========== 工序信息 1-002-027-000 ============
|
||||||
@@ -194,35 +194,35 @@ public class ErrorCodeConstants {
|
|||||||
public static final ErrorCode PROCESS_NAME_EXISTS = new ErrorCode(1_002_027_003, "工序名称已存在");
|
public static final ErrorCode PROCESS_NAME_EXISTS = new ErrorCode(1_002_027_003, "工序名称已存在");
|
||||||
|
|
||||||
// ========== 机台 1-002-029-000 ==========
|
// ========== 机台 1-002-029-000 ==========
|
||||||
public static final ErrorCode MACHINE_NOT_EXISTS = new ErrorCode(1_002_029_000, "机台不存在");
|
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, "机台模板不存在");
|
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, "默认模板数量异常");
|
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, "当前机台已使用,禁止删除");
|
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, "当前机台错误,请重新选择机台");
|
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, "当前机台配置的模板中,该品牌已存在,请重新输入品牌名称");
|
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, "该型号的机台模板不存在,请进行配置");
|
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, "品牌ID错误,或品牌不存在");
|
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, "当前组织该类型的机台创建已达到最大值,无法继续创建");
|
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, "当前机台名称已存在,请重新输入机台名称");
|
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, "当前机台模板的名称已存在,请重新输入机台模板名称");
|
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, "当前机台关联的贴标机数据有误,请在高级配置中重新配置贴标机或选择其他模板");
|
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, "当前机台关联的钻孔机数据有误,请在钻孔模块中重新配置钻孔机或选择其他模板");
|
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, "当前组织还未进行机台授权,请联系组织管理员在基础管理里对当前组织进行机台授权,或联系客服进行授权");
|
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, "组织授权的机台数量不能超过127台");
|
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, "当前机台在加工方案组中已使用,无法删除");
|
public static final ErrorCode MACHINE_USED_ALREADY = new ErrorCode(1_002_029_018, "machine.used.already");
|
||||||
|
|
||||||
|
|
||||||
// ========== 标签模板 1-002-300-000 ==========
|
// ========== 标签模板 1-002-300-000 ==========
|
||||||
public static final ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_300_000, "标签模板不存在");
|
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, "标签不存在");
|
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, "该类型标签默认模板不存在");
|
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, "当前标签已有机台使用,无法删除");
|
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, "默认标签模板无法删除");
|
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, "当前标签打包设置中已有用户使用,无法删除");
|
public static final ErrorCode LABEL_IS_USE_ERROR = new ErrorCode(1_002_300_006, "label.is.use.error");
|
||||||
|
|
||||||
|
|
||||||
// ========== 系统数据源 1_002_301_000 ==========
|
// ========== 系统数据源 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 ============
|
//=========== 工序组信息 1-002-032-000 ============
|
||||||
public static final ErrorCode PROCESS_GROUP_NOT_EXISTS = new ErrorCode(1_002_032_001, "工序组不存在");
|
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, "工序用户存在");
|
public static final ErrorCode PROCESS_USER_EXISTS = new ErrorCode(1_002_034_002, "工序用户存在");
|
||||||
|
|
||||||
// ========== 配件信息 1-002-035-000 ==========
|
// ========== 配件信息 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 ============
|
//=========== 应用信息 1-002-037-000 ============
|
||||||
public static final ErrorCode ERR = new ErrorCode(1_002_038_001, "未知错误");
|
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 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_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, "余料板未使用");
|
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, "余料板使用类型为不可核销类型");
|
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, "未选中余料板,请选择余料板");
|
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_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 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 ============
|
//=========== 用户的系统配置 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 ============
|
//=========== 系统配置 1-002-040-000 ============
|
||||||
public static final ErrorCode SYSTEM_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_001, "系统配置不存在");
|
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, "不支持的系统配置类型");
|
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, "自定义板编号配置:自定义板编号保存格式错误,请检查配置规则");
|
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, "自定义板编号配置:该规则不支持手动复位/清零");
|
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, "自定义板编号配置:找不到对应的规则项进行手动复位/清零");
|
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, "自定义板编号配置:手动复位/清零生产单下序号失败,请联系客服");
|
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, "规则编码不能为空");
|
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, "规则编码【{}】不合法,请检查配置规则");
|
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, "时间格式【{}】不合法,请检查配置规则");
|
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, "自定义字符值不能为空,请检查配置规则");
|
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, "规则【{}】复位/清零模式不合法,请检查配置规则");
|
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, "【{}】下的【{}】不能为空,请检查配置规则");
|
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, "【{}】下的数值类型参数{}:【{}】转换异常,请检查配置规则");
|
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, "【{}】下的布尔类型参数{}:【{}】转换异常,请检查配置规则");
|
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, "加工方案组的:{} 为空,无法保存,请进行配置");
|
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, "加工方案组的:{} 为空,请检查配置信息");
|
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, "当前方案组的配置异常,请重新配置");
|
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, "当前方案组已在排单中使用,无法删除");
|
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, "当前方案组对应的解析器的机台的标签数据为空,请检查机台的标签配置信息");
|
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, "当前系统配置的数据有误,请重新尝试排序");
|
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, "当前加工分线配置在加工方案组中已使用,无法删除");
|
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, "当前数据处理配置在加工方案组中已使用,无法删除");
|
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, "第 {} 条配置中,有字段值为空,请添加数据");
|
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, "第 {} 条配置中,{} 要大于等于 {},请修改数据");
|
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, "当前封边条配置有误,请重新检查后新增");
|
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, "当前配置的名称已存在,请重新命名");
|
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, "第 {} 条配置中,小数位数最大为 3 位,请进行修改");
|
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, "第 {} 条配置中,宽最小值:{} 要大于0,请修改数据");
|
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, "第 {} 条配置中,宽最大值:{} 要大于0,请修改数据");
|
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, "第 {} 条配置中,宽最大值 要大于 宽最小值,请修改数据");
|
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 ============
|
//=========== 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_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配置不存在");
|
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已过期,请重新配置或延长时间");
|
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, "应用名称不允许更改");
|
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的配置为空,无需删除");
|
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, "当前未选择有效时间,请选择再进行新增");
|
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, "当前选择的有效时间已过期,请增加有效时间");
|
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新增失败,请重新尝试");
|
public static final ErrorCode INSERT_TOKEN_DATA_ERROR = new ErrorCode(1_002_042_008, "token.insert.data_error");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========== 资金管理 1-002-043-000 ============
|
//=========== 资金管理 1-002-043-000 ============
|
||||||
public static final ErrorCode INVOICE_NO_EXIST = new ErrorCode(1_002_043_002, "当前发票记录有误,请重新查看");
|
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, "请填写拒绝开票原因");
|
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, "当前发票对应的购买记录有误,请退回组织后重新申请开票");
|
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, "当前发票已开票,无法再次进行开票");
|
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, "产品【{}】已存在,请修改产品名称后再次操作");
|
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, "当前产品已上架,无法删除,请下架后再删除");
|
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, "当前产品已上架,无法进行修改");
|
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, "定价规则对应的产品已上架,无法进行修改");
|
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, "投放时间错误,结束时间应大于开始时间");
|
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, "当前广告名称已存在,请重新命名");
|
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, "当前广告已经发布,无法删除,请结束发布后再删除");
|
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, "当前优惠活动名称已存在,请修改");
|
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, "当前所选产品下{}{}购买时长的优惠活动已存在,请修改");
|
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, "发票抬头不存在,请先创建发票抬头");
|
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, "当前勾选的购买记录中部分可能已开票,请查询后重新勾选提交开票");
|
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, "确认开票发票附件不能为空,请上传后再提交");
|
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, "组织下已存在发票抬头,请刷新后编辑抬头内容");
|
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, "统一社会信用代码已存在,请检查");
|
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, "当前产品未上架");
|
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, "组织下存在购买中的产品操作,请稍后再试");
|
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, "企业统一信用代码不能为空");
|
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, "可开票金额为,请检查购买记录");
|
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, "当前提交记录中存在不可开票记录,请刷新列表后重新选择提交");
|
public static final ErrorCode INVOICE_APPLY_UNINVOICEABLE_EXIST = new ErrorCode(1_002_043_026, "invoice.apply.uninvoiceable.exist");
|
||||||
|
|
||||||
//=========== 支付相关 1-002-048-000 ============
|
//=========== 支付相关 1-002-048-000 ============
|
||||||
public static final ErrorCode PAY_CHANNEL_NOT_SUPPORT = new ErrorCode(1_002_048_000, "暂不支持的支付渠道,请使用其他支付渠道");
|
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, "支付订单不存在,支付编号:{},请重新发起支付");
|
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, "如果您已确认扫码支付,请稍后刷新页面,支付平台可能存在延迟到账");
|
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, "解析支付回调数据异常");
|
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, "支付订单不处于待支付");
|
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, "发起渠道支付异常,请联系客服");
|
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, "不支持的支付回调tradeType:【{}】,请检查支付渠道");
|
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 ============
|
//=========== 产品相关 1-002-045-000 ============
|
||||||
public static final ErrorCode PRODUCTS_NO_EXIST = new ErrorCode(1_002_045_001, "当前产品不存在");
|
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, "当前产品的规则不存在");
|
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, "当前产品下已存在产品时长:{}/{}的定价规则,请修改后重新操作");
|
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, "当前优惠活动不存在");
|
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, "不支持的时长单位,请检查该定价规则的时长单位");
|
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, "组织下存在当前产品的待支付记录,请确认或取消支付后再次发起软件购买");
|
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, "产品建议价格为空,请联系客服");
|
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, "组织订购记录不存在,请检查数据");
|
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, "组织[{}]订购记录已存在,请勿重复定义订购机构");
|
public static final ErrorCode ORG_PRODUCT_PURCHASE_EXIST_ERROR = new ErrorCode(1_002_045_009, "org.product_purchase_exist_error");
|
||||||
|
|
||||||
//=========== 广告相关 1-002-046-000 ============
|
//=========== 广告相关 1-002-046-000 ============
|
||||||
public static final ErrorCode ADVERTISEMENT_NO_EXIST = new ErrorCode(1_002_046_001, "广告不存在");
|
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, "当前广告投放结束时间已超期,请重新发布选择投放时间或重新编辑投放时间");
|
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, "广告图片文件为空,请重新上传");
|
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, "广告图片上传失败,请稍后再试");
|
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, "当前广告已经发布,若要编辑请先结束发布");
|
public static final ErrorCode ADVERTISEMENT_UPDATE_STATUS_ERROR = new ErrorCode(1_002_046_005, "advertisement.update_status_error");
|
||||||
|
|
||||||
|
|
||||||
//=========== 解析器管理 1-002-044-000 ============
|
//=========== 解析器管理 1-002-044-000 ============
|
||||||
public static final ErrorCode PARSER_NO_EXIST = new ErrorCode(1_002_044_001, "当前解析器不存在,请重新选择");
|
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, "当前解析器模板不存在,请重新选择");
|
public static final ErrorCode PARSER_TEMPLATE_NO_EXIST = new ErrorCode(1_002_044_002, "parser.template_no_exist");
|
||||||
|
|
||||||
//=========== 产品延期管理 1-002-049-000 ============
|
//=========== 产品延期管理 1-002-049-000 ============
|
||||||
public static final ErrorCode PRODUCT_PURCHASE_NO_EXIST = new ErrorCode(1_002_049_001, "当前购买记录不存在,请检查");
|
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, "当前产品订购有效期{}未超过当前日期,请调整订购时长");
|
public static final ErrorCode PRODUCT_PURCHASE_ENDTIME_BEFORE_DELAYTIME_ERROR = new ErrorCode(1_002_049_002, "product_purchase.endtime_before_delaytime_error");
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.application;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
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.dal.dataobject.application.ApplicationDO;
|
||||||
import com.cf.imes.module.system.service.application.ApplicationService;
|
import com.cf.imes.module.system.service.application.ApplicationService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -9,9 +10,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import jakarta.annotation.Resource;
|
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;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.APPLICATION_NOT_EXISTS;
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@@ -26,7 +24,7 @@ public class ApplicationApiImpl implements ApplicationApi{
|
|||||||
// 获取数值
|
// 获取数值
|
||||||
ApplicationDO applicationDO = applicationService.getApplicationByOrganId(organId);
|
ApplicationDO applicationDO = applicationService.getApplicationByOrganId(organId);
|
||||||
if (applicationDO == null){
|
if (applicationDO == null){
|
||||||
throw exception(APPLICATION_NOT_EXISTS);
|
throw new ServiceException(APPLICATION_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 数据转json
|
// 数据转json
|
||||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(applicationDO);
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(applicationDO);
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.system.api.datasource;
|
package com.cf.imes.module.system.api.datasource;
|
||||||
|
|
||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
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.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
||||||
import com.cf.imes.module.system.dal.dataobject.datasource.DataSourceDO;
|
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 jakarta.annotation.Resource;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class DataSourceApiImpl implements DataSourceApi {
|
public class DataSourceApiImpl implements DataSourceApi {
|
||||||
@@ -22,7 +23,7 @@ public class DataSourceApiImpl implements DataSourceApi {
|
|||||||
public CommonResult<String> getSqlById(Long id) {
|
public CommonResult<String> getSqlById(Long id) {
|
||||||
DataSourceDO dataSourceDO = dataSourceMapper.selectById(id);
|
DataSourceDO dataSourceDO = dataSourceMapper.selectById(id);
|
||||||
if(Objects.isNull(dataSourceDO)) {
|
if(Objects.isNull(dataSourceDO)) {
|
||||||
throw exception(new ErrorCode(2133,"数据源不存在"));
|
throw new ServiceException(new ErrorCode(2133,"数据源不存在"));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.organ;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
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.CommonResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.module.system.api.organ.dto.OrganizationDTO;
|
import com.cf.imes.module.system.api.organ.dto.OrganizationDTO;
|
||||||
@@ -18,7 +19,6 @@ import java.time.LocalDate;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ORG_PRODUCT_EXPIRED;
|
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;
|
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@@ -75,7 +75,7 @@ public class OrganApiImpl implements OrganApi {
|
|||||||
}
|
}
|
||||||
// 产品过期且没有有效的延期记录时,提示产品已过期
|
// 产品过期且没有有效的延期记录时,提示产品已过期
|
||||||
if (!productMatch && !delayMatch) {
|
if (!productMatch && !delayMatch) {
|
||||||
throw exception(ORG_PRODUCT_EXPIRED);
|
throw new ServiceException(ORG_PRODUCT_EXPIRED);
|
||||||
}
|
}
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.system.api.process;
|
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.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.module.system.api.process.dto.ProcessListReqDTO;
|
import com.cf.imes.module.system.api.process.dto.ProcessListReqDTO;
|
||||||
import com.cf.imes.module.system.api.process.dto.ProcessRespDTO;
|
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.ArrayList;
|
||||||
import java.util.List;
|
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;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PROCESS_GROUP_NOT_EXISTS;
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@@ -41,7 +41,7 @@ public class ProcessGroupApiImpl implements ProcessGroupApi {
|
|||||||
ProcessGroupDO processGroupDO = processGroupMapper.selectById(groupId);
|
ProcessGroupDO processGroupDO = processGroupMapper.selectById(groupId);
|
||||||
|
|
||||||
if (processGroupDO == null)
|
if (processGroupDO == null)
|
||||||
throw exception(PROCESS_GROUP_NOT_EXISTS);
|
throw new ServiceException(PROCESS_GROUP_NOT_EXISTS);
|
||||||
String[] items = processGroupDO.getItems().split(",");
|
String[] items = processGroupDO.getItems().split(",");
|
||||||
List<ProcessRespDTO> lists = new ArrayList<>();
|
List<ProcessRespDTO> lists = new ArrayList<>();
|
||||||
ProcessListReqDTO processListReqDTO = BeanUtils.toBean(processGroupDO, ProcessListReqDTO.class).setLists(lists);
|
ProcessListReqDTO processListReqDTO = BeanUtils.toBean(processGroupDO, ProcessListReqDTO.class).setLists(lists);
|
||||||
|
|||||||
+2
-2
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.setting;
|
|||||||
|
|
||||||
|
|
||||||
import com.cf.imes.framework.common.enums.UserSettingTypeEnum;
|
import com.cf.imes.framework.common.enums.UserSettingTypeEnum;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.security.core.LoginUser;
|
import com.cf.imes.framework.security.core.LoginUser;
|
||||||
import com.cf.imes.module.system.api.setting.dto.PackageConfigDTO;
|
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 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.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CURRENTLY_NO_CONFIGURATION_AVAILABLE;
|
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());
|
PackageConfigDO packageConfigDO = packageConfigMapper.selectSetting(type, loginUser.getId(), loginUser.getOrganId());
|
||||||
|
|
||||||
if(packageConfigDO == null){
|
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);
|
return BeanUtils.toBean(packageConfigDO,PackageConfigDTO.class);
|
||||||
|
|||||||
+7
-7
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.systemconfig;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
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.CommonResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -31,7 +32,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
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.pojo.CommonResult.success;
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray;
|
import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray;
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
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));
|
.select(SystemConfigSchemeDO::getId,SystemConfigDO::getSetting));
|
||||||
|
|
||||||
if(CollUtil.isEmpty(systemConfigSchemeDOS)){
|
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);
|
AtomicReference<Integer> processSize = new AtomicReference<>(0);
|
||||||
@@ -126,13 +126,13 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
|||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.getMessage());
|
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){
|
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());
|
return success(processSize.get());
|
||||||
@@ -166,7 +166,7 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
|||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.getMessage());
|
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);
|
List<ProcessSchemeDTO> schemeDTOS = BeanUtils.toBean(processSchemeConfigs, ProcessSchemeDTO.class);
|
||||||
@@ -201,7 +201,7 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
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));
|
return success(BeanUtils.toBean(processSchemeConfigs,ProcessSchemeDTO.class));
|
||||||
@@ -214,7 +214,7 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
|||||||
private void checkValueIsNotEmpty(List<?> value,String error) {
|
private void checkValueIsNotEmpty(List<?> value,String error) {
|
||||||
|
|
||||||
if(ObjectUtils.isEmpty(value)){
|
if(ObjectUtils.isEmpty(value)){
|
||||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR,error);
|
throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR,error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
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.CommonResult;
|
||||||
import com.cf.imes.framework.common.pojo.PageParam;
|
import com.cf.imes.framework.common.pojo.PageParam;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
@@ -42,7 +43,6 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.hutool.core.date.DatePattern.NORM_DATE_FORMATTER;
|
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.common.pojo.CommonResult.success;
|
||||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORGAN_EXPIRETIME_PRODUCTID_LACK;
|
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) {
|
public CommonResult<OrganRespVO> getOrgan(@RequestParam("id") Long id) {
|
||||||
OrganizationDO organ = organService.getOrgan(id);
|
OrganizationDO organ = organService.getOrgan(id);
|
||||||
if (ObjectUtil.isNull(organ)) {
|
if (ObjectUtil.isNull(organ)) {
|
||||||
throw exception(ORGAN_NOT_EXISTS);
|
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class);
|
OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class);
|
||||||
|
|
||||||
@@ -151,14 +151,14 @@ public class OrganController {
|
|||||||
String expireTime = "";
|
String expireTime = "";
|
||||||
OrganizationDO organ = organService.getOrgan(id);
|
OrganizationDO organ = organService.getOrgan(id);
|
||||||
if (ObjectUtil.isNull(organ)) {
|
if (ObjectUtil.isNull(organ)) {
|
||||||
throw exception(ORGAN_NOT_EXISTS);
|
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class);
|
OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class);
|
||||||
// 是否管理端,管理端要选了产品后展示有效时间
|
// 是否管理端,管理端要选了产品后展示有效时间
|
||||||
boolean manageEndPoint = SecurityFrameworkUtils.isManageEndPoint();
|
boolean manageEndPoint = SecurityFrameworkUtils.isManageEndPoint();
|
||||||
if (manageEndPoint) {
|
if (manageEndPoint) {
|
||||||
if (ObjectUtil.isNull(productId)) {
|
if (ObjectUtil.isNull(productId)) {
|
||||||
throw exception(ORGAN_EXPIRETIME_PRODUCTID_LACK);
|
throw new ServiceException(ORGAN_EXPIRETIME_PRODUCTID_LACK);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 生产端从token中获取产品
|
// 生产端从token中获取产品
|
||||||
|
|||||||
+1
-2
@@ -34,7 +34,6 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
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.common.pojo.CommonResult.success;
|
||||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ROLE_NOT_EXISTS;
|
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) {
|
public CommonResult<RoleRespVO> getRole(@RequestParam("id") Long id) {
|
||||||
RoleDO role = roleService.getRole(id);
|
RoleDO role = roleService.getRole(id);
|
||||||
if (ObjectUtil.isNull(role)) {
|
if (ObjectUtil.isNull(role)) {
|
||||||
throw exception(ROLE_NOT_EXISTS);
|
throw new ServiceException(ROLE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return success(BeanUtils.toBean(role, RoleRespVO.class));
|
return success(BeanUtils.toBean(role, RoleRespVO.class));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.controller.admin.user;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
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.CommonResult;
|
||||||
import com.cf.imes.framework.common.pojo.PageParam;
|
import com.cf.imes.framework.common.pojo.PageParam;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
@@ -43,7 +44,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
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.pojo.CommonResult.success;
|
||||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList;
|
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
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) {
|
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
|
||||||
AdminUserDO user = userService.getUser(id);
|
AdminUserDO user = userService.getUser(id);
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
throw exception(USER_NOT_EXISTS);
|
throw new ServiceException(USER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 拼接数据
|
// 拼接数据
|
||||||
DeptDO dept = deptService.getDept(user.getDeptId());
|
DeptDO dept = deptService.getDept(user.getDeptId());
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.system.controller.admin.user;
|
package com.cf.imes.module.system.controller.admin.user;
|
||||||
|
|
||||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
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.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.UserMobileUpdateReqVO;
|
||||||
import com.cf.imes.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
|
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 jakarta.validation.Valid;
|
||||||
import java.util.List;
|
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.common.pojo.CommonResult.success;
|
||||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
|
||||||
@@ -83,7 +83,7 @@ public class UserProfileController {
|
|||||||
@Operation(summary = "上传用户个人头像")
|
@Operation(summary = "上传用户个人头像")
|
||||||
public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception {
|
public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception {
|
||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
throw exception(FILE_IS_EMPTY);
|
throw new ServiceException(FILE_IS_EMPTY);
|
||||||
}
|
}
|
||||||
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
||||||
return success(avatar);
|
return success(avatar);
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.dal.mysql.user;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@@ -53,7 +53,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
|||||||
.eq(AdminUserDO::getUsername, userName));
|
.eq(AdminUserDO::getUsername, userName));
|
||||||
if (CollUtil.isNotEmpty(adminUserDOS)) {
|
if (CollUtil.isNotEmpty(adminUserDOS)) {
|
||||||
if (adminUserDOS.size() > 1) {
|
if (adminUserDOS.size() > 1) {
|
||||||
throw ServiceExceptionUtil.exception(USERNAME_MULTIPLE_ERROR, userName);
|
throw new ServiceException(USERNAME_MULTIPLE_ERROR, userName);
|
||||||
}
|
}
|
||||||
adminUserDO = adminUserDOS.get(0);
|
adminUserDO = adminUserDOS.get(0);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-13
@@ -1,13 +1,8 @@
|
|||||||
package com.cf.imes.module.system.service.application;
|
package com.cf.imes.module.system.service.application;
|
||||||
|
|
||||||
import com.cf.imes.framework.common.exception.ServerException;
|
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.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.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.ApplicationPageReqVO;
|
||||||
import com.cf.imes.module.system.controller.admin.application.vo.application.ApplicationRespVO;
|
import com.cf.imes.module.system.controller.admin.application.vo.application.ApplicationRespVO;
|
||||||
import com.cf.imes.module.system.controller.admin.application.vo.application.ApplicationSaveReqVO;
|
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.convert.auth.AuthConvert;
|
||||||
import com.cf.imes.module.system.dal.dataobject.application.ApplicationDO;
|
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.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.dal.mysql.application.ApplicationMapper;
|
||||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
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.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.enums.oauth2.OAuth2ClientConstants;
|
||||||
import com.cf.imes.module.system.service.oauth2.OAuth2TokenService;
|
import com.cf.imes.module.system.service.oauth2.OAuth2TokenService;
|
||||||
import com.cf.imes.module.system.util.rsa.AsymmetricAlgorithmUtil;
|
import com.cf.imes.module.system.util.rsa.AsymmetricAlgorithmUtil;
|
||||||
@@ -29,10 +22,9 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
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;
|
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) {
|
private void validateApplicationExists(Long id) {
|
||||||
if (applicationMapper.selectById(id) == null) {
|
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) {
|
public ApplicationLoginRespVO loginApplication(ApplicationRespVO reqVO) {
|
||||||
ApplicationDO app = applicationMapper.selectByAppId(reqVO.getAppId());
|
ApplicationDO app = applicationMapper.selectByAppId(reqVO.getAppId());
|
||||||
if (Objects.isNull(app)) {
|
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());
|
String appId = AsymmetricAlgorithmUtil.encryptByPublic(reqVO.getAppKey(), app.getAppSecret());
|
||||||
if (!appId.equals(app.getAppId())) {
|
if (!appId.equals(app.getAppId())) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.APPLICATION_LOGIN_USER_DISABLED);
|
throw new ServiceException(ErrorCodeConstants.APPLICATION_LOGIN_USER_DISABLED);
|
||||||
}
|
}
|
||||||
// 创建 Token 令牌,记录登录日志
|
// 创建 Token 令牌,记录登录日志
|
||||||
return BeanUtils.toBean(createTokenAfterLoginSuccess(app.getId(), app.getAppId(), LoginLogTypeEnum.LOGIN_USERNAME), ApplicationLoginRespVO.class).setAppId(app.getId());
|
return BeanUtils.toBean(createTokenAfterLoginSuccess(app.getId(), app.getAppId(), LoginLogTypeEnum.LOGIN_USERNAME), ApplicationLoginRespVO.class).setAppId(app.getId());
|
||||||
|
|||||||
+11
-13
@@ -6,7 +6,6 @@ import com.anji.captcha.service.CaptchaService;
|
|||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
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.monitor.TracerUtils;
|
||||||
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
||||||
import com.cf.imes.framework.common.util.validation.ValidationUtils;
|
import com.cf.imes.framework.common.util.validation.ValidationUtils;
|
||||||
@@ -57,7 +56,6 @@ import org.springframework.transaction.support.TransactionTemplate;
|
|||||||
|
|
||||||
import java.util.Objects;
|
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.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORGAN_DATA_CODE_NOT_EXISTS;
|
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) {
|
if (user == null) {
|
||||||
createLoginLog(null, username, null, null, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
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();
|
Long organId = user.getOrganId();
|
||||||
// 校验机构有效性
|
// 校验机构有效性
|
||||||
@@ -143,12 +141,12 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
// 校验密码
|
// 校验密码
|
||||||
if (!userService.isPasswordMatch(password, user.getPassword())) {
|
if (!userService.isPasswordMatch(password, user.getPassword())) {
|
||||||
createLoginLog(user.getId(), username, null, organId, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
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())) {
|
if (CommonStatusEnum.isDisable(user.getStatus())) {
|
||||||
createLoginLog(user.getId(), username, null, organId, logTypeEnum, LoginResultEnum.USER_DISABLED);
|
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;
|
return user;
|
||||||
}
|
}
|
||||||
@@ -183,7 +181,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
String dataSourceCode = organ.getDataSourceCode();
|
String dataSourceCode = organ.getDataSourceCode();
|
||||||
// 校验机构数据源
|
// 校验机构数据源
|
||||||
if (StringUtils.isBlank(dataSourceCode)) {
|
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())) {
|
if (CommonStatusEnum.ENABLE.getStatus().equals(organ.getGrayStatus())) {
|
||||||
// 机构启用灰度、版本赋值到user
|
// 机构启用灰度、版本赋值到user
|
||||||
@@ -230,7 +228,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
public void sendSmsCode(AuthSmsSendReqVO reqVO) {
|
public void sendSmsCode(AuthSmsSendReqVO reqVO) {
|
||||||
// 登录场景,验证是否存在
|
// 登录场景,验证是否存在
|
||||||
if (userService.getUserByMobile(reqVO.getMobile()) == null) {
|
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()));
|
smsCodeApi.sendSmsCode(AuthConvert.INSTANCE.convert(reqVO).setCreateIp(getClientIP()));
|
||||||
@@ -244,13 +242,13 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
// 获得用户信息
|
// 获得用户信息
|
||||||
AdminUserDO user = userService.getUserByMobile(reqVO.getMobile());
|
AdminUserDO user = userService.getUserByMobile(reqVO.getMobile());
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
Long organId = user.getOrganId();
|
Long organId = user.getOrganId();
|
||||||
OrganizationDO organ = organService.getOrgan(organId);
|
OrganizationDO organ = organService.getOrgan(organId);
|
||||||
String dataSourceCode = organ.getDataSourceCode();
|
String dataSourceCode = organ.getDataSourceCode();
|
||||||
if(StringUtils.isBlank(dataSourceCode)) {
|
if(StringUtils.isBlank(dataSourceCode)) {
|
||||||
throw exception(ORGAN_DATA_CODE_NOT_EXISTS);
|
throw new ServiceException(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建 Token 令牌,记录登录日志
|
// 创建 Token 令牌,记录登录日志
|
||||||
@@ -297,20 +295,20 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
SocialUserRespDTO socialUser = socialUserService.getSocialUserByCode(UserTypeEnum.ADMIN.getValue(), reqVO.getType(),
|
SocialUserRespDTO socialUser = socialUserService.getSocialUserByCode(UserTypeEnum.ADMIN.getValue(), reqVO.getType(),
|
||||||
reqVO.getCode(), reqVO.getState());
|
reqVO.getCode(), reqVO.getState());
|
||||||
if (socialUser == null || socialUser.getUserId() == null) {
|
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());
|
AdminUserDO user = userService.getUser(socialUser.getUserId());
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
Long organId = user.getOrganId();
|
Long organId = user.getOrganId();
|
||||||
OrganizationDO organ = organService.getOrgan(organId);
|
OrganizationDO organ = organService.getOrgan(organId);
|
||||||
String dataSourceCode = organ.getDataSourceCode();
|
String dataSourceCode = organ.getDataSourceCode();
|
||||||
if(StringUtils.isBlank(dataSourceCode)) {
|
if(StringUtils.isBlank(dataSourceCode)) {
|
||||||
throw exception(ORGAN_DATA_CODE_NOT_EXISTS);
|
throw new ServiceException(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建 Token 令牌,记录登录日志
|
// 创建 Token 令牌,记录登录日志
|
||||||
@@ -332,7 +330,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
if (!response.isSuccess()) {
|
if (!response.isSuccess()) {
|
||||||
// 创建登录失败日志(验证码不正确)
|
// 创建登录失败日志(验证码不正确)
|
||||||
createLoginLog(null, reqVO.getUsername(), null, null, LoginLogTypeEnum.LOGIN_USERNAME, LoginResultEnum.CAPTCHA_CODE_ERROR);
|
createLoginLog(null, reqVO.getUsername(), null, null, LoginLogTypeEnum.LOGIN_USERNAME, LoginResultEnum.CAPTCHA_CODE_ERROR);
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_CAPTCHA_CODE_ERROR, response.getRepMsg());
|
throw new ServiceException(ErrorCodeConstants.AUTH_LOGIN_CAPTCHA_CODE_ERROR, response.getRepMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -22,7 +22,7 @@ import jakarta.annotation.Resource;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
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_CUSTOM_PLATE_NO_RULE_FIND;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS;
|
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::getType, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())
|
||||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return systemConfigDO;
|
return systemConfigDO;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -28,7 +28,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.*;
|
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.framework.common.util.object.BeanUtils.toBean;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.DATA_SOURCE_NOT_EXISTS;
|
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) {
|
private void validateDataSourceExists(Long id) {
|
||||||
if (dataSourceMapper.selectById(id) == null) {
|
if (dataSourceMapper.selectById(id) == null) {
|
||||||
throw exception(DATA_SOURCE_NOT_EXISTS);
|
throw new ServiceException(DATA_SOURCE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-18
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
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.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.framework.security.core.LoginUser;
|
import com.cf.imes.framework.security.core.LoginUser;
|
||||||
@@ -30,7 +30,6 @@ import jakarta.annotation.Resource;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
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.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.DEPT_USER_OPER_NOT_ALLOW;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PARENT_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);
|
validateDeptExists(id);
|
||||||
// 校验是否有子部门
|
// 校验是否有子部门
|
||||||
if (deptMapper.selectCountByParentId(id) > 0) {
|
if (deptMapper.selectCountByParentId(id) > 0) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_EXITS_CHILDREN);
|
throw new ServiceException(ErrorCodeConstants.DEPT_EXITS_CHILDREN);
|
||||||
}
|
}
|
||||||
// 校验部门内用户操作
|
// 校验部门内用户操作
|
||||||
checkCurrentWhenOperate(id);
|
checkCurrentWhenOperate(id);
|
||||||
// 校验部门内是否存在用户,存在用户则禁止删除
|
// 校验部门内是否存在用户,存在用户则禁止删除
|
||||||
if (!userService.getUserListByDeptIds(Collections.singletonList(id)).isEmpty()) {
|
if (!userService.getUserListByDeptIds(Collections.singletonList(id)).isEmpty()) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_EXISTS_USER);
|
throw new ServiceException(ErrorCodeConstants.DEPT_EXISTS_USER);
|
||||||
}
|
}
|
||||||
// 删除部门
|
// 删除部门
|
||||||
deptMapper.deleteById(id);
|
deptMapper.deleteById(id);
|
||||||
@@ -123,12 +122,12 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
private void checkCurrentWhenOperate(Long deptId) {
|
private void checkCurrentWhenOperate(Long deptId) {
|
||||||
Long currentDeptId = SecurityFrameworkUtils.getUserDeptId();
|
Long currentDeptId = SecurityFrameworkUtils.getUserDeptId();
|
||||||
if (ObjectUtil.equal(deptId, currentDeptId)) {
|
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);
|
List<DeptDO> childDeptList = getChildDeptList(deptId);
|
||||||
childDeptList.stream().filter(d -> d.getId().equals(currentDeptId)).findAny().ifPresent(deptDO -> {
|
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);
|
DeptDO dept = deptMapper.selectById(id);
|
||||||
if (dept == null) {
|
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. 不能设置自己为父部门
|
// 1. 不能设置自己为父部门
|
||||||
if (Objects.equals(id, parentId)) {
|
if (Objects.equals(id, parentId)) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_ERROR);
|
throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_ERROR);
|
||||||
}
|
}
|
||||||
// 2. 父部门不存在
|
// 2. 父部门不存在
|
||||||
DeptDO parentDept = deptMapper.selectById(parentId);
|
DeptDO parentDept = deptMapper.selectById(parentId);
|
||||||
if (parentDept == null) {
|
if (parentDept == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS);
|
throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS);
|
||||||
}
|
}
|
||||||
// 2.1 父部门状态校验
|
// 2.1 父部门状态校验
|
||||||
checkParentStatus(parentDept.getStatus(), parentDept.getName());
|
checkParentStatus(parentDept.getStatus(), parentDept.getName());
|
||||||
@@ -164,7 +163,7 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
// 3.1 校验环路
|
// 3.1 校验环路
|
||||||
parentId = parentDept.getParentId();
|
parentId = parentDept.getParentId();
|
||||||
if (Objects.equals(id, parentId)) {
|
if (Objects.equals(id, parentId)) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_IS_CHILD);
|
throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_IS_CHILD);
|
||||||
}
|
}
|
||||||
// 3.2 继续递归下一级父部门
|
// 3.2 继续递归下一级父部门
|
||||||
if (parentId == null || DeptDO.PARENT_ID_ROOT.equals(parentId)) {
|
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) {
|
private void checkParentStatus(Integer status, String parentName) {
|
||||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(status)) {
|
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 的部门
|
// 如果 id 为空,说明不用比较是否为相同 id 的部门
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NAME_DUPLICATE);
|
throw new ServiceException(ErrorCodeConstants.DEPT_NAME_DUPLICATE);
|
||||||
}
|
}
|
||||||
if (ObjectUtil.notEqual(dept.getId(), id)) {
|
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) {
|
public void validDept(Long deptId) {
|
||||||
DeptDO deptDO = deptMapper.selectById(deptId);
|
DeptDO deptDO = deptMapper.selectById(deptId);
|
||||||
if (deptDO == null) {
|
if (deptDO == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NOT_FOUND);
|
throw new ServiceException(ErrorCodeConstants.DEPT_NOT_FOUND);
|
||||||
}
|
}
|
||||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(deptDO.getStatus())) {
|
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);
|
validParentDept(deptDO);
|
||||||
@@ -287,7 +286,7 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(deptDO.getStatus())) {
|
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);
|
validParentDept(deptDO);
|
||||||
@@ -308,9 +307,9 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (parentDept == null) {
|
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())) {
|
} 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 {
|
} else {
|
||||||
validParentDept(parentDept);
|
validParentDept(parentDept);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-9
@@ -8,7 +8,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -151,10 +151,10 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
}
|
}
|
||||||
// 如果 id 为空,说明不用比较是否为相同 id 的字典数据
|
// 如果 id 为空,说明不用比较是否为相同 id 的字典数据
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE);
|
throw new ServiceException(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE);
|
||||||
}
|
}
|
||||||
if (!dictData.getId().equals(id)) {
|
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);
|
DictDataDO dictData = dictDataMapper.selectById(id);
|
||||||
if (dictData == null) {
|
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) {
|
public void validateDictTypeExists(String type) {
|
||||||
DictTypeDO dictType = dictTypeService.getDictType(type);
|
DictTypeDO dictType = dictTypeService.getDictType(type);
|
||||||
if (dictType == null) {
|
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())) {
|
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 -> {
|
values.forEach(value -> {
|
||||||
DictDataDO dictData = dictDataMap.get(value);
|
DictDataDO dictData = dictDataMap.get(value);
|
||||||
if (dictData == null) {
|
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())) {
|
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);
|
JSONObject obj = JSON.parseObject(transResult);
|
||||||
String errorCode = obj.getString("error_code");
|
String errorCode = obj.getString("error_code");
|
||||||
if (StringUtils.isNotEmpty(errorCode)) {
|
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");
|
JSONArray arr = obj.getJSONArray("trans_result");
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -4,7 +4,7 @@ import cn.hutool.core.text.CharSequenceUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -97,7 +97,7 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||||||
DictTypeDO dictType = validateDictTypeExists(id);
|
DictTypeDO dictType = validateDictTypeExists(id);
|
||||||
// 校验是否有字典数据
|
// 校验是否有字典数据
|
||||||
if (dictDataService.getDictDataCountByDictType(dictType.getType()) > 0) {
|
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());
|
dictTypeMapper.updateToDelete(id, LocalDateTime.now());
|
||||||
@@ -116,10 +116,10 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||||||
}
|
}
|
||||||
// 如果 id 为空,说明不用比较是否为相同 id 的字典类型
|
// 如果 id 为空,说明不用比较是否为相同 id 的字典类型
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE);
|
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE);
|
||||||
}
|
}
|
||||||
if (!dictType.getId().equals(id)) {
|
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 的字典类型
|
// 如果 id 为空,说明不用比较是否为相同 id 的字典类型
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE);
|
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE);
|
||||||
}
|
}
|
||||||
if (!dictType.getId().equals(id)) {
|
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);
|
DictTypeDO dictType = dictTypeMapper.selectById(id);
|
||||||
if (dictType == null) {
|
if (dictType == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return dictType;
|
return dictType;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.system.service.errorcode;
|
package com.cf.imes.module.system.service.errorcode;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.module.system.api.errorcode.dto.ErrorCodeAutoGenerateReqDTO;
|
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.List;
|
||||||
import java.util.Map;
|
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.convertMap;
|
||||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ERROR_CODE_DUPLICATE;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ERROR_CODE_DUPLICATE;
|
||||||
@@ -90,17 +91,17 @@ public class ErrorCodeServiceImpl implements ErrorCodeService {
|
|||||||
}
|
}
|
||||||
// 如果 id 为空,说明不用比较是否为相同 id 的错误码
|
// 如果 id 为空,说明不用比较是否为相同 id 的错误码
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw exception(ERROR_CODE_DUPLICATE);
|
throw new ServiceException(ERROR_CODE_DUPLICATE);
|
||||||
}
|
}
|
||||||
if (!errorCodeDO.getId().equals(id)) {
|
if (!errorCodeDO.getId().equals(id)) {
|
||||||
throw exception(ERROR_CODE_DUPLICATE);
|
throw new ServiceException(ERROR_CODE_DUPLICATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void validateErrorCodeExists(Long id) {
|
void validateErrorCodeExists(Long id) {
|
||||||
if (errorCodeMapper.selectById(id) == null) {
|
if (errorCodeMapper.selectById(id) == null) {
|
||||||
throw exception(ERROR_CODE_NOT_EXISTS);
|
throw new ServiceException(ERROR_CODE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.service.funds.advertisement;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -24,7 +25,6 @@ import java.io.IOException;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,7 +49,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
|||||||
|
|
||||||
if (createReqVO.getStartTime().isAfter(createReqVO.getEndTime())) {
|
if (createReqVO.getStartTime().isAfter(createReqVO.getEndTime())) {
|
||||||
|
|
||||||
throw exception(ADVERTISEMENT_TIME_ERROR);
|
throw new ServiceException(ADVERTISEMENT_TIME_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
AdvertisementDO aDo = advertisementMapper.selectAdByAdName(createReqVO.getAdName(), null);
|
AdvertisementDO aDo = advertisementMapper.selectAdByAdName(createReqVO.getAdName(), null);
|
||||||
@@ -74,7 +74,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
|||||||
@Override
|
@Override
|
||||||
public void update(AdvertisementSaveReqVO reqVO) {
|
public void update(AdvertisementSaveReqVO reqVO) {
|
||||||
if (reqVO.getStartTime().isAfter(reqVO.getEndTime())) {
|
if (reqVO.getStartTime().isAfter(reqVO.getEndTime())) {
|
||||||
throw exception(ADVERTISEMENT_TIME_ERROR);
|
throw new ServiceException(ADVERTISEMENT_TIME_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
Long id = reqVO.getId();
|
Long id = reqVO.getId();
|
||||||
@@ -83,7 +83,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
|||||||
|
|
||||||
// 发布中的广告不允许编辑
|
// 发布中的广告不允许编辑
|
||||||
if (advertisementDO.getStatus().equals(AdvertisementStatusEnum.PUBLISHED.getStatus())) {
|
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);
|
AdvertisementDO advertisementDO = validateAdvertisementExists(id);
|
||||||
|
|
||||||
if (advertisementDO.getStatus().equals(AdvertisementStatusEnum.PUBLISHED.getStatus())) {
|
if (advertisementDO.getStatus().equals(AdvertisementStatusEnum.PUBLISHED.getStatus())) {
|
||||||
throw exception(ADVERTISEMENT_NO_DELETE);
|
throw new ServiceException(ADVERTISEMENT_NO_DELETE);
|
||||||
}
|
}
|
||||||
// 删除广告
|
// 删除广告
|
||||||
advertisementMapper.deleteById(id);
|
advertisementMapper.deleteById(id);
|
||||||
@@ -161,7 +161,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
|||||||
// 广告的结束时间
|
// 广告的结束时间
|
||||||
LocalDate endTime = advertisementDO.getEndTime();
|
LocalDate endTime = advertisementDO.getEndTime();
|
||||||
if (LocalDate.now().isAfter(endTime)) {
|
if (LocalDate.now().isAfter(endTime)) {
|
||||||
throw exception(ADVERTISEMENT_STATUS_ENDTIME_EXPIRED);
|
throw new ServiceException(ADVERTISEMENT_STATUS_ENDTIME_EXPIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
advertisementMapper.update(new LambdaUpdateWrapper<AdvertisementDO>()
|
advertisementMapper.update(new LambdaUpdateWrapper<AdvertisementDO>()
|
||||||
@@ -186,7 +186,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
|||||||
validateAdvertisementExists(id);
|
validateAdvertisementExists(id);
|
||||||
|
|
||||||
if (reqVO.getStartTime().isAfter(reqVO.getEndTime())) {
|
if (reqVO.getStartTime().isAfter(reqVO.getEndTime())) {
|
||||||
throw exception(ADVERTISEMENT_TIME_ERROR);
|
throw new ServiceException(ADVERTISEMENT_TIME_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
advertisementMapper.update(new LambdaUpdateWrapper<AdvertisementDO>()
|
advertisementMapper.update(new LambdaUpdateWrapper<AdvertisementDO>()
|
||||||
@@ -221,7 +221,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
|||||||
.eq(AdvertisementDO::getDeleted, false)
|
.eq(AdvertisementDO::getDeleted, false)
|
||||||
.eq(AdvertisementDO::getId, id));
|
.eq(AdvertisementDO::getId, id));
|
||||||
if (advertisementDO == null) {
|
if (advertisementDO == null) {
|
||||||
throw exception(ADVERTISEMENT_NO_EXIST);
|
throw new ServiceException(ADVERTISEMENT_NO_EXIST);
|
||||||
}
|
}
|
||||||
return advertisementDO;
|
return advertisementDO;
|
||||||
}
|
}
|
||||||
@@ -230,12 +230,12 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
|||||||
public String uploadAdImage(MultipartFile adImageFile) {
|
public String uploadAdImage(MultipartFile adImageFile) {
|
||||||
try {
|
try {
|
||||||
if (adImageFile.isEmpty()) {
|
if (adImageFile.isEmpty()) {
|
||||||
throw exception(ADVERTISEMENT_IMAGE_EMPTY_ERROR);
|
throw new ServiceException(ADVERTISEMENT_IMAGE_EMPTY_ERROR);
|
||||||
}
|
}
|
||||||
return fileApi.createFile(adImageFile.getBytes());
|
return fileApi.createFile(adImageFile.getBytes());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("上传广告图片失败", e);
|
log.error("上传广告图片失败", e);
|
||||||
throw exception(ADVERTISEMENT_IMAGE_UPLOAD_FAIL);
|
throw new ServiceException(ADVERTISEMENT_IMAGE_UPLOAD_FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -58,7 +58,6 @@ import java.util.Locale;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static cn.hutool.core.date.DatePattern.PURE_DATETIME_PATTERN;
|
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.parseObject;
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
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())
|
if (invoiceRecordsDO.getStatus().equals(InvoiceStatusEnum.INVOICINGFAILED.getCode())
|
||||||
|| invoiceRecordsDO.getStatus().equals(InvoiceStatusEnum.INVOICINGSUCCESSFUL.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) {
|
private InvoiceRecordsDO validateInvoiceExists(Long invoiceId) {
|
||||||
InvoiceRecordsDO invoiceRecordsDO = invoiceRecordsMapper.selectById(invoiceId);
|
InvoiceRecordsDO invoiceRecordsDO = invoiceRecordsMapper.selectById(invoiceId);
|
||||||
if (ObjectUtil.isNull(invoiceRecordsDO)) {
|
if (ObjectUtil.isNull(invoiceRecordsDO)) {
|
||||||
throw exception(INVOICE_NO_EXIST);
|
throw new ServiceException(INVOICE_NO_EXIST);
|
||||||
}
|
}
|
||||||
return invoiceRecordsDO;
|
return invoiceRecordsDO;
|
||||||
}
|
}
|
||||||
@@ -439,7 +438,7 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
private List<PurchaseRecordDO> validatePurchaseRecordExists(List<Long> purchaseId) {
|
private List<PurchaseRecordDO> validatePurchaseRecordExists(List<Long> purchaseId) {
|
||||||
List<PurchaseRecordDO> purchaseRecordDOS = purchaseRecordMapper.selectBatchIds(purchaseId);
|
List<PurchaseRecordDO> purchaseRecordDOS = purchaseRecordMapper.selectBatchIds(purchaseId);
|
||||||
if (CollUtil.isEmpty(purchaseRecordDOS)) {
|
if (CollUtil.isEmpty(purchaseRecordDOS)) {
|
||||||
throw exception(PURCHASE_RECORD_NO_EXIST);
|
throw new ServiceException(PURCHASE_RECORD_NO_EXIST);
|
||||||
}
|
}
|
||||||
return purchaseRecordDOS;
|
return purchaseRecordDOS;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.system.service.funds.productpromotion;
|
package com.cf.imes.module.system.service.funds.productpromotion;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
||||||
@@ -21,7 +22,6 @@ import jakarta.annotation.Resource;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
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_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_NO_EXIST;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PRODUCT_PROMOTION_PURCHASEDURATION_IS_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) {
|
private ProductPromotionDO validateRechargeActiveExists(Long id) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw exception(PRODUCT_PROMOTION_NO_EXIST);
|
throw new ServiceException(PRODUCT_PROMOTION_NO_EXIST);
|
||||||
}
|
}
|
||||||
ProductPromotionDO giftMoneyDetailsDO = productPromotionMapper.selectOne(new LambdaQueryWrapperX<ProductPromotionDO>()
|
ProductPromotionDO giftMoneyDetailsDO = productPromotionMapper.selectOne(new LambdaQueryWrapperX<ProductPromotionDO>()
|
||||||
.eq(ProductPromotionDO::getId, id)
|
.eq(ProductPromotionDO::getId, id)
|
||||||
.eq(ProductPromotionDO::getDeleted, false));
|
.eq(ProductPromotionDO::getDeleted, false));
|
||||||
if (giftMoneyDetailsDO == null) {
|
if (giftMoneyDetailsDO == null) {
|
||||||
throw exception(PRODUCT_PROMOTION_NO_EXIST);
|
throw new ServiceException(PRODUCT_PROMOTION_NO_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
return giftMoneyDetailsDO;
|
return giftMoneyDetailsDO;
|
||||||
|
|||||||
+6
-7
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.funds.products;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -23,7 +23,6 @@ import jakarta.annotation.Resource;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,7 +98,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
|||||||
@Override
|
@Override
|
||||||
public ProductsDetailDO validateProductDetailsExists(Long id) {
|
public ProductsDetailDO validateProductDetailsExists(Long id) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw exception(PRODUCTS_DETAIL_NO_EXIST);
|
throw new ServiceException(PRODUCTS_DETAIL_NO_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductsDetailDO productsDetailDO = productDetailsMapper.selectOne(new LambdaQueryWrapperX<ProductsDetailDO>()
|
ProductsDetailDO productsDetailDO = productDetailsMapper.selectOne(new LambdaQueryWrapperX<ProductsDetailDO>()
|
||||||
@@ -107,7 +106,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
|||||||
.eq(ProductsDetailDO::getDeleted, false));
|
.eq(ProductsDetailDO::getDeleted, false));
|
||||||
|
|
||||||
if (productsDetailDO == null) {
|
if (productsDetailDO == null) {
|
||||||
throw exception(PRODUCTS_DETAIL_NO_EXIST);
|
throw new ServiceException(PRODUCTS_DETAIL_NO_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
return productsDetailDO;
|
return productsDetailDO;
|
||||||
@@ -128,7 +127,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
|||||||
AssertUtils.notEmpty(productsDO, PRODUCTS_NO_EXIST);
|
AssertUtils.notEmpty(productsDO, PRODUCTS_NO_EXIST);
|
||||||
|
|
||||||
if (!productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())) {
|
if (!productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())) {
|
||||||
throw exception(PRODUCTS_NOT_NOLIST);
|
throw new ServiceException(PRODUCTS_NOT_NOLIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
return productsDO;
|
return productsDO;
|
||||||
@@ -148,7 +147,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
|||||||
AssertUtils.notEmpty(productsDO, PRODUCTS_NO_EXIST);
|
AssertUtils.notEmpty(productsDO, PRODUCTS_NO_EXIST);
|
||||||
|
|
||||||
if (productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())) {
|
if (productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())) {
|
||||||
throw exception(PRODUCTS_DETAIL_NO_UPDATE);
|
throw new ServiceException(PRODUCTS_DETAIL_NO_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return productsDO;
|
return productsDO;
|
||||||
@@ -167,7 +166,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService {
|
|||||||
// 时长去重
|
// 时长去重
|
||||||
count = productDetailsMapper.selectCountByDuration(createReqVO.getProductId(), createReqVO.getId(), duration, durationUnit);
|
count = productDetailsMapper.selectCountByDuration(createReqVO.getProductId(), createReqVO.getId(), duration, durationUnit);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw ServiceExceptionUtil.exception(PRODUCTS_DETAIL_DURATION_EXIST, duration, ProductDurationUnitEnum.getDesc(durationUnit));
|
throw new ServiceException(PRODUCTS_DETAIL_DURATION_EXIST, duration, ProductDurationUnitEnum.getDesc(durationUnit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.system.service.funds.products;
|
package com.cf.imes.module.system.service.funds.products;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -18,7 +19,6 @@ import jakarta.annotation.Resource;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
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)) {
|
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);
|
ProductsDO productsDO = BeanUtils.toBean(updateReqVO, ProductsDO.class);
|
||||||
productsMapper.updateById(productsDO);
|
productsMapper.updateById(productsDO);
|
||||||
@@ -82,7 +82,7 @@ public class ProductsServiceImpl implements ProductsService {
|
|||||||
ProductsDO productsDO = validateProductPlateExists(id);
|
ProductsDO productsDO = validateProductPlateExists(id);
|
||||||
|
|
||||||
if(productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())){
|
if(productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())){
|
||||||
throw exception(PRODUCTS_NO_DELETE);
|
throw new ServiceException(PRODUCTS_NO_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
productsMapper.update(new LambdaUpdateWrapper<ProductsDO>()
|
productsMapper.update(new LambdaUpdateWrapper<ProductsDO>()
|
||||||
@@ -115,7 +115,7 @@ public class ProductsServiceImpl implements ProductsService {
|
|||||||
.eq(ProductsDO::getDeleted, false));
|
.eq(ProductsDO::getDeleted, false));
|
||||||
|
|
||||||
if (productsDO == null) {
|
if (productsDO == null) {
|
||||||
throw exception(PRODUCTS_NO_EXIST);
|
throw new ServiceException(PRODUCTS_NO_EXIST);
|
||||||
}
|
}
|
||||||
return productsDO;
|
return productsDO;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -8,7 +8,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
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.PageParam;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
||||||
@@ -249,7 +248,7 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if (duplicateOpt.isPresent()) {
|
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不重复的,作为删除的部分
|
// 5、删选出当前记录和入参列表中purchaseId不重复的,作为删除的部分
|
||||||
|
|||||||
+8
-8
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.system.service.labeltemplate;
|
package com.cf.imes.module.system.service.labeltemplate;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
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.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.module.system.dal.mysql.labeltemplate.LabelTemplateMapper;
|
import com.cf.imes.module.system.dal.mysql.labeltemplate.LabelTemplateMapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,18 +58,18 @@ public class LabelTemplateServiceImpl implements LabelTemplateService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id);
|
LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id);
|
||||||
if (labelTemplateDO == null) {
|
if (labelTemplateDO == null) {
|
||||||
throw exception(LABEL_TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(LABEL_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
Boolean isDefault = labelTemplateDO.getIsDefault();
|
Boolean isDefault = labelTemplateDO.getIsDefault();
|
||||||
if(isDefault) {
|
if(isDefault) {
|
||||||
throw exception(DEFAULT_NOT_DELETED);
|
throw new ServiceException(DEFAULT_NOT_DELETED);
|
||||||
}
|
}
|
||||||
labelTemplateMapper.deleteById(id);
|
labelTemplateMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateLabelTemplateExists(Long id) {
|
private void validateLabelTemplateExists(Long id) {
|
||||||
if (labelTemplateMapper.selectById(id) == null) {
|
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(CollUtil.isNotEmpty(labelTemplateDOS)) {
|
||||||
if (labelTemplateDOS.size() > 1) {
|
if (labelTemplateDOS.size() > 1) {
|
||||||
throw exception(DEFAULT_TEMPLATE_COUNT);
|
throw new ServiceException(DEFAULT_TEMPLATE_COUNT);
|
||||||
}
|
}
|
||||||
LabelTemplateDO labelTemplateDO = labelTemplateDOS.get(0);
|
LabelTemplateDO labelTemplateDO = labelTemplateDOS.get(0);
|
||||||
labelTemplateDO.setTemplate(JsonUtils.unzipString(labelTemplateDO.getTemplate()));
|
labelTemplateDO.setTemplate(JsonUtils.unzipString(labelTemplateDO.getTemplate()));
|
||||||
LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class);
|
LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class);
|
||||||
return labelTemplateRespVO;
|
return labelTemplateRespVO;
|
||||||
}
|
}
|
||||||
throw exception(DEFAULT_LABEL_NOT_EXISTS);
|
throw new ServiceException(DEFAULT_LABEL_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -105,14 +105,14 @@ public class LabelTemplateServiceImpl implements LabelTemplateService {
|
|||||||
public Boolean setDefaultTemplate(Long id) {
|
public Boolean setDefaultTemplate(Long id) {
|
||||||
LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id);
|
LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id);
|
||||||
if(Objects.isNull(labelTemplateDO)) {
|
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>()
|
List<LabelTemplateDO> labelTemplateDOS = labelTemplateMapper.selectList(new LambdaQueryWrapperX<LabelTemplateDO>()
|
||||||
.eq(LabelTemplateDO::getIsDefault, Boolean.TRUE)
|
.eq(LabelTemplateDO::getIsDefault, Boolean.TRUE)
|
||||||
.eq(LabelTemplateDO::getType, labelTemplateDO.getType())
|
.eq(LabelTemplateDO::getType, labelTemplateDO.getType())
|
||||||
);
|
);
|
||||||
// if(CollectionUtil.isEmpty(labelTemplateDOS) || labelTemplateDOS.size()>1) {
|
// if(CollectionUtil.isEmpty(labelTemplateDOS) || labelTemplateDOS.size()>1) {
|
||||||
// throw exception(DEFAULT_TEMPLATE_COUNT);
|
// throw new ServiceException(DEFAULT_TEMPLATE_COUNT);
|
||||||
// }
|
// }
|
||||||
if(!labelTemplateDOS.isEmpty()){
|
if(!labelTemplateDOS.isEmpty()){
|
||||||
LabelTemplateDO templateDO = new LabelTemplateDO();
|
LabelTemplateDO templateDO = new LabelTemplateDO();
|
||||||
|
|||||||
+4
-4
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.lable;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.cf.imes.framework.common.enums.UserSettingTypeEnum;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -27,7 +28,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
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.parseTree;
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
@@ -90,7 +90,7 @@ public class LabelServiceImpl implements LabelService {
|
|||||||
.eq(MachineDO::getLabelId, id)
|
.eq(MachineDO::getLabelId, id)
|
||||||
);
|
);
|
||||||
if(CollUtil.isNotEmpty(machineDOS)) {
|
if(CollUtil.isNotEmpty(machineDOS)) {
|
||||||
throw exception(MACHINE_USE_LABEL);
|
throw new ServiceException(MACHINE_USE_LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> labelId = new ArrayList<>();
|
List<Long> labelId = new ArrayList<>();
|
||||||
@@ -110,7 +110,7 @@ public class LabelServiceImpl implements LabelService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(labelId) && labelId.contains(id)) {
|
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) {
|
private LabelDO validateLabelExists(Long id) {
|
||||||
LabelDO labelDO = labelMapper.selectById(id);
|
LabelDO labelDO = labelMapper.selectById(id);
|
||||||
if (labelDO == null) {
|
if (labelDO == null) {
|
||||||
throw exception(LABEL_NOT_EXISTS);
|
throw new ServiceException(LABEL_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return labelDO;
|
return labelDO;
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-17
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||||
import com.cf.imes.framework.common.enums.MachineTypeEnum;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -44,7 +45,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
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.common.util.json.JsonUtils.*;
|
||||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||||
@@ -95,13 +95,13 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
MachineLimitDO machineLimitDO = machineLimitMapper.selectById(loginUser.getOrganId());
|
MachineLimitDO machineLimitDO = machineLimitMapper.selectById(loginUser.getOrganId());
|
||||||
|
|
||||||
if(machineLimitDO == null){
|
if(machineLimitDO == null){
|
||||||
throw exception(MACHINE_DATA_ERROR);
|
throw new ServiceException(MACHINE_DATA_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验机台名称是否重复
|
// 校验机台名称是否重复
|
||||||
MachineDO machine = machineMapper.selectMachineName(createReqVO.getName(), createReqVO.getMachineType(), getUserOrganId());
|
MachineDO machine = machineMapper.selectMachineName(createReqVO.getName(), createReqVO.getMachineType(), getUserOrganId());
|
||||||
if (machine != null) {
|
if (machine != null) {
|
||||||
throw exception(MACHINE_NAME_ERROR);
|
throw new ServiceException(MACHINE_NAME_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
validateMachineNum(createReqVO.getMachineType(), loginUser.getOrganId());
|
validateMachineNum(createReqVO.getMachineType(), loginUser.getOrganId());
|
||||||
@@ -132,7 +132,7 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
machineTemplateDO = machineTemplateMapper.selectMachine(createReqVO.getBrandId(), createReqVO.getMachineId());
|
machineTemplateDO = machineTemplateMapper.selectMachine(createReqVO.getBrandId(), createReqVO.getMachineId());
|
||||||
|
|
||||||
if (machineTemplateDO == null) {
|
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);
|
MachineDO machineDO = machineMapper.selectById(id);
|
||||||
if (machineDO == null) {
|
if (machineDO == null) {
|
||||||
throw exception(MACHINE_NOT_EXISTS);
|
throw new ServiceException(MACHINE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 校验当前机台是否使用
|
// 校验当前机台是否使用
|
||||||
if (Boolean.TRUE.equals(orderPlanApi.getOrderPlan(id).getData())) {
|
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());
|
List<SystemConfigSchemeDO> systemConfigSchemeDOS = systemConfigSchemeMapper.selectOrganConfig(machineDO.getOrganId());
|
||||||
@@ -374,7 +374,7 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(machineIds.contains(id)){
|
if(machineIds.contains(id)){
|
||||||
throw exception(MACHINE_USED_ALREADY);
|
throw new ServiceException(MACHINE_USED_ALREADY);
|
||||||
}
|
}
|
||||||
|
|
||||||
machineMapper.deleteById(id);
|
machineMapper.deleteById(id);
|
||||||
@@ -384,7 +384,7 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
public void batchDeleteCutting(List<Long> ids) {
|
public void batchDeleteCutting(List<Long> ids) {
|
||||||
List<MachineDO> machineDOS = machineMapper.selectBatchIds(ids);
|
List<MachineDO> machineDOS = machineMapper.selectBatchIds(ids);
|
||||||
if (CollUtil.isEmpty(machineDOS)) {
|
if (CollUtil.isEmpty(machineDOS)) {
|
||||||
throw exception(MACHINE_NOT_EXISTS);
|
throw new ServiceException(MACHINE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
machineMapper.deleteBatchIds(ids);
|
machineMapper.deleteBatchIds(ids);
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,7 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
MachineDO machineDO = machineMapper.selectById(id);
|
MachineDO machineDO = machineMapper.selectById(id);
|
||||||
|
|
||||||
if (machineDO == null) {
|
if (machineDO == null) {
|
||||||
throw exception(MACHINE_ERROR);
|
throw new ServiceException(MACHINE_ERROR);
|
||||||
}
|
}
|
||||||
// 对机台的配置进行解压
|
// 对机台的配置进行解压
|
||||||
machineDO.setSetting(JsonUtils.unzipString(machineDO.getSetting()));
|
machineDO.setSetting(JsonUtils.unzipString(machineDO.getSetting()));
|
||||||
@@ -440,20 +440,20 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
|
|
||||||
OrganizationDO tenant = organMapper.selectById(vo.getOrganId());
|
OrganizationDO tenant = organMapper.selectById(vo.getOrganId());
|
||||||
if (tenant == null) {
|
if (tenant == null) {
|
||||||
throw exception(ORGAN_NOT_EXISTS);
|
throw new ServiceException(ORGAN_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineLimitDO machineLimit = machineLimitMapper.selectById(vo.getOrganId());
|
MachineLimitDO machineLimit = machineLimitMapper.selectById(vo.getOrganId());
|
||||||
|
|
||||||
if (machineLimit != null) {
|
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()};
|
Integer[] limits = {vo.getCutLimit(), vo.getDrillLimit(), vo.getLabelLimit(), vo.getSawLimit(), vo.getSealedgeLimit()};
|
||||||
|
|
||||||
for (Integer limit : limits) {
|
for (Integer limit : limits) {
|
||||||
if (limit > 127) {
|
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());
|
OrganizationDO tenant = organMapper.selectById(vo.getOrganId());
|
||||||
if (tenant == null) {
|
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) {
|
for (Integer limit : limits) {
|
||||||
if (limit > 127) {
|
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) {
|
private void validateExists(Long id, String name, Integer machineType, Long machineId) {
|
||||||
MachineDO machineDO = machineMapper.selectById(id);
|
MachineDO machineDO = machineMapper.selectById(id);
|
||||||
if (machineDO == null) {
|
if (machineDO == null) {
|
||||||
throw exception(MACHINE_NOT_EXISTS);
|
throw new ServiceException(MACHINE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
MachineDO machine = machineMapper.selectMachine(name, machineType, machineId, getUserOrganId());
|
MachineDO machine = machineMapper.selectMachine(name, machineType, machineId, getUserOrganId());
|
||||||
|
|
||||||
if (machine != null) {
|
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) {
|
if (machineNum >= authMachineNum) {
|
||||||
throw exception(MACHINE_NUM_ERROR);
|
throw new ServiceException(MACHINE_NUM_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-13
@@ -5,6 +5,7 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||||
import com.cf.imes.framework.common.enums.MachineTypeEnum;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -34,7 +35,6 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
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.framework.common.util.json.JsonUtils.unzipString;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
|
|
||||||
// todo 测试时的判断,测试完毕后删除
|
// todo 测试时的判断,测试完毕后删除
|
||||||
if (reqVO.getNowBrandId() == null) {
|
if (reqVO.getNowBrandId() == null) {
|
||||||
throw exception(THE_CURRENT_BRAND);
|
throw new ServiceException(THE_CURRENT_BRAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
validateMachineTemplate(reqVO.getName(), reqVO.getMachineType());
|
validateMachineTemplate(reqVO.getName(), reqVO.getMachineType());
|
||||||
@@ -113,7 +113,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
|
|
||||||
MachineBrandDO machineBrandDO = machineBrandMapper.selectById(reqVO.getNowBrandId());
|
MachineBrandDO machineBrandDO = machineBrandMapper.selectById(reqVO.getNowBrandId());
|
||||||
if (machineBrandDO == null) {
|
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) {
|
public CuttingTemplateRespVO getCuttingTemplateById(String id) {
|
||||||
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
||||||
if (Objects.isNull(templateDO)) {
|
if (Objects.isNull(templateDO)) {
|
||||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
templateDO.setSetting(unzipString(templateDO.getSetting()));
|
templateDO.setSetting(unzipString(templateDO.getSetting()));
|
||||||
return MachineTemplateConvert.convert1(templateDO);
|
return MachineTemplateConvert.convert1(templateDO);
|
||||||
@@ -154,7 +154,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectByBrand(brandId);
|
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectByBrand(brandId);
|
||||||
|
|
||||||
if (!machineTemplateDOS.isEmpty()) {
|
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();
|
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());
|
MachineBrandDO machineBrandDO = machineBrandMapper.selectBrand(reqVO.getBrand(), reqVO.getMachineType());
|
||||||
|
|
||||||
if (machineBrandDO != null) {
|
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()
|
MachineBrandDO machineBrand = MachineBrandDO.builder()
|
||||||
@@ -288,7 +288,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
private MachineBrandDO validateBrandExistes(Long id) {
|
private MachineBrandDO validateBrandExistes(Long id) {
|
||||||
MachineBrandDO machineBrandDO = machineBrandMapper.selectById(id);
|
MachineBrandDO machineBrandDO = machineBrandMapper.selectById(id);
|
||||||
if (ObjectUtil.isNull(machineBrandDO)) {
|
if (ObjectUtil.isNull(machineBrandDO)) {
|
||||||
throw exception(THE_CURRENT_BRAND);
|
throw new ServiceException(THE_CURRENT_BRAND);
|
||||||
}
|
}
|
||||||
return machineBrandDO;
|
return machineBrandDO;
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
public Boolean deleteCuttingTemplate(Long id) {
|
public Boolean deleteCuttingTemplate(Long id) {
|
||||||
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
||||||
if (Objects.isNull(templateDO)) {
|
if (Objects.isNull(templateDO)) {
|
||||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
machineTemplateMapper.deleteById(id);
|
machineTemplateMapper.deleteById(id);
|
||||||
@@ -458,7 +458,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} 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) {
|
} 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);
|
MachineTemplateDO machineTemplateDO = machineTemplateMapper.selectById(machineId);
|
||||||
|
|
||||||
if (machineTemplateDO == null) {
|
if (machineTemplateDO == null) {
|
||||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineTemplateDO machineTemplate = machineTemplateMapper.selectMachineTemplate(name, machineType, machineId);
|
MachineTemplateDO machineTemplate = machineTemplateMapper.selectMachineTemplate(name, machineType, machineId);
|
||||||
|
|
||||||
if (machineTemplate != null) {
|
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) {
|
if (machineTemplateDO != null) {
|
||||||
throw exception(MACHINETEMPLATE_NAME_ERROR);
|
throw new ServiceException(MACHINETEMPLATE_NAME_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-5
@@ -1,6 +1,6 @@
|
|||||||
package com.cf.imes.module.system.service.mail;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
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 jakarta.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮箱账号 Service 实现类
|
* 邮箱账号 Service 实现类
|
||||||
*
|
*
|
||||||
@@ -62,7 +60,7 @@ public class MailAccountServiceImpl implements MailAccountService {
|
|||||||
validateMailAccountExists(id);
|
validateMailAccountExists(id);
|
||||||
// 校验是否存在关联模版
|
// 校验是否存在关联模版
|
||||||
if (mailTemplateService.getMailTemplateCountByAccountId(id) > 0) {
|
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) {
|
private void validateMailAccountExists(Long id) {
|
||||||
if (mailAccountMapper.selectById(id) == null) {
|
if (mailAccountMapper.selectById(id) == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -5,6 +5,7 @@ import cn.hutool.extra.mail.MailAccount;
|
|||||||
import cn.hutool.extra.mail.MailUtil;
|
import cn.hutool.extra.mail.MailUtil;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
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.convert.mail.MailAccountConvert;
|
||||||
import com.cf.imes.module.system.dal.dataobject.mail.MailAccountDO;
|
import com.cf.imes.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.mail.MailTemplateDO;
|
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.mq.producer.mail.MailProducer;
|
||||||
import com.cf.imes.module.system.service.member.MemberService;
|
import com.cf.imes.module.system.service.member.MemberService;
|
||||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
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.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -123,7 +123,7 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode);
|
MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode);
|
||||||
// 邮件模板不存在
|
// 邮件模板不存在
|
||||||
if (template == null) {
|
if (template == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId);
|
MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId);
|
||||||
// 邮箱账号不存在
|
// 邮箱账号不存在
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
String validateMail(String mail) {
|
String validateMail(String mail) {
|
||||||
if (CharSequenceUtil.isEmpty(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;
|
return mail;
|
||||||
}
|
}
|
||||||
@@ -158,7 +158,7 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
template.getParams().forEach(key -> {
|
template.getParams().forEach(key -> {
|
||||||
Object value = templateParams.get(key);
|
Object value = templateParams.get(key);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_SEND_TEMPLATE_PARAM_MISS, key);
|
throw new ServiceException(ErrorCodeConstants.MAIL_SEND_TEMPLATE_PARAM_MISS, key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-5
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.mail;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.ReUtil;
|
import cn.hutool.core.util.ReUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO;
|
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.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮箱模版 Service 实现类
|
* 邮箱模版 Service 实现类
|
||||||
*
|
*
|
||||||
@@ -82,7 +80,7 @@ public class MailTemplateServiceImpl implements MailTemplateService {
|
|||||||
// 存在 template 记录的情况下
|
// 存在 template 记录的情况下
|
||||||
if (id == null // 新增时,说明重复
|
if (id == null // 新增时,说明重复
|
||||||
|| ObjectUtil.notEqual(id, template.getId())) { // 更新时,如果 id 不一致,说明重复
|
|| 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) {
|
private void validateMailTemplateExists(Long id) {
|
||||||
if (mailTemplateMapper.selectById(id) == null) {
|
if (mailTemplateMapper.selectById(id) == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS);
|
throw new ServiceException(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.notice;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@@ -20,7 +20,6 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import jakarta.annotation.Resource;
|
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;
|
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);
|
NoticeDO notice = noticeMapper.selectById(id);
|
||||||
if (notice == null) {
|
if (notice == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
throw new ServiceException(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
boolean superAdmin = SecurityFrameworkUtils.isSuperAdmin();
|
boolean superAdmin = SecurityFrameworkUtils.isSuperAdmin();
|
||||||
// 公告和操作人非统一组织,只有超管可以编辑和删除
|
// 公告和操作人非统一组织,只有超管可以编辑和删除
|
||||||
if (NoticeSourceEnum.CUSTOM.equals(notice.getSource())
|
if (NoticeSourceEnum.CUSTOM.equals(notice.getSource())
|
||||||
&& !notice.getOrganId().equals(OrganContextHolder.getOrganId())
|
&& !notice.getOrganId().equals(OrganContextHolder.getOrganId())
|
||||||
&& !superAdmin) {
|
&& !superAdmin) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
throw new ServiceException(ErrorCodeConstants.NOTICE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
// 只有超管可以操作内置公告
|
// 只有超管可以操作内置公告
|
||||||
if (NoticeSourceEnum.SYSTEM.equals(notice.getSource()) && !superAdmin) {
|
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());
|
wrapper.eq(NoticeDO::getOrganId, OrganContextHolder.getOrganId());
|
||||||
}
|
}
|
||||||
if (noticeMapper.exists(wrapper)) {
|
if (noticeMapper.exists(wrapper)) {
|
||||||
throw exception(NOTICE_NAME_UNIQE_ERROR);
|
throw new ServiceException(NOTICE_NAME_UNIQE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user