|
|
@@ -1036,6 +1036,93 @@ public class DataImp implements DataService {
|
|
|
return RequestResult.error("查询失败!", null);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public RequestResult basemap(MultipartFile file, String name, String invalid, String serviceuri, String id, String image) {
|
|
|
+ String imageuri = "";
|
|
|
+ if (file != null) {
|
|
|
+ String filename = file.getOriginalFilename();
|
|
|
+ String currentPath = localFilePath + "/" + filename;
|
|
|
+ try {
|
|
|
+ file.transferTo(new File(currentPath));
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ imageuri = serverhost + ":" + serverport + "/" + localFileProxy + "/" + filename;
|
|
|
+ } else if (StringUtils.isNotEmpty(image)) {
|
|
|
+ imageuri = image;
|
|
|
+ }
|
|
|
+ Connection connection = null;
|
|
|
+ try {
|
|
|
+ connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
|
|
|
+ Statement statement = connection.createStatement();
|
|
|
+ if (StringUtils.isNotEmpty(id)) {
|
|
|
+ String deleteSQL = String.format("delete from t_basemap where id = '%s'", id);
|
|
|
+ statement.execute(deleteSQL);
|
|
|
+ }
|
|
|
+ String insertSQL = String.format("insert into t_basemap (image, name , invalid, serviceuri) values ('%s', '%s','%s','%s')",
|
|
|
+ imageuri, name, invalid, serviceuri);
|
|
|
+ statement.execute(insertSQL);
|
|
|
+ statement.close();
|
|
|
+ connection.close();
|
|
|
+ return RequestResult.success("保存成功!", 1);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("保存失败!", 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RequestResult getbasemap(String name, String invalid) {
|
|
|
+ try {
|
|
|
+ Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
|
|
|
+ Statement statement = connection.createStatement();
|
|
|
+ if (StringUtils.isEmpty(name)) {
|
|
|
+ name = "";
|
|
|
+ }
|
|
|
+ String querySQL = "select * from t_basemap where name like '%" + name + "%'" ;
|
|
|
+ if (StringUtils.isNotEmpty(invalid)){
|
|
|
+ querySQL += " and invalid = '" + invalid + "'";
|
|
|
+ }
|
|
|
+ ResultSet resultSet = statement.executeQuery(querySQL);
|
|
|
+ List<Map> res = new ArrayList<Map>();
|
|
|
+ while (resultSet.next()) {
|
|
|
+ Map cur = new HashMap();
|
|
|
+ cur.put("id", resultSet.getString("id"));
|
|
|
+ cur.put("image", resultSet.getString("image"));
|
|
|
+ cur.put("invalid", resultSet.getString("invalid"));
|
|
|
+ cur.put("serviceuri", resultSet.getString("serviceuri"));
|
|
|
+ cur.put("name", resultSet.getString("name"));
|
|
|
+ res.add(cur);
|
|
|
+ }
|
|
|
+ resultSet.close();
|
|
|
+ statement.close();
|
|
|
+ connection.close();
|
|
|
+ return RequestResult.success("查询成功!", res);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("查询失败!", 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RequestResult deletebasemap(String id) {
|
|
|
+ try {
|
|
|
+ Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
|
|
|
+ Statement statement = connection.createStatement();
|
|
|
+ if (StringUtils.isEmpty(id)) {
|
|
|
+ id = "";
|
|
|
+ }
|
|
|
+ String deleteSQL = String.format("delete from t_basemap where id = '%s'", id);
|
|
|
+ statement.execute(deleteSQL);
|
|
|
+ statement.close();
|
|
|
+ connection.close();
|
|
|
+ return RequestResult.success("删除成功!", 1);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("删除失败!", 0);
|
|
|
+ }
|
|
|
+
|
|
|
// 运行cmd
|
|
|
public String ExecuteCMD(String command) {
|
|
|
String res = "";
|