|
|
@ -980,12 +980,13 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem |
|
|
|
if (null == userEntity) { |
|
|
|
return new Result().error("未查询到改用户"); |
|
|
|
} |
|
|
|
int points = null == userEntity.getPoints() ? 0 : userEntity.getPoints(); |
|
|
|
int pointsTotal = null == userEntity.getPointsTotle() ? 0 : userEntity.getPointsTotle(); |
|
|
|
//规则操作类型(0-减积分,1-加积分)
|
|
|
|
if (PointsOperationEnum.OPERATION_TYPE_ADD.getOperationType().equals(formDTO.getOperationType())) { |
|
|
|
userEntity.setPoints(userEntity.getPoints() + formDTO.getPoints()); |
|
|
|
userEntity.setPointsTotle(userEntity.getPointsTotle() + formDTO.getPoints()); |
|
|
|
userEntity.setPoints(points + formDTO.getPoints()); |
|
|
|
userEntity.setPointsTotle(pointsTotal + formDTO.getPoints()); |
|
|
|
} else if (PointsOperationEnum.OPERATION_TYPE_SUBSTRACT.getOperationType().equals(formDTO.getOperationType())) { |
|
|
|
int points = null == userEntity.getPoints() ? 0 : userEntity.getPoints(); |
|
|
|
if (formDTO.getPoints() > points) { |
|
|
|
return new Result().error("用户积分不足"); |
|
|
|
} |
|
|
|