优化维修费用记录逻辑,根据任务是否定损
- 注释掉部分冗余代码,包括设置维修数量和新增维修费用记录的操作 - 修改 getCostCount 查询条件,使用 task_id 替代 repair_id,并添加 is_ds = 1 的条件 - 优化判断逻辑,将 count <= 0 改为 count == 0
This commit is contained in:
parent
76e36697f4
commit
5362cfd2ee
|
|
@ -465,7 +465,7 @@ public class LossAssessmentServiceImpl implements LossAssessmentService {
|
|||
}
|
||||
BigDecimal sfCosts = countPartCosts(partList, BigDecimal.ZERO);
|
||||
// SQL: 新增【维修费用记录表】
|
||||
repairApplyRecord.setRepairNum(partList.get(0).getPartNum() != null ? BigDecimal.valueOf(partList.get(0).getPartNum()) : BigDecimal.ZERO);
|
||||
//repairApplyRecord.setRepairNum(partList.get(0).getPartNum() != null ? BigDecimal.valueOf(partList.get(0).getPartNum()) : BigDecimal.ZERO);
|
||||
mapper.addRepairCost(repairApplyRecord, sfCosts, "1");
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
.setPartType(bean.getCodeScrapRepairPartList().get(0).getPartType()).setRepairType(3);
|
||||
|
||||
// SQL: 新增【报废费用记录表】
|
||||
repairMapper.addRepairCost(scrapCostsRecord, details.getBuyPrice(), bean.getCodeScrapRepairPartList().get(0).getScrapType());
|
||||
//repairMapper.addRepairCost(scrapCostsRecord, details.getBuyPrice(), bean.getCodeScrapRepairPartList().get(0).getScrapType());
|
||||
|
||||
// 更新报废数量
|
||||
repairMapper.updateScrapNumAndStatus(bean.getId(), BigDecimal.ONE, 1, loginUser.getUserid());
|
||||
|
|
@ -805,7 +805,6 @@ public class RepairServiceImpl implements RepairService {
|
|||
throw new ServiceException("此维修记录不存在,请检查后提交!");
|
||||
}
|
||||
|
||||
|
||||
// 分拆维修单, 准备数据
|
||||
scrapNum = Optional.ofNullable(bean.getNumberScrapRepairPartList().get(0).getScrapNum()).orElse(BigDecimal.ZERO);
|
||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||
|
|
@ -1061,10 +1060,10 @@ public class RepairServiceImpl implements RepairService {
|
|||
BigDecimal sfCosts = countPartCosts(partList, BigDecimal.ZERO);
|
||||
// TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论
|
||||
// SQL: 新增【维修费用记录表】
|
||||
repairApplyRecord.setRepairNum(partList.get(0).getPartNum() != null ? BigDecimal.valueOf(partList.get(0).getPartNum()) : BigDecimal.ZERO);
|
||||
//repairApplyRecord.setRepairNum(partList.get(0).getPartNum() != null ? BigDecimal.valueOf(partList.get(0).getPartNum()) : BigDecimal.ZERO);
|
||||
//查询定损是否把价格已经添加
|
||||
int count = repairMapper.getCostCount(repairApplyRecord);
|
||||
if (count <= 0) {
|
||||
if (count == 0) {
|
||||
repairMapper.addRepairCost(repairApplyRecord, sfCosts, partList.get(0).getPartType().toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -1116,10 +1115,10 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
// TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论
|
||||
// SQL: 新增【维修费用记录表】
|
||||
repairApplyRecord.setRepairNum(partList.get(i).getPartNum() != null ? BigDecimal.valueOf(partList.get(i).getPartNum()) : BigDecimal.ZERO);
|
||||
//repairApplyRecord.setRepairNum(partList.get(i).getPartNum() != null ? BigDecimal.valueOf(partList.get(i).getPartNum()) : BigDecimal.ZERO);
|
||||
//查询定损是否把价格已经添加
|
||||
int count = repairMapper.getCostCount(repairApplyRecord);
|
||||
if (count <= 0) {
|
||||
if (count == 0) {
|
||||
repairMapper.addRepairCost(repairApplyRecord, sfCosts, partList.get(i).getPartType().toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -964,7 +964,8 @@
|
|||
<select id="getCostCount" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM repair_cost
|
||||
WHERE repair_id = #{id}
|
||||
WHERE task_id = #{taskId}
|
||||
and is_ds = 1
|
||||
</select>
|
||||
|
||||
<select id="getRepairCodeList" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
||||
|
|
|
|||
Loading…
Reference in New Issue