| | |
| | | import com.fasterxml.jackson.databind.JsonMappingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.utils.forest.UavClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @Slf4j(topic = "uav") |
| | | public class UavService { |
| | | public static final String USERNAME = "ardbailu";//用户名 |
| | | public static final String PASSWORD = "ardkj12345";//密码 |
| | |
| | | } |
| | | |
| | | public Map getUavUser() { |
| | | if (this.uavUser==null){ |
| | | if (this.uavUser == null) { |
| | | this.login(); |
| | | } |
| | | return this.uavUser; |
| | | } |
| | | |
| | | public void login() { |
| | | System.out.println("登录无人机外部接口"); |
| | | log.debug("登录无人机外部接口"); |
| | | String codedPassword = this.Encrypt(PASSWORD, SALT); |
| | | String body = "{\"username\":\"" + USERNAME + "\",\"password\":\"" + codedPassword + "\"}"; |
| | | try { |