package com.winsun.migration.controller;

import com.winsun.migration.service.IMigrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.NoSuchAlgorithmException;

@RestController
@RequestMapping("/migration")
public class MigrationDataController {

    @Autowired
    private IMigrationService migrationService;

    /**
     * 迁移用户数据
     * @return
     */
    @RequestMapping("/migrationUser")
    public String migrationUser() {
        try {
            migrationService.migrationUser();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return "成功！";
    }

    /**
     * 迁移活动数据
     * @return
     */
    @RequestMapping("/migrationActivity")
    public String migrationActivity() {

        migrationService.migrationActivity();
        migrationService.migrationActivityRecord();
        return "成功！";
    }
}
