Browse Source

feat: 企业承接剩余回收调整2

lixuesong 1 year ago
parent
commit
aa395af772

+ 2 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/WmScorePackageController.java

@@ -2071,6 +2071,7 @@ public class WmScorePackageController {
 	@PostMapping("/stopWmScorePackage")
 	@PostMapping("/stopWmScorePackage")
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
 	public R stopWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
 	public R stopWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
+		log.info("终止积分包(大包)入参:{}", wmScorePackage);
 		if (StrUtil.isBlank(wmScorePackage.getId()) || !StrUtil.equalsAny(wmScorePackage.getEnableType(), "1", "2")) {
 		if (StrUtil.isBlank(wmScorePackage.getId()) || !StrUtil.equalsAny(wmScorePackage.getEnableType(), "1", "2")) {
 			return R.failed("参数错误");
 			return R.failed("参数错误");
 		}
 		}
@@ -3078,6 +3079,7 @@ public class WmScorePackageController {
 	@SysLog("终止积分包(个人包)")
 	@SysLog("终止积分包(个人包)")
 	@GetMapping("/updateEnable")
 	@GetMapping("/updateEnable")
 	public R terminatePackageForPersonal(WmScorePackage wmScorePackage) {
 	public R terminatePackageForPersonal(WmScorePackage wmScorePackage) {
+		log.info("终止积分包(个人包)入参:{}", wmScorePackage);
 		if (!StrUtil.equalsAny(wmScorePackage.getEnableType(), "1", "2") || StrUtil.isBlank(wmScorePackage.getId())) {
 		if (!StrUtil.equalsAny(wmScorePackage.getEnableType(), "1", "2") || StrUtil.isBlank(wmScorePackage.getId())) {
 			return R.failed("参数错误");
 			return R.failed("参数错误");
 		}
 		}

+ 5 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmScorePackageServiceImpl.java

@@ -3068,12 +3068,16 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
 			// 剩余回收
 			// 剩余回收
 			// 可分配积分值
 			// 可分配积分值
 			int recoveryScore = scorePackage.getKfpjf();
 			int recoveryScore = scorePackage.getKfpjf();
+			if (recoveryScore <= 0) {
+				throw new RuntimeException("没有可回收的积分");
+			}
 
 
-			// 剩余收回: 更新积分包分值为已分配的积分
+			// 剩余收回: 更新积分包分值为已分配的积分, 更新可分配积分值为0
 			WmScorePackage updateEntity = new WmScorePackage();
 			WmScorePackage updateEntity = new WmScorePackage();
 			updateEntity.setId(packageId);
 			updateEntity.setId(packageId);
 			updateEntity.setEnableType(terminatePackageType.getEnableType());
 			updateEntity.setEnableType(terminatePackageType.getEnableType());
 			updateEntity.setScore(assignedScore);
 			updateEntity.setScore(assignedScore);
+			updateEntity.setKfpjf(0);
 			updateEntity.setUpdateTime(now);
 			updateEntity.setUpdateTime(now);
 			updateEntity.setUpdateUser(userId);
 			updateEntity.setUpdateUser(userId);
 			log.info("更新积分包参数:{}", updateEntity);
 			log.info("更新积分包参数:{}", updateEntity);