|
@@ -3038,13 +3038,19 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
|
|
throw new RuntimeException("积分包已全部分派");
|
|
throw new RuntimeException("积分包已全部分派");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 已分配积分值
|
|
|
|
+ int assignedScore = 0;
|
|
|
|
+ List<WmScorePackage> subPackages = this.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
|
+ .eq(WmScorePackage::getRelationScoreId, packageId)
|
|
|
|
+ .ne(WmScorePackage::getScorePackageStatus, ScorePackageStatusEnum.TERMINATED.val()));
|
|
|
|
+ if (CollUtil.isNotEmpty(subPackages)) {
|
|
|
|
+ assignedScore = subPackages.stream().mapToInt(WmScorePackage::getScore).sum();
|
|
|
|
+ }
|
|
|
|
+
|
|
log.info("当前积分包终止前数据:{}", scorePackage);
|
|
log.info("当前积分包终止前数据:{}", scorePackage);
|
|
- if (UpmsType.TerminatePackageType.ALL.equals(terminatePackageType)) {
|
|
|
|
|
|
+ if (UpmsType.TerminatePackageType.ALL.equals(terminatePackageType) || assignedScore <= 0) {
|
|
// 全部终止的校验
|
|
// 全部终止的校验
|
|
- int relatedPackageCount = this.count(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
|
- .eq(WmScorePackage::getRelationScoreId, packageId)
|
|
|
|
- .ne(WmScorePackage::getScorePackageStatus, ScorePackageStatusEnum.TERMINATED.val()));
|
|
|
|
- if (relatedPackageCount > 0 || !scorePackage.getScore().equals(scorePackage.getKfpjf())) {
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(subPackages)) {
|
|
throw new RuntimeException("积分包已被分派,请联系下属CSO终止关联积分包后再进行次操作");
|
|
throw new RuntimeException("积分包已被分派,请联系下属CSO终止关联积分包后再进行次操作");
|
|
}
|
|
}
|
|
// 全部终止: 更新积分包状态为已终止
|
|
// 全部终止: 更新积分包状态为已终止
|
|
@@ -3060,14 +3066,9 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
|
|
this.updateById(updateEntity);
|
|
this.updateById(updateEntity);
|
|
} else {
|
|
} else {
|
|
// 剩余回收
|
|
// 剩余回收
|
|
- // 已分配积分值
|
|
|
|
- int assignedScore = 0;
|
|
|
|
- List<WmScorePackage> subPackages = this.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
|
- .eq(WmScorePackage::getRelationScoreId, packageId)
|
|
|
|
- .ne(WmScorePackage::getScorePackageStatus, ScorePackageStatusEnum.TERMINATED.val()));
|
|
|
|
- if (CollUtil.isNotEmpty(subPackages)) {
|
|
|
|
- assignedScore = subPackages.stream().mapToInt(WmScorePackage::getScore).sum();
|
|
|
|
- }
|
|
|
|
|
|
+ // 可分配积分值
|
|
|
|
+ int recoveryScore = scorePackage.getKfpjf();
|
|
|
|
+
|
|
// 剩余收回: 更新积分包分值为已分配的积分
|
|
// 剩余收回: 更新积分包分值为已分配的积分
|
|
WmScorePackage updateEntity = new WmScorePackage();
|
|
WmScorePackage updateEntity = new WmScorePackage();
|
|
updateEntity.setId(packageId);
|
|
updateEntity.setId(packageId);
|
|
@@ -3078,8 +3079,6 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
|
|
log.info("更新积分包参数:{}", updateEntity);
|
|
log.info("更新积分包参数:{}", updateEntity);
|
|
this.updateById(updateEntity);
|
|
this.updateById(updateEntity);
|
|
|
|
|
|
- // 可分配积分值
|
|
|
|
- int recoveryScore = scorePackage.getKfpjf();
|
|
|
|
// 如果关联了大包 回收整包的积分值到大包的可分配积分值。如果没有关联大包,回收整包积分值到该企业的余额
|
|
// 如果关联了大包 回收整包的积分值到大包的可分配积分值。如果没有关联大包,回收整包积分值到该企业的余额
|
|
boolean relatedScoreId = StrUtil.isNotBlank(scorePackage.getRelationScoreId()) && Integer.parseInt(scorePackage.getRelationScoreId()) > 0;
|
|
boolean relatedScoreId = StrUtil.isNotBlank(scorePackage.getRelationScoreId()) && Integer.parseInt(scorePackage.getRelationScoreId()) > 0;
|
|
if (relatedScoreId) {
|
|
if (relatedScoreId) {
|