# WeeklyMonthlyRevenueBudgetController.java

    package cloud.wconnect.rateshop.controller.weeklymonthlyrevenue;

    import cloud.wconnect.commonlib.annotation.ApiId;
    import cloud.wconnect.commonlib.component.SessionContext;
    import cloud.wconnect.commonlib.pojo.dto.group.Edition;
    import cloud.wconnect.rateshop.pojo.dto.weeklymonthlyrevenue.budget.WeeklyMonthlyRevenueBudgetDTO;
    import cloud.wconnect.rateshop.service.weeklymonthlyrevenue.IWeeklyMonthlyRevenueBudgetService;
    import jakarta.annotation.Resource;
    import org.springframework.validation.annotation.Validated;
    import org.springframework.web.bind.annotation.*;

    import java.util.Collections;
    import java.util.Map;

    /**
     * <p>
     * Weekly Monthly Revenue Budget 前端控制器
     * </p>
     *
     * @author zc
     * @since 2024-05-13
     */
    @RestController
    @RequestMapping("/weekly-monthly-revenue/budget")
    public class WeeklyMonthlyRevenueBudgetController {

        @Resource
        private IWeeklyMonthlyRevenueBudgetService revenueBudgetService;
        @Resource
        private SessionContext sessionContext;

        /**
         * 保存指定年月 Revenue Budget
         *
         * @param property         资产标识
         * @param revenueBudgetDTO Revenue Budget DTO
         * @return empty map
         * @author zc
         * @date 2024/5/14
         */
        @ApiId(1175)
        @PostMapping
        public Map<Object, Object> save(@RequestParam String property, @RequestBody @Validated({Edition.class}) WeeklyMonthlyRevenueBudgetDTO revenueBudgetDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            revenueBudgetService.saveBudget(propertyId, revenueBudgetDTO, sessionContext.getLoginUserId());
            return Collections.emptyMap();
        }

        /**
         * 获取指定年月 Revenue Budget
         *
         * @param property 资产标识
         * @param theMonth 年月（yyyyMM）
         * @return WeeklyMonthlyRevenueBudgetDTO
         * @author zc
         * @date 2024/5/15
         */
        @ApiId(1176)
        @GetMapping
        public WeeklyMonthlyRevenueBudgetDTO get(@RequestParam String property, @RequestParam long theMonth) {
            int propertyId = sessionContext.getPropertyId(property);
            return revenueBudgetService.getBudget(propertyId, theMonth);
        }
    }