mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、统一抛出ServiceException带占位符的填充方式,不再使用ServiceExceptionUtils;2、新增System服务ErrorCode的国际化;3、Webcad异步导入移除分布式锁,导入解析事务完善;
This commit is contained in:
+2
-2
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
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)) {
|
||||
generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDO);
|
||||
} 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;
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
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)) {
|
||||
orderNoSeq = resetByDay(orderNoSeq, orgCustomPlateNoSeqRespDTO, plateNoRule);
|
||||
} 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;
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
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)) {
|
||||
return generateNoByDateResetMode(resetModeEnum, plateNoRule, generateConfig, plateDO);
|
||||
} 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
|
||||
*/
|
||||
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 static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2025/5/13 16:41
|
||||
@@ -25,26 +23,6 @@ public class OrderImportTaskServiceImpl implements OrderImportTaskService {
|
||||
@Resource
|
||||
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
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||
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.cf.imes.framework.common.exception.ErrorCode;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
||||
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.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -61,7 +58,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
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.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_FAILED;
|
||||
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
|
||||
private RawGoodsMapper rawGoodsMapper;
|
||||
|
||||
@Resource
|
||||
private DataSourceTransactionManager transactionManager;
|
||||
|
||||
@Resource
|
||||
private SystemConfigApi systemConfigApi;
|
||||
|
||||
@@ -131,6 +124,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
private WebCadImportProperties webCadImportProperties;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean webCadOrderImport(MultipartFile file) {
|
||||
Long organId = OrganContextHolder.getOrganId();
|
||||
|
||||
@@ -138,13 +132,9 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
throw new ServiceException(WEBCAD_ORDER_IMPORT_ORGANID_EMPTY_ERROR);
|
||||
}
|
||||
|
||||
TransactionStatus transactionStatus = transactionManager.getTransaction(TransactionDefinition.withDefaults());
|
||||
// 是否同步处理
|
||||
boolean sync = true;
|
||||
|
||||
// 异步发送是否成功,没有成功需要把锁解开
|
||||
boolean initAsyncSuccess = false;
|
||||
|
||||
Long taskId = null;
|
||||
OrderDO orderDO = null;
|
||||
JsonFactory factory = new JsonFactory();
|
||||
@@ -193,14 +183,9 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
// 缓存请求,创建导入任务
|
||||
taskId = initiateTask(node, organId, orderDO.getId(), fileName);
|
||||
|
||||
// 上锁
|
||||
addAsyncLock(taskId);
|
||||
|
||||
// 发送异步消息
|
||||
sendMessage(taskId);
|
||||
|
||||
initAsyncSuccess = true;
|
||||
|
||||
// 跳过当前 blockData 解析步骤
|
||||
parser.skipChildren(); // 忽略 blockData
|
||||
}
|
||||
@@ -208,18 +193,12 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
parser.skipChildren(); // 忽略其他字段
|
||||
}
|
||||
}
|
||||
// 事务提交
|
||||
transactionManager.commit(transactionStatus);
|
||||
} catch (ServiceException se) {
|
||||
// 事务回滚
|
||||
transactionManager.rollback(transactionStatus);
|
||||
// 移除临时文件
|
||||
removeCacheFileWhenException(sync, taskId);
|
||||
|
||||
throw se;
|
||||
} catch (Exception e) {
|
||||
// 事务回滚
|
||||
transactionManager.rollback(transactionStatus);
|
||||
// 移除临时文件
|
||||
removeCacheFileWhenException(sync, taskId);
|
||||
|
||||
@@ -227,7 +206,8 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
log.error(webcadOrderImportFailed.getMsg(), e);
|
||||
throw new ServiceException(webcadOrderImportFailed);
|
||||
} finally {
|
||||
unlock(sync, initAsyncSuccess, organId, taskId);
|
||||
// 同步解锁
|
||||
unlock(sync, organId);
|
||||
}
|
||||
return sync;
|
||||
}
|
||||
@@ -244,7 +224,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
.eq(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, false));
|
||||
if (ObjectUtil.isNull(orderDOFromOrderNo)) {
|
||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
||||
throw new ServiceException(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
||||
} else {
|
||||
Integer status = orderDOFromOrderNo.getStatus();
|
||||
// 更新生产单来源为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) {
|
||||
if(sync) {
|
||||
private void unlock(boolean sync, Long organId) {
|
||||
if (sync) {
|
||||
// 解同步锁
|
||||
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.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_ORGAN_LOCK_ERROR;
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
||||
@@ -144,14 +143,14 @@ public class DefaultExcelOrderImportConsumer {
|
||||
|
||||
organId = OrganContextHolder.getOrganId();
|
||||
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);
|
||||
lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout());
|
||||
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();
|
||||
// 校验生产单id
|
||||
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);
|
||||
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.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
||||
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.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
||||
@@ -53,7 +52,7 @@ import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
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_ORGAN_LOCK_ERROR;
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL;
|
||||
@@ -141,14 +140,14 @@ public class DefaultXmlOrderImportConsumer {
|
||||
|
||||
organId = OrganContextHolder.getOrganId();
|
||||
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);
|
||||
lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout());
|
||||
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();
|
||||
// 校验生产单id
|
||||
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);
|
||||
return orderDO;
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.cf.imes.module.plan.service.orderImport.consumer;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
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.redis.constants.RedisKeyConstants;
|
||||
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
||||
@@ -57,7 +57,7 @@ public class OrderImportDeadLetterConsumer {
|
||||
channel.basicAck(deliveryTag, false);
|
||||
|
||||
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 {
|
||||
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 com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
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.util.RedisLockUtil;
|
||||
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.beans.factory.annotation.Value;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.messaging.handler.annotation.Header;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.thymeleaf.util.StringUtils;
|
||||
|
||||
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_ORGANID_NOT_EXISTS;
|
||||
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;
|
||||
|
||||
@Resource
|
||||
private DataSourceTransactionManager transactionManager;
|
||||
private ChenfengCacheProperties chenfengCacheProperties;
|
||||
|
||||
@RabbitListener(queues = "#{@orderImportWebCadQueueName}")
|
||||
public void orderImport(String message,
|
||||
@@ -118,27 +116,36 @@ public class WebCadOrderImportConsumer {
|
||||
|
||||
Long organId = null;
|
||||
Long taskId = Long.parseLong(message);
|
||||
boolean nackSent = false;
|
||||
TransactionStatus transactionStatus = null;
|
||||
boolean lockResult = true;
|
||||
OrderImportTaskDO orderImportTaskDO = null;
|
||||
try {
|
||||
// 手动确认消息接收
|
||||
channel.basicAck(deliveryTag, false);
|
||||
|
||||
organId = OrganContextHolder.getOrganId();
|
||||
if (ObjectUtil.isNull(organId)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORGANID_NOT_EXISTS);
|
||||
throw new ServiceException(ORDER_IMPORT_ORGANID_NOT_EXISTS);
|
||||
}
|
||||
|
||||
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 {
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("====================【webcad异步拆单处理临时数据开始】====================");
|
||||
WebCadOrderImportAsyncFactory webCadOrderImportAsyncFactory =
|
||||
new WebCadOrderImportAsyncFactory(organId, orderMapper, snowFlakeGenerator, orderBodyMapper, plateMapper, orderGroupMapper, idWorker,
|
||||
@@ -146,89 +153,42 @@ public class WebCadOrderImportConsumer {
|
||||
webCadOrderImportAsyncFactory.analyzeTempData(taskId, webCadImportProperties.getTempFilePath());
|
||||
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) {
|
||||
log.error(ORDER_IMPORT_FAIL.getMsg(), e);
|
||||
// 回滚事务
|
||||
if (transactionStatus != null) {
|
||||
transactionManager.rollback(transactionStatus);
|
||||
}
|
||||
|
||||
// 更新任务状态
|
||||
orderImportTaskService.updateExceptionTaskStatus(taskId, organId);
|
||||
|
||||
nackSent = true;
|
||||
// 确认消息进入死信队列
|
||||
channel.basicNack(deliveryTag, false, false);
|
||||
updateImportTaskFail(orderImportTaskDO, e);
|
||||
throw e;
|
||||
} finally {
|
||||
// 手动确认消息接收
|
||||
if (!nackSent) {
|
||||
channel.basicAck(deliveryTag, false);
|
||||
if (lockResult) {
|
||||
// 导入锁解锁
|
||||
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) {
|
||||
boolean taskExist = false;
|
||||
OrderImportTaskDO orderImportTaskDO = null;
|
||||
// 线程每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("====================【线程中断异常】====================");
|
||||
}
|
||||
}
|
||||
public void updateImportTaskFail(OrderImportTaskDO orderImportTaskDO, Exception ex) {
|
||||
if (orderImportTaskDO == null) {
|
||||
return;
|
||||
}
|
||||
if (taskExist) {
|
||||
// 更新状态为消费成功
|
||||
orderImportTaskMapper.update(new LambdaUpdateWrapper<OrderImportTaskDO>()
|
||||
.eq(OrderImportTaskDO::getId, taskId)
|
||||
.eq(OrderImportTaskDO::getOrganId, organId)
|
||||
.set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CONSUME_SUCCESS.getStatus()));
|
||||
String msg;
|
||||
if (ex instanceof ServiceException) {
|
||||
msg = ex.getMessage();
|
||||
} else {
|
||||
String taskNotExistNotify = String.format("%s不存在的导入任务,消费中止", taskId);
|
||||
// 更新状态为消费成功,导入失败
|
||||
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));
|
||||
msg = ORDER_IMPORT_FAIL.getMsg();
|
||||
}
|
||||
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.extension.plugins.pagination.Page;
|
||||
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.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
@@ -816,7 +816,7 @@ public class DefaultExcelOrderImportFactory {
|
||||
// 查询大板id用于小板轮廓goodsId
|
||||
GoodsDO goodsDO = goodsMapper.selectById(goodsId);
|
||||
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.setPlateGoodsId(goodsId);
|
||||
@@ -955,7 +955,7 @@ public class DefaultExcelOrderImportFactory {
|
||||
// // 查询大板id用于小板轮廓goodsId
|
||||
// GoodsDO goodsDO = goodsMapper.selectById(goodsId);
|
||||
// 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.setPlateGoodsId(goodsId);
|
||||
@@ -1332,7 +1332,7 @@ public class DefaultExcelOrderImportFactory {
|
||||
// 存在大板
|
||||
goodsDO.setGoodsId(plateGoodDO.getGoodsId());
|
||||
} 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::getVersion, version + 1));
|
||||
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.toolkit.ObjectUtils;
|
||||
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.dict.core.util.DictFrameworkUtils;
|
||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||
@@ -660,7 +660,7 @@ public class DefaultXmlOrderImportFactory {
|
||||
|
||||
// 查询大板id用于小板轮廓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.setPlateGoodsId(goodsId);
|
||||
orderModelDO.setOrganId(organId);
|
||||
@@ -1956,7 +1956,7 @@ public class DefaultXmlOrderImportFactory {
|
||||
.set(OrderDO::getArea, currentPlateArea)
|
||||
.set(OrderDO::getVersion, version + 1));
|
||||
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.update.LambdaUpdateWrapper;
|
||||
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.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
@@ -347,10 +347,10 @@ public class WebCadOrderImportAsyncFactory {
|
||||
} catch (Exception e) {
|
||||
ErrorCode webcadOrderImportOrgSealedgeAnalyzeError = WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
|
||||
log.error(webcadOrderImportOrgSealedgeAnalyzeError.getMsg(), e);
|
||||
throw ServiceExceptionUtil.exception(webcadOrderImportOrgSealedgeAnalyzeError);
|
||||
throw new ServiceException(webcadOrderImportOrgSealedgeAnalyzeError);
|
||||
}
|
||||
} 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::getDeleted, false));
|
||||
if (ObjectUtil.isNull(orderDOFromOrderNo)) {
|
||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
||||
throw new ServiceException(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
||||
} else {
|
||||
Integer status = orderDOFromOrderNo.getStatus();
|
||||
// 更新生产单来源为webcad
|
||||
@@ -389,7 +389,7 @@ public class WebCadOrderImportAsyncFactory {
|
||||
);
|
||||
// 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 {
|
||||
currentPlateNum = existPlateCount.intValue();
|
||||
// 统计当前板件总面积
|
||||
@@ -2150,7 +2150,7 @@ public class WebCadOrderImportAsyncFactory {
|
||||
.set(OrderDO::getArea, currentPlateArea)
|
||||
.set(OrderDO::getVersion, version + 1));
|
||||
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::getVersion, updateDo.getVersion() + 1));
|
||||
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.update.LambdaUpdateWrapper;
|
||||
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.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
@@ -267,7 +267,7 @@ public class WebCadOrderImportFactory {
|
||||
customPlateNoGenerateService.updateCustomPlateNoGenerateConfig(plateNoGenerateConfigVO, orderDO);
|
||||
|
||||
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) {
|
||||
@@ -313,10 +313,10 @@ public class WebCadOrderImportFactory {
|
||||
} catch (Exception e) {
|
||||
ErrorCode webcadOrderImportOrgSealedgeAnalyzeError = WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
|
||||
log.error(webcadOrderImportOrgSealedgeAnalyzeError.getMsg(), e);
|
||||
throw ServiceExceptionUtil.exception(webcadOrderImportOrgSealedgeAnalyzeError);
|
||||
throw new ServiceException(webcadOrderImportOrgSealedgeAnalyzeError);
|
||||
}
|
||||
} 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万片阻止继续拆单
|
||||
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 {
|
||||
currentPlateNum = existPlateCount.intValue();
|
||||
// 统计当前板件总面积
|
||||
@@ -2015,7 +2015,7 @@ public class WebCadOrderImportFactory {
|
||||
.set(OrderDO::getArea, currentPlateArea)
|
||||
.set(OrderDO::getVersion, version + 1));
|
||||
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::getVersion, updateDo.getVersion() + 1));
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user