whycxzp
2022-06-22 d3a0164e1eb0abaee361ead24603a6a797fd2fb8
src/main/java/com/whyc/Application.java
@@ -8,6 +8,7 @@
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationContext;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@@ -27,25 +28,15 @@
@EnableCaching
public class Application extends WebMvcConfigurerAdapter  implements WebMvcConfigurer {
    @Transactional
    public static void main(String[] args) {
        SpringApplication.run(Application.class,args);
        ApplicationContext applicationContext = SpringUtil.getApplicationContext();
        PasswordResetService service = (PasswordResetService) applicationContext.getBean("passwordResetService");
        //密码格式预读及手动确认
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用做校验的用户名:");
        String name = sc.nextLine();
        Response response = service.preCheck(name);
        System.out.println("当前密码模式为:"+response.getMsg()+",密码为"+response.getData());
        System.out.println("核查正确请输入y,不正确请输入n");
        String flag = sc.nextLine();
        if(!flag.toUpperCase().equals("Y")){
            System.out.println("密码解析失败,终止程序");
            System.exit(1);
        }
        //进行密码修改
        service.passwordReset();
        //备份重要密码信息
        service.bakUserInfo();
        //更新字段Snid和upassword长度
        service.updateLength();
        //密码格式重置
        service.passwordReset();
        int sleepSeconds = 3;