AOP is used in Project-RC

2025-08-05

check merchant status

Background: we have various service plans available to merchants, so we need to check the merchant's service plan in some operations.

The merchant's status is as follows:

status

remark

ACTIVE

merchant can work normally.

RESTRICTED

merchant trial period is exceeded or related service plan is in arrears (merchant would be in read-only).

TERMINATED

merchant is in stopping, no any active feature.

Annotation Design: we can get the merchant by the currently logged in user, which allows us to check the status normally, but sometimes we want to check additional information set up in the service plan.

param

remark

checkCampaignQuota

bool type, count whether the merchant's campaign exceed the subscription service limit.

checkUserQuota

bool type, count whether the merchant's admin-user exceed the subscription service limit

check campaign status

Background: each campaign has its own life cycle, like start date, end date, status(enable and disable), so we need to check whether the campaign can be operated.

Annotation Design: we need to get the campaign ID through the annotation content.

param

remark

checkType

it's an enum type.

CAMPAIGN_ID

it can directly get the campaign id.

MEMBER_ID

it can get the member entity, and the entity contains campaign id.

CAMPAIGN_BASE

it is an object with only one attribute, campaign id. Other objects can inherit it and then add more information.

MEMBER_BASE

it is an object with only one attribute, member id. Other objects can inherit it and then add more information.

paramIndex

it refers to the position of the desired parameter in the method.

save user action log

    @OperationLog(module="Campaign", action="Update", dataId="#id", dataRef="#campaignConfig.name", remarks="some remarks")
    public void updateCampaignConfig(@PathVariable("id") Long id, @RequestBody Config campaignConfig)

    @OperationLog(module="'Campaign'", dataId="#id", dataRef="#response.name")
    public CampaignVo getCampaign(@PathVariable("id") Long id)
  • All attributes have a default empty value.

  • All attributes support SpEL expression.

  • The SpEL expression should support getting value from all method parameters and the request/response/result object.

  • Allow to disable operation log.