mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
修复:cad弹窗拆单失败后成功图纸数据不存在,移除拆单失败时删除图纸文件的操作
This commit is contained in:
-23
@@ -22,7 +22,6 @@ import com.cf.imes.module.executor.enums.OrderImportStatusEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderImportTaskStatusEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderImportTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.infra.api.file.FileApi;
|
||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataReqVO;
|
||||
import com.cf.imes.module.plan.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.plan.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||
@@ -121,9 +120,6 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Resource
|
||||
private FileApi fileApi;
|
||||
|
||||
private static final String REDIS_UNIQUEKEY = "webcad";
|
||||
|
||||
@Resource
|
||||
@@ -202,15 +198,11 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
}
|
||||
}
|
||||
} catch (ServiceException se) {
|
||||
// 删除cad图纸数据
|
||||
removeCadFileWhenException(cadViewFileId);
|
||||
// 移除临时文件
|
||||
removeCacheFileWhenException(sync, taskId);
|
||||
|
||||
throw se;
|
||||
} catch (Exception e) {
|
||||
// 删除cad图纸数据
|
||||
removeCadFileWhenException(cadViewFileId);
|
||||
// 移除临时文件
|
||||
removeCacheFileWhenException(sync, taskId);
|
||||
|
||||
@@ -349,19 +341,4 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除cad图纸文件数据
|
||||
*
|
||||
* @param cadViewFileId
|
||||
*/
|
||||
private void removeCadFileWhenException(Long cadViewFileId) {
|
||||
try {
|
||||
if (ObjectUtil.isNotNull(cadViewFileId)) {
|
||||
fileApi.deleteFileById(cadViewFileId);
|
||||
}
|
||||
} catch (IORuntimeException e) {
|
||||
log.error("删除cad图纸数据文件失败: {}", cadViewFileId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -10,7 +10,6 @@ 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.infra.api.file.FileApi;
|
||||
import com.cf.imes.module.plan.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||
import com.cf.imes.module.plan.dal.mysql.goods.GoodsMapper;
|
||||
import com.cf.imes.module.plan.dal.mysql.order.OrderMapper;
|
||||
@@ -103,9 +102,6 @@ public class WebCadOrderImportConsumer {
|
||||
@Resource
|
||||
private ChenfengCacheProperties chenfengCacheProperties;
|
||||
|
||||
@Resource
|
||||
private FileApi fileApi;
|
||||
|
||||
@RabbitListener(queues = "#{@orderImportWebCadQueueName}")
|
||||
@DS("imes_prod")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -151,7 +147,7 @@ public class WebCadOrderImportConsumer {
|
||||
WebCadOrderImportAsyncFactory webCadOrderImportAsyncFactory =
|
||||
new WebCadOrderImportAsyncFactory(organId, orderMapper, snowFlakeGenerator, orderBodyMapper, plateMapper, idWorker,
|
||||
orderImportTaskMapper, orderInputProcessor, goodsMapper, rawGoodsMapper, customPlateNoGenerateService, systemConfigApi, orderImportTaskDO.getCreator(),
|
||||
cadImportPlateNumThreshold, jdbcTemplate, fileApi);
|
||||
cadImportPlateNumThreshold, jdbcTemplate);
|
||||
webCadOrderImportAsyncFactory.analyzeTempData(taskId, webCadImportProperties.getTempFilePath());
|
||||
log.info("====================【webcad异步拆单处理临时数据结束】====================");
|
||||
|
||||
|
||||
+1
-24
@@ -1,7 +1,6 @@
|
||||
package com.cf.imes.module.plan.service.orderImport.factory;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.IORuntimeException;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
@@ -133,8 +132,6 @@ public class WebCadOrderImportAsyncFactory {
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
private FileApi fileApi;
|
||||
|
||||
private Long organId;
|
||||
|
||||
// 批次id
|
||||
@@ -226,8 +223,7 @@ public class WebCadOrderImportAsyncFactory {
|
||||
SystemConfigApi systemConfigApi,
|
||||
String operatorName,
|
||||
int cadImportPlateNumThreshold,
|
||||
JdbcTemplate jdbcTemplate,
|
||||
FileApi fileApi) {
|
||||
JdbcTemplate jdbcTemplate) {
|
||||
this.organId = organId;
|
||||
this.orderMapper = orderMapper;
|
||||
this.snowFlakeGenerator = snowFlakeGenerator;
|
||||
@@ -246,7 +242,6 @@ public class WebCadOrderImportAsyncFactory {
|
||||
sealEdgeConfigList = new ArrayList<>();
|
||||
this.cadImportPlateNumThreshold = cadImportPlateNumThreshold;
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.fileApi = fileApi;
|
||||
}
|
||||
|
||||
public void analyzeTempData(Long taskId, String webcadJsonCachePath) throws FileNotFoundException {
|
||||
@@ -261,9 +256,6 @@ public class WebCadOrderImportAsyncFactory {
|
||||
|
||||
performPostProcessing(taskId);
|
||||
} catch (Exception e) {
|
||||
// 删除cad图纸数据
|
||||
removeCadFileWhenException(cadViewFileId);
|
||||
|
||||
handleProcessingException(e);
|
||||
throw e;
|
||||
} finally {
|
||||
@@ -2494,19 +2486,4 @@ public class WebCadOrderImportAsyncFactory {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除cad图纸文件数据
|
||||
*
|
||||
* @param cadViewFileId
|
||||
*/
|
||||
private void removeCadFileWhenException(Long cadViewFileId) {
|
||||
try {
|
||||
if (ObjectUtil.isNotNull(cadViewFileId)) {
|
||||
fileApi.deleteFileById(cadViewFileId);
|
||||
}
|
||||
} catch (IORuntimeException e) {
|
||||
log.error("删除cad图纸数据文件失败: {}", cadViewFileId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user