|
@@ -1736,11 +1736,11 @@ public class WmScorePackageController {
|
|
* @return R
|
|
* @return R
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "新增积分包", notes = "新增积分包")
|
|
@ApiOperation(value = "新增积分包", notes = "新增积分包")
|
|
- @SysLog("新增积分包")
|
|
|
|
|
|
+ @SysLog("新增积分包(大包)")
|
|
@PostMapping("saves")
|
|
@PostMapping("saves")
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public R saves(@RequestBody WmScorePackage wmScorePackage) {
|
|
public R saves(@RequestBody WmScorePackage wmScorePackage) {
|
|
-
|
|
|
|
|
|
+ log.info("新增积分包(大包)入参:{}", wmScorePackage);
|
|
if (wmScorePackage.getScore() <= 0) {
|
|
if (wmScorePackage.getScore() <= 0) {
|
|
return R.failed("积分包分值必须大于0");
|
|
return R.failed("积分包分值必须大于0");
|
|
}
|
|
}
|
|
@@ -1754,7 +1754,7 @@ public class WmScorePackageController {
|
|
boolean relatedScoreId = StrUtil.isNotBlank(wmScorePackage.getRelationScoreId()) && Integer.parseInt(wmScorePackage.getRelationScoreId()) > 0;
|
|
boolean relatedScoreId = StrUtil.isNotBlank(wmScorePackage.getRelationScoreId()) && Integer.parseInt(wmScorePackage.getRelationScoreId()) > 0;
|
|
LocalDateTime now = LocalDateTime.now();
|
|
LocalDateTime now = LocalDateTime.now();
|
|
SysDeptRecharge deptRecharge = null;
|
|
SysDeptRecharge deptRecharge = null;
|
|
- int currentScore = 0;
|
|
|
|
|
|
+
|
|
if (!relatedScoreId) {
|
|
if (!relatedScoreId) {
|
|
// 校验 发包积分 < 积分充值分配的积分 则可以发包
|
|
// 校验 发包积分 < 积分充值分配的积分 则可以发包
|
|
deptRecharge = sysDeptRechargeMapper.selectOne(Wrappers.<SysDeptRecharge>lambdaQuery()
|
|
deptRecharge = sysDeptRechargeMapper.selectOne(Wrappers.<SysDeptRecharge>lambdaQuery()
|
|
@@ -1769,20 +1769,6 @@ public class WmScorePackageController {
|
|
wmScorePackage.getScore(), deptRecharge.getScore(), limitScore);
|
|
wmScorePackage.getScore(), deptRecharge.getScore(), limitScore);
|
|
throw new RuntimeException(String.format("积分余额:%s。积分不足", deptRecharge.getScore()));
|
|
throw new RuntimeException(String.format("积分余额:%s。积分不足", deptRecharge.getScore()));
|
|
}
|
|
}
|
|
-
|
|
|
|
- // 更新积分充值信息
|
|
|
|
- currentScore = deptRecharge.getScore() - wmScorePackage.getScore();
|
|
|
|
- int updateRecharge = sysDeptRechargeMapper.update(null, Wrappers.<SysDeptRecharge>lambdaUpdate()
|
|
|
|
- .eq(SysDeptRecharge::getId, deptRecharge.getId())
|
|
|
|
- .eq(SysDeptRecharge::getVersion, deptRecharge.getVersion())
|
|
|
|
- .set(SysDeptRecharge::getScore, currentScore)
|
|
|
|
- .set(SysDeptRecharge::getVersion, deptRecharge.getVersion() + 1)
|
|
|
|
- .set(SysDeptRecharge::getUpdateTime, now)
|
|
|
|
- .set(SysDeptRecharge::getUpdateUser, userId));
|
|
|
|
- if (updateRecharge <= 0) {
|
|
|
|
- log.warn("更新积分充值信息失败");
|
|
|
|
- throw new RuntimeException("操作失败,请重试");
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
wmScorePackage.setTypeid("");
|
|
wmScorePackage.setTypeid("");
|
|
@@ -2043,7 +2029,19 @@ public class WmScorePackageController {
|
|
}
|
|
}
|
|
|
|
|
|
if (!relatedScoreId) {
|
|
if (!relatedScoreId) {
|
|
- // 查询关联操作对象
|
|
|
|
|
|
+ // 更新积分充值信息
|
|
|
|
+ int currentScore = deptRecharge.getScore() - wmScorePackage.getScore();
|
|
|
|
+ int updateRecharge = sysDeptRechargeMapper.update(null, Wrappers.<SysDeptRecharge>lambdaUpdate()
|
|
|
|
+ .eq(SysDeptRecharge::getId, deptRecharge.getId())
|
|
|
|
+ .eq(SysDeptRecharge::getVersion, deptRecharge.getVersion())
|
|
|
|
+ .set(SysDeptRecharge::getScore, currentScore)
|
|
|
|
+ .set(SysDeptRecharge::getVersion, deptRecharge.getVersion() + 1)
|
|
|
|
+ .set(SysDeptRecharge::getUpdateTime, now)
|
|
|
|
+ .set(SysDeptRecharge::getUpdateUser, userId));
|
|
|
|
+ if (updateRecharge <= 0) {
|
|
|
|
+ log.warn("更新积分充值信息失败");
|
|
|
|
+ throw new RuntimeException("操作失败,请重试");
|
|
|
|
+ }
|
|
// 更新积分充值记录
|
|
// 更新积分充值记录
|
|
SysDeptRechargeRecord rechargeRecord = new SysDeptRechargeRecord();
|
|
SysDeptRechargeRecord rechargeRecord = new SysDeptRechargeRecord();
|
|
rechargeRecord.setDeptId(deptId);
|
|
rechargeRecord.setDeptId(deptId);
|
|
@@ -2213,10 +2211,11 @@ public class WmScorePackageController {
|
|
* @return R
|
|
* @return R
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "修改积分包", notes = "修改积分包")
|
|
@ApiOperation(value = "修改积分包", notes = "修改积分包")
|
|
- @SysLog("修改积分包")
|
|
|
|
|
|
+ @SysLog("修改积分包(大包)")
|
|
@PostMapping("/updateByIds")
|
|
@PostMapping("/updateByIds")
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public R updateByIds(@RequestBody WmScorePackage wmScorePackage) {
|
|
public R updateByIds(@RequestBody WmScorePackage wmScorePackage) {
|
|
|
|
+ log.info("修改积分包(大包)入参:{}", wmScorePackage);
|
|
if (wmScorePackage.getScore() <= 0) {
|
|
if (wmScorePackage.getScore() <= 0) {
|
|
return R.failed("积分包分值必须大于0");
|
|
return R.failed("积分包分值必须大于0");
|
|
}
|
|
}
|
|
@@ -2998,9 +2997,10 @@ public class WmScorePackageController {
|
|
* @return R
|
|
* @return R
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "新增积分包", notes = "新增积分包")
|
|
@ApiOperation(value = "新增积分包", notes = "新增积分包")
|
|
- @SysLog("新增积分包")
|
|
|
|
|
|
+ @SysLog("新增积分包(小包)")
|
|
@PostMapping("/addWmScorePackage")
|
|
@PostMapping("/addWmScorePackage")
|
|
public R addWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
|
|
public R addWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
|
|
|
|
+ log.info("新增积分包(小包)入参:{}", wmScorePackage);
|
|
if (wmScorePackage.getPackageType1().equals("1")) {//定额
|
|
if (wmScorePackage.getPackageType1().equals("1")) {//定额
|
|
if (wmScorePackage.getScore() <= 0) {
|
|
if (wmScorePackage.getScore() <= 0) {
|
|
return R.failed("积分包分值必须大于0");
|
|
return R.failed("积分包分值必须大于0");
|
|
@@ -3031,9 +3031,10 @@ public class WmScorePackageController {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改积分包", notes = "修改积分包")
|
|
@ApiOperation(value = "修改积分包", notes = "修改积分包")
|
|
- @SysLog("修改积分包")
|
|
|
|
|
|
+ @SysLog("修改积分包(小包)")
|
|
@PostMapping("/updateWmScorePackage")
|
|
@PostMapping("/updateWmScorePackage")
|
|
public R updateWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
|
|
public R updateWmScorePackage(@RequestBody WmScorePackage wmScorePackage) {
|
|
|
|
+ log.info("修改积分包(小包)入参:{}", wmScorePackage);
|
|
if (wmScorePackage.getPackageType1().equals("1")) {//定额
|
|
if (wmScorePackage.getPackageType1().equals("1")) {//定额
|
|
if (wmScorePackage.getScore() <= 0) {
|
|
if (wmScorePackage.getScore() <= 0) {
|
|
return R.failed("积分包分值必须大于0");
|
|
return R.failed("积分包分值必须大于0");
|