package com.zy.asrs.controller; import com.core.annotations.ManagerAuth; import com.core.common.Cools; import com.core.common.R; import com.zy.asrs.domain.param.SystemSwitchParam; import com.zy.core.properties.SystemProperties; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; /** * 主控图接口 * Created by vincent on 2020-06-01 */ @Slf4j @RestController @RequestMapping("/console") public class ConsoleController { @PostMapping("/system/running/status") @ManagerAuth(memo = "系统运行状态") public R systemRunningStatus(){ return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get())); } @PostMapping("/system/switch") @ManagerAuth(memo = "系统运行开关操作") public R systemSwitch(SystemSwitchParam param) throws InterruptedException { if (Cools.isEmpty(param.getOperatorType())){ return R.error(); } if (param.getOperatorType() == 0) { if (Cools.isEmpty(param.getPassword())){ return R.error("请输入口令"); } if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)){ return R.error("口令错误"); } } Thread.sleep(200L); SystemProperties.WCS_RUNNING_STATUS.set(param.getOperatorType()==1?Boolean.TRUE:Boolean.FALSE); return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get())); } }