UserSyncController.java 1.41 KB
package com.mass.controller;

import com.mass.service.UserSyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.repository.query.Param;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;

@Slf4j
@RestController
@RequestMapping(value = "/sync")
public class UserSyncController {

    @Resource
    private UserSyncService userSyncService;

    @GetMapping("/syncAllUser")
    public String syncAllUser() throws IOException {
        userSyncService.syncAllUser();
        return "ok";
    }

    @GetMapping("/syncUpdateUser")
    public String syncUpdateUser() throws IOException {
        userSyncService.syncUpdateUser();
        return "ok";
    }

    @GetMapping("/syncAllOrg")
    public String syncAllOrg() throws IOException {
        userSyncService.syncAllOrg();
        return "ok";
    }

    @GetMapping("/syncUpdateOrg")
    public String syncUpdateOrg() throws IOException {
        userSyncService.syncUpdateOrg();
        return "ok";
    }

    @GetMapping("/getLastExecTime")
    public String getLastExecTime(@Param("fileName") String fileName) throws IOException {
        userSyncService.getLastExecTime(fileName);
        return "ok";
    }
}