From 4ddfd502023662f6d25c4be416d88751e206d91a Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 25 十月 2022 09:45:30 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/config/InitConfig.java | 66 +++++++++++++++++++++++++-------- 1 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/lf/server/config/InitConfig.java b/src/main/java/com/lf/server/config/InitConfig.java index 3c93526..5be8ac2 100644 --- a/src/main/java/com/lf/server/config/InitConfig.java +++ b/src/main/java/com/lf/server/config/InitConfig.java @@ -1,9 +1,12 @@ package com.lf.server.config; +import cn.hutool.crypto.symmetric.AES; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.lf.server.entity.bd.DlgAgnp; +import com.lf.server.entity.bd.DlgAgnpEntity; +import com.lf.server.helper.AesHelper; import com.lf.server.helper.PathHelper; import com.lf.server.mapper.bd.DlgAgnpMapper; import com.lf.server.service.sys.ArgsService; @@ -40,37 +43,47 @@ public void run(ApplicationArguments args) { // noinspection AlibabaRemoveCommentedCode try { - // "E:\\data\\7.Insar\\insartest.tif","E:\\data\\6.楂樺厜璋盶\GF5_Cut_1.img","E:\\data\\22.tif\\110.747 sq km.tif","E:\\Test\\Test.gdb" + // GDAL娴嬭瘯锛�"E:\\data\\7.Insar\\insartest.tif","E:\\data\\6.楂樺厜璋盶\GF5_Cut_1.img","E:\\data\\22.tif\\110.747 sq km.tif","E:\\Test\\Test.gdb" //GdalHelper.readTif("E:\\data\\7.Insar\\insartest.tif") //GdalHelper.readShp("E:\\data\\13.cppe\\shps\\addr.shp"); //GdalHelper.readGdb("E:\\Test\\addr.gdb"); + //ShpRecord sr = GdalHelper.readShpFirstRecord("D:\\LF\\data\\shp\\extent.shp"); - // com.lf.server.helper.RsaHelper.generate(); - + //com.lf.server.helper.RsaHelper.generate(); //testMybatisPlus(); + //testAes(); + //boolean f1 = ZipHelper.unzip("D:\\LF\\data\\resources.zip", "D:\\LF\\data\\unzip"); + //boolean f2 = ZipHelper.zip("D:\\LF\\data\\res.zip", "D:\\LF\\data\\unzip\\resources"); + //boolean f3 = Zip4jHelper.zip("D:\\LF\\data\\zip\\resources.zip", "D:\\LF\\data\\zip\\resources", "12345"); + //boolean f4 = Zip4jHelper.unzip("D:\\LF\\data\\zip\\resources.zip", "D:\\LF\\data\\zip\\res", "12345"); + + // 鍒濆鍖� pathHelper.init(); - argsService.initSettingData(); log.info("***************** 绯荤粺鍚姩瀹屾瘯 *****************" + "\n"); } catch (Exception ex) { - log.error(ex.getMessage() + ex.getStackTrace() + "\n"); + log.error(ex.getMessage(), ex); } } + /** + * 娴嬭瘯 Mybatis-Plus + */ private void testMybatisPlus() { - DlgAgnp dlg = dlgAgnpMapper.selectById(1); + DlgAgnpEntity dlg = dlgAgnpMapper.selectById(1); + String wkt = dlgAgnpMapper.selectWktById(2); Map<String, Object> map = new HashMap<String, Object>(3); map.put("gid", 2); - List<DlgAgnp> list1 = dlgAgnpMapper.selectByMap(map); + List<DlgAgnpEntity> list1 = dlgAgnpMapper.selectByMap(map); - QueryWrapper<DlgAgnp> w1 = new QueryWrapper<>(); + QueryWrapper<DlgAgnpEntity> w1 = new QueryWrapper<>(); w1.eq("name", "娌诲鍘�"); - List<DlgAgnp> list2 = dlgAgnpMapper.selectList(w1); + List<DlgAgnpEntity> list2 = dlgAgnpMapper.selectList(w1); - UpdateWrapper<DlgAgnp> w2 = new UpdateWrapper<DlgAgnp>(); + UpdateWrapper<DlgAgnpEntity> w2 = new UpdateWrapper<DlgAgnpEntity>(); // 璁剧疆鏇存柊鍐呭 w2.set("name", "newName").set("gb", "10013") // 璁剧疆鏇存柊鏉′欢 @@ -81,17 +94,38 @@ ids.add(1); ids.add(2); // dlgAgnpMapper.deleteBatchIds(ids) - List<DlgAgnp> list3 = dlgAgnpMapper.selectBatchIds(ids); + List<DlgAgnpEntity> list3 = dlgAgnpMapper.selectBatchIds(ids); // dlgAgnpMapper.updateById(dlg) // List<DlgAgnp> all = dlgAgnpMapper.selectList(null) // 椤垫暟 / 姣忛〉璁板綍鏁� - Page<DlgAgnp> page = new Page<>(1, 10); - // 鍒嗛〉 / 鍙傛暟浜岋細wrapper鏌ヨ鏉′欢 - Page<DlgAgnp> userPage = dlgAgnpMapper.selectPage(page, null); + Page<DlgAgnpEntity> page = new Page<>(1, 10); + // 鍗囧簭鎺掑簭 + page.addOrder(OrderItem.asc("gid")); + // 鍒嗛〉锛歐rapper鏌ヨ鏉′欢 + Page<DlgAgnpEntity> userPage = dlgAgnpMapper.selectPage(page, null); // 鎬婚〉鏁� / 鎬昏褰曟暟锛�325 / 3247 String str = userPage.getPages() + " / " + userPage.getTotal(); - List<DlgAgnp> list4 = userPage.getRecords(); + List<DlgAgnpEntity> list4 = userPage.getRecords(); + + QueryWrapper<DlgAgnpEntity> w3 = new QueryWrapper<>(); + w3.like("name", "澶�").ge("gid", 100); + List<DlgAgnpEntity> list5 = dlgAgnpMapper.selectList(w3); + } + + private void testAes() { + try { + String content = "POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))"; + System.out.println("鍔犲瘑鍓嶏細" + content); + String encrypt = AesHelper.encrypt(content); + + System.out.println("鍔犲瘑鍚庯細" + encrypt); + String decrypt = AesHelper.decrypt(encrypt); + + System.out.println("瑙e瘑鍚庯細" + decrypt); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } } } -- Gitblit v1.9.3