🐛 评分自评得分哨兵值-1归一为空,避免线下评估默认回显
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+35
-16
@@ -1173,6 +1173,7 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
|
|
||||||
/** 将 Excel 填写值回填到评分明细:选项型匹配选项,分值型写入 scoreInput/selfScore */
|
/** 将 Excel 填写值回填到评分明细:选项型匹配选项,分值型写入 scoreInput/selfScore */
|
||||||
private void applyImportedScoreDetail(CustomerCreditScoreDetailVO detail, String fillValue, String selfScoreText) {
|
private void applyImportedScoreDetail(CustomerCreditScoreDetailVO detail, String fillValue, String selfScoreText) {
|
||||||
|
BigDecimal importedSelfScore = parseImportedSelfScore(selfScoreText);
|
||||||
if ("score".equalsIgnoreCase(detail.getOptionType())) {
|
if ("score".equalsIgnoreCase(detail.getOptionType())) {
|
||||||
BigDecimal scoreInput;
|
BigDecimal scoreInput;
|
||||||
try {
|
try {
|
||||||
@@ -1181,12 +1182,8 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
throw new ServiceException("填写值必须为数字");
|
throw new ServiceException("填写值必须为数字");
|
||||||
}
|
}
|
||||||
detail.setScoreInput(scoreInput);
|
detail.setScoreInput(scoreInput);
|
||||||
if (Func.isNotEmpty(selfScoreText)) {
|
if (importedSelfScore != null) {
|
||||||
try {
|
detail.setSelfScore(importedSelfScore);
|
||||||
detail.setSelfScore(new BigDecimal(selfScoreText));
|
|
||||||
} catch (NumberFormatException exception) {
|
|
||||||
throw new ServiceException("自评得分必须为数字");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1203,13 +1200,19 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
}
|
}
|
||||||
detail.setSelectedOption(optionValue == null ? fillValue : String.valueOf(optionValue));
|
detail.setSelectedOption(optionValue == null ? fillValue : String.valueOf(optionValue));
|
||||||
BigDecimal optionScore = resolveOptionScore(matched);
|
BigDecimal optionScore = resolveOptionScore(matched);
|
||||||
detail.setSelfScore(optionScore == null ? BigDecimal.ZERO : optionScore);
|
detail.setSelfScore(importedSelfScore != null ? importedSelfScore : (optionScore == null ? BigDecimal.ZERO : optionScore));
|
||||||
if (Func.isNotEmpty(selfScoreText)) {
|
}
|
||||||
try {
|
|
||||||
detail.setSelfScore(new BigDecimal(selfScoreText));
|
/** 解析线下 Excel 自评得分;空值或哨兵值 -1 视为未填写 */
|
||||||
} catch (NumberFormatException exception) {
|
private BigDecimal parseImportedSelfScore(String selfScoreText) {
|
||||||
throw new ServiceException("自评得分必须为数字");
|
if (Func.isEmpty(selfScoreText) || "-1".equals(selfScoreText.trim())) {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
BigDecimal selfScore = new BigDecimal(selfScoreText.trim());
|
||||||
|
return selfScore.compareTo(BigDecimal.ONE.negate()) == 0 ? null : selfScore;
|
||||||
|
} catch (NumberFormatException exception) {
|
||||||
|
throw new ServiceException("自评得分必须为数字");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1700,6 +1703,9 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
scoreVO.setMaxCreditLimit(normalizeSentinelAmount(scoreVO.getMaxCreditLimit()));
|
scoreVO.setMaxCreditLimit(normalizeSentinelAmount(scoreVO.getMaxCreditLimit()));
|
||||||
scoreVO.setApplyCreditLimit(normalizeSentinelAmount(scoreVO.getApplyCreditLimit()));
|
scoreVO.setApplyCreditLimit(normalizeSentinelAmount(scoreVO.getApplyCreditLimit()));
|
||||||
scoreVO.setTempApplyCreditLimit(normalizeOptionalScoreAmount(scoreVO.getTempApplyCreditLimit()));
|
scoreVO.setTempApplyCreditLimit(normalizeOptionalScoreAmount(scoreVO.getTempApplyCreditLimit()));
|
||||||
|
scoreVO.setSelfScore(normalizeSentinelAmount(scoreVO.getSelfScore()));
|
||||||
|
scoreVO.setReviewScore(normalizeSentinelAmount(scoreVO.getReviewScore()));
|
||||||
|
scoreVO.setFinalScore(normalizeSentinelAmount(scoreVO.getFinalScore()));
|
||||||
scoreVO.setProofAttachments(normalizeScoreProofAttachments(scoreVO));
|
scoreVO.setProofAttachments(normalizeScoreProofAttachments(scoreVO));
|
||||||
CustomerCreditScore score = Objects.requireNonNull(BeanUtil.copyProperties(scoreVO, CustomerCreditScore.class));
|
CustomerCreditScore score = Objects.requireNonNull(BeanUtil.copyProperties(scoreVO, CustomerCreditScore.class));
|
||||||
score.setId(scoreId);
|
score.setId(scoreId);
|
||||||
@@ -1720,6 +1726,9 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
if (detailVO.getScore() == null) {
|
if (detailVO.getScore() == null) {
|
||||||
detailVO.setScore(resolveFullScore(detailVO.getOptionsJson()));
|
detailVO.setScore(resolveFullScore(detailVO.getOptionsJson()));
|
||||||
}
|
}
|
||||||
|
detailVO.setSelfScore(normalizeSentinelAmount(detailVO.getSelfScore()));
|
||||||
|
detailVO.setReviewScore(normalizeSentinelAmount(detailVO.getReviewScore()));
|
||||||
|
detailVO.setScoreInput(normalizeSentinelAmount(detailVO.getScoreInput()));
|
||||||
CustomerCreditScoreDetail detail = Objects.requireNonNull(BeanUtil.copyProperties(detailVO, CustomerCreditScoreDetail.class));
|
CustomerCreditScoreDetail detail = Objects.requireNonNull(BeanUtil.copyProperties(detailVO, CustomerCreditScoreDetail.class));
|
||||||
detail.setId(IdWorker.getId());
|
detail.setId(IdWorker.getId());
|
||||||
detail.setTenantId(score.getTenantId());
|
detail.setTenantId(score.getTenantId());
|
||||||
@@ -1883,8 +1892,17 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
.collect(Collectors.groupingBy(CustomerCreditScoreDetailVO::getScoreId));
|
.collect(Collectors.groupingBy(CustomerCreditScoreDetailVO::getScoreId));
|
||||||
return scores.stream().map(score -> {
|
return scores.stream().map(score -> {
|
||||||
CustomerCreditScoreVO scoreVO = Objects.requireNonNull(BeanUtil.copyProperties(score, CustomerCreditScoreVO.class));
|
CustomerCreditScoreVO scoreVO = Objects.requireNonNull(BeanUtil.copyProperties(score, CustomerCreditScoreVO.class));
|
||||||
|
scoreVO.setSelfScore(normalizeSentinelAmount(scoreVO.getSelfScore()));
|
||||||
|
scoreVO.setReviewScore(normalizeSentinelAmount(scoreVO.getReviewScore()));
|
||||||
|
scoreVO.setFinalScore(normalizeSentinelAmount(scoreVO.getFinalScore()));
|
||||||
scoreVO.setAttachments(parseScoreAttachments(score.getProofAttachments()));
|
scoreVO.setAttachments(parseScoreAttachments(score.getProofAttachments()));
|
||||||
scoreVO.setDetails(detailMap.getOrDefault(score.getId(), new ArrayList<>()));
|
List<CustomerCreditScoreDetailVO> details = detailMap.getOrDefault(score.getId(), new ArrayList<>());
|
||||||
|
details.forEach(detail -> {
|
||||||
|
detail.setSelfScore(normalizeSentinelAmount(detail.getSelfScore()));
|
||||||
|
detail.setReviewScore(normalizeSentinelAmount(detail.getReviewScore()));
|
||||||
|
detail.setScoreInput(normalizeSentinelAmount(detail.getScoreInput()));
|
||||||
|
});
|
||||||
|
scoreVO.setDetails(details);
|
||||||
scoreVO.setStandards(loadStandards(score.getQuantificationId()));
|
scoreVO.setStandards(loadStandards(score.getQuantificationId()));
|
||||||
return scoreVO;
|
return scoreVO;
|
||||||
}).toList();
|
}).toList();
|
||||||
@@ -2004,8 +2022,9 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
: resolveFullScore(itemOptions);
|
: resolveFullScore(itemOptions);
|
||||||
detail.setScore(fullScore == null ? BigDecimal.ZERO : fullScore);
|
detail.setScore(fullScore == null ? BigDecimal.ZERO : fullScore);
|
||||||
detail.setOptionsJson(buildOptionsJson(itemOptions));
|
detail.setOptionsJson(buildOptionsJson(itemOptions));
|
||||||
detail.setSelfScore(BigDecimal.ZERO);
|
// 模板明细自评/复评默认空,避免前端线下评估回显 -1/0 哨兵值
|
||||||
detail.setReviewScore(BigDecimal.ZERO);
|
detail.setSelfScore(null);
|
||||||
|
detail.setReviewScore(null);
|
||||||
details.add(detail);
|
details.add(detail);
|
||||||
}
|
}
|
||||||
return details;
|
return details;
|
||||||
|
|||||||
Reference in New Issue
Block a user