修改 更新暂存数据的问题,在保存3个试验实施过程时 删除暂存数据

This commit is contained in:
dengchun
2025-07-06 09:30:45 +08:00
parent 7cd58c951d
commit 29795fbae6
7 changed files with 27 additions and 36 deletions

View File

@@ -8,6 +8,8 @@ pnpm run build
# 后端发布
## 测试环境
cd /root/physical
sh build.sh
docker compose pull
docker compose up -d

View File

@@ -154,7 +154,6 @@ public class ExperimentAnnealProcessController extends JeecgController<Experimen
SysUser userByName = userService.getUserByName(username);
experimentLog.setCreateBy(userByName.getRealname());
experimentLogService.save(experimentLog);
return Result.OK("编辑成功!");
}

View File

@@ -8,5 +8,5 @@ public interface IStageDataService extends IService<StageData> {
boolean saveOrUpdateByBizId(StageData stageData);
StageData queryStageDataByBizId(String bizId, int dataType);
void deleteByBizId(String bizId);
void deleteByBizId(String bizId, int dataType);
}

View File

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.database.constant.StageDataType;
import org.jeecg.modules.database.entity.*;
import org.jeecg.modules.database.mapper.ExperimentAnnealProcessMapper;
import org.jeecg.modules.database.service.*;
@@ -32,6 +33,8 @@ public class ExperimentAnnealProcessServiceImpl extends ServiceImpl<ExperimentAn
private IExperimentDeviationEquipmentService experimentDeviationEquipmentService;
@Autowired
private IExperimentDeviationConditionService experimentDeviationConditionService;
@Autowired
private IStageDataService stageDataService;
@Override
public List<ExperimentAnnealProcess> getByExperimentId(String experimentId) {
@@ -91,39 +94,10 @@ public class ExperimentAnnealProcessServiceImpl extends ServiceImpl<ExperimentAn
}
}
experimentAnnealProcess.setSampleInfo(StringUtils.join(sampleInfoIds, ","));
// 保存偏置条件信息
// 20250502 - 邓春: 不修改前端 传过来的退火设备大字段
/* String deviationCondition = experimentAnnealProcess.getDeviationCondition();
if (StringUtils.isNotBlank(deviationCondition)) {
List<ExperimentDeviationCondition> deviationConditionList = JSON.parseArray(deviationCondition,
ExperimentDeviationCondition.class);
for (ExperimentDeviationCondition sampleInfo : deviationConditionList) {
if (StringUtils.equals(type, "add")) {
sampleInfo.setId(null);
}
sampleInfo.setExperimentId(experimentAnnealProcess.getExperimentId());
experimentDeviationConditionService.saveOrUpdate(sampleInfo);
}
experimentAnnealProcess.setDeviationCondition(JSON.toJSONString(deviationConditionList));
}*/
//加偏设备信息
//20250502 - 邓春:不修改前端 传过来的退火设备大字段
/* String deviationEquipment = experimentAnnealProcess.getDeviationEquipment();
if (StringUtils.isNotBlank(deviationEquipment)) {
List<ExperimentDeviationEquipment> deviationEquipmentList = JSON.parseArray(deviationEquipment,
ExperimentDeviationEquipment.class);
for (ExperimentDeviationEquipment sampleInfo : deviationEquipmentList) {
if (StringUtils.equals(type, "add")) {
sampleInfo.setId(null);
}
sampleInfo.setExperimentId(experimentAnnealProcess.getExperimentId());
experimentDeviationEquipmentService.saveOrUpdate(sampleInfo);
}
experimentAnnealProcess.setDeviationEquipment(JSON.toJSONString(deviationEquipmentList));
}*/
saveOrUpdate(experimentAnnealProcess);
// 删除暂存数据 20250706 邓春
stageDataService.deleteByBizId(experimentAnnealProcess.getExperimentId(), StageDataType.ANNEAL_PROCESS.getCode());
}
@Override

View File

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.date.TimeRange;
import org.jeecg.modules.database.constant.StageDataType;
import org.jeecg.modules.database.entity.*;
import org.jeecg.modules.database.mapper.ExperimentRadiationProcessMapper;
import org.jeecg.modules.database.service.*;
@@ -35,6 +36,9 @@ public class ExperimentRadiationProcessServiceImpl extends ServiceImpl<Experimen
@Autowired
private IExperimentIrradiationBoardService experimentIrradiationBoardService;
@Autowired
private IStageDataService stageDataService;
@Override
public List<ExperimentRadiationProcess> getByExperimentId(String experimentId) {
List<ExperimentRadiationProcess> list = list(
@@ -106,6 +110,9 @@ public class ExperimentRadiationProcessServiceImpl extends ServiceImpl<Experimen
experimentRadiationProcess.setSampleInfo(StringUtils.join(sampleInfoIds, ","));
saveOrUpdate(experimentRadiationProcess);
// 删除暂存数据
stageDataService.deleteByBizId(experimentRadiationProcess.getExperimentId(), StageDataType.RADIATION_PROCESS.getCode());
}
@Override

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.database.constant.ComponentSearchType;
import org.jeecg.modules.database.constant.StageDataType;
import org.jeecg.modules.database.dto.*;
import org.jeecg.modules.database.entity.*;
import org.jeecg.modules.database.mapper.ExperimentTestProcessMapper;
@@ -37,6 +38,9 @@ public class ExperimentTestProcessServiceImpl extends ServiceImpl<ExperimentTest
@Autowired
private IComponentSearchService componentSearchService;
@Autowired
private IStageDataService stageDataService;
private static final Logger logger = LoggerFactory.getLogger(ExperimentTestProcessServiceImpl.class);
@@ -153,6 +157,9 @@ public class ExperimentTestProcessServiceImpl extends ServiceImpl<ExperimentTest
}
}
// 删除暂存数据
stageDataService.deleteByBizId(experimentTestProcess.getExperimentId(), StageDataType.RADIATION_PROCESS.getCode());
}
@Override

View File

@@ -19,6 +19,8 @@ public class StageDataServiceImpl extends ServiceImpl<StageDataMapper, StageData
if (stageDataByBizId != null) {
stageDataByBizId.setId(stageDataByBizId.getId());
stageDataByBizId.setUpdateTime(new Date());
stageDataByBizId.setDataType(stageData.getDataType());
stageDataByBizId.setContent(stageData.getContent());
result = saveOrUpdate(stageDataByBizId);
}else {
stageData.setCreateTime(new Date());
@@ -35,7 +37,7 @@ public class StageDataServiceImpl extends ServiceImpl<StageDataMapper, StageData
}
@Override
public void deleteByBizId(String bizId) {
baseMapper.delete(new LambdaQueryWrapper<StageData>().eq(StageData::getBizId, bizId));
public void deleteByBizId(String bizId, int dataType) {
baseMapper.delete(new LambdaQueryWrapper<StageData>().eq(StageData::getBizId, bizId).eq(StageData::getDataType, dataType));
}
}