| | |
| | | import com.se.simu.domain.dto.GeFile; |
| | | import com.se.simu.domain.dto.GeLayer; |
| | | import com.se.simu.domain.po.DataPo; |
| | | import com.se.simu.helper.CaffeineHelper; |
| | | import com.se.simu.helper.RsaHelper; |
| | | import com.se.simu.helper.ShpHelper; |
| | | import com.se.simu.helper.StringHelper; |
| | |
| | | @Resource |
| | | RestTemplate restTemplate; |
| | | |
| | | private final static String TOKEN_KEY = "gedb_token"; |
| | | |
| | | public boolean test(DataPo data) throws Exception { |
| | | createPath(config.getInPath() + File.separator + data.getInPath()); |
| | | |
| | |
| | | } |
| | | |
| | | public String getToken() throws Exception { |
| | | Object obj = CaffeineHelper.get(TOKEN_KEY); |
| | | if (obj instanceof String) { |
| | | return obj.toString(); |
| | | } |
| | | |
| | | String token = getTokenByServer(); |
| | | if (null == token) throw new Exception("获取GEDB令牌失败"); |
| | | |
| | | CaffeineHelper.put(TOKEN_KEY, token); |
| | | |
| | | return token; |
| | | } |
| | | |
| | | private String getTokenByServer() throws Exception { |
| | | Map<String, Object> map = new HashMap<>(2); |
| | | map.put("userid", config.getUser()); |
| | | map.put("password", getPassword()); |
| | | |
| | | JSONObject obj = restTemplate.postForObject(config.getHost() + "account-service/security/login", map, JSONObject.class); |
| | | log.info(obj.toString()); |
| | | |
| | | JSONObject data = obj.getJSONObject("data"); |
| | | |