# M3AccountController.java

    package cloud.wconnect.finance.controller.pl;

    import cloud.wconnect.commonlib.annotation.ApiId;
    import cloud.wconnect.commonlib.component.SessionContext;
    import cloud.wconnect.commonlib.pojo.dto.ListPagedDTO;
    import cloud.wconnect.finance.entity.pl.M3Account;
    import cloud.wconnect.finance.pojo.query.pl.AccountQuery;
    import cloud.wconnect.finance.service.pl.IM3AccountService;
    import cloud.wconnect.finance.service.pl.IM3AccountSyncLogService;
    import jakarta.validation.Valid;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.PostMapping;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;

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

    /**
     * Account控制层
     *
     * @author lichen
     * @date 2025/9/29
     */
    @RestController
    @RequestMapping("/pl/account")
    public class M3AccountController {

        @Autowired
        private SessionContext sessionContext;
        @Autowired
        private IM3AccountService m3AccountService;
        @Autowired
        private IM3AccountSyncLogService m3AccountSyncLogService;

        /**
         * 分页查询Account 列表
         *
         * @param property 资产标识
         * @param query    查询参数
         * @return cloud.wconnect.commonlib.pojo.dto.ListPagedDTO<cloud.wconnect.finance.entity.pl.M3Account>
         * @author lichen
         * @date 2025/9/29
         */
        @ApiId(1599)
        @GetMapping
        public ListPagedDTO<M3Account> pageList(String property, @Valid AccountQuery query) {
            int propertyId = sessionContext.getPropertyId(property);
            return m3AccountService.pageList(propertyId, query);
        }

        /**
         * Account 同步日志
         *
         * @param property 资产标识
         * @return java.util.Map<java.lang.String, java.lang.Object>
         * @author lichen
         * @date 2025/9/29
         */
        @ApiId(1600)
        @GetMapping("/log")
        public Map<String, Long> listLog(String property) {
            int propertyId = sessionContext.getPropertyId(property);
            Long syncTime = m3AccountSyncLogService.getLastSyncTime(propertyId);
            Map<String, Long> map = new HashMap<>();
            map.put("lastSyncTime", syncTime);
            return map;
        }

        /**
         * 刷新Account数据
         *
         * @param property 资产标识
         * @return java.util.Map<java.lang.String, java.lang.Object>
         * @author lichen
         * @date 2025/9/29
         */
        @ApiId(1612)
        @PostMapping("/refresh")
        public Map<String, Object> refreshAccount(String property) {
            int propertyId = sessionContext.getPropertyId(property);
            m3AccountService.refreshAccount(propertyId);
            return Collections.emptyMap();
        }
    }