Merge branch 'main' of 192.168.65.198:toolchaintechnologycenter/spdm-backend into dev-glc
This commit is contained in:
@@ -13,6 +13,9 @@ import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
import com.sdm.common.utils.PageUtils;
|
||||
import com.sdm.common.utils.TimeCalculator;
|
||||
import com.sdm.outbridge.entity.LyricVProjectBatchToDM;
|
||||
import com.sdm.outbridge.service.lyric.LyricVProjectBatchToDmService;
|
||||
import com.sdm.outbridge.service.lyric.LyricVProjectToDmService;
|
||||
import com.sdm.project.common.MemberTypeEnum;
|
||||
import com.sdm.project.dao.SimulationTaskMapper;
|
||||
import com.sdm.project.dao.SimulationWorkMapper;
|
||||
@@ -56,6 +59,9 @@ public class SimulationWorkServiceImpl extends ServiceImpl<SimulationWorkMapper,
|
||||
@Autowired
|
||||
private SimulationTaskExtraServiceImpl taskExtraService;
|
||||
|
||||
@Autowired
|
||||
private LyricVProjectBatchToDmService lyricVProjectBatchToDmService;
|
||||
|
||||
// 报工类型常量
|
||||
public static final int WORK_TYPE_START = 0; // 开始报工
|
||||
public static final int WORK_TYPE_FINISH = 1; // 完成报工
|
||||
@@ -67,6 +73,12 @@ public class SimulationWorkServiceImpl extends ServiceImpl<SimulationWorkMapper,
|
||||
SimulationTaskExtra.PROPERTY_NAME_SHOULD_PROGRESS
|
||||
);
|
||||
|
||||
// 特殊批次名称
|
||||
public static final String SPECIAL_BATCH_NAME = "C01";
|
||||
|
||||
// 普通批次名称
|
||||
public static final String GENERAL_BATCH_NAME = "P00";
|
||||
|
||||
/**
|
||||
* 更新任务应达成进度(删除旧值+保存新值)
|
||||
*/
|
||||
@@ -362,4 +374,44 @@ public class SimulationWorkServiceImpl extends ServiceImpl<SimulationWorkMapper,
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目ID获取对应的批次号
|
||||
* 规则:优先返回C01批次,无则返回固定值P00
|
||||
*
|
||||
* @param projectId 项目ID(非空)
|
||||
* @return 批次号(C01/P00)
|
||||
*/
|
||||
public String getBatchByProjectId(String projectId) {
|
||||
// 1. 参数校验
|
||||
if (StringUtils.isBlank(projectId)) {
|
||||
String errorMsg = String.format("获取批次号失败:projectId不能为空,入参为[%s]", projectId);
|
||||
log.error(errorMsg);
|
||||
throw new IllegalArgumentException(errorMsg);
|
||||
}
|
||||
|
||||
// 2. 直接查询是否存在C01批次
|
||||
boolean existsSpecialBatch = lyricVProjectBatchToDmService.lambdaQuery()
|
||||
.eq(LyricVProjectBatchToDM::getProjectId, projectId)
|
||||
.eq(LyricVProjectBatchToDM::getBatch, SPECIAL_BATCH_NAME)
|
||||
.exists();
|
||||
|
||||
// 3. 存在C01批次则返回,否则检查是否有其他批次
|
||||
if (existsSpecialBatch) {
|
||||
return SPECIAL_BATCH_NAME;
|
||||
}
|
||||
|
||||
// 4. 检查是否有其他批次数据(原逻辑:无数据返回空串,有数据返回P00)
|
||||
boolean existsAnyBatch = lyricVProjectBatchToDmService.lambdaQuery()
|
||||
.eq(LyricVProjectBatchToDM::getProjectId, projectId)
|
||||
.exists();
|
||||
|
||||
if (!existsAnyBatch) {
|
||||
log.error("根据projectId:{}未查询到任何批次信息,返回空串", projectId);
|
||||
return "";
|
||||
}
|
||||
|
||||
// 5. 有批次但无C01,返回通用批次
|
||||
return GENERAL_BATCH_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user