From c31e03f0e51214a524d3fc34d30f3459698ff625 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 02 六月 2023 17:16:30 +0800 Subject: [PATCH] 4.变更所有类的名称空间 --- src/main/resources/mapper/data/StyleMapper.xml | 10 src/main/resources/mapper/all/BaseQueryMapper.xml | 18 src/main/java/com/moon/server/helper/GdbHelper.java | 622 src/main/java/com/moon/server/service/sys/ArgsService.java | 103 src/main/java/com/moon/server/mapper/sys/AttachMapper.java | 168 src/main/java/com/moon/server/controller/sys/OperateController.java | 236 src/main/java/com/moon/server/service/all/CommonsFileuploadService.java | 115 src/main/java/com/moon/server/config/MybatisPlusConfig.java | 52 src/main/java/com/moon/server/entity/other/CheckOutLicense.java | 238 src/main/java/com/moon/server/controller/all/CrdsController.java | 164 src/main/java/com/moon/server/entity/sys/RoleMenuAuthEntity.java | 105 src/main/java/com/moon/server/aspect/LogAspect.java | 153 src/main/java/com/moon/server/controller/sys/ReportController.java | 183 src/main/java/com/moon/server/controller/show/PipelineController.java | 263 src/main/java/com/moon/server/entity/all/PermsAuthEntity.java | 95 src/main/java/com/moon/server/helper/AesHelper.java | 128 src/main/java/com/moon/server/controller/show/ComprehensiveController.java | 336 src/main/java/com/moon/server/controller/show/MarkController.java | 217 src/main/java/com/moon/server/entity/ctrl/DownloadReqEntity.java | 137 src/main/java/com/moon/server/controller/all/SignController.java | 265 src/main/java/com/moon/server/controller/all/BaseQueryController.java | 776 + src/main/java/com/moon/server/controller/data/MetaController.java | 539 src/main/java/com/moon/server/service/sys/BlacklistService.java | 109 src/main/java/com/moon/server/entity/ctrl/IdNameEntity.java | 34 src/main/java/com/moon/server/service/data/UploadService.java | 576 src/main/java/com/moon/server/entity/ctrl/FileInfoEntity.java | 58 src/main/java/com/moon/server/entity/sys/DownlogEntity.java | 125 src/main/resources/mapper/data/DomainMapper.xml | 10 src/main/java/com/moon/server/controller/sys/DownlogController.java | 62 src/main/java/com/moon/server/interceptor/CrosFilter.java | 42 src/main/resources/mapper/sys/BlacklistMapper.xml | 10 src/main/java/com/moon/server/extend/InsertBatchMethod.java | 76 src/main/java/com/moon/server/helper/AccessHelper.java | 107 src/main/resources/mapper/show/PublishMapper.xml | 14 src/main/resources/mapper/sys/MenuAuthMapper.xml | 12 src/main/java/com/moon/server/controller/all/PermsController.java | 188 src/main/java/com/moon/server/mapper/all/BasicMapper.java | 55 src/main/resources/mapper/sys/AttachMapper.xml | 22 src/main/java/com/moon/server/entity/ctrl/ShpRecordEntity.java | 40 src/main/java/com/moon/server/mapper/sys/MetaDownMapper.java | 96 src/main/resources/mapper/show/OneMapMapper.xml | 8 src/main/java/com/moon/server/helper/ExcelHelper.java | 97 src/main/java/com/moon/server/entity/data/MetaFileEntity.java | 202 src/main/resources/mapper/data/DownloadMapper.xml | 14 src/main/java/com/moon/server/controller/sys/ResOpController.java | 236 src/main/java/com/moon/server/entity/sys/BlacklistEntity.java | 125 src/main/resources/mapper/show/ModelMapper.xml | 12 src/main/java/com/moon/server/entity/sys/OperateEntity.java | 143 src/main/java/com/moon/server/controller/show/ModelController.java | 220 src/main/java/com/moon/server/service/all/SysService.java | 25 pom.xml | 2 src/main/java/com/moon/server/controller/sys/DepController.java | 207 src/main/java/com/moon/server/mapper/sys/ResOpMapper.java | 96 src/main/resources/mapper/sys/ResOpMapper.xml | 10 src/main/java/com/moon/server/controller/sys/RoleController.java | 252 src/main/java/com/moon/server/service/all/BaseQueryService.java | 312 src/main/java/com/moon/server/service/sys/DownlogService.java | 98 src/main/resources/mapper/sys/AuthMapper.xml | 12 src/main/java/com/moon/server/entity/all/AbstractPwdEntity.java | 17 src/main/java/com/moon/server/entity/all/StaticData.java | 273 src/main/resources/mapper/data/DirMapper.xml | 20 src/main/java/com/moon/server/entity/sys/LoginEntity.java | 116 src/main/java/com/moon/server/config/SwaggerConfig.java | 66 src/main/java/com/moon/server/service/sys/RoleResService.java | 68 src/main/java/com/moon/server/entity/ctrl/CountEntity.java | 70 src/main/java/com/moon/server/controller/data/VerController.java | 190 src/main/java/com/moon/server/service/sys/DepService.java | 71 src/main/java/com/moon/server/entity/show/ApplyEntity.java | 225 src/main/java/com/moon/server/service/sys/RoleUserService.java | 68 src/main/java/com/moon/server/service/data/DictService.java | 78 src/main/java/com/moon/server/entity/sys/DepEntity.java | 211 src/main/java/com/moon/server/helper/StringHelper.java | 229 src/main/java/com/moon/server/config/PropertiesConfig.java | 54 src/main/java/com/moon/server/entity/sys/ResOpEntity.java | 94 src/main/java/com/moon/server/helper/WebHelper.java | 404 src/main/java/com/moon/server/service/sys/AuthService.java | 74 src/main/resources/mapper/data/LayerMapper.xml | 10 src/main/java/com/moon/server/service/all/TestService.java | 188 src/main/java/com/moon/server/controller/sys/BlacklistController.java | 254 src/main/java/com/moon/server/mapper/sys/MenuMapper.java | 77 src/main/java/com/moon/server/entity/ctrl/FmeReqEntity.java | 100 src/main/java/com/moon/server/service/sys/ResOpService.java | 70 src/main/java/com/moon/server/entity/data/VerEntity.java | 113 src/main/java/com/moon/server/helper/RestHelper.java | 258 src/main/java/com/moon/server/mapper/show/ApplyMapper.java | 168 src/main/java/com/moon/server/service/data/PublishService.java | 248 src/main/java/com/moon/server/service/show/OneMapService.java | 360 src/main/java/com/moon/server/controller/data/DirController.java | 212 src/main/java/com/moon/server/entity/ctrl/SdkSecretEntity.java | 43 src/main/java/com/moon/server/mapper/show/OneMapMapper.java | 220 src/main/java/com/moon/server/entity/show/PipelineEntity.java | 138 src/main/java/com/moon/server/entity/sys/ResEntity.java | 210 src/main/java/com/moon/server/helper/MdbHelper.java | 92 src/main/resources/mapper/sys/RoleMenuAuthMapper.xml | 12 src/main/resources/mapper/sys/MetaDownMapper.xml | 10 src/main/java/com/moon/server/controller/sys/CtrlController.java | 94 src/main/java/com/moon/server/entity/all/HttpStatus.java | 104 src/main/java/com/moon/server/entity/show/FlowEntity.java | 135 src/main/java/com/moon/server/controller/sys/ArgsController.java | 263 src/main/java/com/moon/server/config/WebConfig.java | 110 src/main/java/com/moon/server/entity/ctrl/NameValueEntity.java | 35 src/main/java/com/moon/server/entity/show/ModelEntity.java | 155 src/main/java/com/moon/server/controller/sys/MenuController.java | 231 src/main/java/com/moon/server/helper/LicHelper.java | 105 src/main/java/com/moon/server/controller/sys/TokenController.java | 172 src/main/java/com/moon/server/mapper/data/DownloadMapper.java | 126 src/main/java/com/moon/server/service/show/FlowService.java | 68 src/main/java/com/moon/server/entity/ctrl/SdkDecryptEntity.java | 48 src/main/java/com/moon/server/mapper/sys/DownlogMapper.java | 103 src/main/java/com/moon/server/entity/sys/ArgsEntity.java | 145 src/main/java/com/moon/server/service/data/DownloadService.java | 173 src/main/java/com/moon/server/entity/data/FmeLogEntity.java | 105 src/main/java/com/moon/server/controller/sys/RoleUserController.java | 273 src/main/java/com/moon/server/entity/sys/AuthEntity.java | 113 src/main/java/com/moon/server/mapper/sys/BlacklistMapper.java | 105 src/main/java/com/moon/server/entity/ctrl/RegisterEntity.java | 144 src/main/java/com/moon/server/entity/sys/AttachEntity.java | 125 src/main/java/com/moon/server/controller/sys/RoleResController.java | 273 src/main/java/com/moon/server/service/show/ModelService.java | 73 src/main/java/com/moon/server/entity/all/SettingData.java | 57 src/main/java/com/moon/server/mapper/sys/ReportMapper.java | 120 src/main/resources/mapper/show/FlowMapper.xml | 10 src/main/java/com/moon/server/service/sys/AttachService.java | 196 src/main/java/com/moon/server/helper/WordHelper.java | 346 src/main/java/com/moon/server/service/data/DirService.java | 129 src/main/java/com/moon/server/mapper/sys/TokenMapper.java | 108 src/main/java/com/moon/server/entity/sys/TokenEntity.java | 153 src/main/java/com/moon/server/service/sys/OperateService.java | 75 src/main/java/com/moon/server/entity/data/PublishEntity.java | 235 src/main/java/com/moon/server/service/sys/MenuAuthService.java | 78 src/main/resources/mapper/data/UploadMapper.xml | 8 src/main/java/com/moon/server/extend/CustomizedSqlInjector.java | 26 src/main/java/com/moon/server/controller/show/ExportController.java | 136 src/main/java/com/moon/server/annotation/ExcelHead.java | 25 src/main/java/com/moon/server/entity/show/ExportEntity.java | 146 src/main/java/com/moon/server/service/data/StyleService.java | 70 src/main/java/com/moon/server/mapper/sys/UserMapper.java | 172 src/main/java/com/moon/server/service/sys/ReportService.java | 310 src/main/java/com/moon/server/service/sys/LoginService.java | 96 src/main/java/com/moon/server/service/sys/ResService.java | 80 src/main/java/com/moon/server/helper/JsonHelper.java | 79 src/main/java/com/moon/server/interceptor/AuthInterceptor.java | 184 src/main/java/com/moon/server/mapper/data/PublishMapper.java | 141 src/main/java/com/moon/server/controller/sys/LoginController.java | 237 src/main/java/com/moon/server/entity/other/ReqParamFloatServer.java | 143 src/main/java/com/moon/server/mapper/show/ModelMapper.java | 105 src/main/resources/mapper/data/DictMapper.xml | 10 src/main/java/com/moon/server/config/ScheduleConfig.java | 117 src/main/java/com/moon/server/service/sys/TokenService.java | 285 src/main/java/com/moon/server/entity/data/DownloadEntity.java | 185 src/main/resources/mapper/data/MetaMapper.xml | 24 src/main/java/com/moon/server/service/data/VerService.java | 74 src/main/java/com/moon/server/entity/sys/RoleResEntity.java | 107 src/main/java/com/moon/server/service/all/UploadAttachService.java | 515 src/main/resources/mapper/sys/RoleUserMapper.xml | 10 src/main/java/com/moon/server/entity/ctrl/TabEntity.java | 84 src/main/java/com/moon/server/controller/all/FloatServerController.java | 130 src/main/java/com/moon/server/service/sys/UserService.java | 303 src/main/java/com/moon/server/helper/FileHelper.java | 448 src/main/java/com/moon/server/entity/ctrl/MarkJsonEntity.java | 88 src/main/java/com/moon/server/controller/all/BaseController.java | 44 src/main/java/com/moon/server/service/show/PipelineService.java | 231 src/main/java/com/moon/server/controller/all/FmeItController.java | 290 src/main/java/com/moon/server/entity/data/StyleEntity.java | 234 src/main/java/com/moon/server/entity/sys/ReportEntity.java | 145 src/main/java/com/moon/server/helper/ClassHelper.java | 135 src/main/java/com/moon/server/entity/ctrl/PubEntity.java | 114 src/main/java/com/moon/server/config/MultipartFileUploadConfig.java | 18 src/main/java/com/moon/server/config/WebSocketConfig.java | 21 src/main/java/com/moon/server/service/show/ExportService.java | 118 src/main/java/com/moon/server/service/all/BaseUploadService.java | 538 src/main/java/com/moon/server/entity/ctrl/TabMapperEntity.java | 40 src/main/java/com/moon/server/entity/show/OneMapEntity.java | 294 src/main/java/com/moon/server/entity/data/DictEntity.java | 235 src/main/java/com/moon/server/mapper/show/FlowMapper.java | 96 src/main/java/com/moon/server/service/sys/MetaDownService.java | 68 src/main/resources/mapper/sys/RoleMapper.xml | 10 src/main/resources/mapper/sys/ArgsMapper.xml | 10 src/main/java/com/moon/server/helper/Md5Helper.java | 109 src/main/java/com/moon/server/service/data/DataQueryService.java | 92 src/main/java/com/moon/server/service/data/FmeService.java | 344 src/main/java/com/moon/server/mapper/all/GeomBaseMapper.java | 70 src/main/java/com/moon/server/mapper/data/DirMapper.java | 118 src/main/resources/mapper/sys/DownlogMapper.xml | 10 src/main/java/com/moon/server/entity/data/CoordEntity.java | 51 src/main/java/com/moon/server/controller/data/upload/CheckController.java | 523 src/main/java/com/moon/server/entity/data/DirEntity.java | 170 src/main/java/com/moon/server/mapper/sys/ResMapper.java | 110 src/main/java/com/moon/server/mapper/sys/MenuAuthMapper.java | 116 src/main/java/com/moon/server/service/all/WebSocketService.java | 130 src/main/java/com/moon/server/entity/ctrl/UserUpdateEntity.java | 46 src/main/java/com/moon/server/mapper/data/MetaMapper.java | 204 src/main/java/com/moon/server/controller/sys/RoleMenuAuthController.java | 301 src/main/java/com/moon/server/entity/all/RedisCacheKey.java | 77 src/main/java/com/moon/server/controller/data/LayerController.java | 253 src/main/java/com/moon/server/mapper/data/DomainMapper.java | 109 src/main/resources/mapper/sys/LoginMapper.xml | 12 src/main/resources/mapper/sys/RoleResMapper.xml | 10 src/main/java/com/moon/server/controller/data/DataQueryController.java | 59 src/main/java/com/moon/server/service/sys/MenuService.java | 64 src/main/java/com/moon/server/config/RestTemplateConfig.java | 100 src/main/java/com/moon/server/mapper/sys/OperateMapper.java | 103 src/main/java/com/moon/server/service/show/InquiryService.java | 206 src/main/resources/mapper/sys/DepMapper.xml | 14 src/main/java/com/moon/server/annotation/SysLog.java | 14 src/main/java/com/moon/server/controller/sys/ResController.java | 316 src/main/java/com/moon/server/service/sys/RoleService.java | 69 src/main/java/com/moon/server/entity/ctrl/SdkDecryptDataEntity.java | 82 src/main/java/com/moon/server/service/data/DomainService.java | 78 src/main/resources/mapper/show/PipelineMapper.xml | 8 src/main/java/com/moon/server/mapper/show/PipelineMapper.java | 39 src/main/java/com/moon/server/service/show/ApplyService.java | 276 src/main/java/com/moon/server/mapper/data/UploadMapper.java | 48 src/main/java/com/moon/server/controller/sys/UserController.java | 400 src/main/java/com/moon/server/entity/sys/UserEntity.java | 233 src/main/java/com/moon/server/controller/sys/MenuAuthController.java | 301 src/main/java/com/moon/server/controller/data/PublishController.java | 226 src/main/java/com/moon/server/controller/show/InquiryController.java | 142 src/main/java/com/moon/server/helper/HttpHelper.java | 278 src/main/resources/mapper/sys/TokenMapper.xml | 12 src/main/java/com/moon/server/service/all/SignService.java | 69 src/main/java/com/moon/server/helper/SpringContextHelper.java | 86 src/main/java/com/moon/server/service/show/DataLibService.java | 346 src/main/java/com/moon/server/mapper/all/PermsMapper.java | 67 src/main/java/com/moon/server/controller/data/upload/QueryController.java | 289 src/main/java/com/moon/server/mapper/sys/LoginMapper.java | 105 src/main/java/com/moon/server/mapper/data/StyleMapper.java | 89 src/main/resources/mapper/data/VerMapper.xml | 12 src/main/java/com/moon/server/LfApplication.java | 27 src/main/java/com/moon/server/controller/show/ApplyController.java | 305 src/main/java/com/moon/server/mapper/data/LayerMapper.java | 96 src/main/resources/mapper/sys/OperateMapper.xml | 12 src/main/java/com/moon/server/helper/RsaHelper.java | 209 src/main/java/com/moon/server/helper/ShpHelper.java | 243 src/main/java/com/moon/server/helper/PathHelper.java | 166 src/main/java/com/moon/server/service/show/MarkService.java | 231 src/main/java/com/moon/server/service/all/PermsService.java | 111 src/main/java/com/moon/server/mapper/sys/RoleMapper.java | 91 src/main/resources/mapper/show/ApplyMapper.xml | 14 src/main/java/com/moon/server/entity/sys/RoleEntity.java | 143 src/main/java/com/moon/server/mapper/data/DictMapper.java | 101 src/main/java/com/moon/server/mapper/data/VerMapper.java | 99 src/main/java/com/moon/server/entity/sys/MenuAuthEntity.java | 106 src/main/java/com/moon/server/service/data/LayerService.java | 73 src/main/java/com/moon/server/service/all/RedisService.java | 96 src/main/java/com/moon/server/mapper/sys/ArgsMapper.java | 104 src/main/java/com/moon/server/entity/data/MetaEntity.java | 305 src/main/java/com/moon/server/entity/sys/MetaDownEntity.java | 65 src/main/java/com/moon/server/mapper/all/BaseQueryMapper.java | 111 src/main/java/com/moon/server/controller/data/StyleController.java | 321 src/main/java/com/moon/server/entity/other/FloatServerResponse.java | 107 src/main/java/com/moon/server/config/RedisConfig.java | 94 src/main/java/com/moon/server/mapper/sys/AuthMapper.java | 107 src/main/java/com/moon/server/entity/all/BaseEntity.java | 174 src/main/java/com/moon/server/entity/data/DomainEntity.java | 145 src/main/java/com/moon/server/controller/data/upload/UploadController.java | 240 src/main/java/com/moon/server/helper/Zip4jHelper.java | 154 src/main/resources/mapper/sys/MenuMapper.xml | 12 src/main/java/com/moon/server/controller/data/DictController.java | 261 src/main/java/com/moon/server/mapper/sys/RoleMenuAuthMapper.java | 116 src/main/java/com/moon/server/controller/show/OneMapController.java | 389 src/main/java/com/moon/server/helper/ZipHelper.java | 149 src/main/java/com/moon/server/controller/sys/AuthController.java | 274 src/main/java/com/moon/server/entity/all/MenusAuthEntity.java | 135 src/main/resources/mapper/all/PermsMapper.xml | 10 src/main/java/com/moon/server/mapper/sys/DepMapper.java | 97 src/main/resources/mapper/sys/ResMapper.xml | 12 src/main/java/com/moon/server/entity/data/LayerEntity.java | 235 src/main/resources/mapper/show/MarkMapper.xml | 10 src/main/java/com/moon/server/mapper/show/MarkMapper.java | 96 src/main/java/com/moon/server/controller/data/WmtsController.java | 190 src/main/java/com/moon/server/service/sys/RoleMenuAuthService.java | 78 src/main/resources/mapper/sys/UserMapper.xml | 24 src/main/java/com/moon/server/config/InitConfig.java | 51 src/main/java/com/moon/server/service/all/ScheduleService.java | 249 src/main/java/com/moon/server/extend/UpdateBatchMethod.java | 86 src/main/resources/mapper/sys/ReportMapper.xml | 16 src/main/java/com/moon/server/entity/all/BaseGeoEntity.java | 20 src/main/java/com/moon/server/entity/all/ResAuthEntity.java | 45 src/main/java/com/moon/server/entity/all/ResponseMsg.java | 107 src/main/java/com/moon/server/entity/sys/RoleUserEntity.java | 95 src/main/java/com/moon/server/service/data/MetaService.java | 631 src/main/java/com/moon/server/controller/data/DomainController.java | 307 /dev/null | 303 src/main/java/com/moon/server/entity/show/MarkEntity.java | 85 src/main/java/com/moon/server/entity/sys/MenuEntity.java | 192 src/main/java/com/moon/server/mapper/sys/RoleResMapper.java | 96 src/main/java/com/moon/server/controller/show/DataLibController.java | 267 src/main/java/com/moon/server/helper/GdalHelper.java | 371 src/main/java/com/moon/server/controller/data/DataCountController.java | 132 src/main/java/com/moon/server/entity/ctrl/DownloadTileEntity.java | 105 src/main/java/com/moon/server/mapper/sys/RoleUserMapper.java | 96 src/main/java/com/moon/server/entity/ctrl/KeyValueEntity.java | 35 src/main/java/com/moon/server/helper/EnumHelper.java | 84 294 files changed, 41,461 insertions(+), 541 deletions(-) diff --git a/pom.xml b/pom.xml index cca4ce0..9a7f2fe 100644 --- a/pom.xml +++ b/pom.xml @@ -264,7 +264,7 @@ <artifactId>spring-boot-maven-plugin</artifactId> <!--<version>2.3.0.RELEASE</version>--> <configuration> - <mainClass>com.lf.server.LfApplication</mainClass> + <mainClass>com.moon.server.LfApplication</mainClass> </configuration> </plugin> </plugins> diff --git a/src/main/java/com/lf/server/LfApplication.java b/src/main/java/com/lf/server/LfApplication.java deleted file mode 100644 index 71a3bce..0000000 --- a/src/main/java/com/lf/server/LfApplication.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.lf.server; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -/** - * Land搴旂敤绋嬪簭 - * @author WWW - * 鎺掗櫎Security锛�, exclude = {SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class} - * - * jar -> war锛氱户鎵� SpringBootServletInitializer锛屽疄鐜� configure 鍑芥暟 - */ -@EnableSwagger2 -@SpringBootApplication(scanBasePackages = {"com.lf.server.*"}) -public class LfApplication extends SpringBootServletInitializer { - public static void main(String[] args) { - SpringApplication.run(LfApplication.class, args); - } - - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder springApplicationBuilder) { - return springApplicationBuilder.sources(LfApplication.class); - } -} diff --git a/src/main/java/com/lf/server/annotation/ExcelHead.java b/src/main/java/com/lf/server/annotation/ExcelHead.java deleted file mode 100644 index b583354..0000000 --- a/src/main/java/com/lf/server/annotation/ExcelHead.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.lf.server.annotation; - -import java.lang.annotation.*; - -/** - * Excel澶存敞瑙g被 - * @author WWW - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface ExcelHead { - /** - * Excel澶磋鏁� - * - * @return 澶磋鏁� - */ - int headRows() default 1; - - /** - * 鎺掗櫎鐨凷heet鍚嶇О锛堝涓敤閫楀彿闅斿紑锛� - * - * @return - */ - String excludeSheets() default ""; -} diff --git a/src/main/java/com/lf/server/annotation/SysLog.java b/src/main/java/com/lf/server/annotation/SysLog.java deleted file mode 100644 index f712dbd..0000000 --- a/src/main/java/com/lf/server/annotation/SysLog.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.lf.server.annotation; - -import java.lang.annotation.*; - -/** - * 绯荤粺鏃ュ織娉ㄨВ绫� - * @author WWW - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface SysLog { - String value() default ""; -} diff --git a/src/main/java/com/lf/server/aspect/LogAspect.java b/src/main/java/com/lf/server/aspect/LogAspect.java deleted file mode 100644 index 590876c..0000000 --- a/src/main/java/com/lf/server/aspect/LogAspect.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.lf.server.aspect; - -import com.lf.server.annotation.SysLog; -import com.lf.server.entity.sys.OperateEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.sys.OperateService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletRequest; -import java.lang.reflect.Method; - -/** - * 鏃ュ織鍒囬潰绫� - * @author WWW - */ -@Aspect -@Component -public class LogAspect { - @Autowired - private TokenService tokenService; - - @Autowired - private OperateService operateService; - - private final static String SELECT = "select"; - - private final static String INSERT = "insert"; - - private final static String UPDATE = "update"; - - private final static String DELETE = "delete"; - - private final static String UPLOAD = "upload"; - - private final static String DOWNLOAD = "download"; - - private final static String COUNT = "count"; - - private final static String SPLIT = "\\\\"; - - private static final Log log = LogFactory.getLog(LogAspect.class); - - @Pointcut("@annotation(com.lf.server.annotation.SysLog)") - public void logPointCut() { - // - } - - /** - * 鐜粫閫氱煡 @Around锛屼篃鍙互浣跨敤 @Before (鍓嶇疆閫氱煡) 鎴� @After (鍚庣疆閫氱煡) - */ - @Around("logPointCut()") - public Object around(ProceedingJoinPoint point) throws Throwable { - long beginTime = System.currentTimeMillis(); - - // 鎵ц鏂规硶 - Object result = point.proceed(); - - // 鎵ц鏃堕暱(姣) - long time = System.currentTimeMillis() - beginTime; - - // 淇濆瓨鏃ュ織 - saveLog(point, time); - - return result; - } - - /** - * 淇濆瓨鏃ュ織 - */ - private void saveLog(ProceedingJoinPoint joinPoint, long time) { - try { - MethodSignature signature = (MethodSignature) joinPoint.getSignature(); - Class<?> clazz = joinPoint.getTarget().getClass(); - Method method = signature.getMethod(); - - HttpServletRequest req = WebHelper.getRequest(); - String url = req.getServletPath(); - - OperateEntity oe = new OperateEntity(); - oe.setIp(WebHelper.getIpAddress(req)); - oe.setUrl(url); - oe.setExec(time); - - // 璁剧疆妯″潡 - Api api = clazz.getAnnotation(Api.class); - if (api != null) { - String[] strs = api.tags()[0].split(SPLIT); - oe.setModular1(strs[0]); - oe.setModular2(strs[1]); - } - - // 璁剧疆绫诲悕\鏂规硶鍚嶃�佺被鍒� - oe.setClazz(clazz.getName() + "." + method.getName()); - oe.setType(getType(method.getName())); - - // 璁剧疆澶囨敞 - SysLog sysLog = method.getAnnotation(SysLog.class); - if (sysLog != null) { - oe.setBak(sysLog.value()); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - oe.setUserid(ue.getId()); - } - - operateService.insertOperate(oe); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 鑾峰彇鎿嶄綔绫诲瀷 - */ - private static int getType(String methodName) { - if (methodName.contains(SELECT)) { - return 1; - } - if (methodName.contains(INSERT)) { - return 2; - } - if (methodName.contains(UPDATE)) { - return 3; - } - if (methodName.contains(DELETE)) { - return 4; - } - if (methodName.contains(UPLOAD)) { - return 5; - } - if (methodName.contains(DOWNLOAD)) { - return 6; - } - // methodName.indexOf(COUNT) > -1 - if (methodName.contains(COUNT)) { - return 7; - } - - return 0; - } -} diff --git a/src/main/java/com/lf/server/config/InitConfig.java b/src/main/java/com/lf/server/config/InitConfig.java deleted file mode 100644 index 4b4e83c..0000000 --- a/src/main/java/com/lf/server/config/InitConfig.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.lf.server.config; - -import com.lf.server.helper.*; -import com.lf.server.service.all.TestService; -import com.lf.server.service.all.UploadAttachService; -import com.lf.server.service.sys.ArgsService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -/** - * 鍒濆鍖栧畬鎴愰厤缃被 - * @author WWW - */ -@Component -public class InitConfig implements ApplicationRunner { - private final static Log log = LogFactory.getLog(InitConfig.class); - - @Autowired - PathHelper pathHelper; - - @Autowired - ArgsService argsService; - - @Autowired - Environment env; - - //@Autowired - //TestService testService; - - @Override - public void run(ApplicationArguments args) { - // noinspection AlibabaRemoveCommentedCode - try { - GdalHelper.init(env.getProperty("sys.gdal_path")); - UploadAttachService.init(env.getProperty("sys.attachTabs")); - - //testService.testRegister(); - pathHelper.init(); - argsService.initSettingData(); - - log.info("***************** 绯荤粺鍚姩瀹屾瘯 *****************" + "\n"); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } -} diff --git a/src/main/java/com/lf/server/config/MultipartFileUploadConfig.java b/src/main/java/com/lf/server/config/MultipartFileUploadConfig.java deleted file mode 100644 index 0ca3012..0000000 --- a/src/main/java/com/lf/server/config/MultipartFileUploadConfig.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.lf.server.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.multipart.MultipartResolver; -import org.springframework.web.multipart.support.StandardServletMultipartResolver; - -/** - * 澶氭枃浠朵笂浼犻厤缃� - * @author WWW - */ -@Configuration -public class MultipartFileUploadConfig { - @Bean - public MultipartResolver multipartResolver() { - return new StandardServletMultipartResolver(); - } -} diff --git a/src/main/java/com/lf/server/config/MybatisPlusConfig.java b/src/main/java/com/lf/server/config/MybatisPlusConfig.java deleted file mode 100644 index 4f24e18..0000000 --- a/src/main/java/com/lf/server/config/MybatisPlusConfig.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.lf.server.config; - -import com.baomidou.mybatisplus.annotation.DbType; -import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer; -import com.baomidou.mybatisplus.core.MybatisConfiguration; -import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; -import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; -import com.lf.server.extend.CustomizedSqlInjector; -import org.apache.ibatis.type.JdbcType; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -/** - * Mybatis-Plus鍒嗛〉閰嶇疆 - * @author WWW - */ -@EnableTransactionManagement -@Configuration -@MapperScan("com.lf.server.mapper") -public class MybatisPlusConfig { - /** - * 鏂扮殑鍒嗛〉鎻掍欢,涓�缂撳拰浜岀紦閬靛惊mybatis鐨勮鍒�,闇�瑕佽缃� - * MybatisConfiguration#useDeprecatedExecutor = false - * 閬垮厤缂撳瓨鍑虹幇闂(璇ュ睘鎬т細鍦ㄦ棫鎻掍欢绉婚櫎鍚庝竴鍚岀Щ闄�) - */ - @Bean - public MybatisPlusInterceptor mybatisPlusInterceptor() { - MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); - interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL)); - return interceptor; - } - - @Bean - public ConfigurationCustomizer configurationCustomizer() { - return new ConfigurationCustomizer() { - @Override - public void customize(MybatisConfiguration configuration) { - configuration.setCacheEnabled(true); - configuration.setMapUnderscoreToCamelCase(true); - configuration.setCallSettersOnNulls(true); - configuration.setJdbcTypeForNull(JdbcType.NULL); - } - }; - } - - @Bean - public CustomizedSqlInjector customizedSqlInjector() { - return new CustomizedSqlInjector(); - } -} diff --git a/src/main/java/com/lf/server/config/PropertiesConfig.java b/src/main/java/com/lf/server/config/PropertiesConfig.java deleted file mode 100644 index 7b2297f..0000000 --- a/src/main/java/com/lf/server/config/PropertiesConfig.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.lf.server.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; - -/** - * 灞炴�ч厤缃被 - * @author WWW - */ -@Configuration -@SuppressWarnings("AlibabaCommentsMustBeJavadocFormat") -public class PropertiesConfig { - @Value("${sys.path.download}") - private String downloadPath; - - @Value("${sys.path.upload}") - private String uploadPath; - - @Value("${sys.path.temp}") - private String tempPath; - - // @Value("${spring.datasource.druid.stat-view-servlet.login-username}") - private String druidUser; - - // @Value("${spring.datasource.druid.stat-view-servlet.login-password}") - private String druidPwd; - - @Value("${sys.tile_path}") - private String tilePath; - - public String getDownloadPath() { - return downloadPath; - } - - public String getUploadPath() { - return uploadPath; - } - - public String getTempPath() { - return tempPath; - } - - public String getDruidUser() { - return druidUser; - } - - public String getDruidPwd() { - return druidPwd; - } - - public String getTilePath() { - return tilePath; - } -} diff --git a/src/main/java/com/lf/server/config/RedisConfig.java b/src/main/java/com/lf/server/config/RedisConfig.java deleted file mode 100644 index 2cdb276..0000000 --- a/src/main/java/com/lf/server/config/RedisConfig.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.lf.server.config; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; -import org.springframework.cache.Cache; -import org.springframework.cache.annotation.CachingConfigurerSupport; -import org.springframework.cache.interceptor.CacheErrorHandler; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; -import org.springframework.data.redis.serializer.StringRedisSerializer; - -import java.util.HashMap; -import java.util.Map; - -/** - * Redis閰嶇疆绫� - * @author WWW - */ -@Configuration -@AutoConfigureAfter(RedisAutoConfiguration.class) -public class RedisConfig extends CachingConfigurerSupport { - /** - * 閰嶇疆鑷畾涔塺edisTemplate - */ - @SuppressWarnings("deprecation") - @Bean - public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { - RedisTemplate<String, Object> template = new RedisTemplate<>(); - template.setConnectionFactory(redisConnectionFactory); - - // 浣跨敤Jackson2JsonRedisSerializer鏉ュ簭鍒楀寲鍜屽弽搴忓垪鍖杛edis鐨剉alue鍊� - Jackson2JsonRedisSerializer<Object> serializer = new Jackson2JsonRedisSerializer<Object>(Object.class); - - ObjectMapper mapper = new ObjectMapper(); - mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); - serializer.setObjectMapper(mapper); - - template.setValueSerializer(serializer); - - //浣跨敤StringRedisSerializer鏉ュ簭鍒楀寲鍜屽弽搴忓垪鍖杛edis鐨刱ey鍊� - template.setKeySerializer(new StringRedisSerializer()); - template.setHashKeySerializer(new StringRedisSerializer()); - template.setHashValueSerializer(serializer); - template.afterPropertiesSet(); - - return template; - } - - @Bean - @Override - public CacheErrorHandler errorHandler() { - // 寮傚父澶勭悊锛屽綋Redis鍙戠敓寮傚父鏃讹紝鎵撳嵃鏃ュ織锛屼絾鏄▼搴忔甯歌蛋 - return new CacheErrorHandler() { - @Override - public void handleCacheGetError(RuntimeException e, Cache cache, Object key) { - Map<String, Object> error = new HashMap<String, Object>(3); - error.put("e", e); - error.put("cache", cache); - error.put("key", key); - } - - @Override - public void handleCachePutError(RuntimeException e, Cache cache, Object key, Object value) { - Map<String, Object> error = new HashMap<String, Object>(4); - error.put("e", e); - error.put("cache", cache); - error.put("key", key); - error.put("value", value); - } - - @Override - public void handleCacheEvictError(RuntimeException e, Cache cache, Object key) { - Map<String, Object> error = new HashMap<String, Object>(3); - error.put("e", e); - error.put("cache", cache); - error.put("key", key); - } - - @Override - public void handleCacheClearError(RuntimeException e, Cache cache) { - Map<String, Object> error = new HashMap<String, Object>(2); - error.put("e", e); - error.put("cache", cache); - } - }; - } -} diff --git a/src/main/java/com/lf/server/config/RestTemplateConfig.java b/src/main/java/com/lf/server/config/RestTemplateConfig.java deleted file mode 100644 index 403dce2..0000000 --- a/src/main/java/com/lf/server/config/RestTemplateConfig.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.lf.server.config; - -import org.apache.http.client.HttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.client.ClientHttpRequestFactory; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.http.client.SimpleClientHttpRequestFactory; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.StringHttpMessageConverter; -import org.springframework.web.client.RestTemplate; - -import java.nio.charset.StandardCharsets; -import java.util.List; - -/** - * Rest妯℃澘閰嶇疆绫� - * @author WWW - */ -@Configuration -@ConditionalOnClass(value = {RestTemplate.class, HttpClient.class}) -public class RestTemplateConfig { - /** - * 杩炴帴姹犵殑鏈�澶ц繛鎺ユ暟榛樿涓�0 - */ - @Value("${remote.maxTotalConnect:0}") - private int maxTotalConnect; - - /** - * 鍗曚釜涓绘満鐨勬渶澶ц繛鎺ユ暟 - */ - @Value("${remote.maxConnectPerRoute:1000}") - private int maxConnectPerRoute; - - /** - * 杩炴帴瓒呮椂榛樿5s - */ - @Value("${remote.connectTimeout:5000}") - private int connectTimeout; - - /** - * 璇诲彇瓒呮椂榛樿30s - */ - @Value("${remote.readTimeout:30000}") - private int readTimeout; - - /** - * 鍒涘缓HTTP瀹㈡埛绔伐鍘� - * - * @return 瀹㈡埛绔伐鍘� - */ - private ClientHttpRequestFactory createFactory() { - if (this.maxTotalConnect <= 0) { - SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); - factory.setConnectTimeout(this.connectTimeout); - factory.setReadTimeout(this.readTimeout); - return factory; - } - - HttpClient httpClient = HttpClientBuilder.create().setMaxConnTotal(this.maxTotalConnect).setMaxConnPerRoute(this.maxConnectPerRoute).build(); - - HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient); - factory.setConnectTimeout(this.connectTimeout); - factory.setReadTimeout(this.readTimeout); - - return factory; - } - - /** - * 鍒濆鍖朢estTemplate,骞跺姞鍏pring鐨凚ean宸ュ巶锛岀敱spring缁熶竴绠$悊 - * 蹇呴』鍔犳敞瑙LoadBalanced - * - * @return - */ - @Bean - @ConditionalOnMissingBean(RestTemplate.class) - public RestTemplate getRestTemplate() { - RestTemplate restTemplate = new RestTemplate(this.createFactory()); - List<HttpMessageConverter<?>> converterList = restTemplate.getMessageConverters(); - - // 閲嶆柊璁剧疆StringHttpMessageConverter瀛楃闆嗕负UTF-8锛岃В鍐充腑鏂囦贡鐮侀棶棰� - HttpMessageConverter<?> converterTarget = null; - for (HttpMessageConverter<?> item : converterList) { - if (StringHttpMessageConverter.class == item.getClass()) { - converterTarget = item; - break; - } - } - if (null != converterTarget) { - converterList.remove(converterTarget); - } - converterList.add(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); - - return restTemplate; - } -} diff --git a/src/main/java/com/lf/server/config/ScheduleConfig.java b/src/main/java/com/lf/server/config/ScheduleConfig.java deleted file mode 100644 index 1fbe663..0000000 --- a/src/main/java/com/lf/server/config/ScheduleConfig.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.lf.server.config; - -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.lf.server.entity.data.FmeLogEntity; -import com.lf.server.service.all.ScheduleService; -import com.lf.server.service.all.WebSocketService; -import com.lf.server.service.sys.AttachService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * 鏃ョ▼閰嶇疆绫� - * @author WWW - */ -@Component -@EnableScheduling -public class ScheduleConfig { - @Autowired - AttachService attachService; - - @Autowired - ScheduleService scheduleService; - - private static boolean isBusy = false; - - private static final Log log = LogFactory.getLog(ScheduleConfig.class); - - @Scheduled(fixedRate = 15 * 1000) - public void pushMonitorInfo() { - try { - JSONObject jsonObject = new JSONObject(); - - // 鏌ヨCpu淇℃伅 - jsonObject.put("cpuInfo", scheduleService.selectCpuInfo()); - // 鏌ヨ鍐呭瓨淇℃伅 - jsonObject.put("memInfo", scheduleService.selectMemInfo()); - // 鏌ヨ鍦ㄧ嚎鐢ㄦ埛 - jsonObject.put("userInfo", scheduleService.selectOnlineUsers()); - - String json = JSONObject.toJSONStringWithDateFormat(jsonObject, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue); - - WebSocketService.broadCastInfo(json); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - @Scheduled(fixedRate = 30 * 1000) - public void checkSystemStatus() { - try { - JSONObject jsonObject = new JSONObject(); - - // 鏌ヨ鏈嶅姟璧勬簮鐘舵�� - jsonObject.put("resInfo", scheduleService.selectResStatus()); - - String json = JSONObject.toJSONStringWithDateFormat(jsonObject, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue); - - WebSocketService.broadCastInfo(json); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - @Scheduled(fixedRate = 30 * 1000) - public void countSystemStatus() { - // noinspection AlibabaRemoveCommentedCode - try { - JSONObject jsonObject = new JSONObject(); - - // 鏈嶅姟璧勬簮鐘舵�� sys_res - jsonObject.put("resUseCount", scheduleService.countResStatus()); - - // 鐢ㄦ埛鐧诲綍鐘舵�� sys_login - jsonObject.put("userLoginCount", scheduleService.userLoginCount()); - - // 璧勬簮鎿嶄綔鐘舵�� sys_operate - jsonObject.put("operateCount", scheduleService.operateCount()); - - // 璧勬簮璋冪敤鐘舵�� - String json = JSONObject.toJSONStringWithDateFormat(jsonObject, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue); - - WebSocketService.broadCastInfo(json); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 鍚屾闄勪欢 - */ - @Scheduled(fixedRate = 30 * 1000) - public void syncAttaches() { - try { - List<FmeLogEntity> list = attachService.selectFmeLogs(); - if (isBusy || null == list || list.isEmpty()) { - return; - } - - isBusy = true; - for (FmeLogEntity entity : list) { - attachService.syncAttaches(entity); - attachService.updateFmeLog(entity.getId()); - } - isBusy = false; - } catch (Exception ex) { - isBusy = false; - log.error(ex.getMessage(), ex); - } - } -} diff --git a/src/main/java/com/lf/server/config/SwaggerConfig.java b/src/main/java/com/lf/server/config/SwaggerConfig.java deleted file mode 100644 index 5619012..0000000 --- a/src/main/java/com/lf/server/config/SwaggerConfig.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.lf.server.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.*; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spi.service.contexts.SecurityContext; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -import java.util.ArrayList; -import java.util.List; - -/** - * Swagger閰嶇疆绫� - * @author www - */ -@Configuration -@EnableSwagger2 -public class SwaggerConfig { - private List<ApiKey> securitySchemes() { - List<ApiKey> apiKeys = new ArrayList<ApiKey>(); - apiKeys.add(new ApiKey("Authorization", "token", "header")); - - return apiKeys; - } - - private List<SecurityContext> securityContexts() { - List<SecurityContext> securityContexts = new ArrayList<>(); - securityContexts.add(SecurityContext.builder() - .securityReferences(defaultAuth()) - .forPaths(PathSelectors.regex("^(?!auth).*$")).build()); - - return securityContexts; - } - - private List<SecurityReference> defaultAuth() { - AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); - AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; - authorizationScopes[0] = authorizationScope; - List<SecurityReference> securityReferences = new ArrayList<>(); - securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); - - return securityReferences; - } - - @Bean - public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()).select() - .apis(RequestHandlerSelectors.basePackage("com.lf.server.controller")) - //.securitySchemes(securitySchemes()) - //.securityContexts(securityContexts()) - .paths(PathSelectors.any()).build(); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("Spring Boot鎺ュ彛API") - .description("Spring Boot鎺ュ彛API鏌ョ湅") - .version("1.0").build(); - } -} diff --git a/src/main/java/com/lf/server/config/WebConfig.java b/src/main/java/com/lf/server/config/WebConfig.java deleted file mode 100644 index 3d11745..0000000 --- a/src/main/java/com/lf/server/config/WebConfig.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.lf.server.config; - -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.alibaba.fastjson.support.config.FastJsonConfig; -import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; -import com.lf.server.interceptor.AuthInterceptor; -import com.lf.server.service.all.SysService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.util.AntPathMatcher; -import org.springframework.web.servlet.config.annotation.*; - -import java.nio.charset.Charset; -import java.util.List; - -/** - * Web閰嶇疆绫� - * @author WWW - */ -@Configuration -public class WebConfig extends WebMvcConfigurationSupport { - @Autowired - private SysService sysService; - - @Override - public void addViewControllers(ViewControllerRegistry registry) { - // 璁剧疆璁块棶璺緞涓� 鈥�/鈥� 璺宠浆鍒版寚瀹氶〉闈� - registry.addViewController("/").setViewName("redirect:/sign/toIndex"); - // 璁剧疆涓烘渶楂樹紭鍏堢骇 - registry.setOrder(Ordered.HIGHEST_PRECEDENCE); - } - - /** - * 鑾峰彇鎷︽埅鍣ㄥ璞� - * - * @return - */ - public AuthInterceptor getAuthBean() { - return new AuthInterceptor(sysService); - } - - /** - * swagger鎺у埗 - */ - @Override - protected void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); - registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); - registry.addResourceHandler("/**").addResourceLocations("classpath:/static/"); - super.addResourceHandlers(registry); - } - - /** - * 蹇界暐url鍦板潃澶у皬鍐� - */ - @Override - protected void configurePathMatch(PathMatchConfigurer configurer) { - AntPathMatcher matcher = new AntPathMatcher(); - matcher.setCaseSensitive(false); - - configurer.setPathMatcher(matcher); - } - - /** - * 璺ㄥ煙璇锋眰 - */ - @Override - protected void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**") - .allowCredentials(true) - .allowedOrigins("*") - .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") - .allowedHeaders("*") - .maxAge(3600); - } - - /** - * 娣诲姞缁熶竴鐨勬嫤鎴櫒 - */ - @Override - protected void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(getAuthBean()) - // .excludePathPatterns("/swagger", "/webjars/**", "/v2/**", "/sign/**") - .addPathPatterns("/**"); - super.addInterceptors(registry); - } - - /** - * 澶勭悊json鏍煎紡锛屽�糿ull鐨勮浆鎹负"" - */ - @Override - public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { - FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); - FastJsonConfig config = new FastJsonConfig(); - config.setSerializerFeatures( - SerializerFeature.WriteNullListAsEmpty, - SerializerFeature.WriteMapNullValue, - //SerializerFeature.WriteNullStringAsEmpty, - SerializerFeature.WriteNullNumberAsZero, - SerializerFeature.WriteNullBooleanAsFalse); - // 缁撴灉鏄惁鏍煎紡鍖�,榛樿涓篺alse - //SerializerFeature.PrettyFormat); - - converter.setFastJsonConfig(config); - converter.setDefaultCharset(Charset.forName("UTF-8")); - converters.add(converter); - } -} diff --git a/src/main/java/com/lf/server/config/WebSocketConfig.java b/src/main/java/com/lf/server/config/WebSocketConfig.java deleted file mode 100644 index 9c1d3a2..0000000 --- a/src/main/java/com/lf/server/config/WebSocketConfig.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.lf.server.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Component; -import org.springframework.web.socket.server.standard.ServerEndpointExporter; - -/** - * WebSocket閰嶇疆绫� - * @author WWW - */ -@Component -public class WebSocketConfig { - /** - * 鑷姩娉ㄥ唽浣跨敤@ServerEndpoint - */ - @Bean - public ServerEndpointExporter serverEndpointExporter() { - return new ServerEndpointExporter(); - } -} diff --git a/src/main/java/com/lf/server/controller/all/BaseController.java b/src/main/java/com/lf/server/controller/all/BaseController.java deleted file mode 100644 index a9c26d0..0000000 --- a/src/main/java/com/lf/server/controller/all/BaseController.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.lf.server.controller.all; - -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Controller鍩虹被 - * @author WWW - */ -public class BaseController { - public Log log = LogFactory.getLog(getClass()); - - public <T> ResponseMsg<T> success(T result) { - return new ResponseMsg<T>(HttpStatus.OK, result); - } - - public <T> ResponseMsg<T> success(String msg, T result) { - return new ResponseMsg<T>(HttpStatus.OK, msg, result); - } - - public <T> ResponseMsg<T> success(long count, T result) { - return new ResponseMsg<T>(HttpStatus.OK, count, result); - } - - public <T> ResponseMsg<T> success(String msg, long count, T result) { - return new ResponseMsg<T>(HttpStatus.OK, msg, count, result); - } - - public <T> ResponseMsg<T> fail(T result) { - return new ResponseMsg<T>(HttpStatus.ERROR, result); - } - - public <T> ResponseMsg<T> fail(String msg, T result) { - return new ResponseMsg<T>(HttpStatus.ERROR, msg, result); - } - - public <T> ResponseMsg<T> fail(Exception ex, T result) { - log.error(ex.getMessage(), ex); - - return new ResponseMsg<T>(HttpStatus.ERROR, ex.getMessage(), result); - } -} diff --git a/src/main/java/com/lf/server/controller/all/BaseQueryController.java b/src/main/java/com/lf/server/controller/all/BaseQueryController.java deleted file mode 100644 index f116f94..0000000 --- a/src/main/java/com/lf/server/controller/all/BaseQueryController.java +++ /dev/null @@ -1,776 +0,0 @@ -package com.lf.server.controller.all; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.metadata.OrderItem; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.lf.server.annotation.SysLog; -import com.lf.server.entity.all.BaseGeoEntity; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.DownloadReqEntity; -import com.lf.server.entity.ctrl.IdNameEntity; -import com.lf.server.entity.ctrl.KeyValueEntity; -import com.lf.server.entity.ctrl.TabEntity; -import com.lf.server.entity.data.*; -import com.lf.server.entity.sys.AttachEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.AesHelper; -import com.lf.server.helper.ClassHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.mapper.all.GeomBaseMapper; -import com.lf.server.service.all.BaseQueryService; -import com.lf.server.service.data.DictService; -import com.lf.server.service.data.DirService; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.data.MetaService; -import com.lf.server.service.show.DataLibService; -import com.lf.server.service.sys.AttachService; -import com.lf.server.service.sys.DepService; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.List; - -/** - * 鐖舵煡璇㈡帶鍒跺櫒 - * @author WWW - */ -public class BaseQueryController extends BaseController { - @Autowired - AttachService attachService; - - @Autowired - TokenService tokenService; - - @Autowired - DepService depService; - - @Autowired - DirService dirService; - - @Autowired - MetaService metaService; - - @Autowired - DataLibService dataLibService; - - @Autowired - public DownlogService downlogService; - - @Autowired - public DownloadService downloadService; - - @Autowired - BaseQueryService baseQueryService; - - @Autowired - DictService dictService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), - @ApiImplicitParam(name = "filter", value = "杩囨护鏉′欢", dataType = "String", paramType = "query", example = "gid >= 50 and name like '鍘�' and objectid < 5000.0"), - @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = "gAPpDbZ53XfoQfvT8dj/uhBWX5os8kBJQ1LrNvH3VX7byFQdUJMPiEr8Fkj0q2i1pw+L8KFrvR0MLXq2xaO21nlQQXmEPofJxpDQZwEWUIFZsToXo1kLRD3t6WQezxWB8YTzXHM20Ba73x/ZuuezVhOFOq1U8HKf1dXQdv7gBzEB6fWMmFDc3FuH8GDDHv3LfT86Gio9VgMO6ohlrUdf3ZKtTHeLSuzGF4t0RZuX97YBNo25IIzpeTfRTXBxfdxA") - }) - @GetMapping(value = "/selectCount") - @PostMapping(value = "/selectCount") - public ResponseMsg<Long> selectCount(String name, String filter, String wkt) { - try { - BasicMapper baseMapper = ClassHelper.getBasicMapper(name); - if (baseMapper == null) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); - } - - QueryWrapper wrapper = new QueryWrapper(); - baseQueryService.addFilterWrapper(wrapper, filter); - baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt); - - long count = baseMapper.selectCount(wrapper); - - return success(count); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), - @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), - @ApiImplicitParam(name = "dirs", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00,01"), - @ApiImplicitParam(name = "filter", value = "杩囨护鏉′欢", dataType = "String", paramType = "query", example = "gid >= 50 and name like '鍘�' and objectid < 5000.0"), - @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = ""), - //@ApiImplicitParam(name = "srid", value = "绌洪棿寮曠敤鏍囪瘑绗�", dataType = "Integer", paramType = "query", example = "4326"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "hasGeom", value = "鏄�/鍚﹀寘鍚┖闂翠俊鎭�", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - @PostMapping(value = "/selectByPage") - public ResponseMsg<List<Object>> selectByPage(String name, String depcode, String dirs, String filter, String wkt, Integer pageIndex, Integer pageSize, Integer hasGeom) { - try { - BasicMapper baseMapper = ClassHelper.getBasicMapper(name); - if (null == baseMapper) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); - } - - QueryWrapper wrapper = new QueryWrapper(); - baseQueryService.addFilterWrapper(wrapper, filter); - baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt); - if (!StringHelper.isEmpty(depcode)) { - wrapper.likeRight("depid", depcode); - } - - dirs = DataLibService.copeCodes(dirs, "dirid"); - if (!StringHelper.isEmpty(dirs)) { - wrapper.apply(dirs); - } - - boolean hasWkt = null != hasGeom && hasGeom > 0 && baseMapper instanceof GeomBaseMapper; - if (hasWkt) { - wrapper.select("ST_AsText(geom) as geom, *"); - } - - Page<Object> page = new Page<>(pageIndex, pageSize); - page.addOrder(OrderItem.desc("gid")); - IPage<Object> paged = baseMapper.selectPage(page, wrapper); - if (hasWkt && null != paged.getRecords()) { - copeWkt(paged.getRecords()); - } - - return success(paged.getTotal(), paged.getRecords()); - } catch (Exception ex) { - return fail(ex, null); - } - } - - /** - * 澶勭悊WKT - */ - private void copeWkt(List<?> list) { - for (int i = 0, c = list.size(); i < c; i++) { - Object obj = list.get(i); - setWktEncrypt(obj); - } - } - - /** - * 璁剧疆WKT鍔犲瘑 - */ - private void setWktEncrypt(Object obj) { - if (obj instanceof BaseGeoEntity) { - BaseGeoEntity entity = (BaseGeoEntity) obj; - if (StringHelper.isEmpty(entity.getGeom())) { - return; - } - - try { - String wkt = AesHelper.encrypt(entity.getGeom()); - entity.setGeom(wkt); - } catch (Exception ex) { - entity.setGeom(null); - log.error(ex.getMessage(), ex); - } - } - } - - @SysLog() - @ApiOperation(value = "缂撳啿鍖烘煡璇�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), - @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "buffer", value = "缂撳啿鍖哄ぇ灏�", dataType = "Double", paramType = "query", example = "10"), - @ApiImplicitParam(name = "limit", value = "闄愬埗鏉℃暟", dataType = "Integer", paramType = "query", example = "20") - }) - @GetMapping(value = "/selectByBuffer") - public ResponseMsg<List<?>> selectByBuffer(String name, String wkt, Double buffer, Integer limit) { - try { - if (StringHelper.isEmpty(wkt)) { - return fail("WKT涓嶈兘涓虹┖", null); - } - if (null == limit || limit < 1 || limit > StaticData.ONE_HUNDRED) { - limit = 20; - } - if (null == buffer || buffer < 0 || buffer > StaticData.ONE_HUNDRED_THOUSAND) { - buffer = 10.0; - } - - GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(name); - if (baseMapper == null) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); - } - - QueryWrapper wrapper = new QueryWrapper(); - wrapper.select("ST_AsText(geom) as geom, *"); - baseQueryService.addBufferWrapper(baseMapper, wrapper, wkt, buffer); - wrapper.last("limit " + limit); - - List<?> list = baseMapper.selectList(wrapper); - - return success(null == list ? 0 : list.size(), list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鐖禝D鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "metaid", value = "鐖禝D", dataType = "String", paramType = "query", example = "0"), - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectPageAndCountByPid") - public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - if (null == metaid || metaid < 1) { - return fail("鐖禝D涓嶈兘涓虹┖涓斿ぇ浜�1", null); - } - - int count = metaService.selectCountByPid(metaid, name); - if (count == 0) { - return success(0, null); - } - - List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨWKT") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), - @ApiImplicitParam(name = "gid", value = "GID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectWktById") - public ResponseMsg<String> selectWktById(String name, Integer gid) { - try { - GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(name); - if (null == baseMapper) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦ㄦ垨涓嶆槸绌洪棿琛�", null); - } - - String tab = BaseQueryService.getTabName(baseMapper); - if (StringHelper.isNull(tab)) { - return fail("鏌ヨ瀵硅薄鐨勮〃鍚嶄笉瀛樺湪", null); - } - - String wkt = baseMapper.selectWktById(tab, gid); - if (!StringHelper.isEmpty(wkt)) { - wkt = AesHelper.encrypt(wkt); - } - - return success(wkt); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁GID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), - @ApiImplicitParam(name = "gid", value = "GID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByGid") - public ResponseMsg<Object> selectByGid(String name, int gid) { - try { - BasicMapper baseMapper = ClassHelper.getBasicMapper(name); - if (null == baseMapper) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); - } - - QueryWrapper wrapper = new QueryWrapper(); - if (baseMapper instanceof GeomBaseMapper) { - wrapper.select("ST_AsText(geom) as geom, *"); - } - wrapper.eq("gid", gid); - - Object obj = baseMapper.selectOne(wrapper); - setWktEncrypt(obj); - - return success(null == obj ? 0 : 1, obj); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁瀹炰綋鍚嶆煡璇㈣〃鍚�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp") - }) - @GetMapping(value = "/selectTabByEntity") - public ResponseMsg<Object> selectTabByEntity(String name) { - try { - BasicMapper baseMapper = ClassHelper.getBasicMapper(name); - if (baseMapper == null) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); - } - - String tab = BaseQueryService.getTabName(baseMapper); - - return success(tab); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "妯$硦鎼滅储瀛楁") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), - @ApiImplicitParam(name = "field", value = "瀛楁", dataType = "String", paramType = "query", example = "name"), - @ApiImplicitParam(name = "value", value = "鍊�", dataType = "String", paramType = "query", example = "'鍘�'") - }) - @GetMapping(value = "/selectFieldFuzzy") - public ResponseMsg<List<String>> selectFieldFuzzy(String name, String field, String value) { - try { - BasicMapper baseMapper = ClassHelper.getBasicMapper(name); - if (baseMapper == null) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); - } - - String tab = BaseQueryService.getTabName(baseMapper); - if (StringHelper.isNull(tab)) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); - } - if (StringHelper.isEmpty(field) || StringHelper.isSqlInjection(field)) { - return fail("鏌ヨ瀛楁涓嶆纭�", null); - } - - value = StringHelper.isEmpty(value) ? "%" : StringHelper.getLikeUpperStr(value); - List<String> rs = baseMapper.selectFieldFuzzy(tab, field, value); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "妯$硦鎼滅储鐢ㄦ埛") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "瀹�") - }) - @GetMapping(value = "/selectUserFuzzy") - public ResponseMsg<List<IdNameEntity>> selectUserFuzzy(String name) { - try { - List<IdNameEntity> rs = baseQueryService.selectUserFuzzy(name); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "妯$硦鎼滅储鍗曚綅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍗曚綅鍚�", dataType = "String", paramType = "query", example = "鍙�") - }) - @GetMapping(value = "/selectDepFuzzy") - public ResponseMsg<List<IdNameEntity>> selectDepFuzzy(String name) { - try { - List<IdNameEntity> rs = baseQueryService.selectDepFuzzy(name); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈夎〃") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鐐�"), - @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false") - }) - @GetMapping(value = "/selectTabs") - public ResponseMsg<List<TabEntity>> selectTabs(String name, Boolean hasGeom) { - try { - List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom"); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁琛ㄥ悕鍒嗛〉鏌ヨ琛�") - @GetMapping(value = "/selectTabsByPage") - @ApiImplicitParams({ - @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), - @ApiImplicitParam(name = "dirs", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00,01"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_"), - @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - public ResponseMsg<Object> selectTabsByPage(String depcode, String dirs, String tab, Boolean hasGeom, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - if (StringHelper.isSqlInjection(depcode)) { - return fail("鍗曚綅浠g爜鍚湁闈炴硶瀛楃", null); - } - - String filters = "1=1"; - if (!StringHelper.isEmpty(depcode)) { - filters += String.format(" and depid like '%s%%'", depcode); - } - dirs = DataLibService.copeCodes(dirs, "dirid"); - if (dirs != null) { - filters += String.format(" and %s", dirs); - } - - String field = null == hasGeom || !hasGeom ? "gid" : "geom"; - int count = baseQueryService.selectTabsForCount(tab, field); - if (count == 0) { - return success(0, null); - } - - List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, field, filters, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ瀛楁淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlg25wAanp") - }) - @GetMapping(value = "/selectFields") - public ResponseMsg<List<DictEntity>> selectFields(String name) { - try { - BasicMapper baseMapper = ClassHelper.getBasicMapper(name); - if (baseMapper == null) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); - } - - String tabName = BaseQueryService.getTabName(baseMapper); - if (tabName == null) { - return null; - } - - String[] strs = tabName.split("\\."); - List<DictEntity> list = baseQueryService.selectFields(strs[0], strs[1]); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ瀛楁淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg25wAanp") - }) - @GetMapping(value = "/selectTabFields") - public ResponseMsg<List<DictEntity>> selectTabFields(String ns, String tab) { - try { - if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(tab)) { - return fail("鍚嶇О绌洪棿鍜岃〃鍚嶄笉鑳戒负绌�", null); - } - - List<DictEntity> list = baseQueryService.selectFields(ns, tab); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍊煎煙淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlg25wAanp") - }) - @GetMapping(value = "/selectDomains") - public ResponseMsg<List<DomainEntity>> selectDomains(String name) { - try { - BasicMapper baseMapper = ClassHelper.getBasicMapper(name); - if (baseMapper == null) { - return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); - } - - String tabName = BaseQueryService.getTabName(baseMapper); - if (tabName == null) { - return null; - } - - String[] strs = tabName.split("\\."); - List<DomainEntity> list = baseQueryService.selectDomains(strs[0], strs[1]); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "tabName", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "lf.sys_style"), - @ApiImplicitParam(name = "eventid", value = "涓婚敭", dataType = "String", paramType = "query", example = "fa25979a5ef8b43ba82a0be35b3fb0d4") - }) - @GetMapping(value = "/selectFiles") - public ResponseMsg<List<AttachEntity>> selectFiles(String tabName, String eventid) { - try { - if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) { - return fail("鍙傛暟涓嶈兘涓虹┖", null); - } - - List<AttachEntity> list = attachService.selectByTab(tabName, eventid); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deleteFiles(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int rows = attachService.deletes(ids); - - return success(rows); - } catch (Exception ex) { - return fail(ex, 0); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍏冩暟鎹腑婧㈠嚭鐨勫崟浣岻D") - @ApiImplicitParams({ - @ApiImplicitParam(name = "reqEntity", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/selectMetaOverflowDep") - public ResponseMsg<Object> selectMetaOverflowDep(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == dr || null == dr.getIds() || dr.getIds().isEmpty()) { - return fail("璇烽�夋嫨瑕佷笅杞界殑鏂囦欢ID"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (StaticData.ADMIN.equals(ue.getUid())) { - return success(new ArrayList<String>()); - } - - List<String> list = metaService.selectMetaOverflowDep(ue, dr); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨDB涓孩鍑虹殑鍗曚綅ID") - @ApiImplicitParams({ - @ApiImplicitParam(name = "reqEntity", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/selectDbOverflowDep") - public ResponseMsg<Object> selectDbOverflowDep(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == dr || null == dr.getEntities() || dr.getEntities().isEmpty()) { - return fail("璇烽�夋嫨瑕佷笅杞界殑瀹炰綋鍚�"); - } - if (!StringHelper.isEmpty(dr.getWkt())) { - dr.setWkt(AesHelper.decrypt(dr.getWkt())); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (StaticData.ADMIN.equals(ue.getUid())) { - return success(new ArrayList<String>()); - } - - List<String> list = dataLibService.selectDbOverflowDep(ue, dr); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鍗曚綅缂栫爜鏁扮粍鏌ヨ鍗曚綅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "codes", value = "鍗曚綅缂栫爜鏁扮粍", dataType = "String", paramType = "query", allowMultiple = true, example = "00,0001") - }) - @GetMapping(value = "/selectDepsByCodes") - public ResponseMsg<Object> selectDepsByCodes(String[] codes) { - try { - if (null == codes || codes.length == 0) { - return fail("鍗曚綅ID闆嗗悎涓虹┖"); - } - - List<IdNameEntity> list = depService.selectDepsByCodes(codes); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇DB鏁版嵁") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dr", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/downloadDbData") - public ResponseMsg<Object> downloadDbData(@RequestBody DownloadReqEntity dr, HttpServletRequest req) { - try { - if (null == dr || null == dr.getEntities() || dr.getEntities().isEmpty()) { - return fail("璇烽�夋嫨瑕佷笅杞界殑瀹炰綋鍚�"); - } - if (StringHelper.isEmpty(dr.getPwd())) { - return fail("瀵嗙爜涓嶈兘涓虹┖"); - } - if (!DownloadService.decryptPwd(dr)) { - return fail("瀵嗙爜瑙e瘑澶辫触", null); - } - if (StringHelper.isPwdInvalid(dr.getPwd())) { - return fail("瀵嗙爜涓嶇鍚堣姹�"); - } - if (!StringHelper.isEmpty(dr.getWkt())) { - dr.setWkt(AesHelper.decrypt(dr.getWkt())); - } - - UserEntity ue = tokenService.getCurrentUser(req); - String guid = dataLibService.downloadDbReq(ue, dr); - - return success(guid); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ョ湅鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") - }) - @GetMapping(value = "/downloadForView") - public void downloadForView(String guid, HttpServletResponse res) { - metaService.downloadForView(guid, true, res); - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectPageCountForDownload") - public ResponseMsg<List<DownloadEntity>> selectPageCountForDownload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - int count = downloadService.selectCountForUser(ue.getId(), "3,4", name); - if (count == 0) { - return success(0, null); - } - List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), "3,4", name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鐩綍绫诲埆") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "D") - }) - @GetMapping(value = "/selectDirTypes") - public ResponseMsg<Object> selectDirTypes(String name) { - try { - List<KeyValueEntity> list = baseQueryService.selectDirTypes(name); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ椤圭洰鍚嶇О") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "瑗�") - }) - @GetMapping(value = "/selectProject") - public ResponseMsg<Object> selectProject(String name) { - try { - List<DirEntity> list = dirService.selectProject(name); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鍏冩暟鎹甀D鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectMetaById") - public ResponseMsg<MetaEntity> selectMetaById(int id) { - try { - MetaEntity entity = metaService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/lf/server/controller/all/CrdsController.java b/src/main/java/com/lf/server/controller/all/CrdsController.java deleted file mode 100644 index 4fd8e09..0000000 --- a/src/main/java/com/lf/server/controller/all/CrdsController.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.lf.server.controller.all; - -import com.lf.server.annotation.SysLog; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.data.DirEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.helper.HttpHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.data.DirService; -import com.lf.server.service.data.FmeService; -import com.lf.server.service.data.MetaService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * CRDS绯荤粺鎺ュ彛 - * @author WWW - */ -@Api(tags = "绯荤粺瀵规帴\\CRDS") -@RestController -@RequestMapping("/crds") -public class CrdsController extends BaseController { - @Autowired - DirService dirService; - - @Autowired - FmeService fmeService; - - @Autowired - MetaService metaService; - - @SysLog() - @ApiOperation(value = "鏌ヨ椤圭洰") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "瑗�") - }) - @GetMapping(value = "/selectProject") - public ResponseMsg<List<DirEntity>> selectProject(String name) { - try { - List<DirEntity> list = dirService.selectProject(name); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ椤圭洰鐩綍鏍�") - @GetMapping(value = "/selectDirsForPrj") - public ResponseMsg<List<DirEntity>> selectDirsForPrj() { - try { - List<DirEntity> list = dirService.selectDirsForPrj(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ浠诲姟鐘舵��") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") - }) - @GetMapping(value = "/selectTaskStatus") - public Object selectTaskStatus(String id, HttpServletRequest req) { - try { - if (StringHelper.isEmpty(id)) { - return fail("id涓嶈兘涓虹┖"); - } - - return fmeService.getTaskStatus(id, req); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "璇锋眰鎵撳寘") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dirCode", value = "鐩綍缂栫爜", dataType = "String", paramType = "01"), - @ApiImplicitParam(name = "major", value = "涓撲笟", dataType = "String", paramType = "绌胯法瓒�"), - @ApiImplicitParam(name = "isCut", value = "鏄惁瑁佸壀", dataType = "String", paramType = "NO") - }) - @GetMapping(value = "/uploadReqPackaging") - public ResponseMsg<Object> uploadReqPackaging(String dirCode, String major, String isCut, HttpServletRequest req) { - try { - boolean isMajor = StaticData.CROSSING.equals(major) || StaticData.ROUTE.equals(major); - if (!isMajor) { - return fail("涓撲笟鍙兘鏄�滅┛璺ㄨ秺鈥濇垨鈥滅嚎璺��"); - } - - boolean bCut = StaticData.YES.equals(isCut) || StaticData.NO.equals(isCut); - if (!bCut) { - return fail("鏄惁瑁佸壀鍙兘鏄�淵ES鈥濇垨鈥淣O鈥�"); - } - - if (StringHelper.isEmpty(dirCode)) { - return fail("鐩綍缂栫爜涓嶈兘涓虹┖"); - } - DirEntity dir = dirService.selectByCode(dirCode); - if (null == dir) { - return fail("鐩綍缂栫爜涓�" + dirCode + "鐨勭洰褰曚笉瀛樺湪"); - } - - String id = fmeService.crdsPackaging(dirCode, major, isCut, req); - - return success(id); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") - }) - @GetMapping(value = "/downloadFile") - public void downloadResult(String id, HttpServletRequest req, HttpServletResponse res) { - try { - if (!StringHelper.isEmpty(id)) { - String url = fmeService.getDownloadUrl(id, req); - - HttpHelper httpHelper = new HttpHelper(); - httpHelper.service(req, res, url, null); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鐩綍缂栫爜鏌ヨ鍏冩暟鎹枃浠�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dircode", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "01") - }) - @GetMapping(value = "/selectMetasByDirCode") - public ResponseMsg<Object> selectMetasByDirCode(String dircode) { - try { - if (StringHelper.isEmpty(dircode)) { - return fail("鐩綍缂栫爜涓嶈兘涓虹┖"); - } - - List<MetaEntity> list = metaService.selectMetasByDirCode(dircode); - - return success(null == list ? 0 : list.size(), list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/all/FloatServerController.java b/src/main/java/com/lf/server/controller/all/FloatServerController.java deleted file mode 100644 index 05d9647..0000000 --- a/src/main/java/com/lf/server/controller/all/FloatServerController.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.lf.server.controller.all; - -import com.alibaba.fastjson.JSON; -import com.lf.server.entity.ctrl.SdkDecryptEntity; -import com.lf.server.entity.ctrl.SdkSecretEntity; -import com.lf.server.entity.other.FloatServerResponse; -import com.lf.server.entity.other.ReqParamFloatServer; -import com.lf.server.helper.HttpHelper; -import com.lf.server.helper.LicHelper; -import com.lf.server.helper.WebHelper; -import io.swagger.annotations.Api; -import org.apache.http.HttpEntity; -import org.apache.http.entity.InputStreamEntity; -import org.apache.http.util.EntityUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; - -/** - * FloatServer - * @author WWW - */ -@RestController -@RequestMapping("/floatserver") -public class FloatServerController extends BaseController { - private static LicHelper licHelper; - - private final static boolean IS_REDIRECT = false; - - @PostMapping({"/checkout/license"}) - public void license(HttpServletRequest req, HttpServletResponse res) { - try { - if (IS_REDIRECT) { - HttpHelper httpHelper = new HttpHelper(); - httpHelper.service(req, res, "http://192.168.20.43:38080/floatserver/checkout/license", null); - return; - } - - HttpEntity entity = new InputStreamEntity(req.getInputStream(), getContentLength(req)); - String str = EntityUtils.toString(entity, "UTF-8"); - - LicHelper helper = getHelper(); - String reqJson = helper.b(str); - - ReqParamFloatServer rfs = JSON.parseObject(reqJson, ReqParamFloatServer.class); - FloatServerResponse fsr = new FloatServerResponse(rfs); - - String resJson = JSON.toJSONString(fsr); - String strRes = helper.a(resJson); - - res.getWriter().write(strRes); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - private Integer getContentLength(HttpServletRequest request) { - String contentLengthHeader = request.getHeader("Content-Length"); - if (contentLengthHeader != null) { - return Integer.parseInt(contentLengthHeader); - } - - return -1; - } - - private static LicHelper getHelper() { - if (licHelper == null) { - licHelper = new LicHelper(); - licHelper.d("&kdaow$IEW.##%5-"); - licHelper.c("*y91z72a;pclfleoqc20161v$DSP&%3+"); - } - - return licHelper; - } - - @SuppressWarnings("AlibabaUndefineMagicConstant") - private static String getClientIpAddr(HttpServletRequest req) { - String ip; - if ((ip = req.getHeader("x-forwarded-for")) == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = req.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = req.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = req.getRemoteAddr(); - } - - return ip; - } - - public static void test() { - try { - ReqParamFloatServer reqParam = new ReqParamFloatServer("192.168.20.106", "12316"); - String json = JSON.toJSONString(reqParam); - - String licCode = "78a82f0920de0f557f8177bec1e48601c4dc25e4054a00728e4314b56528d3a1632de5298edee38a65412277977a174fea5d91c452b19ef138dbc2ba089ba632"; - - LicHelper helper = getHelper(); - String str = helper.a(json); - System.out.println("ReqParamFloatServer: " + str); - - String data = "8dfb75298185cbcc4b2d485fdb4f25627f7aeb4dd41329076b5015586e4d56cfe2c56f12cd9852c447904210117b41fe2672b24d7e82fd581ad5a0983b501b5bcbe97d65dbbe770dbdc4a98e80d2966a71ecd0041a5282283bff853d70caf7aed671bc9c9d4bedf6d1d0294394861af40f195d68a965d957d53c78aa50ada3afc65d1a526c54648e6e081e8f7f7ab1c31b9f75916170e638b0b9216d30204864afe3a7a1bc8a6563bf44daf6a29e27c19f798c4f82dbb904ea4aa4fcc87a82226d9bf3e891ecb97b94263064fec025e3aa7c440d7c0e8ed559b84ae2438ec0fc438444a03c992883170ecdde20e08552efcf9d584de469930b27c81f946548d5c6e63e815671182b03b5e6e622ddb10a3f6a35ad3f44ec247a3b2dee0e936020d48efb7abc2d2abfb555f61d54c85eca"; - String rs = helper.b(data); - System.out.println("Lic: " + rs); - } catch (Exception ex) { - System.out.println(Arrays.toString(ex.getStackTrace())); - } - } - - @GetMapping({"/licenseEncryption/getLicenseSecret"}) - @PostMapping({"/licenseEncryption/getLicenseSecret"}) - public void getLicenseSecret(HttpServletResponse res) { - // http://127.0.0.1:12316/server/floatserver/licenseEncryption/getLicenseSecret - String json = JSON.toJSONString(new SdkSecretEntity()); - WebHelper.writeStr2Page(res, json); - } - - @GetMapping({"/licenseEncryption/getLicenseDecrypt"}) - @PostMapping({"/licenseEncryption/getLicenseDecrypt"}) - public void getLicenseDecrypt(HttpServletResponse res) { - // http://127.0.0.1:12316/server/floatserver/licenseEncryption/getLicenseDecrypt - String json = JSON.toJSONString(new SdkDecryptEntity()); - WebHelper.writeStr2Page(res, json); - } -} diff --git a/src/main/java/com/lf/server/controller/all/FmeItController.java b/src/main/java/com/lf/server/controller/all/FmeItController.java deleted file mode 100644 index e661233..0000000 --- a/src/main/java/com/lf/server/controller/all/FmeItController.java +++ /dev/null @@ -1,290 +0,0 @@ -package com.lf.server.controller.all; - -import com.lf.server.annotation.SysLog; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.data.DirEntity; -import com.lf.server.entity.sys.RoleEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.data.DirService; -import com.lf.server.service.sys.RoleService; -import com.lf.server.service.sys.TokenService; -import com.lf.server.service.sys.UserService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * FME鎺ュ彛鎺у埗鍣� - * @author WWW - */ -@Api(tags = "绯荤粺瀵规帴\\FME") -@RestController -@RequestMapping("/fmeIt") -public class FmeItController extends BaseController { - @Autowired - UserService userService; - - @Autowired - RoleService roleService; - - @Autowired - TokenService tokenService; - - @Autowired - DirService dirService; - - @SysLog() - @ApiOperation(value = "鏌ヨ鏄�/鍚︿负绠$悊鍛�") - @GetMapping(value = "/selectForIsAdmin") - public ResponseMsg<Boolean> selectForIsAdmin(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", false); - } - - Integer rows = userService.selectForIsAdmin(ue.getId()); - - return success("鎴愬姛", rows > 0); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectUser") - public ResponseMsg<UserEntity> selectUser(int id) { - try { - UserEntity userEntity = userService.selectUser(id); - - return success(userEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鐢ㄦ埛ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uid", value = "鐢ㄦ埛ID", dataType = "String", paramType = "query", example = "admin") - }) - @GetMapping(value = "/selectByUid") - public ResponseMsg<UserEntity> selectByUid(String uid) { - try { - if (StringHelper.isEmpty(uid)) { - fail("鐢ㄦ埛ID涓嶈兘涓虹┖", null); - } - - UserEntity userEntity = userService.selectByUid(uid); - - return success(userEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ鐢ㄦ埛骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "瀹�"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageForUser") - public ResponseMsg<List<UserEntity>> selectByPageForUser(String uname, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - int count = userService.selectCount(uname, null); - if (count == 0) { - return success(0, null); - } - List<UserEntity> rs = userService.selectByPage(uname, null, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏄�/鍚︿负绠$悊鍛�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐢ㄦ埛ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectIsAdmin") - public ResponseMsg<Boolean> selectIsAdmin(Integer id) { - try { - UserEntity ue = userService.selectUser(id); - if (ue == null) { - return fail("鐢ㄦ埛涓嶅瓨鍦�", false); - } - - Integer rows = userService.selectForIsAdmin(ue.getId()); - - return success("鎴愬姛", rows > 0); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ绠$悊鍛樼敤鎴�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "绠$悊鍛樼被鍒�", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectAdminUsers") - public ResponseMsg<Object> selectAdminUsers(Integer type) { - try { - if (null == type || type < 1) { - return fail("绠$悊鍛樼被鍒笉鑳戒负绌烘垨灏忎簬1", false); - } - - List<UserEntity> rs = userService.selectAdminUsers(type); - - return success(rs); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐢ㄦ埛ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectRoleByUserId") - public ResponseMsg<Object> selectRoleByUserId(Integer id) { - try { - if (null == id || id < 1) { - return fail("鐢ㄦ埛ID涓嶈兘涓虹┖鎴栧皬浜�1", false); - } - - List<RoleEntity> rs = userService.selectRoleByUserId(id); - - return success(rs); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁瑙掕壊鏌ヨ鐢ㄦ埛") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectUserByRoleId") - public ResponseMsg<Object> selectUserByRoleId(Integer id) { - try { - if (null == id || id < 1) { - return fail("鐢ㄦ埛ID涓嶈兘涓虹┖鎴栧皬浜�1", false); - } - - List<UserEntity> rs = userService.selectUserByRoleId(id); - - return success(rs); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectRole") - public ResponseMsg<RoleEntity> selectRole(int id) { - try { - RoleEntity roleEntity = roleService.selectRole(id); - - return success(roleEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ瑙掕壊骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "Admin"), - @ApiImplicitParam(name = "depid", value = "鍗曚綅ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageForRole") - public ResponseMsg<List<RoleEntity>> selectByPageForRole(String name, Integer depid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = roleService.selectCount(name, depid); - if (count == 0) { - return success(0, null); - } - - List<RoleEntity> rs = roleService.selectByPage(name, depid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏍圭洰褰�") - @GetMapping(value = "/selectDirRoot") - public ResponseMsg<List<DirEntity>> selectDirRoot() { - try { - List<DirEntity> list = dirService.selectDirRoot(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ椤圭洰") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "瑗�") - }) - @GetMapping(value = "/selectProject") - public ResponseMsg<List<DirEntity>> selectProject(String name) { - try { - List<DirEntity> list = dirService.selectProject(name); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ椤圭洰鐩綍鏍�") - @GetMapping(value = "/selectDirsForPrj") - public ResponseMsg<List<DirEntity>> selectDirsForPrj() { - try { - List<DirEntity> list = dirService.selectDirsForPrj(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/all/PermsController.java b/src/main/java/com/lf/server/controller/all/PermsController.java deleted file mode 100644 index ba2a378..0000000 --- a/src/main/java/com/lf/server/controller/all/PermsController.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.lf.server.controller.all; - -import com.lf.server.annotation.SysLog; -import com.lf.server.entity.all.*; -import com.lf.server.entity.data.LayerEntity; -import com.lf.server.entity.sys.MenuEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.PermsService; -import com.lf.server.service.data.LayerService; -import com.lf.server.service.sys.MenuService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鎺堟潈鎺у埗鍣� - * @author WWW - */ -@Api(tags = "杩愮淮绠$悊\\鎺堟潈绠$悊") -@RestController -@RequestMapping("/perms") -public class PermsController extends BaseController { - @Autowired - PermsService permsService; - - @Autowired - TokenService tokenService; - - @Autowired - MenuService menuService; - - @Autowired - LayerService layerService; - - @SysLog() - @ApiOperation(value = "鏌ヨ褰撳墠鐢ㄦ埛鐨勮祫婧愭巿鏉�") - @GetMapping(value = "/selectRes") - public ResponseMsg<List<ResAuthEntity>> selectRes(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); - List<ResAuthEntity> rs = permsService.selectRes(uid); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ褰撳墠鐢ㄦ埛鐨勮彍鍗曟巿鏉�") - @GetMapping(value = "/selectMenus") - public ResponseMsg<List<MenusAuthEntity>> selectMenus(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); - List<MenusAuthEntity> rs = permsService.selectMenus(uid); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ褰撳墠鐢ㄦ埛鐨勬潈闄愭巿鏉�") - @GetMapping(value = "/selectPerms") - public ResponseMsg<List<String>> selectPerms(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); - List<String> rs = permsService.selectPerms(uid); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ褰撳墠鐢ㄦ埛鐨勬潈闄愭巿鏉冨疄浣撻泦鍚�") - @GetMapping(value = "/selectPermsEntity") - public ResponseMsg<List<PermsAuthEntity>> selectPermsEntity(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); - List<PermsAuthEntity> rs = permsService.selectPermsEntity(uid); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "娓呯┖鎵�鏈夋巿鏉冪紦瀛�") - @GetMapping(value = "/deleteAllCache") - public ResponseMsg<Boolean> deleteAllCache() { - try { - permsService.clearAllCache(); - - return success(true); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鐢ㄦ埛瑙掕壊") - @GetMapping("/selectRoles") - public ResponseMsg<Object> selectRoles(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - List<Integer> list = permsService.selectRoles(ue.getUid()); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "閫掑綊鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = "14") - }) - @GetMapping(value = "/selectMenuRecursive") - public ResponseMsg<Object> selectMenuRecursive(int id, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); - List<MenuEntity> list = permsService.selectMenuRecursive(id, uid); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈夊浘灞�") - @GetMapping(value = "/selectLayers") - public ResponseMsg<Object> selectLayers(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - List<LayerEntity> list = layerService.selectAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/all/SignController.java b/src/main/java/com/lf/server/controller/all/SignController.java deleted file mode 100644 index a5abd72..0000000 --- a/src/main/java/com/lf/server/controller/all/SignController.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.lf.server.controller.all; - -import com.lf.server.annotation.SysLog; -import com.lf.server.config.PropertiesConfig; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.SettingData; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.sys.LoginEntity; -import com.lf.server.entity.sys.OperateEntity; -import com.lf.server.entity.sys.TokenEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.service.all.ScheduleService; -import com.lf.server.service.sys.LoginService; -import com.lf.server.service.sys.OperateService; -import com.lf.server.service.sys.TokenService; -import com.lf.server.service.sys.UserService; -import com.lf.server.service.all.SignService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * 绛惧悕鎺у埗鍣� - * @author WWW - * @date 2022-09-21 - */ -@Api(tags = "杩愮淮绠$悊\\绛惧悕绠$悊") -@RestController -@RequestMapping("/sign") -public class SignController extends BaseController { - @Autowired - UserService userService; - - @Autowired - LoginService loginService; - - @Autowired - TokenService tokenService; - - @Autowired - SignService signService; - - @Autowired - private OperateService operateService; - - @Autowired - PropertiesConfig propertiesConfig; - - @Autowired - private ScheduleService scheduleService; - - @SysLog() - @ApiOperation(value = "璺宠浆棣栭〉") - @GetMapping({"/", "/toIndex"}) - public ModelAndView toIndex(ModelAndView mv, HttpServletRequest req) { - mv.setViewName("index"); - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - mv.addObject("msg", "Hello " + ue.getUname() + " !"); - } - - return mv; - } - - @SysLog() - @ApiOperation(value = "璺宠浆鐧诲綍椤�") - @GetMapping("/toLogin") - public ModelAndView toLogin(ModelAndView mv) { - mv.setViewName("login"); - - return mv; - } - - @SysLog() - @ApiOperation(value = "鏁版嵁搴撶洃鎺�") - @GetMapping(value = "/toDruid") - public ModelAndView toDruid(HttpServletRequest req, HttpServletResponse res) { - ModelAndView mv = new ModelAndView(); - mv.setViewName("druid"); - - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - String sessionId = WebHelper.getCookieByKey(StaticData.DRUID_COOKIE_KEY, req); - if (StringHelper.isNull(sessionId)) { - signService.loginDruid(req, res); - } - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - - return mv; - } - - @SysLog() - @ApiOperation(value = "璧勬簮鐩戞帶") - @GetMapping(value = "/toMonitor") - public ModelAndView toMonitor(ModelAndView mv, HttpServletRequest req, HttpServletResponse res) { - try { - mv.setViewName("redirect:/toLogin"); - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - mv.setViewName("monitor"); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - - return mv; - } - - @SysLog() - @ApiOperation(value = "鐧诲綍") - @ApiImplicitParams({ - @ApiImplicitParam(name = "user", value = "鐢ㄦ埗鍚�", dataType = "UsersEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/login", produces = "application/json; charset=UTF-8") - public ResponseMsg<TokenEntity> login(@RequestBody UserEntity user, HttpServletRequest req, HttpServletResponse res) { - try { - String str = userService.validateLoginPwd(user); - if (str != null) { - return fail(str, null); - } - - UserEntity ue = userService.selectByUid(user.getUid()); - if (ue == null) { - return fail("鐢ㄦ埛鍚嶄笉瀛樺湪", null); - } - - if (!Md5Helper.validatePassword(user.getPwd(), ue.getPwd())) { - tokenService.setPwdErrCache(ue); - return fail("瀵嗙爜涓嶆纭�", null); - } - - LoginEntity le = loginService.getNewLogin(ue.getId(), 1, 1, 1, req); - Integer rows = loginService.insertLogin(le); - if (rows == 0) { - return fail("鍒涘缓鐧诲綍鏃ュ織澶辫触", null); - } - - TokenEntity te = tokenService.getNewToken(ue, req); - rows = tokenService.insertToken(te); - if (rows == 0) { - return fail("鍒涘缓浠ょ墝澶辫触", null); - } - - te.setAutoLogOut(SettingData.AUTO_LOGOUT); - tokenService.saveToken(ue, te, req, res); - - int onlineUser = scheduleService.countOnlineUsers(); - String msg = onlineUser >= SettingData.MAX_USER_LOGIN ? "璀﹀憡锛氱郴缁熷凡缁忓埌杈剧敤鎴疯闂噺鐨勪笂闄愶紒" : ""; - - return success(msg, te); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鐧诲嚭") - @GetMapping(value = "/logout") - public ResponseMsg<Boolean> logout(HttpServletRequest req, HttpServletResponse res) { - try { - String token = WebHelper.getToken(req); - if (StringHelper.isEmpty(token)) { - return fail("娌℃湁妫�娴嬪埌浠ょ墝", false); - } - - Boolean flag = tokenService.logout(token, req, res); - - return success(flag ? "鐧诲嚭鎴愬姛" : "鐧诲嚭澶辫触", flag); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "妫�鏌ユ槸/鍚︾櫥褰�") - @GetMapping("/check") - public ResponseMsg<Boolean> check(HttpServletRequest req, HttpServletResponse res) { - try { - Boolean flag = tokenService.isLogin(req, res); - if (flag) { - // 鍐欐棩蹇� - UserEntity ue = tokenService.getCurrentUser(req); - LoginEntity le = loginService.getNewLogin(ue.getId(), 1, 2, 1, req); - Integer rows = loginService.insertLogin(le); - } - - return success(flag ? "鐢ㄦ埛宸茬櫥褰�" : "鐢ㄦ埛鏈櫥褰�", flag); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鑾峰彇褰撳墠鐢ㄦ埛") - @GetMapping("/getCurrentUser") - public ResponseMsg<UserEntity> getCurrentUser(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("娌℃湁鎵惧埌", null); - } - - return success(ue); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鑾峰彇RSA鍔犲瘑鍏挜") - @GetMapping("/getPublicKey") - public ResponseMsg<String> getPublicKey() { - try { - String key = RsaHelper.getPublicKey(); - - return success(key); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @ApiOperation(value = "鎻掑叆鎿嶄綔鏃ュ織") - @GetMapping("/insertOpLog") - public ResponseMsg<Object> insertOpLog(String m1, String m2, HttpServletRequest req) { - try { - if (StringHelper.isEmpty(m1)) { - return fail("涓�绾фā鍧楀繀濉�", 0); - } - - OperateEntity oe = new OperateEntity(); - oe.setIp(WebHelper.getIpAddress(req)); - oe.setModular1(m1); - oe.setModular2(m2); - oe.setType(0); - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - oe.setUserid(ue.getId()); - } - - int rows = operateService.insertOperate(oe); - - return success(rows); - } catch (Exception ex) { - return fail(ex, 0); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/DataCountController.java b/src/main/java/com/lf/server/controller/data/DataCountController.java deleted file mode 100644 index b5e416b..0000000 --- a/src/main/java/com/lf/server/controller/data/DataCountController.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.controller.all.BaseQueryController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.ctrl.CountEntity; -import com.lf.server.entity.sys.ReportEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.all.UploadAttachService; -import com.lf.server.service.sys.ReportService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 鏁版嵁缁熻 - * @author WWW - */ -@Api(tags = "鏁版嵁绠$悊\\鏁版嵁缁熻") -@RestController -@RequestMapping("/dataCount") -public class DataCountController extends BaseController { - @Autowired - ReportService reportService; - - @Autowired - TokenService tokenService; - - @Autowired - UploadAttachService uploadAttachService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "code", value = "缂栫爜", dataType = "String", paramType = "query", example = "countOperates"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<ReportEntity>> selectByPageAndCount(String name, String code, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = reportService.selectCount(name, code); - if (count == 0) { - return success(0, null); - } - - List<ReportEntity> rs = reportService.selectByPage(name, code, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏁版嵁閲忕粺璁�") - @GetMapping(value = "/selectCountSizes") - public ResponseMsg<Object> selectCountSizes() { - try { - List<CountEntity> list = reportService.countSizes(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏈嶅姟璋冪敤閲忕粺璁�") - @GetMapping(value = "/selectCountServices") - public ResponseMsg<Object> selectCountServices() { - try { - List<CountEntity> list = reportService.countServices(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鐢ㄦ埛娴侀噺缁熻") - @GetMapping(value = "/selectCountOperates") - public ResponseMsg<Object> selectCountOperates() { - try { - List<CountEntity> list = reportService.countOperates(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鎶ュ憡") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鎶ュ憡ID", dataType = "Integer", paramType = "7") - }) - @GetMapping(value = "/downloadReport") - public void downloadReport(Integer id, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == id || id < 1) { - return; - } - - ReportEntity re = reportService.selectById(id); - if (null == re || StringHelper.isEmpty(re.getGuid()) || StringHelper.isEmpty(re.getType()) || StringHelper.isEmpty(re.getCode())) { - return; - } - - UserEntity ue = tokenService.getCurrentUser(req); - - reportService.createReport(ue, re, res); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/DataQueryController.java b/src/main/java/com/lf/server/controller/data/DataQueryController.java deleted file mode 100644 index ede92a2..0000000 --- a/src/main/java/com/lf/server/controller/data/DataQueryController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseQueryController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.data.DataQueryService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletRequest; - -/** - * 鏁版嵁妫�绱� - * @author WWW - */ -@Api(tags = "鏁版嵁绠$悊\\鏁版嵁鏌ヨ") -@RestController -@RequestMapping("/dataQuery") -public class DataQueryController extends BaseQueryController { - @Autowired - TokenService tokenService; - - @Autowired - DataQueryService dataQueryService; - - @SysLog() - @ApiOperation(value = "涓婁紶鏂囦欢") - @ResponseBody - @ApiImplicitParams({ - @ApiImplicitParam(name = "tabName", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "lf.sys_style"), - @ApiImplicitParam(name = "eventid", value = "涓婚敭", dataType = "String", paramType = "query", example = "fa25979a5ef8b43ba82a0be35b3fb0d4") - }) - @PostMapping(value = "/uploadFiles") - public ResponseMsg<Integer> uploadFiles(String tabName, String eventid, @RequestParam("file") MultipartFile[] files, HttpServletRequest req) { - try { - if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) { - return fail("鍙傛暟涓嶈兘涓虹┖", null); - } - if (null == files || files.length == 0) { - return fail("鏂囦欢涓婁紶涓虹┖", 0); - } - - UserEntity ue = tokenService.getCurrentUser(req); - Integer count = dataQueryService.uploadFiles(ue, tabName, eventid, files, req); - - return success(count); - } catch (Exception ex) { - return fail(ex, 0); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/DictController.java b/src/main/java/com/lf/server/controller/data/DictController.java deleted file mode 100644 index 6265339..0000000 --- a/src/main/java/com/lf/server/controller/data/DictController.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.ctrl.TabEntity; -import com.lf.server.entity.data.DictEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.data.DictService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 瀛楀吀绠$悊 - * @author WWW - */ -@Api(tags = "鏁版嵁绠$悊\\瀛楀吀绠$悊") -@RestController -@RequestMapping("/dict") -public class DictController extends BaseController { - @Autowired - DictService dictService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "琛ㄧ┖闂�", dataType = "String", paramType = "query", required = false, example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_hyda") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String ns, String tab) { - try { - int count = dictService.selectCount(ns, tab); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "琛ㄧ┖闂�", dataType = "String", paramType = "query", example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_hyda"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<DictEntity>> selectByPage(String ns, String tab, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<DictEntity> rs = dictService.selectByPage(ns, tab, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "琛ㄧ┖闂�", dataType = "String", paramType = "query", example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_hyda"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<DictEntity>> selectByPageAndCount(String ns, String tab, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = dictService.selectCount(ns, tab); - if (count == 0) { - return success(0, null); - } - - List<DictEntity> rs = dictService.selectByPage(ns, tab, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<DictEntity> selectById(int id) { - try { - DictEntity entity = dictService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ瀛楀吀琛ㄧ粨鏋�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鐐�"), - @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false") - }) - @GetMapping(value = "/selectDictTab") - public ResponseMsg<List<TabEntity>> selectDictTab(String name, Boolean hasGeom) { - try { - List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom"); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DictEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody DictEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = dictService.insert(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DictEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<DictEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (DictEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = dictService.inserts(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = dictService.delete(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = dictService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DictEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody DictEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = dictService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DictEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<DictEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (DictEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = dictService.updates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/DirController.java b/src/main/java/com/lf/server/controller/data/DirController.java deleted file mode 100644 index 45f0410..0000000 --- a/src/main/java/com/lf/server/controller/data/DirController.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.data.DirEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.data.DirService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 鐩綍绠$悊 - * @author sws - * @date 2022-09-22 - */ -@Api(tags = "鏁版嵁绠$悊\\鐩綍绠$悊") -@RestController -@RequestMapping("/dir") -public class DirController extends BaseController { - @Autowired - DirService dirService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.data.DirEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertDir", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertDir(@RequestBody DirEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - dirService.insert(entity); - - return success(entity.getId()); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "com.lf.server.entity.data.DirEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertDirs", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertDirs(@RequestBody List<DirEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - for (DirEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - - int count = dirService.inserts(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteDir") - public ResponseMsg<Integer> deleteDir(int id) { - try { - int count = dirService.deleteDir(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "com.lf.server.entity.data.DirEntity", paramType = "body", example = "") - }) - @GetMapping(value = "/deleteDirs") - public ResponseMsg<Integer> deleteDirs(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = dirService.deleteDirs(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DictEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateDir", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateDir(@RequestBody DirEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = dirService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DirEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateDirs", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateDirs(@RequestBody List<DirEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (DirEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = dirService.updates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ鏁版嵁") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectDir") - public ResponseMsg<DirEntity> selectDir(int id) { - try { - DirEntity dirEntity = dirService.selectDir(id); - - return success(dirEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") - @GetMapping(value = "/selectDirAll") - public ResponseMsg<List<DirEntity>> selectDirAll() { - try { - List<DirEntity> list = dirService.selectDirAll(); - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鐩綍缁撴瀯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐩綍ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/downloadDir") - public void downloadDir(int id, HttpServletResponse res) { - try { - DirEntity entity = dirService.selectDir(id); - if (null == entity || entity.getPid() > 0) { - return; - } - - String zipFile = dirService.createDirs(id); - if (null == zipFile) { - return; - } - - WebHelper.download(zipFile, entity.getName() + ".zip", res); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/DomainController.java b/src/main/java/com/lf/server/controller/data/DomainController.java deleted file mode 100644 index 78b337e..0000000 --- a/src/main/java/com/lf/server/controller/data/DomainController.java +++ /dev/null @@ -1,307 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.ctrl.TabEntity; -import com.lf.server.entity.data.DomainEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.all.BaseQueryService; -import com.lf.server.service.data.DictService; -import com.lf.server.service.data.DomainService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鍊煎煙 - * @author WWW - */ -@Api(tags = "鏁版嵁绠$悊\\鍊煎煙") -@RestController -@RequestMapping("/domain") -public class DomainController extends BaseController { - @Autowired - DomainService domainService; - - @Autowired - TokenService tokenService; - - @Autowired - BaseQueryService baseQueryService; - - @Autowired - DictService dictService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_aanp"), - @ApiImplicitParam(name = "code", value = "缂栫爜", dataType = "String", paramType = "query", example = "210") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String ns, String tab, String code) { - try { - int count = domainService.selectCount(ns, tab, code); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_aanp"), - @ApiImplicitParam(name = "code", value = "缂栫爜", dataType = "String", paramType = "query", example = "210"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<DomainEntity>> selectByPage(String ns, String tab, String code, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<DomainEntity> rs = domainService.selectByPage(ns, tab, code, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "b_hy20w_s23"), - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "绛夌骇"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<DomainEntity>> selectByPageAndCount(String ns, String tab, String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = domainService.selectCount(ns, tab, name); - if (count == 0) { - return success(0, null); - } - - List<DomainEntity> rs = domainService.selectByPage(ns, tab, name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectAll") - public ResponseMsg<List<DomainEntity>> selectAll() { - try { - List<DomainEntity> list = domainService.selectAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍊煎煙琛ㄩ泦鍚�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "b_"), - @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false") - }) - @GetMapping(value = "/selectDomainTabs") - public ResponseMsg<List<TabEntity>> selectDomainTabs(String name, Boolean hasGeom) { - try { - List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom"); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁琛ㄥ悕鏌ヨ鍊煎煙鍚嶇О") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "b_hy20w_s23") - }) - @GetMapping(value = "/selectDomainNames") - public ResponseMsg<List<String>> selectDomainNames(String ns, String tab) { - try { - if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(tab)) { - return fail("鍚嶇О绌洪棿鍜岃〃鍚嶄笉鑳戒负绌�", null); - } - - List<String> list = domainService.selectDomainNames(ns, tab); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<DomainEntity> selectById(int id) { - try { - DomainEntity entity = domainService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DomainEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody DomainEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = domainService.insert(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DomainEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<DomainEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (DomainEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = domainService.inserts(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = domainService.delete(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = domainService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DomainEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody DomainEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = domainService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DomainEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<DomainEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (DomainEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = domainService.updates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/LayerController.java b/src/main/java/com/lf/server/controller/data/LayerController.java deleted file mode 100644 index 91e96d0..0000000 --- a/src/main/java/com/lf/server/controller/data/LayerController.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.data.LayerEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.data.LayerService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鍥惧眰绠$悊 - * @author WWW - */ -@Api(tags = "鏁版嵁绠$悊\\鍥惧眰绠$悊") -@RestController -@RequestMapping("/layer") -public class LayerController extends BaseController { - @Autowired - LayerService layerService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "cnName", value = "涓枃鍚嶇О", dataType = "String", paramType = "query", required = false, example = "") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String cnName) { - try { - int count = layerService.selectCount(cnName); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "cnName", value = "涓枃鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<LayerEntity>> selectByPage(String cnName, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<LayerEntity> rs = layerService.selectByPage(cnName, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "cnName", value = "涓枃鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<LayerEntity>> selectByPageAndCount(String cnName, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = layerService.selectCount(cnName); - if (count == 0) { - return success(0, null); - } - - List<LayerEntity> rs = layerService.selectByPage(cnName, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectAll") - public ResponseMsg<List<LayerEntity>> selectAll() { - try { - List<LayerEntity> list = layerService.selectAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<LayerEntity> selectById(int id) { - try { - LayerEntity entity = layerService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "LayerEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody LayerEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = layerService.insert(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "LayerEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<LayerEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (LayerEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = layerService.inserts(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = layerService.delete(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = layerService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "LayerEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody LayerEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = layerService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "LayerEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<LayerEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (LayerEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = layerService.updates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/MetaController.java b/src/main/java/com/lf/server/controller/data/MetaController.java deleted file mode 100644 index c565155..0000000 --- a/src/main/java/com/lf/server/controller/data/MetaController.java +++ /dev/null @@ -1,536 +0,0 @@ -package com.lf.server.controller.data; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.metadata.OrderItem; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.DownloadReqEntity; -import com.lf.server.entity.ctrl.IdNameEntity; -import com.lf.server.entity.data.DictEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.data.VerEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.service.all.BaseQueryService; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.data.MetaService; -import com.lf.server.service.data.VerService; -import com.lf.server.service.sys.DepService; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.net.URLDecoder; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; - -/** - * 鍏冩暟鎹� - * @author WWW - */ -@Api(tags = "鏁版嵁绠$悊\\淇℃伅绠$悊") -@RestController -@RequestMapping("/meta") -public class MetaController extends BaseController { - @Autowired - MetaService metaService; - - @Autowired - TokenService tokenService; - - @Autowired - BaseQueryService baseQueryService; - - @Autowired - DownlogService downlogService; - - @Autowired - DownloadService downloadService; - - @Autowired - VerService verService; - - @Autowired - DepService depService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), - @ApiImplicitParam(name = "dircode", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00"), - @ApiImplicitParam(name = "verid", value = "鐗堟湰ID", dataType = "Integer", paramType = "query", example = "0"), - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<MetaEntity>> selectByPageAndCount(String depcode, String dircode, Integer verid, String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = metaService.selectCount(depcode, dircode, verid, name); - if (count == 0) { - return success(0, null); - } - - List<MetaEntity> rs = metaService.selectByPage(depcode, dircode, verid, name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鐖禝D鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "metaid", value = "鐖禝D", dataType = "String", paramType = "query", example = "0"), - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectPageAndCountByPid") - public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - if (null == metaid || metaid < 1) { - return fail("鐖禝D涓嶈兘涓虹┖涓斿ぇ浜�1", null); - } - - int count = metaService.selectCountByPid(metaid, name); - if (count == 0) { - return success(0, null); - } - - List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鐩綍ID鏌ヨ鐗堟湰鍒楄〃") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query") - }) - @GetMapping(value = "/selectVerByDirid") - public ResponseMsg<List<VerEntity>> selectVerByDirid(Integer dirid) { - try { - if (null == dirid || dirid < 0) { - dirid = 0; - } - - List<VerEntity> list = verService.selectByDirid(dirid); - if (null == list || list.isEmpty()) { - list = verService.selectByDirid(0); - } - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<MetaEntity> selectById(int id) { - try { - MetaEntity entity = metaService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ琛ㄤ腑鏁版嵁") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鍏冩暟鎹甀D", dataType = "Integer", paramType = "query", example = "115"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10") - }) - @GetMapping(value = "/selectDbData") - public ResponseMsg<Object> selectDbData(Integer id, Integer pageIndex, Integer pageSize) { - // noinspection AlibabaRemoveCommentedCode - try { - if (null == id || id < 0) { - return fail("鍏冩暟鎹甀D涓嶈兘涓虹┖鎴栧皬浜�0", null); - } - - MetaEntity meta = metaService.selectById(id); - if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { - return fail("鎵句笉鍒板厓鏁版嵁淇℃伅", null); - } - - String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); - BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); - if (null == baseMapper) { - return null; - } - - QueryWrapper wrapper = new QueryWrapper(); - wrapper.eq("parentid", meta.getEventid()); - - Page<Object> page = new Page<>(pageIndex, pageSize); - page.addOrder(OrderItem.desc("gid")); - IPage<Object> paged = baseMapper.selectPage(page, wrapper); - - return success(paged.getTotal(), paged.getRecords()); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ瀛楁淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg25wAanp") - }) - @GetMapping(value = "/selectTabFields") - public ResponseMsg<List<DictEntity>> selectTabFields(String ns, String tab) { - try { - if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(tab)) { - return fail("鍚嶇О绌洪棿鍜岃〃鍚嶄笉鑳戒负绌�", null); - } - - List<DictEntity> list = baseQueryService.selectFields(ns, tab); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MetaEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody MetaEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - entity.setCreateTime(WebHelper.getCurrentTimestamp()); - int count = metaService.insert(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MetaEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<MetaEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (MetaEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = metaService.inserts(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = metaService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MetaEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody MetaEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = metaService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MetaEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<MetaEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (MetaEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = metaService.updates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectPageCountForDownload") - public ResponseMsg<List<DownloadEntity>> selectPageCountForDownload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - int count = downloadService.selectCountForUser(ue.getId(), "3,4", name); - if (count == 0) { - return success(0, null); - } - List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), "3,4", name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍏冩暟鎹腑婧㈠嚭鐨勫崟浣岻D") - @ApiImplicitParams({ - @ApiImplicitParam(name = "reqEntity", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/selectMetaOverflowDep") - public ResponseMsg<Object> selectMetaOverflowDep(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == dr || null == dr.getIds() || dr.getIds().isEmpty()) { - return fail("璇烽�夋嫨瑕佷笅杞界殑鏂囦欢ID"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (StaticData.ADMIN.equals(ue.getUid())) { - return success(new ArrayList<String>()); - } - - List<String> list = metaService.selectMetaOverflowDep(ue, dr); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鍗曚綅缂栫爜鏁扮粍鏌ヨ鍗曚綅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "codes", value = "鍗曚綅缂栫爜鏁扮粍", dataType = "String", paramType = "query", allowMultiple = true, example = "00,0001") - }) - @GetMapping(value = "/selectDepsByCodes") - public ResponseMsg<Object> selectDepsByCodes(String[] codes) { - try { - if (null == codes || codes.length == 0) { - return fail("鍗曚綅ID闆嗗悎涓虹┖"); - } - - List<IdNameEntity> list = depService.selectDepsByCodes(codes); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "璇锋眰鍏冩暟鎹笅杞�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dr", value = "璇锋眰涓嬭浇瀹炰綋绫�", dataType = "DownloadReqEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/downloadReq") - public ResponseMsg<Object> downloadReq(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == dr || StringHelper.isEmpty(dr.getPwd())) { - return fail("瀵嗙爜涓嶈兘涓虹┖"); - } - if (null == dr.getIds() || dr.getIds().isEmpty()) { - return fail("璇烽�夋嫨瑕佷笅杞界殑鏂囦欢ID"); - } - if (!DownloadService.decryptPwd(dr)) { - return fail("瀵嗙爜瑙e瘑澶辫触", null); - } - if (StringHelper.isPwdInvalid(dr.getPwd())) { - return fail("瀵嗙爜涓嶇鍚堣姹�"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - String guid = metaService.downloadMeteReq(ue, dr); - - return success(guid); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), - @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") - }) - @GetMapping(value = "/selectDownloadFile") - public ResponseMsg<Boolean> selectDownloadFile(String guid, String pwd) { - try { - if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { - return fail("鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", null); - } - if (!pwd.endsWith(StaticData.EQ)) { - pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); - } - - String password = DownloadService.decryptPwd(pwd); - if (null == password) { - return fail("瀵嗙爜瑙e瘑澶辫触", null); - } - - DownloadEntity de = downloadService.selectByGuid(guid); - if (null == de) { - return fail("鏂囦欢涓嶅瓨鍦�", null); - } - if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { - return fail("瀵嗙爜涓嶆纭�", null); - } - - String filePath = downloadService.getDownloadFilePath(de); - File file = new File(filePath); - - return success(file.exists()); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), - @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") - }) - @ResponseBody - @GetMapping(value = "/downloadFile") - public void downloadFile(String guid, String pwd, HttpServletRequest req, HttpServletResponse res) { - try { - if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { - WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", res); - } - if (!pwd.endsWith(StaticData.EQ)) { - pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); - } - - String password = DownloadService.decryptPwd(pwd); - if (null == password) { - WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "瀵嗙爜瑙e瘑澶辫触", res); - } - - DownloadEntity de = downloadService.selectByGuid(guid); - if (null == de) { - WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); - return; - } - if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { - WebHelper.writeInfo(HttpStatus.UNAUTHORIZED, "瀵嗙爜涓嶆纭�", res); - } - - UserEntity ue = tokenService.getCurrentUser(req); - downlogService.updateInfos(ue, de, req); - - String filePath = downloadService.getDownloadFilePath(de); - WebHelper.download(filePath, de.getName(), res); - } catch (Exception ex) { - WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); - } - } - - @SysLog() - @ApiOperation(value = "鏌ョ湅鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") - }) - @GetMapping(value = "/downloadForView") - public void downloadForView(String guid, HttpServletResponse res) { - metaService.downloadForView(guid, true, res); - } -} diff --git a/src/main/java/com/lf/server/controller/data/PublishController.java b/src/main/java/com/lf/server/controller/data/PublishController.java deleted file mode 100644 index d7d48b2..0000000 --- a/src/main/java/com/lf/server/controller/data/PublishController.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.ctrl.PubEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.data.PublishEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.data.PublishService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鏁版嵁鍙戝竷 - * @author WWW - */ -@Api(tags = "鏁版嵁绠$悊\\鍙戝竷绠$悊") -@RestController -@RequestMapping("/publish") -public class PublishController extends BaseController { - @Autowired - PublishService publishService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ鍏冩暟鎹�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), - @ApiImplicitParam(name = "dircode", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "01"), - @ApiImplicitParam(name = "verid", value = "鐗堟湰ID", dataType = "Integer", paramType = "query", example = "0"), - @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "String", paramType = "query", example = "DOM"), - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectMetasByPage") - public ResponseMsg<Object> selectMetasByPage(String depcode, String dircode, Integer verid, String type, String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - if (StringHelper.isEmpty(type)) { - return fail("鏁版嵁绫诲埆涓虹┖", null); - } - - String types = getType(type); - int count = publishService.selectMetasByCount(depcode, dircode, verid, types, name); - if (count == 0) { - return success(0, null); - } - - List<MetaEntity> rs = publishService.selectMetasByPage(depcode, dircode, verid, types, name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex.getMessage(), null); - } - } - - /** - * 鑾峰彇绫诲瀷 - */ - private String getType(String type) throws Exception { - switch (type) { - case "DOM": - return "type in ('tif', 'tiff', 'img')"; - case "DEM": - return "type in ('tif', 'tiff')"; - case "MPT": - return "type = 'mpt'"; - case "3DML": - return "type = '3dml'"; - case "BIM": - return "type in ('ifc', 'fbx', 'rvt')"; - default: - throw new Exception("鏁版嵁绫诲瀷涓嶅尮閰�"); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = publishService.selectCount(name); - if (count == 0) { - return success(0, null); - } - - List<PublishEntity> rs = publishService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex.getMessage(), null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<PublishEntity> selectById(int id) { - try { - PublishEntity entity = publishService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex.getMessage(), null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆鍙戝竷鏁版嵁") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PubEntity", paramType = "body") - }) - @PostMapping(value = "/insertForPub", produces = "application/json; charset=UTF-8") - public ResponseMsg<Object> insertForPub(@RequestBody PubEntity entity, HttpServletRequest req) { - try { - if (null == entity || null == entity.getIds() || entity.getIds().isEmpty()) { - return fail("瀹炰綋绫讳负绌烘垨鎵句笉鍒板厓鏁版嵁ID", 0); - } - if (StringHelper.isEmpty(entity.getType())) { - return fail("鏁版嵁绫诲埆涓虹┖", null); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUserId(ue.getId()); - entity.setToken(WebHelper.getToken(req)); - } - - String method = getConvertMethod(entity.getType()); - long count = publishService.postForPub(entity, method, req); - - return success(count); - } catch (Exception ex) { - return fail(ex.getMessage(), -1); - } - } - - /** - * 鑾峰彇杞崲鏂规硶 - */ - private String getConvertMethod(String type) throws Exception { - switch (type) { - case "DOM": - return "/Convert/ToTiles"; - case "DEM": - return "/Convert/ToTerra"; - case "MPT": - case "3DML": - return "/Convert/ToSG"; - case "BIM": - return "/Convert/ToTileset"; - default: - throw new Exception("鏁版嵁绫诲瀷涓嶅尮閰�"); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids, HttpServletRequest req) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = publishService.deletes(ids, req); - - return success(count); - } catch (Exception ex) { - return fail(ex.getMessage(), -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PublishEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody PublishEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = publishService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex.getMessage(), -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/StyleController.java b/src/main/java/com/lf/server/controller/data/StyleController.java deleted file mode 100644 index eea9c90..0000000 --- a/src/main/java/com/lf/server/controller/data/StyleController.java +++ /dev/null @@ -1,321 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.ctrl.DownloadReqEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.data.StyleEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.all.UploadAttachService; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.data.StyleService; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 鏍峰紡绠$悊 - * @author sws - * @date 2022-09.26 - */ -@Api(tags = "鏁版嵁绠$悊\\鏍峰紡绠$悊") -@RestController -@RequestMapping("/style") -public class StyleController extends BaseController { - @Autowired - StyleService styleService; - - @Autowired - TokenService tokenService; - - @Autowired - DownloadService downloadService; - - @Autowired - DownlogService downlogService; - - @Autowired - UploadAttachService uploadAttachService; - - private final static String TAB_NAME = "lf.sys_style"; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "a") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String name) { - try { - int count = styleService.selectCount(name); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "a"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<StyleEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 0) { - return fail("鍒嗛〉鏁板皬浜�1鎴栧垎椤电储寮曞皬浜�0", null); - } - - List<StyleEntity> rs = styleService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "a"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<StyleEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 0) { - return fail("鍒嗛〉鏁板皬浜�1鎴栧垎椤电储寮曞皬浜�0", null); - } - - int count = styleService.selectCount(name); - if (count == 0) { - return success(0, null); - } - - List<StyleEntity> rs = styleService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.data.StyleEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertStyle", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertStyle(@RequestBody StyleEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = styleService.insertStyle(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "com.lf.server.entity.data.StyleEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertStyles", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertStyles(@RequestBody List<StyleEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (StyleEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = styleService.insertStyles(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteStyle") - public ResponseMsg<Integer> deleteStyle(int id) { - try { - int count = styleService.deleteStyle(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteStyles") - public ResponseMsg<Integer> deleteStyles(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = styleService.deleteStyles(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "StyleEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateStyle", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateStyle(@RequestBody StyleEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = styleService.updateStyle(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectStyle") - public ResponseMsg<StyleEntity> selectStyle(int id) { - try { - StyleEntity styleEntity = styleService.selectStyle(id); - - return success(styleEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectStyleAll") - public ResponseMsg<List<StyleEntity>> selectStyleAll() { - - try { - List<StyleEntity> list = styleService.selectStyleAll(); - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓婁紶鏂囦欢") - @ResponseBody - @PostMapping(value = "/upload") - public ResponseMsg<String> upload(@RequestParam("file") MultipartFile file, HttpServletRequest req) { - UserEntity ue = tokenService.getCurrentUser(req); - - return uploadAttachService.upload(ue, TAB_NAME, file, this); - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") - }) - @GetMapping(value = "/download") - public void download(String guid, HttpServletResponse res) { - uploadAttachService.download(guid, res); - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") - }) - @RequestMapping(value = "/downloadFile", method = RequestMethod.GET) - public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, "鐢ㄦ埛鏈櫥褰�")); - } - - DownloadEntity de = downloadService.selectByGuid(guid); - if (de == null) { - WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�")); - } - - downlogService.updateInfos(ue, de, req); - - String filePath = downloadService.getDownloadFilePath(de); - WebHelper.download(filePath, de.getName(), res); - } catch (Exception ex) { - WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, ex.getMessage())); - log.error(ex.getMessage(), ex); - } - } - - @SysLog() - @ApiOperation(value = "璇锋眰涓嬭浇") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guids", value = "闄勪欢Guid鏁扮粍", dataType = "String", paramType = "body", allowMultiple = true, example = "e5b6ae0889b88111f13a4b6e048348db,fa4f299e901a0c46e634f8fcc8185c0c") - }) - @ResponseBody - @PostMapping(value = "/downloadReqForGuids") - public ResponseMsg<Object> downloadReqForGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == dre || null == dre.getGuids() || dre.getGuids().isEmpty()) { - return fail("Guid鏁扮粍涓虹┖"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - String guid = uploadAttachService.downloadReqForGuids(ue, dre.getGuids()); - - return success(guid); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/VerController.java b/src/main/java/com/lf/server/controller/data/VerController.java deleted file mode 100644 index 89562a3..0000000 --- a/src/main/java/com/lf/server/controller/data/VerController.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.data.VerEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.data.VerService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鐗堟湰琛� - * @author SWS - * @date 2022-09.29 - */ -@Api(tags = "鏁版嵁绠$悊\\鐗堟湰绠$悊") -@RestController -@RequestMapping("/ver") -public class VerController extends BaseController { - @Autowired - VerService versionService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<VerEntity>> selectByPageAndCount(Integer dirid, String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = versionService.selectCount(dirid, name); - if (count == 0) { - return success(0, null); - } - - List<VerEntity> rs = versionService.selectByPage(dirid, name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.data.VersionEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertVersion", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertVersion(@RequestBody VerEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = versionService.insertVersion(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<VersionEntity>", paramType = "body", example = "") - }) - @PostMapping(value = "/insertVersions", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertVersions(@RequestParam List<VerEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (VerEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = versionService.insertVersions(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteVersion") - public ResponseMsg<Integer> deleteVersion(int id) { - try { - int count = versionService.deleteVersion(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteVersions") - public ResponseMsg<Integer> deleteVersions(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - int count = versionService.deleteVersions(ids); - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "VersionEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateVersion", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateVersion(@RequestBody VerEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = versionService.updateVersion(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectVersion") - public ResponseMsg<VerEntity> selectVersion(int id) { - try { - VerEntity verEntity = versionService.selectVersion(id); - - return success(verEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectVersionAll") - public ResponseMsg<List<VerEntity>> selectVersionAll() { - try { - List<VerEntity> list = versionService.selectVersionAll(); - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/WmtsController.java b/src/main/java/com/lf/server/controller/data/WmtsController.java deleted file mode 100644 index 4abbf2d..0000000 --- a/src/main/java/com/lf/server/controller/data/WmtsController.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.lf.server.controller.data; - -import com.lf.server.annotation.SysLog; -import com.lf.server.config.PropertiesConfig; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.ClassPathResource; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.server.ServerHttpRequest; -import org.springframework.http.server.ServerHttpResponse; -import org.springframework.http.server.ServletServerHttpRequest; -import org.springframework.http.server.ServletServerHttpResponse; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import java.util.Date; -import java.util.List; - -/** - * WMTS鏈嶅姟 - * @author WWW - */ -@Api(tags = "鏁版嵁绠$悊\\WMTS鏈嶅姟") -@RestController -@RequestMapping("/wmts") -public class WmtsController { - @Autowired - PropertiesConfig config; - - private final static Log log = LogFactory.getLog(WmtsController.class); - - @SysLog() - @ApiOperation(value = "鑾峰彇WMTS鍏冩暟鎹�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "token", value = "浠ょ墝", required = true, dataType = "String", defaultValue = "token", paramType = "path") - }) - @GetMapping("select/{token}/WMTSCapabilities.xml") - public void selectWmtsCapabilities(@PathVariable(name = "token") String token, HttpServletRequest req, HttpServletResponse res) { - try { - ClassPathResource resource = new ClassPathResource("wmts/web.xml"); - if (!resource.exists()) { - return; - } - - InputStream stream = resource.getInputStream(); - byte[] data = new byte[stream.available()]; - stream.read(data); - stream.close(); - - String url = req.getRequestURL().toString().replace("WMTSCapabilities.xml", "tile?"); - - String result = new String(data, StandardCharsets.UTF_8); - result = result.replace("{url}", url); - byte[] bytes = result.getBytes(StandardCharsets.UTF_8); - - res.setHeader("Content-Type", "application/xml;charset=UTF-8"); - ServletOutputStream os = res.getOutputStream(); - os.write(bytes); - os.flush(); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - @ApiOperation(value = "鑾峰彇WMTS鐡︾墖") - @ApiImplicitParams({ - @ApiImplicitParam(name = "token", value = "浠ょ墝", required = true, dataType = "String", defaultValue = "token", paramType = "path"), - @ApiImplicitParam(name = "layer", value = "鍥惧眰绫诲瀷", required = true, dataType = "String", defaultValue = "img"), - @ApiImplicitParam(name = "tilematrix", value = "灞傜骇", required = true, dataType = "Integer"), - @ApiImplicitParam(name = "tilerow", value = "琛屽彿", required = true, dataType = "Integer"), - @ApiImplicitParam(name = "tilecol", value = "鍒楀彿", required = true, dataType = "Integer") - }) - @GetMapping("select/{token}/tile") - public void selectWmtsTile(@PathVariable(name = "token") String token, HttpServletRequest req, HttpServletResponse res) { - try { - String layer = WebHelper.getReqParamVal(req, "layer"); - String matrix = WebHelper.getReqParamVal(req, "tilematrix"); - String row = WebHelper.getReqParamVal(req, "tilerow"); - String col = WebHelper.getReqParamVal(req, "tilecol"); - if (StringHelper.isEmpty(layer) || StringHelper.isEmpty(matrix) || StringHelper.isEmpty(layer) || StringHelper.isEmpty(row) || StringHelper.isEmpty(col)) { - return; - } - - int z = Integer.parseInt(matrix); - int x = Integer.parseInt(row); - int y = Integer.parseInt(col); - - getWmtsTile(layer, z, x, y, req, res); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 鑾峰彇WMTS鐡︾墖 - */ - private void getWmtsTile(String layer, int z, int x, int y, HttpServletRequest req, HttpServletResponse res) throws Exception { - ServletServerHttpRequest ssReq = new ServletServerHttpRequest(req); - ServletServerHttpResponse ssRes = new ServletServerHttpResponse(res); - - // 妫�鏌ョ紦瀛樻槸鍚﹁繃鏈� - if (checkIfNotModify(ssReq, ssRes)) { - // 璁剧疆缂撳瓨澶� - setBrowerCache(ssRes); - return; - } - - // 璁剧疆缂撳瓨鍙傛暟 - setBrowerCache(ssRes); - //res.setContentType("image/png") - - // 閫氳繃response瀵硅薄锛岃幏鍙栧埌杈撳嚭娴� - ServletOutputStream outputStream = res.getOutputStream(); - // 瀹氫箟杈撳叆娴侊紝閫氳繃杈撳叆娴佽鍙栨枃浠跺唴瀹� - FileInputStream fileInputStream; - - // y = (int) Math.pow(2, z) - y - 1; - String path = config.getTilePath() + File.separator + layer + File.separator + z + File.separator + y + File.separator + x + ".png"; - System.out.println(path); - - File file = new File(path); - if (!file.exists() || file.isDirectory()) { - ClassPathResource resource = new ClassPathResource("wmts/nofound.png"); - fileInputStream = new FileInputStream(resource.getFile()); - } else { - System.out.println(path); - fileInputStream = new FileInputStream(file); - } - - int len = 0; - byte[] bytes = new byte[1024]; - while ((len = fileInputStream.read(bytes)) != -1) { - outputStream.write(bytes, 0, len); - outputStream.flush(); - } - //outputStream.close() - fileInputStream.close(); - - // 璁剧疆杩斿洖鍥剧墖绫诲瀷 - ssRes.getHeaders().set("Content-Type", "image/png"); - - OutputStream os = ssRes.getBody(); - os.write(bytes); - os.flush(); - } - - /** - * 璁剧疆娴忚鍣ㄧ紦瀛樺弬鏁� - */ - private void setBrowerCache(ServerHttpResponse res) { - HttpHeaders headers = res.getHeaders(); - headers.setCacheControl("public, must-revalidate"); - - headers.setExpires(System.currentTimeMillis() + 24 * 60 * 60 * 1000); - headers.setAccessControlMaxAge(Duration.ofHours(24)); - headers.setETag("\"" + new Date().toString() + "\""); - // must-revalidate - // response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); - } - - /** - * 楠岃瘉缂撳瓨鍙傛暟 - */ - boolean checkIfNotModify(ServerHttpRequest req, ServerHttpResponse res) { - List<String> etags = req.getHeaders().getIfNoneMatch(); - if (0 == etags.size() || StringHelper.isEmpty(etags.get(0))) { - return false; - } - - res.setStatusCode(HttpStatus.NOT_MODIFIED); - - return true; - } -} diff --git a/src/main/java/com/lf/server/controller/data/upload/CheckController.java b/src/main/java/com/lf/server/controller/data/upload/CheckController.java deleted file mode 100644 index ae92877..0000000 --- a/src/main/java/com/lf/server/controller/data/upload/CheckController.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.lf.server.controller.data.upload; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.FmeReqEntity; -import com.lf.server.entity.ctrl.RegisterEntity; -import com.lf.server.helper.HttpHelper; -import com.lf.server.helper.PathHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.data.FmeService; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -/** - * 妫�鏌ユ帶鍒跺櫒 - * @author WWW - */ -public class CheckController extends BaseController { - @Autowired - protected PathHelper pathHelper; - - @Autowired - protected FmeService fmeService; - - @SysLog() - @ApiOperation(value = "鏌ヨ浠诲姟鐘舵��") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") - }) - @GetMapping(value = "/selectTaskStatus") - public Object selectTaskStatus(String id, HttpServletRequest req) { - try { - if (StringHelper.isEmpty(id)) { - return fail("id涓嶈兘涓虹┖"); - } - - return fmeService.getTaskStatus(id, req); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇璐ㄦ缁撴灉") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") - }) - @GetMapping(value = "/downloadResult") - public void downloadResult(String id, HttpServletRequest req, HttpServletResponse res) { - try { - if (!StringHelper.isEmpty(id)) { - String url = fmeService.getDownloadUrl(id, req); - - HttpHelper httpHelper = new HttpHelper(); - // res.sendRedirect(url) - httpHelper.service(req, res, url, null); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - @SysLog() - @ApiOperation(value = "鎻愪氦鏁版嵁璐ㄦ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "FME璇锋眰瀹炰綋绫�", dataType = "FmeReqEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/uploadChecks") - public ResponseMsg<Object> uploadChecks(@RequestBody FmeReqEntity entity, HttpServletRequest req) { - try { - if (StringHelper.isEmpty(entity.names)) { - return fail("浠诲姟鍚嶇О涓嶈兘涓虹┖"); - } - if (StringHelper.isEmpty(entity.zipPath)) { - return fail("璇烽�夋嫨寰呰川妫�鐨剒ip鏂囦欢"); - } - - entity.zipPath = getFullPath(entity.zipPath); - if (!isZipFile(entity.zipPath)) { - return fail("寰呰川妫�鐨剒ip鏂囦欢涓嶅瓨鍦�"); - } - if (entity.names.contains(StaticData.CHECK_MAIN)) { - entity.wbsPath = getFullPath(entity.wbsPath); - if (!isXlsFile(entity.wbsPath)) { - return fail("寰呰川妫�鐨刉BS鏂囦欢涓嶅瓨鍦�"); - } - } - - List<String> list = new ArrayList<>(); - for (String name : entity.names.split(StaticData.COMMA)) { - String guid = invoke(name, entity, req); - list.add(guid); - } - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - /** - * 鑾峰彇鏂囦欢璺緞 - */ - private String getFullPath(String filePath) { - return null == filePath ? null : pathHelper.getConfig().getTempPath() + File.separator + filePath; - } - - /** - * 鏄�/鍚︿负Zip鏂囦欢 - */ - private boolean isZipFile(String filePath) { - if (null == filePath || !filePath.toLowerCase().endsWith(StaticData.ZIP)) { - return false; - } - - File zipFile = new File(filePath); - - return zipFile.exists() && !zipFile.isDirectory(); - } - - /** - * 鏄�/鍚︿负Excel鏂囦欢 - */ - private boolean isXlsFile(String filePath) { - if (null == filePath) { - return false; - } - if (!(filePath.toLowerCase().endsWith(StaticData.XLS) || filePath.toLowerCase().endsWith(StaticData.XLSX))) { - return false; - } - - File zipFile = new File(filePath); - - return zipFile.exists() && !zipFile.isDirectory(); - } - - /** - * 鏂规硶璋冪敤 - */ - private String invoke(String name, FmeReqEntity entity, HttpServletRequest req) throws Exception { - Method method; - try { - method = FmeService.class.getDeclaredMethod(name, FmeReqEntity.class, HttpServletRequest.class); - } catch (Exception ex) { - throw new Exception(name + "锛岃妫�鏌ユ柟娉曚笉瀛樺湪"); - } - - Object obj = method.invoke(fmeService, entity, req); - - return null == obj ? null : obj.toString(); - } - - /*@SysLog() - @ApiOperation(value = "鏌ヨOSGB妫�鏌�") - @GetMapping(value = "/selectCheckOsgb") - public ResponseMsg<Object> selectCheckOsgb(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\OSGB妫�鏌�.zip"; - fme.imgResolution = 0.2; - - String rs = fmeService.checkOsgb(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ琛ㄦ牸鏁版嵁妫�鏌�") - @GetMapping(value = "/selectCheckXls") - public ResponseMsg<Object> selectCheckXls(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.sjzy = "娴嬮噺涓撲笟"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\琛ㄦ牸鏁版嵁妫�鏌�.zip"; - - String rs = fmeService.checkXls(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鐐逛簯妫�鏌�") - @GetMapping(value = "/selectCheckLaz") - public ResponseMsg<Object> selectCheckLaz(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鐐逛簯妫�鏌�.zip"; - fme.lazDensity = 1; - - String rs = fmeService.checkLaz(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ楂樼▼妫�鏌�") - @GetMapping(value = "/selectCheckDem") - public ResponseMsg<Object> selectCheckDem(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\楂樼▼妫�鏌�.zip"; - fme.demTolerance = 5; - fme.demChangeRate = 200; - - String rs = fmeService.checkDem(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ灞炴�ф鏌�") - @GetMapping(value = "/selectCheckAttrs") - public ResponseMsg<Object> selectCheckAttrs(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.sjzy = "娴嬮噺涓撲笟"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\灞炴�ф鏌�.zip"; - - String rs = fmeService.checkAttrs(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎷撴墤妫�鏌�") - @GetMapping(value = "/selectCheckTopology") - public ResponseMsg<Object> selectCheckTopology(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鎷撴墤妫�鏌�.zip"; - fme.polyTolerance = 0.001; - fme.lineTolerance = 0.001; - fme.pointTolerance = 0.001; - fme.gcdOffset = 20; - fme.kzdOffset = 100; - fme.rangeOffset = 200; - fme.xgMax = 0.005; - - String rs = fmeService.checkTopology(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍥鹃潰鏁撮グ妫�鏌�") - @GetMapping(value = "/selectCheckDecorate") - public ResponseMsg<Object> selectCheckDecorate(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鍥鹃潰鏁撮グ妫�鏌�.zip"; - fme.xlsList = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鏂囦欢娓呭崟.xlsx"; - - String rs = fmeService.checkDecorate(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍘熺偣妫�鏌�") - @GetMapping(value = "/selectCheckOrigin") - public ResponseMsg<Object> selectCheckOrigin(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鍘熺偣妫�鏌�.zip"; - - String rs = fmeService.checkOrigin(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏍呮牸妫�鏌�") - @GetMapping(value = "/selectCheckDom") - public ResponseMsg<Object> selectCheckDom(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.sjzy = "娴嬮噺涓撲笟"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鏍呮牸妫�鏌�.zip"; - fme.coordinateSystem = "CGCS2000/GK3d-93E_FME"; - fme.imgResolution = 0.2; - - String rs = fmeService.checkDom(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏁板鍩虹妫�鏌�") - @GetMapping(value = "/selectCheckMath") - public ResponseMsg<Object> selectCheckMath(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.sjzy = "娴嬮噺涓撲笟"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鏁板鍩虹妫�鏌�.zip"; - - String rs = fmeService.checkMath(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍏冩暟鎹鏌�") - @GetMapping(value = "/selectCheckMeta") - public ResponseMsg<Object> selectCheckMeta(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.sjzy = "娴嬮噺涓撲笟"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鍏冩暟鎹鏌�.zip"; - - String rs = fmeService.checkMeta(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎬昏川妫�") - @GetMapping(value = "/selectCheckMain") - public ResponseMsg<Object> selectCheckMain(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.sjzy = "娴嬮噺涓撲笟"; - fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�.7z"; - fme.wbsPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\椤圭洰WBS瀵煎嚭.xlsx"; - fme.isDiZai = "NO"; - fme.diZaiType = "NO"; - - String rs = fmeService.checkMain(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "閫昏緫涓�鑷存�ф鏌�") - @GetMapping(value = "/checkLogical") - public ResponseMsg<Object> checkLogical(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.sjzy = "娴嬮噺涓撲笟"; - fme.zipPath = "D:\\LF\\temp\\20230411\\鏁板瓧鍖栨垚鏋�.zip"; - - String rs = fmeService.checkLogical(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍗曢」鎴愭灉瀹屾暣鎬ф鏌�") - @GetMapping(value = "/checkSingleIntegrity") - public ResponseMsg<Object> checkSingleIntegrity(HttpServletRequest req) { - try { - FmeReqEntity fme = new FmeReqEntity(); - fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; - fme.sjzy = "娴嬮噺涓撲笟"; - fme.sjfl = "鏁板瓧鍖栨垚鏋�"; - fme.zipPath = "D:\\LF\\temp\\20230411\\鏁板瓧鍖栨垚鏋�.zip"; - - String rs = fmeService.checkSingleIntegrity(fme, req); - if (StringHelper.isEmpty(rs)) { - return fail("妫�鏌ュけ璐�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - }*/ - - @SysLog() - @ApiOperation(value = "鏈嶅姟娉ㄥ唽") - @GetMapping(value = "/selectServerRegister") - public ResponseMsg<Object> selectServerRegister(HttpServletRequest req) { - try { - RegisterEntity rs = fmeService.serverRegister("瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116DT02锛�", "http://127.0.0.1/LFData/2d/tiles/01/{z}/{x}/{y}.png", "DOM", req); - if (null == rs || StringHelper.isEmpty(rs.getSerialnum())) { - return fail("澶辫触"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏈嶅姟鐢宠") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鏈嶅姟ID", dataType = "String", paramType = "query", example = "195f77eb-19dd-4e34-afc1-fcff8f758f7b"), - @ApiImplicitParam(name = "pubid", value = "鍙戝竷ID", dataType = "Integer", paramType = "query", example = "1"), - }) - @GetMapping(value = "/selectServerApply") - public ResponseMsg<Object> selectServerApply(String id, Integer pubid, HttpServletRequest req) { - try { - fmeService.serverApply(id, pubid, req); - - return success("OK"); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎璧勬簮") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鏈嶅姟ID", dataType = "String", paramType = "query", example = "6f4b6783-4b98-4d46-a0d9-43cdb5f339dc") - }) - @GetMapping(value = "/selectDeleteRes") - public ResponseMsg<Object> selectDeleteRes(String id, HttpServletRequest req) { - try { - fmeService.deleteRes(id, req); - - return success("OK"); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/upload/QueryController.java b/src/main/java/com/lf/server/controller/data/upload/QueryController.java deleted file mode 100644 index 74379cd..0000000 --- a/src/main/java/com/lf/server/controller/data/upload/QueryController.java +++ /dev/null @@ -1,289 +0,0 @@ -package com.lf.server.controller.data.upload; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.metadata.OrderItem; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.lf.server.annotation.SysLog; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.TabEntity; -import com.lf.server.entity.data.*; -import com.lf.server.entity.sys.DepEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.ClassHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.service.all.BaseQueryService; -import com.lf.server.service.data.*; -import com.lf.server.service.sys.DepService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鏌ヨ鎺у埗鍣� - * @author WWW - */ -public class QueryController extends CheckController { - @Autowired - protected DepService depService; - - @Autowired - protected DirService dirService; - - @Autowired - protected VerService verService; - - @Autowired - protected MetaService metaService; - - @Autowired - protected TokenService tokenService; - - @Autowired - protected UploadService uploadService; - - @Autowired - protected BaseQueryService baseQueryService; - - @Autowired - DictService dictService; - - @SysLog() - @ApiOperation(value = "鏍规嵁鐖禝D鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "metaid", value = "鐖禝D", dataType = "String", paramType = "query", example = "0"), - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectPageAndCountByPid") - public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - if (null == metaid || metaid < 1) { - return fail("鐖禝D涓嶈兘涓虹┖涓斿ぇ浜�1", null); - } - - int count = metaService.selectCountByPid(metaid, name); - if (count == 0) { - return success(0, null); - } - - List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈夊崟浣�") - @GetMapping(value = "/selectDepAll") - public ResponseMsg<List<DepEntity>> selectDepAll() { - try { - List<DepEntity> list = depService.selectDepAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈夌洰褰�") - @GetMapping(value = "/selectDirAll") - public ResponseMsg<List<DirEntity>> selectDirAll() { - try { - List<DirEntity> list = dirService.selectDirAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鐩綍ID鏌ヨ鐗堟湰鍒楄〃") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query") - }) - @GetMapping(value = "/selectVerByDirid") - public ResponseMsg<List<VerEntity>> selectVerByDirid(Integer dirid) { - try { - if (null == dirid || dirid < 0) { - dirid = 0; - } - - List<VerEntity> list = verService.selectByDirid(dirid); - if (null == list || list.isEmpty()) { - list = verService.selectByDirid(0); - } - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍧愭爣绯�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "zoning", value = "甯﹀彿", dataType = "String", paramType = "query", example = "6搴︽湁甯﹀彿") - }) - @GetMapping(value = "/selectCoords") - public ResponseMsg<Object> selectCoords(String zoning) { - try { - List<CoordEntity> list = uploadService.selectCoords(zoning); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ椤圭洰鍚嶇О") - @GetMapping(value = "/selectProject") - public ResponseMsg<Object> selectProject() { - try { - List<DirEntity> list = uploadService.selectProject(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈夎〃") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鐐�"), - @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false") - }) - @GetMapping(value = "/selectTabs") - public ResponseMsg<List<TabEntity>> selectTabs(String name, Boolean hasGeom) { - try { - List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom"); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ瀛楁淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg25wAanp") - }) - @GetMapping(value = "/selectFields") - public ResponseMsg<List<DictEntity>> selectFields(String ns, String tab) { - try { - if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(tab)) { - return fail("鍚嶇О绌洪棿鍜岃〃鍚嶄笉鑳戒负绌�", null); - } - - List<DictEntity> list = baseQueryService.selectFields(ns, tab); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ琛ㄤ腑鏁版嵁") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鍏冩暟鎹甀D", dataType = "Integer", paramType = "query", example = "115"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10") - }) - @GetMapping(value = "/selectDbData") - public ResponseMsg<Object> selectDbData(Integer id, Integer pageIndex, Integer pageSize) { - // noinspection AlibabaRemoveCommentedCode - try { - if (null == id || id < 0) { - return fail("鍏冩暟鎹甀D涓嶈兘涓虹┖鎴栧皬浜�0", null); - } - - MetaEntity meta = metaService.selectById(id); - if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { - return fail("鎵句笉鍒板厓鏁版嵁淇℃伅", null); - } - - String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); - BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); - if (null == baseMapper) { - return null; - } - - QueryWrapper wrapper = new QueryWrapper(); - wrapper.eq("parentid", meta.getEventid()); - - Page<Object> page = new Page<>(pageIndex, pageSize); - page.addOrder(OrderItem.desc("gid")); - IPage<Object> paged = baseMapper.selectPage(page, wrapper); - - return success(paged.getTotal(), paged.getRecords()); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ涓婁紶鏁版嵁骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageForUpload") - public ResponseMsg<Object> selectByPageForUpload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - UserEntity ue = tokenService.getCurrentUser(req); - - int count = metaService.selectCountForUpload(name, ue.getId(), null); - if (count == 0) { - return success(0, null); - } - - List<MetaEntity> list = metaService.selectByPageForUpload(name, ue.getId(), null, pageSize, pageSize * (pageIndex - 1)); - - return success(count, list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鍏冩暟鎹甀D鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectMetaById") - public ResponseMsg<MetaEntity> selectMetaById(int id) { - try { - MetaEntity entity = metaService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/data/upload/UploadController.java b/src/main/java/com/lf/server/controller/data/upload/UploadController.java deleted file mode 100644 index 0b41714..0000000 --- a/src/main/java/com/lf/server/controller/data/upload/UploadController.java +++ /dev/null @@ -1,240 +0,0 @@ -package com.lf.server.controller.data.upload; - -import com.lf.server.annotation.SysLog; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.ctrl.KeyValueEntity; -import com.lf.server.entity.data.DirEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.data.MetaFileEntity; -import com.lf.server.entity.data.VerEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.all.UploadAttachService; -import com.lf.server.service.data.UploadService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 鏁版嵁鍏ュ簱 - * @author WWW - */ -@Api(tags = "鏁版嵁绠$悊\\鏁版嵁涓婁紶") -@RestController -@RequestMapping("/dataUpload") -public class UploadController extends QueryController { - @Autowired - UploadService uploadService; - - @Autowired - UploadAttachService uploadAttachService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璺緞") - @GetMapping(value = "/selectPath") - public ResponseMsg<String> selectPath() { - try { - String pathName = uploadService.selectPath(); - - return success(pathName); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓婁紶鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "path", value = "璺緞", dataType = "String", paramType = "query") - }) - @ResponseBody - @PostMapping(value = "/uploadFiles") - public ResponseMsg<Object> uploadFiles(String path, HttpServletRequest req, HttpServletResponse res) { - try { - List<MetaFileEntity> list = uploadService.uploadData(null, path, false, req, res); - if (null == list || list.isEmpty()) { - return fail("娌℃湁鎵惧埌涓婁紶鏂囦欢", null); - } - - uploadService.copePath(list); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - /** - * 鎺ユ敹鏁扮粍1锛欯RequestParam(value = "ids")List<Integer> ids - * &ids=1209&ids=1180&ids=1387 - * 鎺ユ敹鏁版嵁2锛欼nteger[] ids - * formData.append("ids", 1209); formData.append("ids", 1180); formData.append("ids", 1387); - */ - @SysLog() - @ApiOperation(value = "涓婁紶Excel闄勪欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "path", value = "璺緞", dataType = "String", paramType = "query"), - @ApiImplicitParam(name = "ids", value = "鍏冩暟鎹泦鍚�", dataType = "Integer", allowMultiple = true, paramType = "query") - }) - @ResponseBody - @PostMapping(value = "/uploadXlsAnnex") - public ResponseMsg<Object> uploadXlsAnnex(String path, Integer[] ids, HttpServletRequest req, HttpServletResponse res) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - if (null == ids || ids.length == 0) { - return fail("鎵句笉鍒板厓鏁版嵁鐨処D闆嗗悎"); - } - - List<MetaEntity> ms = metaService.selectXlsAnnex(ids, UploadAttachService.getTabs()); - if (null == ms || ms.isEmpty()) { - return fail("鎵句笉鍒拌涓婁紶闄勪欢鐨勫厓鏁版嵁"); - } - - List<MetaFileEntity> list = uploadService.uploadData(null, path, false, req, res); - if (null == list || list.isEmpty()) { - return fail("娌℃湁鎵惧埌涓婁紶鏂囦欢", null); - } - - List<KeyValueEntity> rs = uploadAttachService.uploadXlsAnnex(ue, ms, list, path); - if (null == rs || rs.size() == 0) { - return fail("娌℃湁瑕佹洿鏂扮殑鍏冩暟鎹�"); - } - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "path", value = "璺緞", dataType = "String", paramType = "query") - }) - @GetMapping(value = "/selectFiles") - public ResponseMsg<List<MetaFileEntity>> selectFiles(String path) { - try { - List<MetaFileEntity> list = uploadService.selectFiles(path); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MetaEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/deleteFiles") - public ResponseMsg<Object> deleteFiles(@RequestBody List<MetaFileEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - if (null == list || list.isEmpty()) { - return fail("娌℃湁鎵惧埌鏂囦欢", null); - } - - int rows = uploadService.deleteFiles(list); - - return success("鎴愬姛", rows); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏄犲皠") - @ApiImplicitParams({ - @ApiImplicitParam(name = "path", value = "璺緞", dataType = "String", paramType = "query", example = "20230110010101"), - @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query", example = "163"), - @ApiImplicitParam(name = "verid", value = "鐗堟湰ID", dataType = "Integer", paramType = "query", example = "0"), - @ApiImplicitParam(name = "epsgCode", value = "鍧愭爣缂栫爜", dataType = "String", paramType = "query", example = "EPSG:4490") - }) - @GetMapping(value = "/selectMappers") - public ResponseMsg<Object> selectMappers(String path, Integer dirid, Integer verid, String epsgCode, HttpServletRequest req) { - try { - if (StringHelper.isEmpty(path) || StringHelper.isEmpty(epsgCode) || null == dirid || null == verid) { - return fail("璺緞銆佺洰褰旾D銆佺増鏈琁D鍜屽潗鏍囩紪鐮佷笉鑳戒负绌�"); - } - if (1 > uploadService.selectCount4Coord(epsgCode)) { - return fail("鍧愭爣缂栫爜" + epsgCode + "涓嶅瓨鍦�"); - } - DirEntity dir = dirService.selectDir(dirid); - if (null == dir) { - return fail("鐩綍ID=" + dirid + "涓嶅瓨鍦�"); - } - VerEntity ver = verService.selectVersion(verid); - if (null == ver) { - return fail("鐗堟湰ID=" + verid + "涓嶅瓨鍦�"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - List<MetaFileEntity> list = uploadService.selectMappers(ue, path, dir, ver, epsgCode); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "鍏冩暟鎹枃浠堕泦鍚�", dataType = "MetaFileEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/insertFiles") - public ResponseMsg<Object> insertFiles(@RequestBody List<MetaFileEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (null == ue) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - if (null == list || list.isEmpty()) { - return fail("鍏冩暟鎹枃浠堕泦鍚堜负绌�", null); - } - - uploadService.insertFiles(ue, list, req); - - return success("鎴愬姛", list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎鍏冩暟鎹�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1") - }) - @GetMapping(value = "/deleteMetas") - public ResponseMsg<Integer> deleteMetas(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = metaService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/show/ApplyController.java b/src/main/java/com/lf/server/controller/show/ApplyController.java deleted file mode 100644 index b39f129..0000000 --- a/src/main/java/com/lf/server/controller/show/ApplyController.java +++ /dev/null @@ -1,305 +0,0 @@ -package com.lf.server.controller.show; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.DownloadReqEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.show.ApplyEntity; -import com.lf.server.entity.show.FlowEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.AesHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.show.ApplyService; -import com.lf.server.service.show.FlowService; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import com.lf.server.service.sys.UserService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.sql.Timestamp; -import java.util.List; - -/** - * 鏁版嵁鐢宠 - * @author WWW - */ -@Api(tags = "缁煎悎灞曠ず\\鏁版嵁鐢宠") -@RestController -@RequestMapping("/apply") -public class ApplyController extends BaseController { - @Autowired - ApplyService applyService; - - @Autowired - FlowService flowService; - - @Autowired - TokenService tokenService; - - @Autowired - UserService userService; - - @Autowired - DownlogService downlogService; - - @Autowired - DownloadService downloadService; - - @SysLog() - @ApiOperation(value = "鎻掑叆鏁版嵁鐢宠") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dr", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/insertApply") - public ResponseMsg<Object> insertApply(@RequestBody DownloadReqEntity dr, HttpServletRequest req) { - try { - if (null == dr || null == dr.getEntities() || dr.getEntities().isEmpty()) { - return fail("璇烽�夋嫨瑕佷笅杞界殑瀹炰綋鍚�"); - } - if (StringHelper.isEmpty(dr.getPwd())) { - return fail("瀵嗙爜涓嶈兘涓虹┖"); - } - dr.setPwd(AesHelper.decrypt(dr.getPwd())); - if (StringHelper.isPwdInvalid(dr.getPwd())) { - return fail("瀵嗙爜涓嶇鍚堣姹�"); - } - if (!StringHelper.isEmpty(dr.getWkt())) { - dr.setWkt(AesHelper.decrypt(dr.getWkt())); - } - if (null == dr.getTabs() || dr.getTabs().isEmpty()) { - return fail("璇烽�夋嫨瑕佷笅杞界殑琛ㄥ悕"); - } - if (null == dr.getDepcodes() || dr.getDepcodes().isEmpty()) { - return fail("璇烽�夋嫨寰呯敵璇风殑鍗曚綅缂栫爜(澶氫釜浠ラ�楀彿闅斿紑)"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - int rows = applyService.insertApply(ue, dr); - - return success(rows); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ鐢宠") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "鍛�"), - @ApiImplicitParam(name = "status", value = "鐘舵��", dataType = "Integer", paramType = "query", example = "0"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-12-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-12-31 23:00:00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<Object> selectByPage(String uname, Integer status, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex, HttpServletRequest req) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = applyService.selectCount(uname, status, start, end); - if (count == 0) { - return success(0, null); - } - - UserEntity ue = tokenService.getCurrentUser(req); - List<ApplyEntity> rs = applyService.selectByPage(ue.getId(), uname, status, start, end, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ寰呭鏍告暟") - @GetMapping(value = "/selectSubmits") - public ResponseMsg<Object> selectSubmits(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - int rows = applyService.selectSubmits(ue.getId()); - - return success(rows); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ娴佺▼") - @ApiImplicitParams({ - @ApiImplicitParam(name = "applyid", value = "鏁版嵁鐢宠ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectFlows") - public ResponseMsg<Object> selectFlows(Integer applyid) { - try { - List<FlowEntity> rs = applyService.selectFlows(applyid); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "搴熷純鐢宠") - @ApiImplicitParams({ - @ApiImplicitParam(name = "applyid", value = "鏁版嵁鐢宠ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/updateForDiscard") - public ResponseMsg<Object> updateForDiscard(Integer applyid, HttpServletRequest req) { - try { - ApplyEntity applyEntity = applyService.selectById(applyid); - if (null == applyEntity) { - return fail("鎵句笉鍒版暟鎹敵璇�"); - } - if (!(applyEntity.getStatus() >= -1 && applyEntity.getStatus() <= StaticData.NINE)) { - return fail("璇ユ暟鎹敵璇锋棤娉曞簾寮�"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - int rows = applyService.updateForDiscard(ue.getId(), applyid); - - return success(rows); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "閲嶆柊鎻愪氦") - @ApiImplicitParams({ - @ApiImplicitParam(name = "applyid", value = "鏁版嵁鐢宠ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/updateForResubmit") - public ResponseMsg<Object> updateForResubmit(Integer applyid, HttpServletRequest req) { - try { - ApplyEntity applyEntity = applyService.selectById(applyid); - if (null == applyEntity) { - return fail("鎵句笉鍒版暟鎹敵璇�"); - } - if (-1 != applyEntity.getStatus()) { - return fail("璇ユ暟鎹敵璇锋棤闇�閲嶆柊鎻愪氦"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - int rows = applyService.updateForResubmit(ue.getId(), applyid); - - return success(rows); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻愪氦娴佺▼") - @ApiImplicitParams({ - @ApiImplicitParam(name = "flowId", value = "鐢宠娴佺▼ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/updateForSubmit") - public ResponseMsg<Object> updateForSubmit(Integer flowId, HttpServletRequest req) { - try { - FlowEntity flowEntity = flowService.selectById(flowId); - if (null == flowEntity) { - return fail("鎵句笉鍒扮敵璇锋祦绋�"); - } - if (flowEntity.getStatus() != 0) { - return fail("璇ョ敵璇锋祦绋嬫棤闇�鎻愪氦"); - } - - ApplyEntity applyEntity = applyService.selectById(flowEntity.getApplyid()); - if (null == applyEntity) { - return fail("鎵句笉鍒版暟鎹敵璇�"); - } - if (!(applyEntity.getStatus() >= 0 && applyEntity.getStatus() <= StaticData.NINE)) { - return fail("璇ユ暟鎹敵璇锋棤闇�鎵撳洖"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - int rows = applyService.updateForSubmit(ue.getId(), applyEntity.getId(), flowEntity.getId()); - - applyEntity = applyService.selectById(applyEntity.getId()); - if (StaticData.TEN == applyEntity.getStatus()) { - UserEntity user = userService.selectUser(applyEntity.getUserid()); - applyService.zipDbData(user, applyEntity); - } - - return success(rows); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎵撳洖娴佺▼") - @ApiImplicitParams({ - @ApiImplicitParam(name = "flowId", value = "鐢宠娴佺▼ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/updateForReject") - public ResponseMsg<Object> updateForReject(Integer flowId, HttpServletRequest req) { - try { - FlowEntity flowEntity = flowService.selectById(flowId); - if (null == flowEntity) { - return fail("鎵句笉鍒扮敵璇锋祦绋�"); - } - if (flowEntity.getStatus() != 0) { - return fail("璇ョ敵璇锋祦绋嬫棤闇�鎵撳洖"); - } - - ApplyEntity applyEntity = applyService.selectById(flowEntity.getApplyid()); - if (null == applyEntity) { - return fail("鎵句笉鍒版暟鎹敵璇�"); - } - if (!(applyEntity.getStatus() >= 0 && applyEntity.getStatus() <= StaticData.NINE)) { - return fail("璇ユ暟鎹敵璇锋棤闇�鎵撳洖"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - Integer rows = applyService.updateForReject(ue.getId(), applyEntity.getId(), flowEntity.getId()); - - return success(rows); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") - }) - @ResponseBody - @GetMapping(value = "/downloadFile") - public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { - try { - DownloadEntity de = downloadService.selectByGuid(guid); - if (null == de) { - WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); - return; - } - - UserEntity ue = tokenService.getCurrentUser(req); - downlogService.updateInfos(ue, de, req); - - String filePath = downloadService.getDownloadFilePath(de); - WebHelper.download(filePath, de.getName(), res); - } catch (Exception ex) { - WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); - } - } -} diff --git a/src/main/java/com/lf/server/controller/show/ComprehensiveController.java b/src/main/java/com/lf/server/controller/show/ComprehensiveController.java deleted file mode 100644 index c19eb80..0000000 --- a/src/main/java/com/lf/server/controller/show/ComprehensiveController.java +++ /dev/null @@ -1,336 +0,0 @@ -package com.lf.server.controller.show; - -import com.lf.server.annotation.SysLog; -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.DownloadReqEntity; -import com.lf.server.entity.ctrl.MarkJsonEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.data.MetaFileEntity; -import com.lf.server.entity.data.PublishEntity; -import com.lf.server.entity.show.PipelineEntity; -import com.lf.server.entity.sys.AttachEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.all.BaseQueryService; -import com.lf.server.service.all.BaseUploadService; -import com.lf.server.service.all.UploadAttachService; -import com.lf.server.service.data.DataQueryService; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.data.PublishService; -import com.lf.server.service.show.MarkService; -import com.lf.server.service.show.PipelineService; -import com.lf.server.service.sys.AttachService; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 缁煎悎灞曠ず - * @author WWW - */ -@Api(tags = "缁煎悎灞曠ず\\棣栭〉") -@RestController -@RequestMapping("/comprehensive") -public class ComprehensiveController extends ModelController { - @Autowired - BaseQueryService baseQueryService; - - @Autowired - MarkService markService; - - @Autowired - TokenService tokenService; - - @Autowired - AttachService attachService; - - @Autowired - DownlogService downlogService; - - @Autowired - PublishService publishService; - - @Autowired - DownloadService downloadService; - - @Autowired - PipelineService pipelineService; - - @Autowired - DataQueryService dataQueryService; - - @Autowired - BaseUploadService baseUploadService; - - @Autowired - UploadAttachService uploadAttachService; - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ鍙戝竷娓呭崟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectPubById") - public ResponseMsg<PublishEntity> selectPubById(int id) { - try { - PublishEntity entity = publishService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex.getMessage(), null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ绠$嚎") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "瑗挎皵涓滆緭"), - }) - @GetMapping(value = "/selectPipelines") - public ResponseMsg<Object> selectPipelines(String name) { - try { - List<PipelineEntity> rs = pipelineService.selectPipelines(name); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ璺綉") - @ApiImplicitParams({ - @ApiImplicitParam(name = "x1", value = "X1", dataType = "Double", paramType = "query", example = "116.78999"), - @ApiImplicitParam(name = "y1", value = "Y1", dataType = "Double", paramType = "query", example = "39.9468"), - @ApiImplicitParam(name = "x2", value = "X2", dataType = "Double", paramType = "query", example = "116.80458"), - @ApiImplicitParam(name = "y2", value = "Y2", dataType = "Double", paramType = "query", example = "39.94758") - }) - @GetMapping(value = "/selectRoute") - public ResponseMsg<Object> selectRoute(double x1, double y1, double x2, double y2) { - try { - String route = baseQueryService.selectRoute(x1, y1, x2, y2); - - return success(route); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓婁紶ShapeFile鏂囦欢") - @ResponseBody - @PostMapping(value = "/uploadShp", produces = "application/json; charset=UTF-8") - public ResponseMsg<Object> uploadShp(HttpServletRequest req, HttpServletResponse res) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - List<MetaFileEntity> meList = baseUploadService.uploadData(null, null, false, req, res); - if (meList == null || meList.size() < StaticData.FOUR) { - return fail("娌℃湁鎵惧埌宸蹭笂浼犵殑鏁版嵁鎴栦笉瀹屾暣", null); - } - - List<MarkJsonEntity> list = markService.readShpForMarks(meList); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇ShapeFile鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "鏍囩粯JSON瀹炰綋绫婚泦鍚�", dataType = "MarkJsonEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/downloadShp", produces = "application/json; charset=UTF-8") - public ResponseMsg<String> downloadShp(@RequestBody List<MarkJsonEntity> list, HttpServletRequest req, HttpServletResponse res) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - if (list == null || list.isEmpty()) { - return fail("鎵句笉鍒版爣缁樻暟鎹�", null); - } - - String guid = markService.downloadShp(ue, list); - if (StringHelper.isNull(guid)) { - return fail("鐢熸垚ShapeFile鏂囦欢澶辫触", null); - } - - return success(guid); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓婁紶鏂囦欢") - @ResponseBody - @ApiImplicitParams({ - @ApiImplicitParam(name = "tabName", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "lf.sys_style"), - @ApiImplicitParam(name = "eventid", value = "涓婚敭", dataType = "String", paramType = "query", example = "fa25979a5ef8b43ba82a0be35b3fb0d4") - }) - @PostMapping(value = "/uploadFiles") - public ResponseMsg<Integer> uploadFiles(String tabName, String eventid, @RequestParam("file") MultipartFile[] files, HttpServletRequest req) { - try { - if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) { - return fail("鍙傛暟涓嶈兘涓虹┖", null); - } - if (null == files || files.length == 0) { - return fail("鏂囦欢涓婁紶涓虹┖", 0); - } - - UserEntity ue = tokenService.getCurrentUser(req); - Integer count = dataQueryService.uploadFiles(ue, tabName, eventid, files, req); - - return success(count); - } catch (Exception ex) { - return fail(ex, 0); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") - }) - @RequestMapping(value = "/downloadFile", method = RequestMethod.GET) - public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, "鐢ㄦ埛鏈櫥褰�")); - } - - DownloadEntity de = downloadService.selectByGuid(guid); - if (de == null) { - WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�")); - } - - downlogService.updateInfos(ue, de, req); - - String filePath = downloadService.getDownloadFilePath(de); - WebHelper.download(filePath, de.getName(), res); - } catch (Exception ex) { - WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, ex.getMessage())); - log.error(ex.getMessage(), ex); - } - } - - @SysLog() - @ApiOperation(value = "鏌ョ湅鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") - }) - @GetMapping(value = "/downloadForView") - public void downloadForView(String guid, HttpServletResponse res) { - uploadAttachService.download(guid, true, res); - } - - @SysLog() - @ApiOperation(value = "璇锋眰涓嬭浇") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guids", value = "闄勪欢Guid鏁扮粍", dataType = "String", paramType = "body", allowMultiple = true, example = "e5b6ae0889b88111f13a4b6e048348db,fa4f299e901a0c46e634f8fcc8185c0c") - }) - @ResponseBody - @PostMapping(value = "/downloadReqForGuids") - public ResponseMsg<Object> downloadReqForGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == dre || null == dre.getGuids() || dre.getGuids().isEmpty()) { - return fail("Guid鏁扮粍涓虹┖"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - String guid = uploadAttachService.downloadReqForGuids(ue, dre.getGuids()); - - return success(guid); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "璇锋眰涓嬭浇") - @ApiImplicitParams({ - @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "body", example = "bd.b_borehole"), - @ApiImplicitParam(name = "guids", value = "闄勪欢Guid鏁扮粍", dataType = "String", paramType = "body", allowMultiple = true, example = "08e5b4ad-93b8-46f6-adaa-46a6274af4ce,6f94f4f8-6e8d-44e7-8803-3d068d34983f") - }) - @ResponseBody - @PostMapping(value = "/downloadReqForTabGuids") - public ResponseMsg<Object> downloadReqForTabGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == dre || StringHelper.isEmpty(dre.getTab())) { - return fail("琛ㄥ悕涓虹┖"); - } - if (null != dre.getGuids() && dre.getGuids().size() == 0) { - dre.setIds(null); - } - - UserEntity ue = tokenService.getCurrentUser(req); - String guid = uploadAttachService.downloadReqForTabGuids(ue, dre.getTab(), dre.getGuids()); - - return success(guid); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "tabName", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "lf.sys_style"), - @ApiImplicitParam(name = "eventid", value = "涓婚敭", dataType = "String", paramType = "query", example = "fa25979a5ef8b43ba82a0be35b3fb0d4") - }) - @GetMapping(value = "/selectFiles") - public ResponseMsg<List<AttachEntity>> selectFiles(String tabName, String eventid) { - try { - if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) { - return fail("鍙傛暟涓嶈兘涓虹┖", null); - } - - List<AttachEntity> list = attachService.selectByTab(tabName, eventid); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deleteFiles(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int rows = attachService.deletes(ids); - - return success(rows); - } catch (Exception ex) { - return fail(ex, 0); - } - } -} diff --git a/src/main/java/com/lf/server/controller/show/DataLibController.java b/src/main/java/com/lf/server/controller/show/DataLibController.java deleted file mode 100644 index 9694661..0000000 --- a/src/main/java/com/lf/server/controller/show/DataLibController.java +++ /dev/null @@ -1,265 +0,0 @@ -package com.lf.server.controller.show; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.metadata.OrderItem; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseQueryController; -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.DownloadReqEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.data.VerEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.service.all.BaseQueryService; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.data.MetaService; -import com.lf.server.service.data.VerService; -import com.lf.server.service.show.DataLibService; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.net.URLDecoder; -import java.nio.charset.StandardCharsets; -import java.util.*; - -/** - * 璧勬枡棣� - * @author WWW - */ -@Api(tags = "缁煎悎灞曠ず\\璧勬枡棣�") -@RestController -@RequestMapping("/dataLib") -public class DataLibController extends BaseQueryController { - @Autowired - MetaService metaService; - - @Autowired - TokenService tokenService; - - @Autowired - DataLibService dataLibService; - - @Autowired - BaseQueryService baseQueryService; - - @Autowired - VerService verService; - - @SysLog() - @ApiOperation(value = "鏍规嵁鐩綍ID鏌ヨ鐗堟湰鍒楄〃") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query") - }) - @GetMapping(value = "/selectVerByDirid") - public ResponseMsg<List<VerEntity>> selectVerByDirid(Integer dirid) { - try { - if (null == dirid || dirid < 0) { - dirid = 0; - } - - List<VerEntity> list = verService.selectByDirid(dirid); - if (null == list || list.isEmpty()) { - list = verService.selectByDirid(0); - } - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ鍏冩暟鎹�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), - @ApiImplicitParam(name = "dirs", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00,01"), - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectMetasForPage") - public ResponseMsg<Object> selectMetasForPage(String depcode, String dirs, String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - dirs = DataLibService.copeCodes(dirs, "dircode"); - - int count = metaService.selectMetasForCount(depcode, dirs, name); - if (count == 0) { - return success(0, null); - } - - List<MetaEntity> rs = metaService.selectMetasForPage(depcode, dirs, name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ琛ㄤ腑鏁版嵁") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鍏冩暟鎹甀D", dataType = "Integer", paramType = "query", example = "115"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10") - }) - @GetMapping(value = "/selectDbData") - public ResponseMsg<Object> selectDbData(Integer id, Integer pageIndex, Integer pageSize) { - // noinspection AlibabaRemoveCommentedCode - try { - if (null == id || id < 0) { - return fail("鍏冩暟鎹甀D涓嶈兘涓虹┖鎴栧皬浜�0", null); - } - - MetaEntity meta = metaService.selectById(id); - if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { - return fail("鎵句笉鍒板厓鏁版嵁淇℃伅", null); - } - - String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); - BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); - if (null == baseMapper) { - return null; - } - - QueryWrapper wrapper = new QueryWrapper(); - wrapper.eq("parentid", meta.getEventid()); - - Page<Object> page = new Page<>(pageIndex, pageSize); - page.addOrder(OrderItem.desc("gid")); - IPage<Object> paged = baseMapper.selectPage(page, wrapper); - - return success(paged.getTotal(), paged.getRecords()); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "璇锋眰鍏冩暟鎹笅杞�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dr", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/downloadReq") - public ResponseMsg<Object> downloadReq(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == dr || StringHelper.isEmpty(dr.getPwd())) { - return fail("瀵嗙爜涓嶈兘涓虹┖"); - } - if (null == dr.getIds() || dr.getIds().isEmpty()) { - return fail("璇烽�夋嫨瑕佷笅杞界殑鏂囦欢ID"); - } - if (!DownloadService.decryptPwd(dr)) { - return fail("瀵嗙爜瑙e瘑澶辫触", null); - } - if (StringHelper.isPwdInvalid(dr.getPwd())) { - return fail("瀵嗙爜涓嶇鍚堣姹�"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - String guid = metaService.downloadMeteReq(ue, dr); - - return success(guid); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), - @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") - }) - @GetMapping(value = "/selectDownloadFile") - public ResponseMsg<Boolean> selectDownloadFile(String guid, String pwd) { - try { - if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { - return fail("鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", null); - } - if (!pwd.endsWith(StaticData.EQ)) { - pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); - } - - String password = DownloadService.decryptPwd(pwd); - if (null == password) { - return fail("瀵嗙爜瑙e瘑澶辫触", null); - } - - DownloadEntity de = downloadService.selectByGuid(guid); - if (null == de) { - return fail("鏂囦欢涓嶅瓨鍦�", null); - } - if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { - return fail("瀵嗙爜涓嶆纭�", null); - } - - String filePath = downloadService.getDownloadFilePath(de); - File file = new File(filePath); - - return success(file.exists()); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), - @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") - }) - @ResponseBody - @GetMapping(value = "/downloadFile") - @SuppressWarnings("AlibabaRemoveCommentedCode") - public void downloadFile(String guid, String pwd, HttpServletRequest req, HttpServletResponse res) { - try { - /*if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { - WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", res); - } - if (!pwd.endsWith(StaticData.EQ)) { - pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); - } - - String password = DownloadService.decryptPwd(pwd); - if (null == password) { - WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "瀵嗙爜瑙e瘑澶辫触", res); - }*/ - - DownloadEntity de = downloadService.selectByGuid(guid); - if (null == de) { - WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); - return; - } - /*if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { - WebHelper.writeInfo(HttpStatus.UNAUTHORIZED, "瀵嗙爜涓嶆纭�", res); - }*/ - - UserEntity ue = tokenService.getCurrentUser(req); - downlogService.updateInfos(ue, de, req); - - String filePath = downloadService.getDownloadFilePath(de); - WebHelper.download(filePath, de.getName(), res); - } catch (Exception ex) { - WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); - } - } -} diff --git a/src/main/java/com/lf/server/controller/show/ExportController.java b/src/main/java/com/lf/server/controller/show/ExportController.java deleted file mode 100644 index 77e0046..0000000 --- a/src/main/java/com/lf/server/controller/show/ExportController.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.lf.server.controller.show; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.show.ExportEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.show.ExportService; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 鍦ㄧ嚎鍒跺浘 - * @author WWW - */ -@Api(tags = "缁煎悎灞曠ず\\鍦ㄧ嚎鍒跺浘") -@RestController -@RequestMapping("/export") -public class ExportController extends BaseController { - @Autowired - TokenService tokenService; - - @Autowired - ExportService exportService; - - @Autowired - DownlogService downlogService; - - @Autowired - DownloadService downloadService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<DownloadEntity>> selectPageCountForDownload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - int count = downloadService.selectCountForUser(ue.getId(), "2", name); - if (count == 0) { - return success(0, null); - } - List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), "2", name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏂板缓鍑哄浘") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "鍦ㄧ嚎鍒跺浘瀹炰綋绫�", dataType = "ExportEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/insertMap", produces = "application/json; charset=UTF-8") - public ResponseMsg<String> insertMap(@RequestBody ExportEntity entity, HttpServletRequest req) { - try { - boolean flag = entity.getXmin() == 0 && entity.getYmin() == 0 && entity.getXmax() == 0 && entity.getYmax() == 0; - if (StringHelper.isEmpty(entity.getLayers()) || StringHelper.isEmpty(entity.getToken()) || flag) { - return fail("鍙傛暟涓嶅畬鏁�"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�"); - } - - String str = exportService.post(ue, entity); - if (StringHelper.isNull(str)) { - return fail("鍑哄浘澶辫触"); - } - - return success("鍑哄浘鎴愬姛", str); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鍑哄浘") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") - }) - @RequestMapping(value = "/downloadFile", method = RequestMethod.GET) - public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { - try { - if (StringHelper.isEmpty(guid)) { - WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "鎵句笉鍒版枃浠禝D", res); - return; - } - - DownloadEntity de = downloadService.selectByGuid(guid); - if (null == de) { - WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); - return; - } - - UserEntity ue = tokenService.getCurrentUser(req); - downlogService.updateInfos(ue, de, req); - - String filePath = downloadService.getDownloadFilePath(de); - WebHelper.download(filePath, de.getName(), res); - } catch (Exception ex) { - WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); - } - } -} diff --git a/src/main/java/com/lf/server/controller/show/InquiryController.java b/src/main/java/com/lf/server/controller/show/InquiryController.java deleted file mode 100644 index 6948fb1..0000000 --- a/src/main/java/com/lf/server/controller/show/InquiryController.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.lf.server.controller.show; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseQueryController; -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.DownloadTileEntity; -import com.lf.server.entity.ctrl.ShpRecordEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.data.MetaFileEntity; -import com.lf.server.entity.data.PublishEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.AesHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.all.BaseUploadService; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.data.PublishService; -import com.lf.server.service.show.InquiryService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 鏌ヨ - * @author WWW - */ -@Api(tags = "缁煎悎灞曠ず\\鏌ヨ") -@RestController -@RequestMapping("/inquiry") -public class InquiryController extends BaseQueryController { - @Autowired - TokenService tokenService; - - @Autowired - BaseUploadService baseUploadService; - - @Autowired - InquiryService inquiryService; - - @Resource - PublishService publishService; - - @SysLog() - @ApiOperation(value = "涓婁紶Shp鏂囦欢璇诲彇绗竴鏉¤褰曠殑WKT") - @ResponseBody - @PostMapping(value = "/uploadShp") - public ResponseMsg<ShpRecordEntity> uploadShp(HttpServletRequest req, HttpServletResponse res) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - List<MetaFileEntity> list = baseUploadService.uploadData(null, null, false, req, res); - if (list == null || list.size() < StaticData.FOUR) { - return fail("娌℃湁鎵惧埌宸蹭笂浼犵殑鏁版嵁鎴栦笉瀹屾暣", null); - } - - ShpRecordEntity sr = inquiryService.readShpFirstRecord(list); - if (sr != null && !StringHelper.isEmpty(sr.getWkt())) { - sr.setWkt(AesHelper.encrypt(sr.getWkt())); - } - - return success(sr); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鐡︾墖") - @ApiImplicitParams({ - @ApiImplicitParam(name = "dt", value = "涓嬭浇鐡︾墖瀹炰綋绫�", dataType = "DownloadTileEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/downloadTiles") - public ResponseMsg<Object> downloadTiles(@RequestBody DownloadTileEntity dt, HttpServletRequest req, HttpServletResponse res) { - try { - if (null == dt || null == dt.getPubid() || StringHelper.isEmpty(dt.getPwd())) { - return fail("鍙戝竷ID鍜屽瘑鐮佷笉鑳戒负绌�"); - } - String err = dt.verifyCoords(); - if (null != err) { - return fail(err); - } - if (!DownloadService.decryptPwd(dt)) { - return fail("瀵嗙爜瑙e瘑澶辫触", null); - } - - PublishEntity pub = publishService.selectById(dt.getPubid()); - if (null == pub) { - return fail("鍙戝竷鏁版嵁涓嶅瓨鍦�"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - String guid = inquiryService.zipTiles(dt, pub, ue); - if (null == guid) { - return fail("娌℃湁鐡︾墖闇�瑕佹墦鍖呬笅杞�"); - } - - return success(guid); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") - }) - @ResponseBody - @GetMapping(value = "/downloadFile") - public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { - try { - DownloadEntity de = downloadService.selectByGuid(guid); - if (null == de) { - WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); - return; - } - - UserEntity ue = tokenService.getCurrentUser(req); - downlogService.updateInfos(ue, de, req); - - String filePath = downloadService.getDownloadFilePath(de); - WebHelper.download(filePath, de.getName(), res); - } catch (Exception ex) { - WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); - } - } -} diff --git a/src/main/java/com/lf/server/controller/show/MarkController.java b/src/main/java/com/lf/server/controller/show/MarkController.java deleted file mode 100644 index 8d63273..0000000 --- a/src/main/java/com/lf/server/controller/show/MarkController.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.lf.server.controller.show; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.show.MarkEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.BaseUploadService; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.show.MarkService; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鏍囩粯 - * @author WWW - */ -@Api(tags = "缁煎悎灞曠ず\\鏍囩粯") -@RestController -@RequestMapping("/mark") -public class MarkController extends BaseController { - @Autowired - MarkService markService; - - @Autowired - TokenService tokenService; - - @Autowired - BaseUploadService baseUploadService; - - @Autowired - DownlogService downlogService; - - @Autowired - DownloadService downloadService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<MarkEntity>> selectByPageAndCount(Integer pageSize, Integer pageIndex, HttpServletRequest req) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - int count = markService.selectCount(ue.getId()); - if (count == 0) { - return success(0, null); - } - - List<MarkEntity> rs = markService.selectByPage(ue.getId(), pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<MarkEntity> selectById(int id) { - try { - MarkEntity entity = markService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MarkEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody MarkEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = markService.insert(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MarkEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<MarkEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (MarkEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = markService.inserts(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = markService.delete(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = markService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MarkEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody MarkEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = markService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MarkEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<MarkEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (MarkEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = markService.updates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/show/ModelController.java b/src/main/java/com/lf/server/controller/show/ModelController.java deleted file mode 100644 index 66b7415..0000000 --- a/src/main/java/com/lf/server/controller/show/ModelController.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.lf.server.controller.show; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.show.ModelEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.show.ModelService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 妯″瀷 - * @author WWW - */ -public class ModelController extends BaseController { - @Autowired - ModelService modelService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ妯″瀷骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "layerid", value = "鍥惧眰ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectModelByPageAndCount") - public ResponseMsg<List<ModelEntity>> selectModelByPageAndCount(Integer layerid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = modelService.selectCount(layerid); - if (count == 0) { - return success(0, null); - } - - List<ModelEntity> rs = modelService.selectByPage(layerid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex.getMessage(), null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ妯″瀷") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectModelById") - public ResponseMsg<ModelEntity> selectModelById(int id) { - try { - ModelEntity entity = modelService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex.getMessage(), null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁Guid鏌ヨ妯″瀷") - @ApiImplicitParams({ - @ApiImplicitParam(name = "layerid", value = "鍥惧眰ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "modelid", value = "妯″瀷ID", dataType = "String", paramType = "query", example = "") - }) - @GetMapping(value = "/selectModelByGuid") - public ResponseMsg<ModelEntity> selectModelByGuid(Integer layerid, String modelid) { - try { - if (null == layerid || StringHelper.isEmpty(modelid)) { - return fail("鍥惧眰ID鍜屾ā鍨婭D涓嶈兘涓虹┖", null); - } - - ModelEntity entity = modelService.selectModelByGuid(layerid, modelid); - - return success(entity); - } catch (Exception ex) { - return fail(ex.getMessage(), null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�涓ā鍨�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ModelEntity", paramType = "body") - }) - @PostMapping(value = "/insertModel", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertModel(@RequestBody ModelEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = modelService.insert(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex.getMessage(), -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氫釜妯″瀷") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ModelEntity", paramType = "body") - }) - @PostMapping(value = "/insertModels", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertModels(@RequestBody List<ModelEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (ModelEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = modelService.inserts(list); - - return success(count); - } catch (Exception ex) { - return fail(ex.getMessage(), -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�涓ā鍨�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteModel") - public ResponseMsg<Integer> deleteModel(int id) { - try { - int count = modelService.delete(id); - - return success(count); - } catch (Exception ex) { - return fail(ex.getMessage(), -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氫釜妯″瀷") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteModels") - public ResponseMsg<Integer> deleteModels(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = modelService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex.getMessage(), -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�涓ā鍨�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ModelEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updateModel", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateModel(@RequestBody ModelEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = modelService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex.getMessage(), -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氫釜妯″瀷") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ModelEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updateModels", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateModels(@RequestBody List<ModelEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (ModelEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = modelService.updates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex.getMessage(), -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/show/OneMapController.java b/src/main/java/com/lf/server/controller/show/OneMapController.java deleted file mode 100644 index 0f114da..0000000 --- a/src/main/java/com/lf/server/controller/show/OneMapController.java +++ /dev/null @@ -1,389 +0,0 @@ -package com.lf.server.controller.show; - - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.show.OneMapEntity; -import com.lf.server.service.show.OneMapService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * 绠$綉涓�寮犲浘 - * aFigurePipelineNetwork - * - * @author xing - * @date 2023/02/13 - */ - -@Api(tags = "缁煎悎灞曠ず\\绠$綉涓�寮犲浘") -@RestController -@RequestMapping("/oneMap") -public class OneMapController extends BaseController { - - @Autowired - OneMapService aMapOfPipelineService; - - - //============[椤圭洰缁熻 project Statistics]================== - - /** - * 椤圭洰绫诲埆 - * Project category - */ - @SysLog() - @ApiOperation(value = "椤圭洰绫诲埆") - @GetMapping("/countProjectCategory") - public ResponseMsg<Object> projectCategoryCount() { - List<String> resList = aMapOfPipelineService.projectCategoryCount(); - return success(resList); - } - - /** - * 椤圭洰浣嶇疆鍒嗗竷鎺ュ彛 - * Project location - */ - @SysLog() - @ApiOperation(value = "椤圭洰浣嶇疆鍒嗗竷鎺ュ彛") - @GetMapping("/countProjectLocation") - public ResponseMsg<Object> projectLocationCount() { - List<String> resList = aMapOfPipelineService.projectLocationCount(); - return success(resList); - } - - - /** - * 鍥藉缁村害-鏁伴噺缁熻 - * Country dimension - */ - @SysLog() - @ApiOperation(value = "鍥藉缁村害-鏁伴噺缁熻") - @GetMapping("/countCountryDimension") - public ResponseMsg<Object> countryDimensionCount() { - List<String> resList = aMapOfPipelineService.countryDimensionCount(); - return success(resList); - } - - /** - * 鐪佺淮搴�-鏁伴噺缁熻 - * Province dimension - quantity - */ - @SysLog() - @ApiOperation(value = "鐪佺淮搴�-鏁伴噺缁熻") - @GetMapping("/countProvinceDimension") - public ResponseMsg<Object> provinceDimensionCount() { - List<String> resList = aMapOfPipelineService.provinceDimensionCount(); - return success(resList); - } - - /** - * 鍏ㄥ浗缁村害-鎸夌収椤硅嚜绫诲瀷缁熻涓嶅悓椤圭洰涓暟 - * Count the number of different items according to their type - */ - @SysLog() - @ApiOperation(value = "鍏ㄥ浗缁村害-鎸夌収椤硅嚜绫诲瀷缁熻涓嶅悓椤圭洰涓暟") - @GetMapping("/countProjectTypeNumber") - public ResponseMsg<Object> countProjectTypeNumber() { - List<String> resList = aMapOfPipelineService.countProjectTypeNumber(); - return success(resList); - } - - - //============[鏁版嵁缁熻 data Statistics]================== - - /** - * 鏁版嵁缁熻 - * 鏁版嵁瀛樺偍 - * data storage - */ - @SysLog() - @ApiOperation(value = "鏁版嵁瀛樺偍缁熻") - @GetMapping("/countDataStorage") - public ResponseMsg<Object> dataStorageCount() { - List<String> resList = aMapOfPipelineService.dataStorageCount(); - return success(resList); - } - - /** - * 鏁版嵁澶х被缁熻 - * Statistics of large categories of data - */ - @SysLog() - @ApiOperation(value = "鏁版嵁澶х被缁熻") - @GetMapping("/countLargeCategories") - public ResponseMsg<Object> statisticalDataCategories() { - List<String> resList = aMapOfPipelineService.statisticalDataCategories(); - return success(resList); - } - - /** - * 鏁版嵁鏈嶅姟绫诲瀷缁熻 - * Data service type statistics - */ - @SysLog() - @ApiOperation(value = "鏁版嵁鏈嶅姟绫诲瀷缁熻") - @GetMapping("/countDataServiceType") - public ResponseMsg<Object> statisticalDataServiceType() { - List<String> resList = aMapOfPipelineService.statisticalDataServiceType(); - return success(resList); - } - - /** - * 鐧诲綍娆℃暟缁熻 - * Number of logins - */ - @SysLog() - @ApiOperation(value = "鐧诲綍娆℃暟缁熻") - @GetMapping("/countLoginNumber") - public ResponseMsg<Object> loginNumberStatistics() { - List<String> resList = aMapOfPipelineService.loginNumberStatistics(); - return success(resList); - } - - - /** - * 鏁版嵁缁熻 - * 鏂囦欢鏍煎紡缁村害-鏂囦欢涓暟 - * File format dimension - */ - @SysLog() - @ApiOperation(value = "鏂囦欢鏍煎紡缁村害-鏂囦欢涓暟") - @GetMapping("/countFileFormat") - public ResponseMsg<Object> fileFormatCount() { - List<String> resList = aMapOfPipelineService.fileFormatCount(); - return success(resList); - } - - /** - * 鏁版嵁缁熻 - * 鏁版嵁鐢宠 - * Data application - */ - @SysLog() - @ApiOperation(value = "鏁版嵁鐢宠") - @GetMapping("/countDataApply") - public ResponseMsg<Object> dataApplyCount() { - List<String> resList = aMapOfPipelineService.dataApplyCount(); - return success(resList); - } - - /** - * 鏁版嵁缁熻 - * 璁块棶娆℃暟 - * Number of visits - */ - @SysLog() - @ApiOperation(value = "璁块棶娆℃暟") - @GetMapping("/countDataVisit") - public ResponseMsg<Object> dataVisitCount() { - List<String> resList = aMapOfPipelineService.dataVisitCount(); - return success(resList); - } - - /** - * 涓嬭浇閲忕粺璁� - * Download statistics - * <p>type绫诲瀷锛�1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡<p/> - */ - @SysLog() - @ApiOperation(value = "涓嬭浇閲忕粺璁�") - @GetMapping("/countDownloads") - public ResponseMsg<Object> countDownloads() { - List<String> resList = aMapOfPipelineService.countDownloads(); - return success(resList); - } - - - /** - * 椤圭洰宸ョ▼灞曠ず - * Project engineering display - */ - @SysLog() - @ApiOperation(value = "椤圭洰宸ョ▼灞曠ず") - @GetMapping("/countProjectDisplay") - public ResponseMsg<Object> countProjectDisplay() { - List<String> resList = aMapOfPipelineService.countProjectDisplay(); - return success(resList); - } - - /** - * 椤圭洰宸ョ▼宸¤鍒楄〃 - * Project inspection tour - */ - @SysLog() - @ApiOperation(value = "椤圭洰宸ョ▼宸¤鍒楄〃") - @GetMapping("/selectProjectTour") - public ResponseMsg<Object> selectProjectTour() { - List<String> resList = aMapOfPipelineService.selectProjectTour(); - return success(resList); - } - - - /** - * 宸ョ▼椤圭洰鐩綍 - * Project Catalog - */ - @SysLog() - @ApiOperation(value = "宸ョ▼椤圭洰鐩綍") - @GetMapping("/selectProjectType") - public ResponseMsg<Object> selectProjectType() { - List<OneMapEntity> resList = aMapOfPipelineService.selectProjectType1(); - return success(resList); - } - - /** - * 鏍规嵁琛ㄥ悕鏌ヨ琛ㄥ瓧娈典俊鎭� - * Query table field information according to table name - */ - @ApiOperation(value = "鏍规嵁琛ㄥ悕鏌ヨ琛ㄥ瓧娈典俊鎭�") - @GetMapping("/selectTableInfo") - public ResponseMsg<Object> selectTableInfo(@RequestParam("tableName") String tableName) { - List<String> resList = aMapOfPipelineService.queryTableInfo(tableName); - return success(resList); - } - - - //============[涓撻灞曠ず Thematic presentations]================== - - /** - * 鍏ㄧ悆绠$綉鍥� - * Global pipe network map - */ - @SysLog() - @ApiOperation(value = "鍏ㄧ悆绠$綉鍥�") - @GetMapping("/countGlobalPipeMap") - public ResponseMsg<Object> countGlobalPipeMap() { - List<String> resList = aMapOfPipelineService.countGlobalPipeMap(); - return success(resList); - } - - /** - * 鍏ㄥ浗绠$綉鍥� - * National pipe network map - */ - @SysLog() - @ApiOperation(value = "鍏ㄥ浗绠$綉鍥�") - @GetMapping("/countNationalPipeMap") - public ResponseMsg<Object> countNationalPipeMap() { - List<String> resList = aMapOfPipelineService.countNationalPipeMap(); - return success(resList); - } - - /** - * 鍏ㄥ浗绠$綉鍥捐緭閫佷粙璐ㄩ暱搴� - * National pipe network diagram conveying medium length - */ - @SysLog() - @ApiOperation(value = "鍏ㄥ浗绠$綉鍥捐緭閫佷粙璐ㄩ暱搴�") - @GetMapping("/countZhPipeMapLength") - public ResponseMsg<Object> countZhPipeMapLenByMed() { - List<String> resList = aMapOfPipelineService.countZhPipeMapLenByMed(); - return success(resList); - } - - /** - * 缁熻鍏ㄥ浗绔欏満搴ф暟 - * Number of station seats nationwide - */ - @SysLog() - @ApiOperation(value = "鍏ㄥ浗绔欏満搴ф暟銆侀榾瀹ゃ�佺閬撴暟绛�") - @GetMapping("/countZhPipeStations") - public ResponseMsg<Object> countZhPipeStations() { - List<String> resList = aMapOfPipelineService.countZhPipeStations(); - return success(resList); - } - - /** - * 鎸夐」鐩粺璁¢」鐩瓨鍌ㄩ噺 - * Count the amount of project storage by project - */ - @SysLog() - @ApiOperation(value = "鎸夐」鐩粺璁¢」鐩瓨鍌ㄩ噺") - @GetMapping("/countStorageByProject") - public ResponseMsg<Object> countStorageByProject() { - List<String> resList = aMapOfPipelineService.countStorageByProject(); - return success(resList); - } - - - //============[宸ョ▼灞曠ず Engineering Showcase]================== - - /** - * 椤圭洰淇℃伅鏌ヨ - * Project information query - */ - @SysLog() - @ApiOperation(value = "椤圭洰淇℃伅鏌ヨ") - @GetMapping("/selectProjectInfo") - public ResponseMsg<Object> selectProjectInfo(@RequestParam("projectCode") String projectCode) { - List<String> resList = aMapOfPipelineService.selectProjectInfo(projectCode); - return success(resList); - } - /** - * 椤圭洰鏂囦欢鍒楄〃鏌ヨ - * Project file list query - */ - @SysLog() - @ApiOperation(value = "椤圭洰鏂囦欢鍒楄〃鏌ヨ") - @GetMapping("/selectProjectFileList") - public ResponseMsg<Object> selectProjectFileList() { - List<String> resList = aMapOfPipelineService.selectProjectFileList(); - return success(resList); - } - - /** - * 鍗曚釜椤圭洰瀛樺偍閲� - * - * @param projectCode 椤圭洰浠g爜 - * @return {@link ResponseMsg}<{@link Object}> - */ - @SysLog() - @ApiOperation(value = "鍗曚釜椤圭洰瀛樺偍閲�") - @GetMapping("/countProjectStorage") - public ResponseMsg<Object> countProjectStorage(@RequestParam("projectCode") String projectCode) { - List<String> resList = aMapOfPipelineService.countProjectStorage(projectCode); - return success(resList); - } - - /** - * 鍗曚釜椤圭洰鏂囦欢鏁伴噺 - * The number of individual project files - * - * @param projectCode 椤圭洰浠g爜 - * @return {@link ResponseMsg}<{@link Object}> - */ - @SysLog() - @ApiOperation(value = "鍗曚釜椤圭洰鏂囦欢绫诲瀷鏁伴噺") - @GetMapping("/countProjectType") - public ResponseMsg<Object> countProjectType(@RequestParam("projectCode") String projectCode) { - List<String> resList = aMapOfPipelineService.countProjectType(projectCode); - return success(resList); - } - - - /** - * 缁熻椤圭洰涓� - * 鍗曚釜椤圭洰涓嬭浇閲� - * - * @param projectCode 椤圭洰浠g爜 - * @return {@link ResponseMsg}<{@link Object}> - */ - @SysLog() - @ApiOperation(value = "鍗曚釜椤圭洰涓嬭浇閲�") - @GetMapping("/countProjectDown") - public ResponseMsg<Object> countProjectDown(@RequestParam("projectCode") String projectCode) { - List<String> resList = aMapOfPipelineService.countProjectDown(projectCode); - return success(resList); - } - - - -} diff --git a/src/main/java/com/lf/server/controller/show/PipelineController.java b/src/main/java/com/lf/server/controller/show/PipelineController.java deleted file mode 100644 index c57fc39..0000000 --- a/src/main/java/com/lf/server/controller/show/PipelineController.java +++ /dev/null @@ -1,263 +0,0 @@ -package com.lf.server.controller.show; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.show.PipelineEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.Md5Helper; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.show.PipelineService; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.net.URLDecoder; -import java.nio.charset.StandardCharsets; -import java.util.*; - -/** - * 绠¢亾鍒嗘瀽 - * @author WWW - */ -@Api(tags = "缁煎悎灞曠ず\\绠¢亾鍒嗘瀽") -@RestController -@RequestMapping("/pipeline") -public class PipelineController extends BaseController { - @Autowired - TokenService tokenService; - - @Autowired - DownlogService downlogService; - - @Autowired - DownloadService downloadService; - - @Autowired - PipelineService pipelineService; - - @SysLog() - @ApiOperation(value = "鏌ヨ绠℃") - @GetMapping(value = "/selectSegNames") - public ResponseMsg<Object> selectSegNames() { - try { - List<PipelineEntity> rs = pipelineService.selectSegNames(); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ绠$嚎鍒嗘瀽") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pe", value = "绠¢亾鍒嗘瀽瀹炰綋绫�", dataType = "PipelineEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/selectPipeAnalysis") - public ResponseMsg<Object> selectPipeAnalysis(@RequestBody PipelineEntity pe) { - try { - if (null == pe.getGid() || pe.getGid() < 1) { - return fail("璇疯緭鍏ョ娈礗D"); - } - if (null == pe.getTabs() || 0 == pe.getTabs().size()) { - return fail("璇疯緭鍏ヨ〃鍚�"); - } - if (!checkTabs(pe.getTabs())) { - return fail("瀛樺湪闈炴硶琛ㄥ悕"); - } - - Map<String, Object> map = new HashMap<>(4); - for (String tab : pe.getTabs()) { - List<PipelineEntity> rs = pipelineService.selectPipeAnalysis(tab, pe.getGid()); - map.put(tab, rs); - } - - return success(map); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "璇锋眰绠¢亾鍒嗘瀽缁撴灉涓嬭浇") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pe", value = "绠¢亾鍒嗘瀽瀹炰綋绫�", dataType = "PipelineEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/downloadReq") - public ResponseMsg<Object> downloadReq(@RequestBody PipelineEntity pe, HttpServletRequest req) { - try { - if (null == pe || StringHelper.isEmpty(pe.getPwd())) { - return fail("瀵嗙爜涓嶈兘涓虹┖"); - } - if (null == pe.getTabs() || 0 == pe.getTabs().size()) { - return fail("璇疯緭鍏ヨ〃鍚�"); - } - if (!checkTabs(pe.getTabs())) { - return fail("瀛樺湪闈炴硶琛ㄥ悕"); - } - if (!DownloadService.decryptPwd(pe)) { - return fail("瀵嗙爜瑙e瘑澶辫触", null); - } - if (StringHelper.isPwdInvalid(pe.getPwd())) { - return fail("瀵嗙爜涓嶇鍚堣姹�"); - } - - Map<String, List<PipelineEntity>> map = new HashMap<>(4); - for (String tab : pe.getTabs()) { - List<PipelineEntity> rs = pipelineService.selectPipeAnalysis(tab, pe.getGid()); - if (null != rs && rs.size() > 0) { - map.put(tab, rs); - } - } - if (map.size() == 0) { - return fail("鏌ユ棤鏁版嵁"); - } - - UserEntity ue = tokenService.getCurrentUser(req); - String guid = pipelineService.createZipFile(ue, map, pe.getPwd()); - - return success(guid); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectPageCountForDownload") - public ResponseMsg<List<DownloadEntity>> selectPageCountForDownload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", null); - } - - int count = downloadService.selectCountForUser(ue.getId(), "5", name); - if (count == 0) { - return success(0, null); - } - List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), "5", name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), - @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") - }) - @GetMapping(value = "/selectDownloadFile") - public ResponseMsg<Boolean> selectDownloadFile(String guid, String pwd) { - try { - if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { - return fail("鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", null); - } - if (!pwd.endsWith(StaticData.EQ)) { - pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); - } - - String password = DownloadService.decryptPwd(pwd); - if (null == password) { - return fail("瀵嗙爜瑙e瘑澶辫触", null); - } - - DownloadEntity de = downloadService.selectByGuid(guid); - if (null == de) { - return fail("鏂囦欢涓嶅瓨鍦�", null); - } - if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { - return fail("瀵嗙爜涓嶆纭�", null); - } - - String filePath = downloadService.getDownloadFilePath(de); - File file = new File(filePath); - - return success(file.exists()); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), - @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") - }) - @ResponseBody - @GetMapping(value = "/downloadFile") - public void downloadFile(String guid, String pwd, HttpServletRequest req, HttpServletResponse res) { - try { - if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { - WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", res); - } - if (!pwd.endsWith(StaticData.EQ)) { - pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); - } - - String password = DownloadService.decryptPwd(pwd); - if (null == password) { - WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "瀵嗙爜瑙e瘑澶辫触", res); - } - - DownloadEntity de = downloadService.selectByGuid(guid); - if (null == de) { - WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); - return; - } - if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { - WebHelper.writeInfo(HttpStatus.UNAUTHORIZED, "瀵嗙爜涓嶆纭�", res); - } - - UserEntity ue = tokenService.getCurrentUser(req); - downlogService.updateInfos(ue, de, req); - - String filePath = downloadService.getDownloadFilePath(de); - WebHelper.download(filePath, de.getName(), res); - } catch (Exception ex) { - WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); - } - } - - /** - * 妫�鏌ヨ〃鍚� - */ - private boolean checkTabs(List<String> tabs) { - for (String tab : tabs) { - if (!StaticData.PIPE_ANALYSIS_TABS.contains(tab)) { - return false; - } - } - - return true; - } -} diff --git a/src/main/java/com/lf/server/controller/sys/ArgsController.java b/src/main/java/com/lf/server/controller/sys/ArgsController.java deleted file mode 100644 index af3f642..0000000 --- a/src/main/java/com/lf/server/controller/sys/ArgsController.java +++ /dev/null @@ -1,263 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.ArgsEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.sys.ArgsService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鍙傛暟璁剧疆 - * @author WWW - */ -@Api(tags = "杩愮淮绠$悊\\绯荤粺閰嶇疆") -@RestController -@RequestMapping("/args") -public class ArgsController extends BaseController { - @Autowired - ArgsService argsService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "鏈夋晥鏈�") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String name) { - try { - int count = argsService.selectCount(name); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鏈夋晥鏈�"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<ArgsEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<ArgsEntity> rs = argsService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鏈夋晥鏈�"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<ArgsEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - int count = argsService.selectCount(name); - if (count == 0) { - return success(0, null); - } - List<ArgsEntity> rs = argsService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectAll") - public ResponseMsg<List<ArgsEntity>> selectAll() { - try { - List<ArgsEntity> list = argsService.selectAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<ArgsEntity> selectById(int id) { - try { - ArgsEntity entity = argsService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - /*@SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ArgsEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody ArgsEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = argsService.insert(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ArgsEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<ArgsEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (ArgsEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = argsService.inserts(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = argsService.delete(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = argsService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - }*/ - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ArgsEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody ArgsEntity entity, HttpServletRequest req) { - try { - ArgsEntity ae = argsService.selectById(entity.getId()); - if (ae == null) { - return fail("鎵句笉鍒板緟鏇存柊鐨勫疄浣�", -1); - } - if (entity.getCvalue() > ae.getMaxValue() || entity.getCvalue() < ae.getMinValue()) { - return fail("寰呮洿鏂扮殑鍊间笉鍦ㄦ湁鏁堣寖鍥村唴", -1); - } - ae.setCvalue(entity.getCvalue()); - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - ae.setUpdateUser(ue.getId()); - } - - int count = argsService.updateForValue(ae); - if (count > 0) { - argsService.updateSettingData(ae); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - /*@SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ArgsEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<ArgsEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (ArgsEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = argsService.updates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - }*/ -} diff --git a/src/main/java/com/lf/server/controller/sys/AuthController.java b/src/main/java/com/lf/server/controller/sys/AuthController.java deleted file mode 100644 index 07b13a7..0000000 --- a/src/main/java/com/lf/server/controller/sys/AuthController.java +++ /dev/null @@ -1,274 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.AuthEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.PermsService; -import com.lf.server.service.sys.AuthService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鏉冮檺琛� - * @author SWS - * @date 2022-09.28 - */ -@Api(tags = "杩愮淮绠$悊\\鏉冮檺绠$悊") -@RestController -@RequestMapping("/auth") -public class AuthController extends BaseController { - @Autowired - AuthService authService; - - @Autowired - TokenService tokenService; - - @Autowired - PermsService permsService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "sys_auth") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String name) { - try { - int count = authService.selectCount(name); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "sys_auth"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<AuthEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - List<AuthEntity> rs = authService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<AuthEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = authService.selectCount(name); - if (count == 0) { - return success(0, null); - } - - List<AuthEntity> rs = authService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鑿滃崟鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageForMenu") - public ResponseMsg<List<AuthEntity>> selectByPageForMenu(Integer menuid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = authService.selectCountForMenu(menuid); - if (count == 0) { - return success(0, null); - } - - List<AuthEntity> rs = authService.selectByPageForMenu(menuid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.AuthEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertAuth", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertAuth(@RequestBody AuthEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = authService.insertAuth(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<AuthEntity>", paramType = "body", example = "") - }) - @PostMapping(value = "/insertAuths", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertAuths(@RequestBody List<AuthEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (AuthEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = authService.insertAuths(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteAuth") - public ResponseMsg<Integer> deleteAuth(int id) { - try { - int count = authService.deleteAuth(id); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteAuths") - public ResponseMsg<Integer> deleteAuths(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = authService.deleteAuths(ids); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "LoginEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateAuth", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateAuth(@RequestBody AuthEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = authService.updateAuth(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectAuth") - public ResponseMsg<AuthEntity> selectAuth(int id) { - try { - AuthEntity authEntity = authService.selectAuth(id); - - return success(authEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectAuthAll") - public ResponseMsg<List<AuthEntity>> selectAuthAll() { - try { - List<AuthEntity> list = authService.selectAuthAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/BlacklistController.java b/src/main/java/com/lf/server/controller/sys/BlacklistController.java deleted file mode 100644 index c33692b..0000000 --- a/src/main/java/com/lf/server/controller/sys/BlacklistController.java +++ /dev/null @@ -1,254 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.BlacklistEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.sys.BlacklistService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 榛戝悕鍗� - * @author WWW - */ -@Api(tags = "杩愮淮绠$悊\\榛戝悕鍗�") -@RestController -@RequestMapping("/blacklist") -public class BlacklistController extends BaseController { - @Autowired - BlacklistService blacklistService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ip", value = "IP鍦板潃", dataType = "String", paramType = "query", required = false, example = "192."), - @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String ip, Integer type) { - try { - int count = blacklistService.selectCount(ip, type); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ip", value = "IP鍦板潃", dataType = "String", paramType = "query", example = "192."), - @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<BlacklistEntity>> selectByPage(String ip, Integer type, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<BlacklistEntity> rs = blacklistService.selectByPage(ip, type, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ip", value = "IP鍦板潃", dataType = "String", paramType = "query", required = false, example = "192."), - @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<BlacklistEntity>> selectByPageAndCount(String ip, Integer type, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - int count = blacklistService.selectCount(ip, type); - if (count == 0) { - return success(0, null); - } - List<BlacklistEntity> rs = blacklistService.selectByPage(ip, type, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectAll") - public ResponseMsg<List<BlacklistEntity>> selectAll() { - try { - List<BlacklistEntity> list = blacklistService.selectAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<BlacklistEntity> selectById(int id) { - try { - BlacklistEntity entity = blacklistService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "BlacklistEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody BlacklistEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = blacklistService.insert(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "BlacklistEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<BlacklistEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (BlacklistEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = blacklistService.inserts(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = blacklistService.delete(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = blacklistService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "BlacklistEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody BlacklistEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = blacklistService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "BlacklistEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<BlacklistEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (BlacklistEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = blacklistService.updates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/CtrlController.java b/src/main/java/com/lf/server/controller/sys/CtrlController.java deleted file mode 100644 index dea8a01..0000000 --- a/src/main/java/com/lf/server/controller/sys/CtrlController.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.lf.server.controller.sys; - -import com.alibaba.fastjson.JSONObject; -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.ResEntity; -import com.lf.server.service.all.ScheduleService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * 鎺у埗鍙版帶鍒跺櫒 - * @author WWW - * @date 2022-09-21 - */ -@Api(tags = "杩愮淮绠$悊\\鎺у埗鍙�") -@RestController -@RequestMapping("/ctrl") -public class CtrlController extends BaseController { - @Autowired - private ScheduleService scheduleService; - - @SysLog() - @ApiOperation(value = "鏌ヨ鏈嶅姟鍣ㄧ姸鎬�") - @GetMapping(value = "/selectServerStatus") - public ResponseMsg<JSONObject> selectServerStatus() { - try { - JSONObject jsonObject = scheduleService.selectServerStatus(); - - return success(jsonObject); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨCpu淇℃伅") - @GetMapping(value = "/selectCpuInfo") - public ResponseMsg<JSONObject> selectCpuInfo() { - try { - JSONObject jsonObject = scheduleService.selectCpuInfo(); - - return success(jsonObject); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍐呭瓨淇℃伅") - @GetMapping(value = "/selectMemInfo") - public ResponseMsg<JSONObject> selectMemInfo() { - try { - JSONObject jsonObject = scheduleService.selectMemInfo(); - - return success(jsonObject); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鍦ㄧ嚎鐢ㄦ埛") - @GetMapping(value = "/selectOnlineUsers") - public ResponseMsg<List<JSONObject>> selectOnlineUsers() { - try { - List<JSONObject> list = scheduleService.selectOnlineUsers(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏈嶅姟璧勬簮鐘舵��") - @GetMapping(value = "/selectResStatus") - public ResponseMsg<List<ResEntity>> selectResStatus() { - try { - List<ResEntity> list = scheduleService.selectResStatus(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/DepController.java b/src/main/java/com/lf/server/controller/sys/DepController.java deleted file mode 100644 index 7e9f046..0000000 --- a/src/main/java/com/lf/server/controller/sys/DepController.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.DepEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.sys.DepService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 缁勭粐鏈烘瀯 - * @author sws - * @date 2022-09-23 - */ -@Api(tags = "杩愮淮绠$悊\\鍗曚綅绠$悊") -@RestController -@RequestMapping("/dep") -public class DepController extends BaseController { - @Autowired - DepService depService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.DepEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertDep", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertDep(@RequestBody DepEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = depService.insertDep(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "com.lf.server.entity.sys.DepEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertDes", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertDes(@RequestBody List<DepEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (DepEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = depService.insertDeps(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteDep") - public ResponseMsg<Integer> deleteDep(int id) { - try { - int count = depService.deleteDep(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteDeps") - public ResponseMsg<Integer> deleteDeps(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = depService.deleteDeps(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DepEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateDep", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateDep(@RequestBody DepEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = depService.updateDep(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DepEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updateDeps", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateDeps(@RequestBody List<DepEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (DepEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = depService.updateDeps(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectDep") - public ResponseMsg<DepEntity> selectDep(int id) { - try { - DepEntity de = depService.selectDep(id); - return success(de); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") - @GetMapping(value = "/selectDepAll") - public ResponseMsg<List<DepEntity>> selectDepAll() { - try { - List<DepEntity> list = depService.selectDepAll(); - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "閫掑綊鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍗曚綅鍚嶇О", dataType = "String", paramType = "query", required = false, example = "涓浗xxx宸ョ▼鏈夐檺鍏徃") - }) - @GetMapping(value = "/selectDepRecursive") - public ResponseMsg<List<DepEntity>> selectDepRecursive(String name) { - try { - if (StringHelper.isEmpty(name)) { - name = "涓浗xxx宸ョ▼鏈夐檺鍏徃"; - } - List<DepEntity> list = depService.selectDepRecursive(name); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/DownlogController.java b/src/main/java/com/lf/server/controller/sys/DownlogController.java deleted file mode 100644 index 1cec9a3..0000000 --- a/src/main/java/com/lf/server/controller/sys/DownlogController.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.DownlogEntity; -import com.lf.server.service.sys.DownlogService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.sql.Timestamp; -import java.util.List; - -/** - * 涓嬭浇鏃ュ織 - * @author WWW - */ -@Api(tags = "杩愮淮绠$悊\\涓嬭浇鏃ュ織") -@RestController -@RequestMapping("/downlog") -public class DownlogController extends BaseController { - @Autowired - DownlogService downlogService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "鍛�"), - @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "3"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-12-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-12-25 17:00:00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<Object> selectByPageAndCount(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = downlogService.selectCount(uname, type, start, end); - if (count == 0) { - return success(0, null); - } - - List<DownlogEntity> rs = downlogService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/LoginController.java b/src/main/java/com/lf/server/controller/sys/LoginController.java deleted file mode 100644 index b6498da..0000000 --- a/src/main/java/com/lf/server/controller/sys/LoginController.java +++ /dev/null @@ -1,237 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.LoginEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.sys.LoginService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.sql.Timestamp; -import java.util.List; - -/** - * 鐧诲綍鏃ュ織 - * @author SWS - * @date 2022-09.28 - */ -@Api(tags = "杩愮淮绠$悊\\鐧诲綍鏃ュ織") -@RestController -@RequestMapping("/login") -public class LoginController extends BaseController { - @Autowired - LoginService loginService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), - @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String uname, Integer type, Timestamp start, Timestamp end) { - try { - int count = loginService.selectCount(uname, type, start, end); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), - @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<LoginEntity>> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - List<LoginEntity> rs = loginService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), - @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<LoginEntity>> selectByPageAndCount(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = loginService.selectCount(uname, type, start, end); - if (count == 0) { - return success(0, null); - } - - List<LoginEntity> rs = loginService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.LoginEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertLogin", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertLogin(@RequestBody LoginEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUserid(ue.getId()); - } - - int count = loginService.insertLogin(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<LoginEntity>", paramType = "body", example = "") - }) - @PostMapping(value = "/insertLogins", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertLogins(@RequestBody List<LoginEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (LoginEntity entity : list) { - entity.setUserid(ue.getId()); - } - } - - int count = loginService.insertLogins(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteLogin") - public ResponseMsg<Integer> deleteLogin(int id) { - try { - int count = loginService.deleteLogin(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteLogins") - public ResponseMsg<Integer> deleteLogins(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - int count = loginService.deleteLogins(ids); - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "LoginEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateLogin", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateLogin(@RequestBody LoginEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUserid(ue.getId()); - } - - int count = loginService.updateLogin(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectLogin") - public ResponseMsg<LoginEntity> selectLogin(int id) { - try { - LoginEntity loginEntity = loginService.selectLogin(id); - - return success(loginEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectLoginAll") - public ResponseMsg<List<LoginEntity>> selectLoginAll() { - try { - List<LoginEntity> list = loginService.selectLoginAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/MenuAuthController.java b/src/main/java/com/lf/server/controller/sys/MenuAuthController.java deleted file mode 100644 index c76cca2..0000000 --- a/src/main/java/com/lf/server/controller/sys/MenuAuthController.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.MenuAuthEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.PermsService; -import com.lf.server.service.sys.MenuAuthService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鑿滃崟-鏉冮檺 - * @author WWW - */ -@Api(tags = "杩愮淮绠$悊\\鑿滃崟鏉冮檺") -@RestController -@RequestMapping("/menuAuth") -public class MenuAuthController extends BaseController { - @Autowired - MenuAuthService menuAuthService; - - @Autowired - TokenService tokenService; - - @Autowired - PermsService permsService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", required = false, example = "") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(Integer menuid) { - try { - int count = menuAuthService.selectCount(menuid); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<MenuAuthEntity>> selectByPage(Integer menuid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<MenuAuthEntity> rs = menuAuthService.selectByPage(menuid, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<MenuAuthEntity>> selectByPageAndCount(Integer menuid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - int count = menuAuthService.selectCount(menuid); - if (count == 0) { - return success(0, null); - } - List<MenuAuthEntity> rs = menuAuthService.selectByPage(menuid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁瑙掕壊ID+鑿滃崟ID鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageForRole") - public ResponseMsg<List<MenuAuthEntity>> selectByPageForRole(Integer roleid, Integer menuid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = menuAuthService.selectCountForRole(roleid, menuid); - if (count == 0) { - return success(0, null); - } - - List<MenuAuthEntity> rs = menuAuthService.selectByPageForRole(roleid, menuid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectAll") - public ResponseMsg<List<MenuAuthEntity>> selectAll() { - try { - List<MenuAuthEntity> list = menuAuthService.selectAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<MenuAuthEntity> selectById(int id) { - try { - MenuAuthEntity entity = menuAuthService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MenuAuthEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody MenuAuthEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = menuAuthService.insert(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MenuAuthEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<MenuAuthEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (MenuAuthEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = menuAuthService.inserts(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = menuAuthService.delete(id); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = menuAuthService.deletes(ids); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MenuAuthEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody MenuAuthEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = menuAuthService.update(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MenuAuthEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<MenuAuthEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (MenuAuthEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = menuAuthService.updates(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/MenuController.java b/src/main/java/com/lf/server/controller/sys/MenuController.java deleted file mode 100644 index 36fcc95..0000000 --- a/src/main/java/com/lf/server/controller/sys/MenuController.java +++ /dev/null @@ -1,232 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.data.DirEntity; -import com.lf.server.entity.sys.MenuEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.all.PermsService; -import com.lf.server.service.sys.MenuService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鑿滃崟 - * @author sws - * @date 2022-09-23 - */ -@Api(tags= "杩愮淮绠$悊\\鑿滃崟绠$悊") -@RestController -@RequestMapping("/menu") -public class MenuController extends BaseController { - @Autowired - MenuService menuService; - - @Autowired - TokenService tokenService; - - @Autowired - PermsService permsService; - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.MenusEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertMenu", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertMenu(@RequestBody MenuEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = menuService.insertMenu(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "com.lf.server.entity.sys.MenusEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertMenus", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertMenus(@RequestBody List<MenuEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (MenuEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = menuService.insertMenus(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteMenu") - public ResponseMsg<Integer> deleteMenu(int id) { - try { - int count = menuService.deleteMenu(id); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteMenus") - public ResponseMsg<Integer> deleteMenus(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = menuService.deleteMenus(ids); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MenusEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateMenu", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateMenu(@RequestBody MenuEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = menuService.updateMenu(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MenusEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateMenus", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateMenus(@RequestBody List<MenuEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (MenuEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = menuService.updateMenus(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectMenu") - public ResponseMsg<MenuEntity> selectMenu(int id) { - try { - MenuEntity menuEntity = menuService.selectMenu(id); - - return success(menuEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectMenuAll") - public ResponseMsg<List<MenuEntity>> selectMenuAll() { - try { - List<MenuEntity> list = menuService.selectMenuAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "閫掑綊鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鑿滃崟鍚嶇О", dataType = "String", paramType = "query", required = false, example = "绠¢亾鍩虹澶ф暟鎹钩鍙�") - }) - @GetMapping(value = "/selectMenuRecursive") - public ResponseMsg<Object> selectMenuRecursive(String name) { - try { - if (StringHelper.isEmpty(name)) { - name = "绠¢亾鍩虹澶ф暟鎹钩鍙�"; - } - List<MenuEntity> list = menuService.selectMenuRecursive(name); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/OperateController.java b/src/main/java/com/lf/server/controller/sys/OperateController.java deleted file mode 100644 index 6a84756..0000000 --- a/src/main/java/com/lf/server/controller/sys/OperateController.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.OperateEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.sys.OperateService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.sql.Timestamp; -import java.util.List; - -/** - * 鎿嶄綔鏃ュ織 - * @author SWS - * @date 2022-09.28 - */ -@Api(tags = "杩愮淮绠$悊\\鎿嶄綔鏃ュ織") -@RestController -@RequestMapping("/operate") -public class OperateController extends BaseController { - @Autowired - OperateService operateService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), - @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String uname, Integer type, Timestamp start, Timestamp end) { - try { - int count = operateService.selectCount(uname, type, start, end); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), - @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<OperateEntity>> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - List<OperateEntity> rs = operateService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), - @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<OperateEntity>> selectByPageAndCount(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = operateService.selectCount(uname, type, start, end); - if (count == 0) { - return success(0, null); - } - - List<OperateEntity> rs = operateService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.OperateEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertOperate", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertOperate(@RequestBody OperateEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUserid(ue.getId()); - } - - int count = operateService.insertOperate(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<OperateEntity>", paramType = "body", example = "") - }) - @PostMapping(value = "/insertOperates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertOperates(@RequestBody List<OperateEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (OperateEntity entity : list) { - entity.setUserid(ue.getId()); - } - } - - int count = operateService.insertOperates(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteOperate") - public ResponseMsg<Integer> deleteOperate(int id) { - try { - int count = operateService.deleteOperate(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteOperates") - public ResponseMsg<Integer> deleteOperates(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - int count = operateService.deleteOperates(ids); - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "OperateEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateOperate", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateOperate(@RequestBody OperateEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUserid(ue.getId()); - } - - int count = operateService.updateOperate(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectOperate") - public ResponseMsg<OperateEntity> selectOperate(int id) { - try { - OperateEntity operateEntity = operateService.selectOperate(id); - - return success(operateEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectOperateAll") - public ResponseMsg<List<OperateEntity>> selectOperateAll() { - try { - List<OperateEntity> list = operateService.selectOperateAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/ReportController.java b/src/main/java/com/lf/server/controller/sys/ReportController.java deleted file mode 100644 index f51c527..0000000 --- a/src/main/java/com/lf/server/controller/sys/ReportController.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.ReportEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.UploadAttachService; -import com.lf.server.service.sys.ReportService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 鎶ュ憡妯℃澘 - * @author WWW - */ -@Api(tags = "杩愮淮绠$悊\\妯℃澘绠$悊") -@RestController -@RequestMapping("/report") -public class ReportController extends BaseController { - @Autowired - ReportService reportService; - - @Autowired - TokenService tokenService; - - @Autowired - UploadAttachService uploadAttachService; - - private final static String TAB_NAME = "lf.sys_report"; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<ReportEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = reportService.selectCount(name, null); - if (count == 0) { - return success(0, null); - } - - List<ReportEntity> rs = reportService.selectByPage(name, null, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<ReportEntity> selectById(int id) { - try { - ReportEntity entity = reportService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ReportEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody ReportEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = reportService.insert(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = reportService.delete(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = reportService.deletes(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ReportEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody ReportEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = reportService.update(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "涓婁紶鏂囦欢") - @ResponseBody - @PostMapping(value = "/upload") - public ResponseMsg<String> upload(@RequestParam("file") MultipartFile file, HttpServletRequest req) { - UserEntity ue = tokenService.getCurrentUser(req); - - return uploadAttachService.upload(ue, TAB_NAME, file, this); - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") - }) - @GetMapping(value = "/download") - public void download(String guid, HttpServletResponse res) { - uploadAttachService.download(guid, res); - } -} diff --git a/src/main/java/com/lf/server/controller/sys/ResController.java b/src/main/java/com/lf/server/controller/sys/ResController.java deleted file mode 100644 index a763bc1..0000000 --- a/src/main/java/com/lf/server/controller/sys/ResController.java +++ /dev/null @@ -1,316 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.ResEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.PermsService; -import com.lf.server.service.all.UploadAttachService; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.sys.ResService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 璧勬簮琛� - * @author SWS - * @date 2022-09.28 - */ -@Api(tags = "杩愮淮绠$悊\\璧勬簮绠$悊") -@RestController -@RequestMapping("/res") -public class ResController extends BaseController { - @Autowired - ResService resService; - - @Autowired - TokenService tokenService; - - @Autowired - PermsService permsService; - - @Autowired - DownloadService downloadService; - - @Autowired - UploadAttachService uploadAttachService; - - private final static String TAB_NAME = "lf.sys_res"; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "sys_res") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String name) { - try { - int count = resService.selectCount(name); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "sys_res"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<ResEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<ResEntity> rs = resService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "sys_res"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<ResEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = resService.selectCount(name); - if (count == 0) { - return success(0, null); - } - List<ResEntity> rs = resService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁瑙掕壊鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageForRole") - public ResponseMsg<List<ResEntity>> selectByPageForRole(Integer roleid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = resService.selectCountForRole(roleid); - if (count == 0) { - return success(0, null); - } - - List<ResEntity> rs = resService.selectByPageForRole(roleid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.ResEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertRes", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertRes(@RequestBody ResEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = resService.insertRes(entity); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<ResEntity>", paramType = "body", example = "") - }) - @PostMapping(value = "/insertRess", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertRess(@RequestBody List<ResEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (ResEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = resService.insertRess(list); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteRes") - public ResponseMsg<Integer> deleteRes(int id) { - try { - int count = resService.deleteRes(id); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteRess") - public ResponseMsg<Integer> deleteRess(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = resService.deleteRess(ids); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ResEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateRes", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateRes(@RequestBody ResEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = resService.updateRes(entity); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectRes") - public ResponseMsg<ResEntity> selectRes(int id) { - try { - ResEntity resEntity = resService.selectRes(id); - - return success(resEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectResAll") - public ResponseMsg<List<ResEntity>> selectResAll() { - try { - List<ResEntity> list = resService.selectResAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "涓婁紶鏂囦欢") - @ResponseBody - @PostMapping(value = "/upload") - public ResponseMsg<String> upload(@RequestParam("file") MultipartFile file, HttpServletRequest req) { - UserEntity ue = tokenService.getCurrentUser(req); - - return uploadAttachService.upload(ue, TAB_NAME, file, this); - } - - @SysLog() - @ApiOperation(value = "涓嬭浇鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") - }) - @GetMapping(value = "/download") - public void download(String guid, HttpServletResponse res) { - uploadAttachService.download(guid, false, res); - } - - @SysLog() - @ApiOperation(value = "鏌ョ湅鏂囦欢") - @ApiImplicitParams({ - @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") - }) - @GetMapping(value = "/downloadForView") - public void downloadForView(String guid, HttpServletResponse res) { - uploadAttachService.download(guid, true, res); - } -} diff --git a/src/main/java/com/lf/server/controller/sys/ResOpController.java b/src/main/java/com/lf/server/controller/sys/ResOpController.java deleted file mode 100644 index 19741f3..0000000 --- a/src/main/java/com/lf/server/controller/sys/ResOpController.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.ResOpEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.sys.ResOpService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.sql.Timestamp; -import java.util.List; - -/** - * 璧勬簮鎿嶄綔 - * @author SWS - * @date 2022-09.28 - */ -@Api(tags = "杩愮淮绠$悊\\璧勬簮鎿嶄綔") -@RestController -@RequestMapping("/resOp") -public class ResOpController extends BaseController { - @Autowired - ResOpService resOpService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "璧勬簮鍚嶇О", dataType = "String", paramType = "query", example = "澶╁湴鍥�"), - @ApiImplicitParam(name = "type", value = "鎿嶄綔绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"), - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String name, Integer type, Timestamp start, Timestamp end) { - try { - int count = resOpService.selectCount(name, type, start, end); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "璧勬簮鍚嶇О", dataType = "String", paramType = "query", example = "澶╁湴鍥�"), - @ApiImplicitParam(name = "type", value = "鎿嶄綔绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<ResOpEntity>> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - List<ResOpEntity> rs = resOpService.selectByPage(name, type, start, end, pageSize, pageSize * (pageIndex - 1)); - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "璧勬簮鍚嶇О", dataType = "String", paramType = "query", example = "澶╁湴鍥�"), - @ApiImplicitParam(name = "type", value = "鎿嶄綔绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<ResOpEntity>> selectByPageAndCount(String name, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = resOpService.selectCount(name, type, start, end); - if (count == 0) { - return success(0, null); - } - - List<ResOpEntity> rs = resOpService.selectByPage(name, type, start, end, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.ResOpEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertResOp", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertResOp(@RequestBody ResOpEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUserid(ue.getId()); - } - - int count = resOpService.insertResOp(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<ResOpEntity>", paramType = "body", example = "") - }) - @PostMapping(value = "/insertResOps", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertResOps(@RequestBody List<ResOpEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (ResOpEntity entity : list) { - entity.setUserid(ue.getId()); - } - } - - int count = resOpService.insertResOps(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteLogin") - public ResponseMsg<Integer> deleteResOp(int id) { - try { - int count = resOpService.deleteResOp(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteResOps") - public ResponseMsg<Integer> deleteResOps(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - int count = resOpService.deleteResOps(ids); - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "ID鏁扮粍", dataType = "LoginEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateResOp", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateResOp(@RequestBody ResOpEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUserid(ue.getId()); - } - - int count = resOpService.updateResOp(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectResOp") - public ResponseMsg<ResOpEntity> selectResOp(int id) { - try { - ResOpEntity resOpEntity = resOpService.selectResOp(id); - - return success(resOpEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectResOpAll") - public ResponseMsg<List<ResOpEntity>> selectResOpAll() { - try { - List<ResOpEntity> list = resOpService.selectResOpAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/RoleController.java b/src/main/java/com/lf/server/controller/sys/RoleController.java deleted file mode 100644 index 7bda6f4..0000000 --- a/src/main/java/com/lf/server/controller/sys/RoleController.java +++ /dev/null @@ -1,252 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.RoleEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.PermsService; -import com.lf.server.service.sys.RoleService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - *瑙掕壊琛� - * @author SWS - * @date 2022-09.28 - */ -@Api(tags = "杩愮淮绠$悊\\瑙掕壊绠$悊") -@RestController -@RequestMapping("/role") -public class RoleController extends BaseController { - @Autowired - RoleService roleService; - - @Autowired - TokenService tokenService; - - @Autowired - PermsService permsService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "Admin"), - @ApiImplicitParam(name = "depid", value = "鍗曚綅ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String name, Integer depid) { - try { - int count = roleService.selectCount(name, depid); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "Admin"), - @ApiImplicitParam(name = "depid", value = "鍗曚綅ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<RoleEntity>> selectByPage(String name, Integer depid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<RoleEntity> rs = roleService.selectByPage(name, depid, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "Admin"), - @ApiImplicitParam(name = "depid", value = "鍗曚綅ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<RoleEntity>> selectByPageAndCount(String name, Integer depid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = roleService.selectCount(name, depid); - if (count == 0) { - return success(0, null); - } - - List<RoleEntity> rs = roleService.selectByPage(name, depid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.RoleEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertRole", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertRole(@RequestBody RoleEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = roleService.insertRole(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<RoleEntity>", paramType = "body", example = "") - }) - @PostMapping(value = "/insertRoles", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertRoles(@RequestBody List<RoleEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (RoleEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = roleService.insertRoles(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteRole") - public ResponseMsg<Integer> deleteRole(int id) { - try { - int count = roleService.deleteRole(id); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteAuths") - public ResponseMsg<Integer> deleteRoles(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = roleService.deleteRoles(ids); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateRole", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateRole(@RequestBody RoleEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = roleService.updateRole(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectRole") - public ResponseMsg<RoleEntity> selectRole(int id) { - try { - RoleEntity roleEntity = roleService.selectRole(id); - - return success(roleEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectRoleAll") - public ResponseMsg<List<RoleEntity>> selectRoleAll() { - try { - List<RoleEntity> list = roleService.selectRoleAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/RoleMenuAuthController.java b/src/main/java/com/lf/server/controller/sys/RoleMenuAuthController.java deleted file mode 100644 index 9a3918c..0000000 --- a/src/main/java/com/lf/server/controller/sys/RoleMenuAuthController.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.RoleMenuAuthEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.PermsService; -import com.lf.server.service.sys.RoleMenuAuthService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 瑙掕壊-鑿滃崟 - * @author WWW - */ -@Api(tags = "杩愮淮绠$悊\\瑙掕壊鑿滃崟") -@RestController -@RequestMapping("/roleMenuAuth") -public class RoleMenuAuthController extends BaseController { - @Autowired - RoleMenuAuthService roleMenuAuthService; - - @Autowired - TokenService tokenService; - - @Autowired - PermsService permsService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", required = false, example = "") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(Integer roleid) { - try { - int count = roleMenuAuthService.selectCount(roleid); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<RoleMenuAuthEntity>> selectByPage(Integer roleid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<RoleMenuAuthEntity> rs = roleMenuAuthService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<RoleMenuAuthEntity>> selectByPageAndCount(Integer roleid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - int count = roleMenuAuthService.selectCount(roleid); - if (count == 0) { - return success(0, null); - } - List<RoleMenuAuthEntity> rs = roleMenuAuthService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁瑙掕壊ID+鑿滃崟ID鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageForRole") - public ResponseMsg<List<RoleMenuAuthEntity>> selectByPageForRole(Integer roleid, Integer menuid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = roleMenuAuthService.selectCountForRole(roleid, menuid); - if (count == 0) { - return success(0, null); - } - - List<RoleMenuAuthEntity> rs = roleMenuAuthService.selectByPageForRole(roleid, menuid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectAll") - public ResponseMsg<List<RoleMenuAuthEntity>> selectAll() { - try { - List<RoleMenuAuthEntity> list = roleMenuAuthService.selectAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<RoleMenuAuthEntity> selectById(int id) { - try { - RoleMenuAuthEntity entity = roleMenuAuthService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleMenuAuthEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody RoleMenuAuthEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = roleMenuAuthService.insert(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleMenuAuthEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<RoleMenuAuthEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (RoleMenuAuthEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = roleMenuAuthService.inserts(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = roleMenuAuthService.delete(id); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = roleMenuAuthService.deletes(ids); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleMenuAuthEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody RoleMenuAuthEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = roleMenuAuthService.update(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleMenuAuthEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<RoleMenuAuthEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (RoleMenuAuthEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = roleMenuAuthService.updates(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/RoleResController.java b/src/main/java/com/lf/server/controller/sys/RoleResController.java deleted file mode 100644 index e09b149..0000000 --- a/src/main/java/com/lf/server/controller/sys/RoleResController.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.RoleResEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.PermsService; -import com.lf.server.service.sys.RoleResService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 瑙掕壊-璧勬簮 - * @author WWW - */ -@Api(tags = "杩愮淮绠$悊\\瑙掕壊璧勬簮") -@RestController -@RequestMapping("/roleRes") -public class RoleResController extends BaseController { - @Autowired - RoleResService roleResService; - - @Autowired - TokenService tokenService; - - @Autowired - PermsService permsService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", required = false, example = "") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(Integer roleid) { - try { - int count = roleResService.selectCount(roleid); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<RoleResEntity>> selectByPage(Integer roleid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<RoleResEntity> rs = roleResService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<RoleResEntity>> selectByPageAndCount(Integer roleid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - int count = roleResService.selectCount(roleid); - if (count == 0) { - return success(0, null); - } - List<RoleResEntity> rs = roleResService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectAll") - public ResponseMsg<List<RoleResEntity>> selectAll() { - try { - List<RoleResEntity> list = roleResService.selectAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<RoleResEntity> selectById(int id) { - try { - RoleResEntity entity = roleResService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleResEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody RoleResEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = roleResService.insert(entity); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleResEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<RoleResEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (RoleResEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = roleResService.inserts(list); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = roleResService.delete(id); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = roleResService.deletes(ids); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleResEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody RoleResEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = roleResService.update(entity); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleResEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<RoleResEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (RoleResEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = roleResService.updates(list); - if (count > 0) { - permsService.clearResCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/RoleUserController.java b/src/main/java/com/lf/server/controller/sys/RoleUserController.java deleted file mode 100644 index e438bbc..0000000 --- a/src/main/java/com/lf/server/controller/sys/RoleUserController.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.RoleUserEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.all.PermsService; -import com.lf.server.service.sys.RoleUserService; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 瑙掕壊-鐢ㄦ埛 - * @author WWW - */ -@Api(tags = "杩愮淮绠$悊\\鐢ㄦ埛瑙掕壊") -@RestController -@RequestMapping("/roleUser") -public class RoleUserController extends BaseController { - @Autowired - RoleUserService roleUserService; - - @Autowired - TokenService tokenService; - - @Autowired - PermsService permsService; - - @SysLog() - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", required = false, example = "") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(Integer roleid) { - try { - int count = roleUserService.selectCount(roleid); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPage") - public ResponseMsg<List<RoleUserEntity>> selectByPage(Integer roleid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - List<RoleUserEntity> rs = roleUserService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); - - return success(rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<RoleUserEntity>> selectByPageAndCount(Integer roleid, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - int count = roleUserService.selectCount(roleid); - if (count == 0) { - return success(0, null); - } - List<RoleUserEntity> rs = roleUserService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectAll") - public ResponseMsg<List<RoleUserEntity>> selectAll() { - try { - List<RoleUserEntity> list = roleUserService.selectAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectById") - public ResponseMsg<RoleUserEntity> selectById(int id) { - try { - RoleUserEntity entity = roleUserService.selectById(id); - - return success(entity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleUserEntity", paramType = "body") - }) - @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insert(@RequestBody RoleUserEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = roleUserService.insert(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleUserEntity", paramType = "body") - }) - @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> inserts(@RequestBody List<RoleUserEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (RoleUserEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = roleUserService.inserts(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/delete") - public ResponseMsg<Integer> delete(int id) { - try { - int count = roleUserService.delete(id); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deletes") - public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = roleUserService.deletes(ids); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleUserEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> update(@RequestBody RoleUserEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = roleUserService.update(entity); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleUserEntity", paramType = "body") - }) - @ResponseBody - @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updates(@RequestBody List<RoleUserEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (RoleUserEntity entity : list) { - entity.setUpdateUser(ue.getId()); - } - } - - int count = roleUserService.updates(list); - if (count > 0) { - permsService.clearPermsCache(); - } - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/TokenController.java b/src/main/java/com/lf/server/controller/sys/TokenController.java deleted file mode 100644 index 8e5ab92..0000000 --- a/src/main/java/com/lf/server/controller/sys/TokenController.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.TokenEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.service.sys.TokenService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 浠ょ墝琛� - * @author sws - * @date 2022-09-28 - */ - -@Api(tags = "杩愮淮绠$悊\\浠ょ墝绠$悊") -@RestController -@RequestMapping("/token") -public class TokenController extends BaseController { - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "浠ょ墝", dataType = "String", paramType = "query", example = "ec101de8-1403-4d8f-ad13-edab8358399b"), - @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "0"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<TokenEntity>> selectByPageAndCount(String name,Integer type, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - int count = tokenService.selectCount(name,type); - if (count == 0) { - return success(0, null); - } - List<TokenEntity> rs = tokenService.selectByPage(name,type, pageSize, pageSize * (pageIndex - 1)); - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.TokenEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertToken", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertToken(@RequestBody TokenEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = tokenService.insertToken(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<TokenEntity>", paramType = "body", example = "") - }) - @PostMapping(value = "/insertTokens", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertTokens(@RequestBody List<TokenEntity> list, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - for (TokenEntity entity : list) { - entity.setCreateUser(ue.getId()); - } - } - - int count = tokenService.insertTokens(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteToken") - public ResponseMsg<Integer> deleteToken(int id) { - try { - int count = tokenService.deleteToken(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteTokens") - public ResponseMsg<Integer> deleteTokens(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - int count = tokenService.deleteTokens(ids); - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "TokenEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateToken", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> updateToken(@RequestBody TokenEntity entity, HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = tokenService.updateToken(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1658") - }) - @GetMapping(value = "/selectToken") - public ResponseMsg<TokenEntity> selectToken(int id) { - try { - TokenEntity tokenEntity = tokenService.selectToken(id); - - return success(tokenEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } -} diff --git a/src/main/java/com/lf/server/controller/sys/UserController.java b/src/main/java/com/lf/server/controller/sys/UserController.java deleted file mode 100644 index 9b415ca..0000000 --- a/src/main/java/com/lf/server/controller/sys/UserController.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.lf.server.controller.sys; - -import com.lf.server.annotation.SysLog; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.sys.RoleEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.entity.ctrl.UserUpdateEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.sys.TokenService; -import com.lf.server.service.sys.UserService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * 鐢ㄦ埛琛� - * @author sws - * @date 2022-09-27 - */ -@Api(tags = "杩愮淮绠$悊\\鐢ㄦ埛绠$悊") -@RestController -@RequestMapping("/user") -public class UserController extends BaseController { - @Autowired - UserService userService; - - @Autowired - TokenService tokenService; - - @SysLog() - @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "瀹�"), - @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<UserEntity>> selectByPageAndCount(String uname, String depcode, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - - int count = userService.selectCount(uname, depcode); - if (count == 0) { - return success(0, null); - } - - List<UserEntity> rs = userService.selectByPage(uname, depcode, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁瑙掕壊+鍗曚綅鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "瀹�"), - @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1"), - @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), - @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), - @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectByPageForRole") - public ResponseMsg<List<UserEntity>> selectByPageForRole(String uname, Integer roleid, String depcode, Integer pageSize, Integer pageIndex) { - try { - if (pageSize < 1 || pageIndex < 1) { - return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); - } - int count = userService.selectCountForRole(uname, roleid, depcode); - if (count == 0) { - return success(0, null); - } - - List<UserEntity> rs = userService.selectByPageForRole(uname, roleid, depcode, pageSize, pageSize * (pageIndex - 1)); - - return success(count, rs); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectUser") - public ResponseMsg<UserEntity> selectUser(int id) { - try { - UserEntity userEntity = userService.selectUser(id); - - return success(userEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鐢ㄦ埛ID鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "uid", value = "鐢ㄦ埛ID", dataType = "String", paramType = "query", example = "admin") - }) - @GetMapping(value = "/selectByUid") - public ResponseMsg<UserEntity> selectByUid(String uid) { - try { - if (StringHelper.isEmpty(uid)) { - fail("鐢ㄦ埛ID涓嶈兘涓虹┖", null); - } - - UserEntity userEntity = userService.selectByUid(uid); - - return success(userEntity); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鎵�鏈�") - @GetMapping(value = "/selectUserAll") - public ResponseMsg<List<UserEntity>> selectUserAll() { - try { - List<UserEntity> list = userService.selectUserAll(); - - return success(list); - } catch (Exception ex) { - return fail(ex, null); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏄�/鍚︿负绠$悊鍛�") - @GetMapping(value = "/selectForIsAdmin") - public ResponseMsg<Boolean> selectForIsAdmin(HttpServletRequest req) { - try { - UserEntity ue = tokenService.getCurrentUser(req); - if (ue == null) { - return fail("鐢ㄦ埛鏈櫥褰�", false); - } - - Integer rows = userService.selectForIsAdmin(ue.getId()); - - return success("鎴愬姛", rows > 0); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ鏄�/鍚︿负绠$悊鍛�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐢ㄦ埛ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectIsAdmin") - public ResponseMsg<Boolean> selectIsAdmin(Integer id) { - try { - UserEntity ue = userService.selectUser(id); - if (ue == null) { - return fail("鐢ㄦ埛涓嶅瓨鍦�", false); - } - - Integer rows = userService.selectForIsAdmin(ue.getId()); - - return success("鎴愬姛", rows > 0); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏌ヨ绠$悊鍛樼敤鎴�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "绠$悊鍛樼被鍒�", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectAdminUsers") - public ResponseMsg<Object> selectAdminUsers(Integer type) { - try { - if (null == type || type < 1) { - return fail("绠$悊鍛樼被鍒笉鑳戒负绌烘垨灏忎簬1", false); - } - - List<UserEntity> rs = userService.selectAdminUsers(type); - - return success(rs); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐢ㄦ埛ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectRoleByUserId") - public ResponseMsg<Object> selectRoleByUserId(Integer id) { - try { - if (null == id || id < 1) { - return fail("鐢ㄦ埛ID涓嶈兘涓虹┖鎴栧皬浜�1", false); - } - - List<RoleEntity> rs = userService.selectRoleByUserId(id); - - return success(rs); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鏍规嵁瑙掕壊鏌ヨ鐢ㄦ埛") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/selectUserByRoleId") - public ResponseMsg<Object> selectUserByRoleId(Integer id) { - try { - if (null == id || id < 1) { - return fail("鐢ㄦ埛ID涓嶈兘涓虹┖鎴栧皬浜�1", false); - } - - List<UserEntity> rs = userService.selectUserByRoleId(id); - - return success(rs); - } catch (Exception ex) { - return fail(ex, false); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.data.UserEntity", paramType = "body", example = "") - }) - @PostMapping(value = "/insertUser", produces = "application/json; charset=UTF-8") - public ResponseMsg<Integer> insertUser(@RequestBody UserEntity entity, HttpServletRequest req) { - try { - String str = userService.validateNewPwd(entity); - if (str != null) { - return fail(str, -1); - } - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - int count = userService.insertUser(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鎻掑叆澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<UserEntity>", paramType = "body", example = "") - }) - @PostMapping(value = "/insertUsers", produces = "application/json; charset=UTF-8") - @SuppressWarnings("AlibabaRemoveCommentedCode") - public ResponseMsg<Integer> insertUsers(@RequestBody List<UserEntity> list, HttpServletRequest req) { - try { - if (list == null || list.isEmpty()) { - return fail("瀹炰綋绫婚泦鍚堜负绌�", -1); - } - - UserEntity ue = tokenService.getCurrentUser(req); - for (UserEntity entity : list) { - /*String str = userService.validateNewPwd(entity); - if (str != null) { - return fail(str, -1); - }*/ - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - } - - int count = userService.insertUsers(list); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") - }) - @GetMapping(value = "/deleteUser") - public ResponseMsg<Integer> deleteUser(int id) { - try { - int count = userService.deleteUser(id); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鍒犻櫎澶氭潯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") - }) - @GetMapping(value = "/deleteUsers") - public ResponseMsg<Integer> deleteUsers(@RequestParam List<Integer> ids) { - try { - if (ids == null || ids.isEmpty()) { - return fail("id鏁扮粍涓嶈兘涓虹┖", -1); - } - - int count = userService.deleteUsers(ids); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊涓�鏉�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "UserEntity", paramType = "body", example = "") - }) - @ResponseBody - @PostMapping(value = "/updateUser", produces = "application/json; charset=UTF-8") - @SuppressWarnings("AlibabaRemoveCommentedCode") - public ResponseMsg<Integer> updateUser(@RequestBody UserEntity entity, HttpServletRequest req) { - try { - /*String str = userService.validateOldPwd(entity); - if (str != null) { - return fail(str, -1); - }*/ - - UserEntity ue = tokenService.getCurrentUser(req); - if (ue != null) { - entity.setUpdateUser(ue.getId()); - } - - int count = userService.updateUser(entity); - - return success(count); - } catch (Exception ex) { - return fail(ex, -1); - } - } - - @SysLog() - @ApiOperation(value = "鏇存柊澶氫釜鐢ㄦ埛瀵嗙爜") - @ApiImplicitParams({ - @ApiImplicitParam(name = "adminPwd", value = "绠$悊鍛樺瘑鐮�", dataType = "String", paramType = "body", example = ""), - @ApiImplicitParam(name = "newPwd", value = "鏂板瘑鐮�", dataType = "String", paramType = "body", example = ""), - @ApiImplicitParam(name = "ids", value = "鐢ㄦ埛ID闆嗗悎", dataType = "List<Integer>", paramType = "body", example = "") - }) - @PostMapping(value = "/updateUsersPwd", produces = "application/json; charset=UTF-8") - public ResponseMsg<Boolean> updateUsersPwd(@RequestBody UserUpdateEntity uue, HttpServletRequest req) { - try { - if (uue == null || uue.getIds() == null || uue.getIds().isEmpty()) { - return fail("娌℃湁鎵惧埌鏁版嵁", false); - } - - UserEntity ue = tokenService.getCurrentUser(req); - String str = userService.validateAdminPwd(ue, uue.getAdminPwd()); - if (str != null) { - return fail(str, false); - } - - Integer rows = userService.selectForIsAdmin(ue.getId()); - if (rows < 1) { - return fail("鍙厑璁哥鐞嗗憳鎿嶄綔", false); - } - - str = userService.validateNewPwd(ue, uue.getNewPwd()); - if (str != null) { - return fail(str, false); - } - - rows = userService.updateUsersPwd(ue.getId(), ue.getSalt(), uue.getIds()); - - return success(rows > 0 ? "鏇存柊鎴愬姛" : "鏇存柊澶辫触", rows > 0); - } catch (Exception ex) { - return fail(ex, false); - } - } -} diff --git a/src/main/java/com/lf/server/entity/all/AbstractPwdEntity.java b/src/main/java/com/lf/server/entity/all/AbstractPwdEntity.java deleted file mode 100644 index 37f7ba9..0000000 --- a/src/main/java/com/lf/server/entity/all/AbstractPwdEntity.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.lf.server.entity.all; - -/** - * 瀵嗙爜鎶借薄绫� - * @author WWW - */ -public abstract class AbstractPwdEntity { - private String pwd; - - public String getPwd() { - return pwd; - } - - public void setPwd(String pwd) { - this.pwd = pwd; - } -} diff --git a/src/main/java/com/lf/server/entity/all/BaseEntity.java b/src/main/java/com/lf/server/entity/all/BaseEntity.java deleted file mode 100644 index 05e6a18..0000000 --- a/src/main/java/com/lf/server/entity/all/BaseEntity.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.lf.server.entity.all; - -import com.baomidou.mybatisplus.annotation.FieldStrategy; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鍩虹瀹炰綋绫� - * @author WWW - */ -public class BaseEntity implements Serializable { - @TableId(type = IdType.AUTO) - private Integer gid; - - private String eventid; - - private String parentid; - - private String dirid; - - private String depid; - - private Integer verid; - - private Timestamp createtime; - - private Integer createuser; - - private Integer updateuser; - - private Timestamp updatetime; - - @TableField(value = "fn_get_fullname(dirid, 2)", updateStrategy = FieldStrategy.NEVER) - private String dirName; - - @TableField(value = "fn_get_fullname(depid, 1)", updateStrategy = FieldStrategy.NEVER) - private String depName; - - @TableField(value = "fn_ver(verid)", updateStrategy = FieldStrategy.NEVER) - private String verName; - - @TableField(value = "fn_uname(createuser)", updateStrategy = FieldStrategy.NEVER) - private String createName; - - @TableField(value = "fn_uname(updateuser)", updateStrategy = FieldStrategy.NEVER) - private String updateName; - - public BaseEntity() { - } - - public Integer getGid() { - return gid; - } - - public void setGid(Integer gid) { - this.gid = gid; - } - - public String getEventid() { - return eventid; - } - - public void setEventid(String eventid) { - this.eventid = eventid; - } - - public String getParentid() { - return parentid; - } - - public void setParentid(String parentid) { - this.parentid = parentid; - } - - public String getDirid() { - return dirid; - } - - public void setDirid(String dirid) { - this.dirid = dirid; - } - - public String getDepid() { - return depid; - } - - public void setDepid(String depid) { - this.depid = depid; - } - - public Integer getVerid() { - return verid; - } - - public void setVerid(Integer verid) { - this.verid = verid; - } - - public Timestamp getCreatetime() { - return createtime; - } - - public void setCreatetime(Timestamp createtime) { - this.createtime = createtime; - } - - public Integer getCreateuser() { - return createuser; - } - - public void setCreateuser(Integer createuser) { - this.createuser = createuser; - } - - public Integer getUpdateuser() { - return updateuser; - } - - public void setUpdateuser(Integer updateuser) { - this.updateuser = updateuser; - } - - public Timestamp getUpdatetime() { - return updatetime; - } - - public void setUpdatetime(Timestamp updatetime) { - this.updatetime = updatetime; - } - - public String getDirName() { - return dirName; - } - - public void setDirName(String dirName) { - this.dirName = dirName; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } - - public String getVerName() { - return verName; - } - - public void setVerName(String verName) { - this.verName = verName; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } -} diff --git a/src/main/java/com/lf/server/entity/all/BaseGeoEntity.java b/src/main/java/com/lf/server/entity/all/BaseGeoEntity.java deleted file mode 100644 index 74dd489..0000000 --- a/src/main/java/com/lf/server/entity/all/BaseGeoEntity.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.lf.server.entity.all; - -import com.baomidou.mybatisplus.annotation.TableField; - -/** - * 绌洪棿鍩虹瀹炰綋绫� - * @author WWW - */ -public class BaseGeoEntity extends BaseEntity { - @TableField(select = false) - private String geom; - - public String getGeom() { - return geom; - } - - public void setGeom(String geom) { - this.geom = geom; - } -} diff --git a/src/main/java/com/lf/server/entity/all/HttpStatus.java b/src/main/java/com/lf/server/entity/all/HttpStatus.java deleted file mode 100644 index 103454c..0000000 --- a/src/main/java/com/lf/server/entity/all/HttpStatus.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.lf.server.entity.all; - -/** - * Http鐘舵�佺爜绫� - * @author WWW - */ -public enum HttpStatus { - /** - * 璇锋眰鎴愬姛 - */ - OK(200,"璇锋眰鎴愬姛"), - - /** - * 璇锋眰鏃犳晥 - */ - BAD_REQUEST(400,"璇锋眰鏃犳晥"), - - /** - * 鏈粡鎺堟潈璁块棶 - */ - UNAUTHORIZED(401,"鏈粡鎺堟潈璁块棶"), - - /** - * 鏈嶅姟璇锋眰鏈壘鍒� - */ - NOT_FOUND(404,"鏈嶅姟璇锋眰鏈壘鍒�"), - - /** - * 绯荤粺閿欒 - */ - ERROR(500,"绯荤粺閿欒"), - - /** - * 瀛樺湪閲嶅鐨勬暟鎹� - */ - UNIQUE_ERROR(500100,"瀛樺湪閲嶅鐨勬暟鎹�"), - - /** - * 鍙傛暟鏍¢獙閿欒 - */ - VALIDATE_ERROR(500101,"鍙傛暟鏍¢獙閿欒"), - - /** - * token閿欒 - */ - TOKEN_ERROR(500102,"token閿欒"), - - /** - * 鐢ㄦ埛鏈櫥闄� - */ - NO_LOGIN_ERROR(500104,"鐢ㄦ埛鏈櫥闄�"), - - /** - * 鐧婚檰澶辫触 - */ - LOGIN_ERROR(500105,"鐧婚檰澶辫触"), - - /** - * 鏃犳潈闄愯闂� - */ - NO_AUTH_ERROR(500106,"鏃犳潈闄愯闂�"), - - /** - * 鐢ㄦ埛鍚嶉敊璇� - */ - LOGIN_USER_ERROR(500107,"鐢ㄦ埛鍚嶉敊璇�"), - - /** - * 瀵嗙爜閿欒 - */ - LOGIN_PWD_ERROR(500108,"瀵嗙爜閿欒"), - - /** - * 鐢ㄦ埛琚攣瀹� - */ - USER_LOCK_ERROR(500109,"鐢ㄦ埛琚攣瀹�"), - - /** - * 瀵嗙爜涓嶅悎瑙勮寖 - */ - PWD_NONSTANDARD(500111,"瀵嗙爜涓嶅悎瑙勮寖"), - - /** - * 瀵嗙爜杩囨湡 - */ - LOGIN_PWD_EXPIRE(500116,"瀵嗙爜杩囨湡"); - - private HttpStatus(int value, String msg) { - this.value = value; - this.msg = msg; - } - - private int value; - - private String msg; - - public int getValue() { - return value; - } - - public String getMsg() { - return msg; - } -} diff --git a/src/main/java/com/lf/server/entity/all/MenusAuthEntity.java b/src/main/java/com/lf/server/entity/all/MenusAuthEntity.java deleted file mode 100644 index 338c79a..0000000 --- a/src/main/java/com/lf/server/entity/all/MenusAuthEntity.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.lf.server.entity.all; - -import java.io.Serializable; - -/** - * 鑿滃崟鎺堟潈 - * @author WWW - */ -public class MenusAuthEntity implements Serializable { - private static final long serialVersionUID = -944664756113218L; - - private Integer id; - - private Integer pid; - - private String cnName; - - private String enName; - - private String url; - - private String perms; - - private Integer type; - - private String css; - - private String icon; - - private Integer level; - - private Integer orderNum; - - private Integer isShow; - - public MenusAuthEntity() { - - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getPid() { - return pid; - } - - public void setPid(Integer pid) { - this.pid = pid; - } - - public String getCnName() { - return cnName; - } - - public void setCnName(String cnName) { - this.cnName = cnName; - } - - public String getEnName() { - return enName; - } - - public void setEnName(String enName) { - this.enName = enName; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getPerms() { - return perms; - } - - public void setPerms(String perms) { - this.perms = perms; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public String getCss() { - return css; - } - - public void setCss(String css) { - this.css = css; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public Integer getLevel() { - return level; - } - - public void setLevel(Integer level) { - this.level = level; - } - - public Integer getOrderNum() { - return orderNum; - } - - public void setOrderNum(Integer orderNum) { - this.orderNum = orderNum; - } - - public Integer getIsShow() { - return isShow; - } - - public void setIsShow(Integer isShow) { - this.isShow = isShow; - } -} diff --git a/src/main/java/com/lf/server/entity/all/PermsAuthEntity.java b/src/main/java/com/lf/server/entity/all/PermsAuthEntity.java deleted file mode 100644 index d8114a5..0000000 --- a/src/main/java/com/lf/server/entity/all/PermsAuthEntity.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.lf.server.entity.all; - -import java.io.Serializable; - -/** - * 鏉冮檺鎺堟潈 - * @author WWW - */ -public class PermsAuthEntity implements Serializable { - private static final long serialVersionUID = -8948994757253139554L; - - private Integer id; - - private Integer pid; - - private Integer orderNum; - - private String cnName; - - private String enName; - - private String name; - - private String perms; - - private String tag; - - public PermsAuthEntity() { - - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getPid() { - return pid; - } - - public void setPid(Integer pid) { - this.pid = pid; - } - - public Integer getOrderNum() { - return orderNum; - } - - public void setOrderNum(Integer orderNum) { - this.orderNum = orderNum; - } - - public String getCnName() { - return cnName; - } - - public void setCnName(String cnName) { - this.cnName = cnName; - } - - public String getEnName() { - return enName; - } - - public void setEnName(String enName) { - this.enName = enName; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPerms() { - return perms; - } - - public void setPerms(String perms) { - this.perms = perms; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } -} diff --git a/src/main/java/com/lf/server/entity/all/RedisCacheKey.java b/src/main/java/com/lf/server/entity/all/RedisCacheKey.java deleted file mode 100644 index 27bff13..0000000 --- a/src/main/java/com/lf/server/entity/all/RedisCacheKey.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.lf.server.entity.all; - -/** - * Redis缂撳瓨閿� - * @author WWW - */ -public class RedisCacheKey { - /** - * 鐧诲綍浠ょ墝閿� - */ - public static String signTokenKey(String key) { - return "sign:token:" + key; - } - - /** - * 鐧诲綍鐢ㄦ埛閿� - */ - public static String signUserKey(String key) { - return "sign:user:" + key; - } - - /** - * 瀵嗙爜閿欒閿� - */ - public static String signPwdError(String key) { - return "sign:pwdError:" + key; - } - - /** - * 鎺堟潈鏍归敭 - */ - public static String permsRootKey() { - return "perms:"; - } - - /** - * 璧勬簮鎺堟潈閿� - */ - public static String permsResKey(String key) { - return "perms:res:" + key; - } - - /** - * 鑿滃崟鎺堟潈閿� - */ - public static String permsMenusKey(String key) { - return "perms:menus:" + key; - } - - /** - * 鏉冮檺鎺堟潈閿� - */ - public static String permsPermsKey(String key) { - return "perms:perms:" + key; - } - - /** - * 鏉冮檺鎺堟潈瀹炰綋閿� - */ - public static String permsPermsEntityKey(String key) { - return "perms:permsEntity:" + key; - } - - /** - * 榛�/鐧藉悕鍗曢敭 - */ - public static String blacklistKey(String key) { - return "blacklist:" + key; - } - - /** - * 鍑犱綍瀵硅薄鐨勭┖闂村弬鑰冮敭 - */ - public static String sridKey(String key) { - return "geom:srid:" + key; - } -} diff --git a/src/main/java/com/lf/server/entity/all/ResAuthEntity.java b/src/main/java/com/lf/server/entity/all/ResAuthEntity.java deleted file mode 100644 index 7452a22..0000000 --- a/src/main/java/com/lf/server/entity/all/ResAuthEntity.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.lf.server.entity.all; - -import java.io.Serializable; - -/** - * 璧勬簮鎺堟潈 - * @author WWW - */ -public class ResAuthEntity implements Serializable { - private static final long serialVersionUID = 7610553267313397837L; - - private Integer id; - - private String name; - - private String server; - - public ResAuthEntity() { - - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getServer() { - return server; - } - - public void setServer(String server) { - this.server = server; - } -} diff --git a/src/main/java/com/lf/server/entity/all/ResponseMsg.java b/src/main/java/com/lf/server/entity/all/ResponseMsg.java deleted file mode 100644 index 3ebb385..0000000 --- a/src/main/java/com/lf/server/entity/all/ResponseMsg.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.lf.server.entity.all; - -/** - * 鍝嶅簲娑堟伅绫� - * @author www - * @param <T> 娉涘瀷 - */ -public class ResponseMsg<T> { - public ResponseMsg() { - this.time = System.currentTimeMillis(); - } - - public ResponseMsg(HttpStatus code, T result) { - this.code = code.getValue(); - this.msg = this.code == 200 ? "鎴愬姛" : "澶辫触"; - this.result = result; - this.time = System.currentTimeMillis(); - } - - public ResponseMsg(HttpStatus code, String msg, T result) { - this.code = code.getValue(); - this.msg = msg; - this.result = result; - this.time = System.currentTimeMillis(); - } - - public ResponseMsg(int code, String msg, T result, long time) { - this.code = code; - this.msg = msg; - this.result = result; - this.time = time; - } - - public ResponseMsg(HttpStatus code, long count, T result) { - this.code = code.getValue(); - this.msg = this.code == 200 ? "鎴愬姛" : "澶辫触"; - this.count = count; - this.result = result; - this.time = System.currentTimeMillis(); - } - - public ResponseMsg(HttpStatus code, String msg, long count, T result) { - this.code = code.getValue(); - this.msg = msg; - this.count = count; - this.result = result; - this.time = System.currentTimeMillis(); - } - - public ResponseMsg(int code, String msg, long count, T result, long time) { - this.code = code; - this.msg = msg; - this.count = count; - this.result = result; - this.time = time; - } - - private int code; - - private String msg; - - private long count; - - private T result; - - private long time; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public long getCount() { - return count; - } - - public void setCount(long count) { - this.count = count; - } - - public T getResult() { - return result; - } - - public void setResult(T result) { - this.result = result; - } - - public long getTime() { - return time; - } - - public void setTime(long time) { - this.time = time; - } -} diff --git a/src/main/java/com/lf/server/entity/all/SettingData.java b/src/main/java/com/lf/server/entity/all/SettingData.java deleted file mode 100644 index c903045..0000000 --- a/src/main/java/com/lf/server/entity/all/SettingData.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.lf.server.entity.all; - -/** - * 璁剧疆鏁版嵁绫� - * @author WWW - */ -public class SettingData { - /** - * 瀵嗙爜鍑洪敊娆℃暟 - */ - public static int PWD_ERR_COUNT = 5; - - /** - * 鍑洪敊绛夊緟鏃堕棿 - */ - public static int PWD_ERR_TIME = 5; - - /** - * 鑷姩鐧诲嚭鏃堕棿 - */ - public static int AUTO_LOGOUT = 15; - - /** - * 浠ょ墝鏈夋晥鏈� - */ - public static int TOKEN_EXPIRE = 240; - - /** - * 缂撳瓨鏈夋晥鏈� - */ - public static int CACHE_EXPIRE = 240; - - /** - * 鏈�澶ф枃浠舵暟锛�2000 - */ - public static int MAX_FILES = 2001; - - /** - * Cookie鏈夋晥鏈燂細s - */ - public static int COOKIE_MAX_AGE = 4 * 60 * 60; - - /** - * 闄勪欢澶у皬锛欱 - */ - public static long MAX_FILE_SIZE = 50 * 1024 * 1024; - - /** - * 鐢ㄦ埛璁块棶閲� - */ - public static int MAX_USER_LOGIN; - - /** - * 鏈嶅姟涓婇檺 - */ - public static int MAX_SERVERS; -} diff --git a/src/main/java/com/lf/server/entity/all/StaticData.java b/src/main/java/com/lf/server/entity/all/StaticData.java deleted file mode 100644 index ca131ff..0000000 --- a/src/main/java/com/lf/server/entity/all/StaticData.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.lf.server.entity.all; - -import com.alibaba.fastjson.JSON; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * 闈欐�佹暟鎹被 - * @author WWW - */ -public class StaticData { - /** - * 鏉冮檺鎺掗櫎璺緞锛�/proxy锛岃姹傚叏閮ㄥ皬鍐� - */ - public static String[] EXCLUDE_PATH = new String[]{"/sign/", "/perms/", "/fmeit/", "/crds/", "/floatserver/", "/wmts/select", "/onemap/", "/swagger", "/error"}; - - public final static int TWO = 2; - - public final static int FOUR = 4; - - public final static int NINE = 9; - - public final static int TEN = 10; - - public final static int SIXTEEN = 16; - - public final static int ONE_HUNDRED = 100; - - public final static int TWO_HUNDRED = 200; - - public final static int ONE_HUNDRED_THOUSAND = 100000; - - public static final double D1024 = 1024.0; - - public static final double D1050 = 1050.0; - - public static final int I12 = 12; - - public static final int I23 = 23; - - public static final int I24 = 24; - - public static final int I31 = 31; - - public static final int I60 = 60; - - public static final int I90 = 90; - - public static final int I90_NEG = -90; - - public static final int I180 = 180; - - public static final int I180_NEG = -180; - - public static final int I1000 = 1000; - - public static final int I2050 = 2050; - - public static final int I4490 = 4490; - - /** - * 瀛楃1 - */ - public final static String S1 = "1"; - - /** - * 绛夊彿 - */ - public final static String EQ = "="; - - /** - * 瀛楃鐐� - */ - public final static String POINT = "."; - - /** - * 閫楀彿 - */ - public final static String COMMA = ","; - - /** - * 鍗曞紩鍙� - */ - public final static String SINGLE_QUOTES = "'"; - - public final static String BBOREHOLE = "bborehole"; - - /** - * 姝f枩鏉� - */ - public final static String SLASH = "/"; - - public final static String IN = "in"; - - public final static String ZIP = ".zip"; - - public final static String XLS = ".xls"; - - public final static String XLSX = ".xlsx"; - - public final static String MDB = ".mdb"; - - public final static String SHP = ".shp"; - - public final static String GDB = ".gdb"; - - public final static String JPG = ".jpg"; - - public final static String IMG = ".img"; - - public final static String MPT = ".mpt"; - - public final static String D3DML = ".3dml"; - - public final static String TIF = ".tif"; - - public final static String TIFF = ".tiff"; - - public final static String ADMIN = "admin"; - - public final static String SYS_META = "sysmeta"; - - /** - * 鐗堟湰鍙� - */ - public final static String VERSION = "1.0.0"; - - /** - * 浠ょ墝閿� - */ - public final static String TOKEN_KEY = "token"; - - /** - * Cookie涓护鐗岄敭 - */ - public final static String TOKEN_COOKIE_KEY = "token"; - - /** - * 鏂囨湰缂栫爜鏂瑰紡 - */ - public final static String TEXT_ENCODER = "UTF-8"; - - /** - * 鎬昏川妫� - */ - public final static String CHECK_MAIN = "checkMain"; - - /** - * Object瀵硅薄 - */ - public final static String OBJECT = "java.lang.Object"; - - /** - * Cookie涓璬ruid閿� - */ - public final static String DRUID_COOKIE_KEY = "JSESSIONID"; - - public final static String YES = "YES"; - - public final static String NO = "NO"; - - /** - * 绾胯矾 - */ - public final static String ROUTE = "绾胯矾"; - - /** - * 绌胯法瓒� - */ - public final static String CROSSING = "绌胯法瓒�"; - - public final static String LINESTRING = "LINESTRING"; - - public final static String MULTILINESTRING = "MULTILINESTRING"; - - public final static String POLYGON = "POLYGON"; - - public final static String MULTIPOLYGON = "MULTIPOLYGON"; - - public static final String NO_FILE = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NOT_FOUND, "鏂囦欢鎵句笉鍒�")); - - /** - * 16杩涘埗 - */ - public static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - - /** - * 瀵嗙爜姝e垯琛ㄨ揪寮� - */ - public final static String PWD_REG = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![a-z0-9]+$)(?![a-z\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![0-9\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)[a-zA-Z0-9\\W!@#$%^&*`~()\\-_+=,.?;<>]{12,20}$"; - - /** - * MPT鏂囦欢鎵╁睍鍚� - */ - public final static List<String> MPT_EXT = new ArrayList<>(Arrays.asList(".midx", ".strmi", ".ei.midx", ".ei.mpt", ".ei.strmi")); - - /** - * JPG鏂囦欢鎵╁睍鍚� - */ - public final static List<String> JPG_EXT = new ArrayList<>(Arrays.asList(".jgw", ".jpg.aux.xml", ".jpg.xml", ".prj")); - - /** - * IMG鏂囦欢鎵╁睍鍚� - */ - public final static List<String> IMG_EXT = new ArrayList<>(Arrays.asList(".rrd", ".img.aux.xml", ".hdr", ".img.enp", ".img.xml")); - - /** - * TIF鏂囦欢鎵╁睍鍚� - */ - public final static List<String> TIF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".tif.ovr", ".tif.aux.xml", ".tif.enp", ".tif.xml")); - - /** - * TIFF鏂囦欢鎵╁睍鍚� - */ - public final static List<String> TIFF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".tiff.ovr", ".tiff.aux.xml", ".tiff.enp", ".tiff.xml")); - - /** - * SHP鏂囦欢鎵╁睍鍚� - */ - public final static List<String> SHP_EXT = new ArrayList<>(Arrays.asList(".shx", ".dbf", ".prj", ".cpg")); - - /** - * Mapper鎺掗櫎鎵╁睍鍚� - */ - public final static List<String> MAPPER_EXCLUDE_EXT = new ArrayList<>(Arrays.asList(".img.aux.xml", ".img.xml", ".tif.aux.xml", ".tif.xml", ".tiff.aux.xml", ".tiff.xml", ".shp.xml")); - - /** - * 鎵�鏈夋枃浠舵墿灞曞悕 - */ - public final static List<String> ALL_EXTENSION = new ArrayList<>(Arrays.asList(".txt", ".xml", ".pdf", ".xls", ".xlsx", ".doc", ".docx", ".ppt", ".pptx", ".shp", ".gdb", ".mdb", ".dwg", ".las", ".laz", ".cpt", ".mpt", ".ei.mpt", ".fly", ".efb", ".g3d", ".fbx", ".obj", ".3dm", ".3dml", ".osgb", ".rvt", ".ifc", ".jpg", ".png", ".img", ".tif", ".tiff", ".dem", ".bmp", ".gif", ".rmvb", ".rm", ".mp3", ".mp4", ".avi", ".wma", ".wmv", ".7z", ".rar", ".zip")); - - /** - * 鎻掑叆鎺掗櫎瀛楁 - */ - public final static List<String> INSERT_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("gid", "objectid", "updateuser", "updatetime", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); - - /** - * 鏇存柊鎺掗櫎瀛楁 - */ - public final static List<String> UPDATE_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("objectid", "createuser", "createtime", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); - - /** - * 璇诲彇鎺掗櫎瀛楁 - */ - public final static List<String> READ_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("gid", "eventid", "parentid", "objectid", "dirid", "depid", "verid", "createtime", "createuser", "updateuser", "updatetime", "shape_leng", "shape_area", "serialversionuid", "dirname", "depname", "vername", "createname", "updatename")); - - /** - * MDB鎺掗櫎瀛楁 - */ - public final static List<String> MDB_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("Shape", "SHAPE_LENG", "Shape_Length", "Shape_Area", "OBJECTID_1")); - - /** - * 鏍囩粯Shp鎺掗櫎瀛楁 - */ - public final static List<String> MARK_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("wkt", "geom", "objectid", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); - - /** - * GDB鎺掗櫎瀛楁 - */ - public final static List<String> GDB_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("geom", "objectid", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); - - /** - * 绠$嚎鍒嗘瀽琛ㄥ悕闆嗗悎 - */ - public final static List<String> PIPE_ANALYSIS_TABS = new ArrayList<>(Arrays.asList("bd.dlg_25w_hydl", "bd.dlg_25w_lrdl", "bd.dlg_25w_lrrl", "bd.dlg_25w_hyda")); - - /** - * 绠$嚎鎺掗櫎瀛楁 - */ - public final static List<String> PIPE_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("serialVersionUID", "tabs", "pwd", "gid", "wkt")); -} diff --git a/src/main/java/com/lf/server/entity/ctrl/CountEntity.java b/src/main/java/com/lf/server/entity/ctrl/CountEntity.java deleted file mode 100644 index c84de19..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/CountEntity.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.lf.server.entity.ctrl; - -/** - * 缁熻瀹炰綋绫� - * @author WWW - */ -public class CountEntity { - private Integer no; - - private String m1; - - private String m2; - - private String m3; - - private Long count; - - private Double sizes; - - public CountEntity() { - } - - public Integer getNo() { - return no; - } - - public void setNo(Integer no) { - this.no = no; - } - - public String getM1() { - return m1; - } - - public void setM1(String m1) { - this.m1 = m1; - } - - public String getM2() { - return m2; - } - - public void setM2(String m2) { - this.m2 = m2; - } - - public String getM3() { - return m3; - } - - public void setM3(String m3) { - this.m3 = m3; - } - - public Long getCount() { - return count; - } - - public void setCount(Long count) { - this.count = count; - } - - public Double getSizes() { - return sizes; - } - - public void setSizes(Double sizes) { - this.sizes = sizes; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java b/src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java deleted file mode 100644 index 547300b..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.lf.server.entity.ctrl; - -import com.lf.server.entity.all.AbstractPwdEntity; - -import java.io.Serializable; -import java.util.List; - -/** - * 璇锋眰涓嬭浇瀹炰綋绫� - * @author WWW - */ -public class DownloadReqEntity extends AbstractPwdEntity implements Serializable { - private static final long serialVersionUID = -8624235184539814997L; - - private String guid; - - private List<String> guids; - - private List<Integer> ids; - - private String wkt; - - private List<String> entities; - - private String tab; - - private List<String> tabs; - - private String descr; - - private String filter; - - private List<String> depcodes; - - private String depcode; - - private String dirs; - - public DownloadReqEntity() { - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public List<String> getGuids() { - return guids; - } - - public void setGuids(List<String> guids) { - this.guids = guids; - } - - public List<Integer> getIds() { - return ids; - } - - public void setIds(List<Integer> ids) { - this.ids = ids; - } - - public String getWkt() { - return wkt; - } - - public void setWkt(String wkt) { - this.wkt = wkt; - } - - public String getTab() { - return tab; - } - - public void setTab(String tab) { - this.tab = tab; - } - - public List<String> getTabs() { - return tabs; - } - - public void setTabs(List<String> tabs) { - this.tabs = tabs; - } - - public List<String> getEntities() { - return entities; - } - - public void setEntities(List<String> entities) { - this.entities = entities; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public String getFilter() { - return filter; - } - - public void setFilter(String filter) { - this.filter = filter; - } - - public List<String> getDepcodes() { - return depcodes; - } - - public void setDepcodes(List<String> depcodes) { - this.depcodes = depcodes; - } - - public String getDirs() { - return dirs; - } - - public void setDirs(String dirs) { - this.dirs = dirs; - } - - public String getDepcode() { - return depcode; - } - - public void setDepcode(String depcode) { - this.depcode = depcode; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/DownloadTileEntity.java b/src/main/java/com/lf/server/entity/ctrl/DownloadTileEntity.java deleted file mode 100644 index 660c653..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/DownloadTileEntity.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.lf.server.entity.ctrl; - -import com.lf.server.entity.all.AbstractPwdEntity; -import com.lf.server.entity.all.StaticData; - -import java.io.Serializable; - -/** - * 涓嬭浇鐡︾墖瀹炰綋绫� - * @author WWW - */ -public class DownloadTileEntity extends AbstractPwdEntity implements Serializable { - private static final long serialVersionUID = -229710198271495902L; - - private Double xmin; - - private Double ymin; - - private Double xmax; - - private Double ymax; - - private Integer pubid; - - private String title; - - public DownloadTileEntity() { - } - - /** - * 楠岃瘉鍧愭爣 - */ - public String verifyCoords() { - if (null == xmin || null == ymin || null == xmax || null == ymax) { - return "鍥涜嚦鍧愭爣鍊间笉鑳戒负绌�"; - } - if (xmin < StaticData.I180_NEG || xmin > StaticData.I180 || xmax < StaticData.I180_NEG || xmax > StaticData.I180) { - return "X鍧愭爣鍊间笉姝g‘"; - } - if (ymin < StaticData.I90_NEG || ymin > StaticData.I90 || ymax < StaticData.I90_NEG || ymax > StaticData.I90) { - return "Y鍧愭爣鍊间笉姝g‘"; - } - - if (xmin > xmax) { - double x = xmax; - xmin = xmax; - xmax = x; - } - if (ymin > ymax) { - double y = ymax; - ymin = ymax; - ymax = y; - } - - return null; - } - - public Double getXmin() { - return xmin; - } - - public void setXmin(Double xmin) { - this.xmin = xmin; - } - - public Double getYmin() { - return ymin; - } - - public void setYmin(Double ymin) { - this.ymin = ymin; - } - - public Double getXmax() { - return xmax; - } - - public void setXmax(Double xmax) { - this.xmax = xmax; - } - - public Double getYmax() { - return ymax; - } - - public void setYmax(Double ymax) { - this.ymax = ymax; - } - - public Integer getPubid() { - return pubid; - } - - public void setPubid(Integer pubid) { - this.pubid = pubid; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/FileInfoEntity.java b/src/main/java/com/lf/server/entity/ctrl/FileInfoEntity.java deleted file mode 100644 index 99cd5c2..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/FileInfoEntity.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.lf.server.entity.ctrl; - -import java.io.Serializable; - -/** - * 鏂囦欢淇℃伅 - * @author WWW - */ -public class FileInfoEntity implements Serializable { - private static final long serialVersionUID = -674723262772248619L; - - private String fileName; - - private Long size; - - private String md5; - - private String path; - - public FileInfoEntity() { - } - - public FileInfoEntity(String fileName) { - this.fileName = fileName; - } - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } - - public Long getSize() { - return size; - } - - public void setSize(Long size) { - this.size = size; - } - - public String getMd5() { - return md5; - } - - public void setMd5(String md5) { - this.md5 = md5; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/FmeReqEntity.java b/src/main/java/com/lf/server/entity/ctrl/FmeReqEntity.java deleted file mode 100644 index 26d83a3..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/FmeReqEntity.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.lf.server.entity.ctrl; - -/** - * FME璇锋眰瀹炰綋绫� - * @author WWW - */ -public class FmeReqEntity { - public FmeReqEntity() { - } - - /** - * 浠诲姟鍚嶇О - */ - public String names; - - /** - * 椤圭洰鍚嶇О - */ - public String xmmc; - - /** - * 鏁版嵁涓撲笟锛氭祴閲忎笓涓� | 鍕樺療涓撲笟 | 鍦扮伨涓撲笟 | 娲炲簱涓撲笟 | 绾胯矾涓撲笟 - */ - public String sjzy; - - /** - * 鏁版嵁鍒嗙被锛氭暟瀛楀寲鎴愭灉 | 鏁版嵁搴撴垚鏋� | 鍕樺療淇℃伅琛� | 琛ㄦ牸鎴愭灉 - */ - public String sjfl; - - /** - * 寰呮鍘嬬缉鍖� - */ - public String zipPath; - - /** - * WBS琛ㄦ牸 - */ - public String wbsPath; - - /** - * 鏄�/鍚︿负鍦扮伨鏁版嵁锛歒ES | NO - */ - public String isDiZai; - - /** - * 鍦扮伨鏁版嵁绫诲瀷锛氾紙宕╁娌荤悊 | 涓嶇ǔ瀹氭枩鍧℃不鐞� | 鍦伴潰濉岄櫡娌荤悊 | 楂橀櫋杈瑰潯娌荤悊 | 娉ョ煶娴佹不鐞� | 姘存瘉娌荤悊 | 婊戝潯娌荤悊锛� | NO - */ - public String diZaiType; - - /** - * 鍧愭爣绯伙細EPSG:4326 - */ - public String coordinateSystem; - - /** - * 褰卞儚鍒嗚鲸鐜囷紙榛樿0.2m锛� - */ - public double imgResolution = 0.2; - - /** - * 闈�/绾�/鐐归噸鍙犲宸� - */ - public double tolerance = 0.001; - - /** - * 楂樼▼鐐归棿璺濅笂闄� - */ - public double gcdOffset = 20; - - /** - * 鎺у埗鐐归棿璺濅笂闄� - */ - public double kzdOffset = 100; - - /** - * 娴嬪尯鑼冨洿锛堢背锛� - */ - public double rangeOffset = 200; - - /** - * 鎮寕绾挎渶澶ц窛绂� - */ - public double xgMax = 0.005; - - /** - * 楂樼▼涓宸紙m锛� - */ - public double demTolerance = 5; - - /** - * 楂樼▼鍊肩獊鍙樼巼(榛樿鍊�200) - */ - public double demChangeRate = 200; - - /** - * 鐐逛簯瀵嗗害锛堥粯璁�1/m3锛� - */ - public double lazDensity = 1; -} diff --git a/src/main/java/com/lf/server/entity/ctrl/IdNameEntity.java b/src/main/java/com/lf/server/entity/ctrl/IdNameEntity.java deleted file mode 100644 index 1c1ac0e..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/IdNameEntity.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.lf.server.entity.ctrl; - -import java.io.Serializable; - -/** - * ID-鍚嶇О瀹炰綋绫� - * @author WWW - */ -public class IdNameEntity implements Serializable { - private static final long serialVersionUID = -8485687857643406110L; - - private Integer id; - - private String name; - - public IdNameEntity() { - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/KeyValueEntity.java b/src/main/java/com/lf/server/entity/ctrl/KeyValueEntity.java deleted file mode 100644 index 432a1da..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/KeyValueEntity.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.lf.server.entity.ctrl; - -/** - * 閿�煎瀹炰綋绫� - * @author WWW - */ -public class KeyValueEntity { - private String key; - - private String value; - - public KeyValueEntity() { - } - - public KeyValueEntity(String key, String value) { - this.key = key; - this.value = value; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/MarkJsonEntity.java b/src/main/java/com/lf/server/entity/ctrl/MarkJsonEntity.java deleted file mode 100644 index 65173d9..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/MarkJsonEntity.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.lf.server.entity.ctrl; - -import java.io.Serializable; - -/** - * 鏍囩粯JSON瀹炰綋绫� - * @author WWW - */ -public class MarkJsonEntity implements Serializable { - private static final long serialVersionUID = 7776629022021914001L; - - private Integer id; - - private String name; - - private String type; - - private String fillColor; - - private Double opacity; - - private String bak; - - private String wkt; - - public MarkJsonEntity() { - } - - public MarkJsonEntity(Integer id) { - this.id = id; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getFillColor() { - return fillColor; - } - - public void setFillColor(String fillColor) { - this.fillColor = fillColor; - } - - public Double getOpacity() { - return opacity; - } - - public void setOpacity(Double opacity) { - this.opacity = opacity; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getWkt() { - return wkt; - } - - public void setWkt(String wkt) { - this.wkt = wkt; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/NameValueEntity.java b/src/main/java/com/lf/server/entity/ctrl/NameValueEntity.java deleted file mode 100644 index ad07cda..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/NameValueEntity.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.lf.server.entity.ctrl; - -/** - * 鍚嶇О鍊煎瀹炰綋绫� - * @author WWW - */ -public class NameValueEntity { - private String name; - - private Object value; - - public NameValueEntity() { - } - - public NameValueEntity(String name, Object value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/PubEntity.java b/src/main/java/com/lf/server/entity/ctrl/PubEntity.java deleted file mode 100644 index 0ab3c87..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/PubEntity.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.lf.server.entity.ctrl; - -import io.swagger.models.auth.In; - -import java.util.List; - -/** - * 鍙戝竷瀹炰綋绫� - * @author WWW - */ -public class PubEntity { - public PubEntity() { - } - - private String type; - - private String token; - - private String name; - - private Integer userId; - - private Integer min; - - private Integer max; - - private Integer noData; - - private String dircode; - - private String depcode; - - private List<String> ids; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Integer getUserId() { - return userId; - } - - public void setUserId(Integer userId) { - this.userId = userId; - } - - public Integer getMin() { - return min; - } - - public void setMin(Integer min) { - this.min = min; - } - - public Integer getMax() { - return max; - } - - public void setMax(Integer max) { - this.max = max; - } - - public Integer getNoData() { - return noData; - } - - public void setNoData(Integer noData) { - this.noData = noData; - } - - public String getDircode() { - return dircode; - } - - public void setDircode(String dircode) { - this.dircode = dircode; - } - - public String getDepcode() { - return depcode; - } - - public void setDepcode(String depcode) { - this.depcode = depcode; - } - - public List<String> getIds() { - return ids; - } - - public void setIds(List<String> ids) { - this.ids = ids; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/RegisterEntity.java b/src/main/java/com/lf/server/entity/ctrl/RegisterEntity.java deleted file mode 100644 index 3b3a483..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/RegisterEntity.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.lf.server.entity.ctrl; - -import com.lf.server.helper.StringHelper; - -import java.util.ArrayList; -import java.util.List; - -/** - * 娉ㄥ唽绫� - * @author WWW - */ -public class RegisterEntity { - public RegisterEntity() { - } - - public RegisterEntity(String name, String uri, String type) { - tags = new ArrayList<>(); - tags.add(type); - - this.name = name; - this.address = uri; - this.detailUrl = uri; - this.type = type; - this.description = name; - this.isrequest = true; - this.hashid = StringHelper.getGuid(); - this.ispublic = false; - } - - public RegisterEntity(Integer pubid) { - this.reason = "娉ㄥ唽"; - this.serialnum = pubid.toString(); - } - - private List<String> tags; - - private String name; - - private String address; - - private String detailUrl; - - private String type; - - private String description; - - private Boolean isrequest; - - private String hashid; - - private String reason; - - private String serialnum; - - private Boolean ispublic; - - public List<String> getTags() { - return tags; - } - - public void setTags(List<String> tags) { - this.tags = tags; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getDetailUrl() { - return detailUrl; - } - - public void setDetailUrl(String detailUrl) { - this.detailUrl = detailUrl; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Boolean getIsrequest() { - return isrequest; - } - - public void setIsrequest(Boolean isrequest) { - this.isrequest = isrequest; - } - - public String getHashid() { - return hashid; - } - - public void setHashid(String hashid) { - this.hashid = hashid; - } - - public String getReason() { - return reason; - } - - public void setReason(String reason) { - this.reason = reason; - } - - public String getSerialnum() { - return serialnum; - } - - public void setSerialnum(String serialnum) { - this.serialnum = serialnum; - } - - public Boolean getIspublic() { - return ispublic; - } - - public void setIspublic(Boolean ispublic) { - this.ispublic = ispublic; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/SdkDecryptDataEntity.java b/src/main/java/com/lf/server/entity/ctrl/SdkDecryptDataEntity.java deleted file mode 100644 index a2fe4ab..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/SdkDecryptDataEntity.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.lf.server.entity.ctrl; - -import com.alibaba.fastjson.annotation.JSONField; -import com.lf.server.entity.all.StaticData; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -/** - * SDK瑙e瘑鏁版嵁绫� - * @author WWW - */ -public class SdkDecryptDataEntity implements Serializable { - private static final long serialVersionUID = 4119527512820258035L; - - private static List<Integer> registeredModules = new ArrayList<>(); - - static { - for (int i = 1; i <= StaticData.ONE_HUNDRED; i++) { - registeredModules.add(i); - } - } - - public SdkDecryptDataEntity() { - machineId = "e7dd8a96913fb5fe62df6b5a7fd503f4"; - // registeredModules = new int[] { 1, 3, 9, 12, 13, 17, 25, 30, 33, 37 } - message = "OK"; - success = true; - - Calendar calendar = Calendar.getInstance(); - calendar.set(2050, 12, 31); - expireDate = calendar.getTime(); - } - - private String machineId; - - private String message; - - private boolean success; - - @JSONField(format = "yyyy-MM-dd HH:mm:ss") - private Date expireDate; - - public String getMachineId() { - return machineId; - } - - public void setMachineId(String machineId) { - this.machineId = machineId; - } - - public List<Integer> getRegisteredModules() { - return registeredModules; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public Date getExpireDate() { - return expireDate; - } - - public void setExpireDate(Date expireDate) { - this.expireDate = expireDate; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/SdkDecryptEntity.java b/src/main/java/com/lf/server/entity/ctrl/SdkDecryptEntity.java deleted file mode 100644 index 02b2b00..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/SdkDecryptEntity.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.lf.server.entity.ctrl; - -import java.io.Serializable; - -/** - * SDK瑙e瘑绫� - * @author WWW - */ -public class SdkDecryptEntity implements Serializable { - private static final long serialVersionUID = 853291437502721609L; - - private int code; - - private String msg; - - private SdkDecryptDataEntity data; - - public SdkDecryptEntity() { - code = 200; - msg = null; - data = new SdkDecryptDataEntity(); - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public SdkDecryptDataEntity getData() { - return data; - } - - public void setData(SdkDecryptDataEntity data) { - this.data = data; - } -} - diff --git a/src/main/java/com/lf/server/entity/ctrl/SdkSecretEntity.java b/src/main/java/com/lf/server/entity/ctrl/SdkSecretEntity.java deleted file mode 100644 index e303833..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/SdkSecretEntity.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.lf.server.entity.ctrl; - -/** - * SDK鍔犲瘑绫� - * @author WWW - */ -public class SdkSecretEntity { - private int code; - - private String msg; - - private String data; - - public SdkSecretEntity() { - code = 200; - msg = null; - data = "1052f106aed368e0c29b4eec89e03a91e352059a24624d0b4fab38e57943a47a0c81e9c843d9e3b11eaed1e7853b09ad7c603d4f854f0351fa9397fe4a06e0c161ca142d0665289510535743fd11e3c47e5648a031d1240536de3640ef94808fec77d15bfea9e6f3faca2f19d15f89b1fcfe23fa7b2b4f433ba22a7484992f63766cb68a81120288e1638a16b126139833b6f1c35876932a4d730ef68fbfecc4"; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/ShpRecordEntity.java b/src/main/java/com/lf/server/entity/ctrl/ShpRecordEntity.java deleted file mode 100644 index 13c1863..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/ShpRecordEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.lf.server.entity.ctrl; - -import java.io.Serializable; - -/** - * Shp璁板綍 - * @author WWW - */ -public class ShpRecordEntity implements Serializable { - private static final long serialVersionUID = -1366388818651675941L; - - private String wkt; - - private String csid; - - public ShpRecordEntity() { - - } - - public ShpRecordEntity(String wkt, String csid) { - this.wkt = wkt; - this.csid = csid; - } - - public String getWkt() { - return wkt; - } - - public void setWkt(String wkt) { - this.wkt = wkt; - } - - public String getCsid() { - return csid; - } - - public void setCsid(String csid) { - this.csid = csid; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/TabEntity.java b/src/main/java/com/lf/server/entity/ctrl/TabEntity.java deleted file mode 100644 index b7f39f3..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/TabEntity.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.lf.server.entity.ctrl; - -import java.io.Serializable; - -/** - * 琛ㄥ疄浣撶被 - * @author WWW - */ -public class TabEntity implements Serializable { - private static final long serialVersionUID = 2786394526795387464L; - - private String ns; - - private String tab; - - private String entity; - - private String tabDesc; - - private String tableType; - - private Integer rows; - - private String bak; - - public TabEntity() { - } - - public String getNs() { - return ns; - } - - public void setNs(String ns) { - this.ns = ns; - } - - public String getTab() { - return tab; - } - - public void setTab(String tab) { - this.tab = tab; - } - - public String getEntity() { - return entity; - } - - public void setEntity(String entity) { - this.entity = entity; - } - - public String getTabDesc() { - return tabDesc; - } - - public void setTabDesc(String tabDesc) { - this.tabDesc = tabDesc; - } - - public String getTableType() { - return tableType; - } - - public void setTableType(String tableType) { - this.tableType = tableType; - } - - public Integer getRows() { - return rows; - } - - public void setRows(Integer rows) { - this.rows = rows; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } -} diff --git a/src/main/java/com/lf/server/entity/ctrl/TabMapperEntity.java b/src/main/java/com/lf/server/entity/ctrl/TabMapperEntity.java deleted file mode 100644 index a91a8e8..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/TabMapperEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.lf.server.entity.ctrl; - -/** - * 琛ㄦ槧灏勫疄浣撶被 - * @author WWW - */ -public class TabMapperEntity { - public TabMapperEntity() { - } - - public TabMapperEntity(String fileName, String type, String tab, String subPath) { - this.fileName = fileName; - this.type = type; - this.tab = tab; - this.subPath = subPath; - } - - private String eventid; - - private int dirid; - - private int depid; - - private int verid; - - private String fileName; - - private String extName; - - private String type; - - private String subPath; - - private String tab; - - private String entity; - - private Integer rows; - -} diff --git a/src/main/java/com/lf/server/entity/ctrl/UserUpdateEntity.java b/src/main/java/com/lf/server/entity/ctrl/UserUpdateEntity.java deleted file mode 100644 index 01b5b35..0000000 --- a/src/main/java/com/lf/server/entity/ctrl/UserUpdateEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.lf.server.entity.ctrl; - -import java.io.Serializable; -import java.util.List; - -/** - * 鐢ㄦ埛鏇存柊绫� - * @author WWW - */ -public class UserUpdateEntity implements Serializable { - private static final long serialVersionUID = 8390219588267518254L; - - private String adminPwd; - - private String newPwd; - - private List<Integer> ids; - - public UserUpdateEntity() { - - } - - public String getAdminPwd() { - return adminPwd; - } - - public void setAdminPwd(String adminPwd) { - this.adminPwd = adminPwd; - } - - public String getNewPwd() { - return newPwd; - } - - public void setNewPwd(String newPwd) { - this.newPwd = newPwd; - } - - public List<Integer> getIds() { - return ids; - } - - public void setIds(List<Integer> ids) { - this.ids = ids; - } -} diff --git a/src/main/java/com/lf/server/entity/data/CoordEntity.java b/src/main/java/com/lf/server/entity/data/CoordEntity.java deleted file mode 100644 index 3f32ef0..0000000 --- a/src/main/java/com/lf/server/entity/data/CoordEntity.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; - -/** - * 鍧愭爣绯� - * @author WWW - */ -public class CoordEntity implements Serializable { - private static final long serialVersionUID = 5660360983928368364L; - - private Integer id; - - private String epsgcode; - - private String coordinate; - - private String zoning; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getEpsgcode() { - return epsgcode; - } - - public void setEpsgcode(String epsgcode) { - this.epsgcode = epsgcode; - } - - public String getCoordinate() { - return coordinate; - } - - public void setCoordinate(String coordinate) { - this.coordinate = coordinate; - } - - public String getZoning() { - return zoning; - } - - public void setZoning(String zoning) { - this.zoning = zoning; - } -} diff --git a/src/main/java/com/lf/server/entity/data/DictEntity.java b/src/main/java/com/lf/server/entity/data/DictEntity.java deleted file mode 100644 index 29ccad6..0000000 --- a/src/main/java/com/lf/server/entity/data/DictEntity.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 瀛楀吀绠$悊 - * @author WWW - */ -public class DictEntity implements Serializable { - private static final long serialVersionUID = -343890141066128689L; - - private int id; - - private String ns; - - private String tab; - - private String tabDesc; - - private String field; - - private String alias; - - private String type; - - private int len; - - private int precision; - - private int orderNum; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String tabletype; - - private String unit; - - private String domainNa; - - private int showtype; - - private int editable; - - private String bak; - - private String createName; - - private String updateName; - - public DictEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getNs() { - return ns; - } - - public void setNs(String ns) { - this.ns = ns; - } - - public String getTab() { - return tab; - } - - public void setTab(String tab) { - this.tab = tab; - } - - public String getTabDesc() { - return tabDesc; - } - - public void setTabDesc(String tabDesc) { - this.tabDesc = tabDesc; - } - - public String getField() { - return field; - } - - public void setField(String field) { - this.field = field; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public int getLen() { - return len; - } - - public void setLen(int len) { - this.len = len; - } - - public int getPrecision() { - return precision; - } - - public void setPrecision(int precision) { - this.precision = precision; - } - - public int getOrderNum() { - return orderNum; - } - - public void setOrderNum(int orderNum) { - this.orderNum = orderNum; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getTabletype() { - return tabletype; - } - - public void setTabletype(String tabletype) { - this.tabletype = tabletype; - } - - public String getUnit() { - return unit; - } - - public void setUnit(String unit) { - this.unit = unit; - } - - public String getDomainNa() { - return domainNa; - } - - public void setDomainNa(String domainNa) { - this.domainNa = domainNa; - } - - public int getShowtype() { - return showtype; - } - - public void setShowtype(int showtype) { - this.showtype = showtype; - } - - public int getEditable() { - return editable; - } - - public void setEditable(int editable) { - this.editable = editable; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } -} diff --git a/src/main/java/com/lf/server/entity/data/DirEntity.java b/src/main/java/com/lf/server/entity/data/DirEntity.java deleted file mode 100644 index dae9fb7..0000000 --- a/src/main/java/com/lf/server/entity/data/DirEntity.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.lf.server.entity.data; - -import lombok.AllArgsConstructor; -import lombok.Data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鐩綍 - * @author WWW - */ -@Data -@AllArgsConstructor -public class DirEntity implements Serializable { - private static final long serialVersionUID = -2184993363389504088L; - - private int id; - - private int pid; - - private String name; - - private String exts; - - private String descr; - - private int level; - - private int orderNum; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String checks; - - private String bak; - - private String code; - - private String fullName; - - public DirEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getPid() { - return pid; - } - - public void setPid(int pid) { - this.pid = pid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getExts() { - return exts; - } - - public void setExts(String exts) { - this.exts = exts; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public int getLevel() { - return level; - } - - public void setLevel(int level) { - this.level = level; - } - - public int getOrderNum() { - return orderNum; - } - - public void setOrderNum(int orderNum) { - this.orderNum = orderNum; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getChecks() { - return checks; - } - - public void setChecks(String checks) { - this.checks = checks; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } -} diff --git a/src/main/java/com/lf/server/entity/data/DomainEntity.java b/src/main/java/com/lf/server/entity/data/DomainEntity.java deleted file mode 100644 index a1aa594..0000000 --- a/src/main/java/com/lf/server/entity/data/DomainEntity.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鍊煎煙 - * @author WWW - */ -public class DomainEntity implements Serializable { - private static final long serialVersionUID = -334732819504445760L; - - private int id; - - private String domDesc; - - private String domName; - - private String domCode; - - private String codeDesc; - - private int level; - - private int orderid; - - private String bsm; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - public DomainEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getDomDesc() { - return domDesc; - } - - public void setDomDesc(String domDesc) { - this.domDesc = domDesc; - } - - public String getDomName() { - return domName; - } - - public void setDomName(String domName) { - this.domName = domName; - } - - public String getDomCode() { - return domCode; - } - - public void setDomCode(String domCode) { - this.domCode = domCode; - } - - public String getCodeDesc() { - return codeDesc; - } - - public void setCodeDesc(String codeDesc) { - this.codeDesc = codeDesc; - } - - public int getLevel() { - return level; - } - - public void setLevel(int level) { - this.level = level; - } - - public int getOrderid() { - return orderid; - } - - public void setOrderid(int orderid) { - this.orderid = orderid; - } - - public String getBsm() { - return bsm; - } - - public void setBsm(String bsm) { - this.bsm = bsm; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } -} diff --git a/src/main/java/com/lf/server/entity/data/DownloadEntity.java b/src/main/java/com/lf/server/entity/data/DownloadEntity.java deleted file mode 100644 index eb14014..0000000 --- a/src/main/java/com/lf/server/entity/data/DownloadEntity.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 涓嬭浇璁板綍 - * @author WWW - */ -public class DownloadEntity implements Serializable { - private static final long serialVersionUID = -767416271272774912L; - - private int id; - - private String name; - - private int type; - - private double sizes; - - private int depid; - - private int dcount; - - private String pwd; - - private String url; - - private String descr; - - private String guid; - - private int createUser; - - private Timestamp createTime; - - private int downloadUser; - - private Timestamp downloadTime; - - private String geom; - - private String bak; - - private String createName; - - public DownloadEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public double getSizes() { - return sizes; - } - - public void setSizes(double sizes) { - this.sizes = sizes; - } - - public int getDepid() { - return depid; - } - - public void setDepid(int depid) { - this.depid = depid; - } - - public int getDcount() { - return dcount; - } - - public void setDcount(int dcount) { - this.dcount = dcount; - } - - public String getPwd() { - return pwd; - } - - public void setPwd(String pwd) { - this.pwd = pwd; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getDownloadUser() { - return downloadUser; - } - - public void setDownloadUser(int downloadUser) { - this.downloadUser = downloadUser; - } - - public Timestamp getDownloadTime() { - return downloadTime; - } - - public void setDownloadTime(Timestamp downloadTime) { - this.downloadTime = downloadTime; - } - - public String getGeom() { - return geom; - } - - public void setGeom(String geo) { - this.geom = geo; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } -} diff --git a/src/main/java/com/lf/server/entity/data/FmeLogEntity.java b/src/main/java/com/lf/server/entity/data/FmeLogEntity.java deleted file mode 100644 index 5d87ed0..0000000 --- a/src/main/java/com/lf/server/entity/data/FmeLogEntity.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * FME鏃ュ織琛� - * @author WWW - */ -public class FmeLogEntity implements Serializable { - private static final long serialVersionUID = -1304153743551710249L; - - public FmeLogEntity() { - } - - private Integer id; - - private String parentid; - - private String dirpath; - - private String pgNs; - - private String tcmc; - - private String tcdm; - - private Integer count; - - private Timestamp createTime; - - private Timestamp updateTime; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getParentid() { - return parentid; - } - - public void setParentid(String parentid) { - this.parentid = parentid; - } - - public String getDirpath() { - return dirpath; - } - - public void setDirpath(String dirpath) { - this.dirpath = dirpath; - } - - public String getPgNs() { - return pgNs; - } - - public void setPgNs(String pgNs) { - this.pgNs = pgNs; - } - - public String getTcmc() { - return tcmc; - } - - public void setTcmc(String tcmc) { - this.tcmc = tcmc; - } - - public String getTcdm() { - return tcdm; - } - - public void setTcdm(String tcdm) { - this.tcdm = tcdm; - } - - public Integer getCount() { - return count; - } - - public void setCount(Integer count) { - this.count = count; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } -} diff --git a/src/main/java/com/lf/server/entity/data/LayerEntity.java b/src/main/java/com/lf/server/entity/data/LayerEntity.java deleted file mode 100644 index 0f3bbbd..0000000 --- a/src/main/java/com/lf/server/entity/data/LayerEntity.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鍥惧眰 - * @author WWW - */ -public class LayerEntity implements Serializable { - private static final long serialVersionUID = -159911666139919168L; - - private int id; - - private int pid; - - private String cnName; - - private String enName; - - private String url; - - private String testUrl; - - private int type; - - private String icon; - - private int level; - - private int orderNum; - - private int isShow; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - private String serveType; - - private String dataType; - - private double elev; - - private String ns; - - private Integer pubid; - - private Integer isProject; - - public LayerEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getPid() { - return pid; - } - - public void setPid(int pid) { - this.pid = pid; - } - - public String getCnName() { - return cnName; - } - - public void setCnName(String cnName) { - this.cnName = cnName; - } - - public String getEnName() { - return enName; - } - - public void setEnName(String enName) { - this.enName = enName; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getTestUrl() { - return testUrl; - } - - public void setTestUrl(String testUrl) { - this.testUrl = testUrl; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public int getLevel() { - return level; - } - - public void setLevel(int level) { - this.level = level; - } - - public int getOrderNum() { - return orderNum; - } - - public void setOrderNum(int orderNum) { - this.orderNum = orderNum; - } - - public int getIsShow() { - return isShow; - } - - public void setIsShow(int isShow) { - this.isShow = isShow; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getServeType() { - return serveType; - } - - public void setServeType(String serveType) { - this.serveType = serveType; - } - - public String getDataType() { - return dataType; - } - - public void setDataType(String dataType) { - this.dataType = dataType; - } - - public double getElev() { - return elev; - } - - public void setElev(double elev) { - this.elev = elev; - } - - public String getNs() { - return ns; - } - - public void setNs(String ns) { - this.ns = ns; - } - - public Integer getPubid() { - return pubid; - } - - public void setPubid(Integer pubid) { - this.pubid = pubid; - } - - public Integer getIsProject() { - return isProject; - } - - public void setIsProject(Integer isProject) { - this.isProject = isProject; - } -} diff --git a/src/main/java/com/lf/server/entity/data/MetaEntity.java b/src/main/java/com/lf/server/entity/data/MetaEntity.java deleted file mode 100644 index 1515fd2..0000000 --- a/src/main/java/com/lf/server/entity/data/MetaEntity.java +++ /dev/null @@ -1,305 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鍏冩暟鎹� - * @author WWW - */ -public class MetaEntity implements Serializable { - private static final long serialVersionUID = -984838663593325184L; - - private int id; - - private String eventid; - - private int metaid; - - private short ismeta; - - private String dircode; - - private String depcode; - - private int verid; - - private String name; - - private String type; - - private String guid; - - private String path; - - private double sizes; - - private String tab; - - private String layer; - - private int rows; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - private String geom; - - private String uname; - - private String depName; - - private String verName; - - private String dirName; - - private Integer downCount; - - private String lastUser; - - private Timestamp lastTime; - - private String url; - - public MetaEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getEventid() { - return eventid; - } - - public void setEventid(String eventid) { - this.eventid = eventid; - } - - public int getMetaid() { - return metaid; - } - - public void setMetaid(int metaid) { - this.metaid = metaid; - } - - public short getIsmeta() { - return ismeta; - } - - public void setIsmeta(short ismeta) { - this.ismeta = ismeta; - } - - public String getDircode() { - return dircode; - } - - public void setDircode(String dircode) { - this.dircode = dircode; - } - - public String getDepcode() { - return depcode; - } - - public void setDepcode(String depcode) { - this.depcode = depcode; - } - - public int getVerid() { - return verid; - } - - public void setVerid(int verid) { - this.verid = verid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public double getSizes() { - return sizes; - } - - public void setSizes(double sizes) { - this.sizes = sizes; - } - - public String getTab() { - return tab; - } - - public void setTab(String tab) { - this.tab = tab; - } - - public String getLayer() { - return layer; - } - - public void setLayer(String layer) { - this.layer = layer; - } - - public int getRows() { - return rows; - } - - public void setRows(int rows) { - this.rows = rows; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getGeom() { - return geom; - } - - public void setGeom(String geom) { - this.geom = geom; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } - - public String getVerName() { - return verName; - } - - public void setVerName(String verName) { - this.verName = verName; - } - - public String getDirName() { - return dirName; - } - - public void setDirName(String dirName) { - this.dirName = dirName; - } - - public Integer getDownCount() { - return downCount; - } - - public void setDownCount(Integer downCount) { - this.downCount = downCount; - } - - public String getLastUser() { - return lastUser; - } - - public void setLastUser(String lastUser) { - this.lastUser = lastUser; - } - - public Timestamp getLastTime() { - return lastTime; - } - - public void setLastTime(Timestamp lastTime) { - this.lastTime = lastTime; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } -} diff --git a/src/main/java/com/lf/server/entity/data/MetaFileEntity.java b/src/main/java/com/lf/server/entity/data/MetaFileEntity.java deleted file mode 100644 index f01b35f..0000000 --- a/src/main/java/com/lf/server/entity/data/MetaFileEntity.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鍏冩暟鎹枃浠� - * @author WWW - */ -public class MetaFileEntity implements Serializable { - private static final long serialVersionUID = -3688958480700165163L; - - private String eventid; - - private String dircode; - - private String depcode; - - private int verid; - - private String name; - - private String type; - - private String guid; - - private String path; - - private double sizes; - - private int createUser; - - private Timestamp createTime; - - private String extName; - - private String epsgCode; - - private String tab; - - private String entity; - - private int rows; - - private String msg; - - private Boolean isMeta; - - private String xlsPath; - - public String getEventid() { - return eventid; - } - - public void setEventid(String eventid) { - this.eventid = eventid; - } - - public String getDircode() { - return dircode; - } - - public void setDircode(String dircode) { - this.dircode = dircode; - } - - public String getDepcode() { - return depcode; - } - - public void setDepcode(String depcode) { - this.depcode = depcode; - } - - public int getVerid() { - return verid; - } - - public void setVerid(int verid) { - this.verid = verid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public double getSizes() { - return sizes; - } - - public void setSizes(double sizes) { - this.sizes = sizes; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public String getExtName() { - return extName; - } - - public void setExtName(String extName) { - this.extName = extName; - } - - public String getEpsgCode() { - return epsgCode; - } - - public void setEpsgCode(String epsgCode) { - this.epsgCode = epsgCode; - } - - public String getTab() { - return tab; - } - - public void setTab(String tab) { - this.tab = tab; - } - - public String getEntity() { - return entity; - } - - public void setEntity(String entity) { - this.entity = entity; - } - - public int getRows() { - return rows; - } - - public void setRows(int rows) { - this.rows = rows; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public Boolean getIsMeta() { - return isMeta; - } - - public void setIsMeta(Boolean isMeta) { - this.isMeta = isMeta; - } - - public String getXlsPath() { - return xlsPath; - } - - public void setXlsPath(String xlsPath) { - this.xlsPath = xlsPath; - } -} diff --git a/src/main/java/com/lf/server/entity/data/PublishEntity.java b/src/main/java/com/lf/server/entity/data/PublishEntity.java deleted file mode 100644 index bbb6d7f..0000000 --- a/src/main/java/com/lf/server/entity/data/PublishEntity.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鏁版嵁鍙戝竷 - * @author WWW - */ -public class PublishEntity implements Serializable { - private static final long serialVersionUID = -386130556178340032L; - - private int id; - - private String regid; - - private String name; - - private String url; - - private String path; - - private String type; - - private int status; - - private String dirid; - - private String depid; - - private int min; - - private int max; - - private String json; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String geom; - - private String bak; - - private String depName; - - private String dirName; - - private String createName; - - private String updateName; - - public PublishEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getRegid() { - return regid; - } - - public void setRegid(String regid) { - this.regid = regid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public String getDirid() { - return dirid; - } - - public void setDirid(String dirid) { - this.dirid = dirid; - } - - public String getDepid() { - return depid; - } - - public void setDepid(String depid) { - this.depid = depid; - } - - public int getMin() { - return min; - } - - public void setMin(int min) { - this.min = min; - } - - public int getMax() { - return max; - } - - public void setMax(int max) { - this.max = max; - } - - public String getJson() { - return json; - } - - public void setJson(String json) { - this.json = json; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getGeom() { - return geom; - } - - public void setGeom(String geom) { - this.geom = geom; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } - - public String getDirName() { - return dirName; - } - - public void setDirName(String dirName) { - this.dirName = dirName; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } -} diff --git a/src/main/java/com/lf/server/entity/data/StyleEntity.java b/src/main/java/com/lf/server/entity/data/StyleEntity.java deleted file mode 100644 index 6508c60..0000000 --- a/src/main/java/com/lf/server/entity/data/StyleEntity.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鏍峰紡绠$悊 - * @author sws - * @date 2022-09-26 - */ - -public class StyleEntity implements Serializable { - private static final long serialVersionUID = 2421229801055033955L; - - private int id; - - private String name; - - private String type; - - private int dirid; - - private int depid; - - private String ver; - - private int status; - - private String precision; - - private String descr; - - private String fname; - - private String fileGuid; - - private String vname; - - private String viewGuid; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String depName; - - private String dirName; - - private String bak; - - private String createName; - - private String updateName; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public int getDirid() { - return dirid; - } - - public void setDirid(int dirid) { - this.dirid = dirid; - } - - public int getDepid() { - return depid; - } - - public void setDepid(int depid) { - this.depid = depid; - } - - public String getVer() { - return ver; - } - - public void setVer(String ver) { - this.ver = ver; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public String getPrecision() { - return precision; - } - - public void setPrecision(String precision) { - this.precision = precision; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public String getFileGuid() { - return fileGuid; - } - - public void setFileGuid(String fileGuid) { - this.fileGuid = fileGuid; - } - - public String getViewGuid() { - return viewGuid; - } - - public void setViewGuid(String viewGuid) { - this.viewGuid = viewGuid; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } - - public String getDirName() { - return dirName; - } - - public void setDirName(String dirName) { - this.dirName = dirName; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getFname() { - return fname; - } - - public void setFname(String fname) { - this.fname = fname; - } - - public String getVname() { - return vname; - } - - public void setVname(String vname) { - this.vname = vname; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } -} diff --git a/src/main/java/com/lf/server/entity/data/VerEntity.java b/src/main/java/com/lf/server/entity/data/VerEntity.java deleted file mode 100644 index 1a57e64..0000000 --- a/src/main/java/com/lf/server/entity/data/VerEntity.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.lf.server.entity.data; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鐗堟湰琛� - * @author sws - * @date 2022-09-29 - */ -public class VerEntity implements Serializable { - private static final long serialVersionUID = 4765222572551658531L; - - private int id; - - private int dirid; - - private String name; - - private String descr; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String depName; - - private String createName; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getDirid() { - return dirid; - } - - public void setDirid(int dirid) { - this.dirid = dirid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } -} diff --git a/src/main/java/com/lf/server/entity/other/CheckOutLicense.java b/src/main/java/com/lf/server/entity/other/CheckOutLicense.java deleted file mode 100644 index 136e64d..0000000 --- a/src/main/java/com/lf/server/entity/other/CheckOutLicense.java +++ /dev/null @@ -1,238 +0,0 @@ -package com.lf.server.entity.other; - -import org.apache.commons.codec.binary.Hex; - -import javax.crypto.Cipher; -import javax.crypto.SecretKey; -import java.io.ByteArrayInputStream; -import java.io.ObjectInputStream; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Random; - -/** - * CheckOutLicense - * @author WWW - */ -@SuppressWarnings("AlibabaUndefineMagicConstant") -public class CheckOutLicense { - public static String createFloatingLicense(int n, String s, long expireDate) { - int[] registeredModules = new int[]{1, 3, 4, 9, 10, 11, 12, 13, 17, 25, 30, 33, 37}; - - long n2; - if ((n2 = System.currentTimeMillis() + 86400000L) > expireDate) { - n2 = expireDate; - } - - CheckOutLicense e = new CheckOutLicense(); - e.a(n2); - e.a(n); - e.cc(s); - e.a(registeredModules); - - return e.aaa(e); - } - - public String aaa(final CheckOutLicense b) { - final CheckOutLicense e = b; - return new String(a(e.a, e.b, e.c)) + new bb().a(new StringBuilder().append(e.ee()).toString()); - } - - private char[] a(final long n, final int[] array, final int i) { - final char[] array2 = new char[48]; - final String b = b(n); - final String value = String.valueOf(i); - - final bb b2 = new bb(); - final String a = b2.a(b); - final String a2 = b2.a(value); - - final cc c = new cc(); - for (int j = 0; j < array.length; ++j) { - c.b(array[j]); - } - - final char[] a3 = c.a(); - for (int k = 0; k < 16; ++k) { - array2[k * 3] = a3[k]; - array2[k * 3 + 1] = a.charAt(k); - array2[k * 3 + 2] = a2.charAt(k); - } - return array2; - } - - private static String b(final long timeInMillis) { - final Calendar instance; - (instance = Calendar.getInstance()).setTimeInMillis(timeInMillis); - final int value = instance.get(1); - final int value2 = instance.get(2); - final int value3 = instance.get(5); - final String substring = Integer.toString(value).substring(2, 4); - String s; - if ((s = Integer.toString(value2 + 1)).length() == 1) { - s = "0".concat(String.valueOf(s)); - } - String s2; - if ((s2 = Integer.toString(value3)).length() == 1) { - s2 = "0".concat(String.valueOf(s2)); - } - return String.valueOf(substring) + s + s2; - } - - public static CheckOutLicense a(String s) { - try { - return null; - } catch (Exception ex) { - return null; - } - } - - public final String ee() { - return this.aa; - } - - private String aa; - private long a; - private int c; - private int[] b; - - public final void a(final long a) { - this.a = a; - } - - public final void a(final int c) { - this.c = c; - } - - public final void a(final int[] b) { - this.b = b; - } - - public final long a() { - return this.a; - } - - public final int[] b() { - return this.b; - } - - public final int c() { - return this.c; - } - - private void cc(String aa) { - this.aa = aa; - } - - @SuppressWarnings("AlibabaClassNamingShouldBeCamel") - public class bb { - private SecretKey a; - - public bb() { - try { - this.a = (SecretKey) new ObjectInputStream(new ByteArrayInputStream(Hex.decodeHex("aced0005737200146a6176612e73656375726974792e4b6579526570bdf94fb3889aa5430200044c0009616c676f726974686d7400124c6a6176612f6c616e672f537472696e673b5b0007656e636f6465647400025b424c0006666f726d617471007e00014c00047479706574001b4c6a6176612f73656375726974792f4b657952657024547970653b7870740003444553757200025b42acf317f8060854e00200007870000000084f5b0e52b33dbf797400035241577e7200196a6176612e73656375726974792e4b6579526570245479706500000000000000001200007872000e6a6176612e6c616e672e456e756d00000000000000001200007870740006534543524554".toCharArray()))).readObject(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - public String a(final String s) { - try { - final Cipher instance; - (instance = Cipher.getInstance("DES/ECB/PKCS5Padding")).init(1, this.a); - return Hex.encodeHexString(instance.doFinal(s.getBytes())); - } catch (Exception ex) { - return null; - } - } - - public String b(final String s) { - try { - final Cipher instance; - (instance = Cipher.getInstance("DES/ECB/PKCS5Padding")).init(2, this.a); - return new String(instance.doFinal(Hex.decodeHex(s.toCharArray()))); - } catch (Exception ex) { - return null; - } - } - } - - @SuppressWarnings("AlibabaClassNamingShouldBeCamel") - public final class cc { - private int a; - private char[] b; - private int c = 63; - - public cc() { - this.a = 0; - Arrays.fill(this.b = new char[c], '0'); - this.a = new Random().nextInt(16); - String obj; - if ((obj = Integer.toBinaryString(this.a)).length() == 1) { - obj = "000".concat(String.valueOf(obj)); - } else if (obj.length() == 2) { - obj = "00".concat(String.valueOf(obj)); - } else if (obj.length() == 3) { - obj = "0".concat(String.valueOf(obj)); - } - for (int i = 0; i < 4; ++i) { - this.b[i] = obj.charAt(i); - } - } - - public cc(String binaryString) { - this.a = 0; - Arrays.fill(this.b = new char[c], '0'); - final int length; - if ((length = (binaryString = Long.toBinaryString(Long.parseUnsignedLong(binaryString, 16))).length()) <= c) { - for (int i = 0; i < length; ++i) { - this.b[c - length + i] = binaryString.charAt(i); - } - } - final char[] value = new char[4]; - System.arraycopy(this.b, 0, value, 0, 4); - binaryString = new String(value); - this.a = Integer.parseUnsignedInt(binaryString, 2); - } - - @Override - public final String toString() { - String string = ""; - for (int i = 0; i < c; ++i) { - string = String.valueOf(string) + this.b[i]; - } - return string; - } - - public final char[] a() { - final String hexString = Long.toHexString(Long.parseUnsignedLong(this.toString(), 2)); - final int n; - final char[] array; - Arrays.fill(array = new char[n = (c + 1) / 4], '0'); - for (int length = hexString.length(), i = 0; i < length; ++i) { - array[n - length + i] = hexString.charAt(i); - } - return array; - } - - public final boolean a(int c) { - return (c = this.c(c)) < c && this.b[c] == '1' && c >= 4; - } - - private int c(int n) { - if (n >= 0 && n < 59) { - if ((n += 4 + this.a) >= 63) { - n -= 59; - } - return n; - } - return -1; - } - - public final void b(int c) { - if ((c = this.c(c)) < c && c >= 4) { - this.b[c] = '1'; - } - } - } -} diff --git a/src/main/java/com/lf/server/entity/other/FloatServerResponse.java b/src/main/java/com/lf/server/entity/other/FloatServerResponse.java deleted file mode 100644 index de5ed9d..0000000 --- a/src/main/java/com/lf/server/entity/other/FloatServerResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.lf.server.entity.other; - -import com.lf.server.helper.StringHelper; - -import java.util.Calendar; - -/** - * FloatServerResponse - * @author WWW - */ -public class FloatServerResponse { - private String modules; - - private String id; - - private String expireDate; - - private int processNum; - - private long time; - - private int availableNum; - - private String licenseCode; - - private String localId; - - public FloatServerResponse() { - } - - public FloatServerResponse(ReqParamFloatServer rfs) { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.YEAR, 2025); - - this.id = rfs.getId(); - this.localId = rfs.getLocalId(); - this.availableNum = rfs.getAvailableNum(); - this.time = calendar.getTimeInMillis(); - this.expireDate = StringHelper.YMD_FORMAT.format(this.time); - //this.licenseCode = "78a82f0920de0f557f8177bec1e48601c4dc25e4054a00728e4314b56528d3a1632de5298edee38a65412277977a174fea5d91c452b19ef138dbc2ba089ba632"; - this.licenseCode = CheckOutLicense.createFloatingLicense(rfs.getAvailableNum(), rfs.getId(), this.time); - } - - public String getModules() { - return this.modules; - } - - public void setModules(final String modules) { - this.modules = modules; - } - - public String getId() { - return this.id; - } - - public void setId(final String id) { - this.id = id; - } - - public String getExpireDate() { - return this.expireDate; - } - - public void setExpireDate(final String expireDate) { - this.expireDate = expireDate; - } - - public int getProcessNum() { - return this.processNum; - } - - public void setProcessNum(final int processNum) { - this.processNum = processNum; - } - - public int getAvailableNum() { - return this.availableNum; - } - - public void setAvailableNum(final int availableNum) { - this.availableNum = availableNum; - } - - public long getTime() { - return this.time; - } - - public void setTime(final long time) { - this.time = time; - } - - public String getLicenseCode() { - return this.licenseCode; - } - - public void setLicenseCode(final String licenseCode) { - this.licenseCode = licenseCode; - } - - public String getLocalId() { - return localId; - } - - public void setLocalId(String localId) { - this.localId = localId; - } -} diff --git a/src/main/java/com/lf/server/entity/other/ReqParamFloatServer.java b/src/main/java/com/lf/server/entity/other/ReqParamFloatServer.java deleted file mode 100644 index 2342e00..0000000 --- a/src/main/java/com/lf/server/entity/other/ReqParamFloatServer.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.lf.server.entity.other; - -import java.net.Inet4Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.util.Enumeration; - -/** - * ReqParamFloatServer - * @author WWW - */ -public class ReqParamFloatServer { - private String id; - - private String port; - - private String modules; - - private int availableNum; - - private long time; - - private String localId; - - private String cmdType; - - public ReqParamFloatServer() { - this.localId = a(); - } - - public ReqParamFloatServer(String id, String port) { - this.id = id; - this.port = port; - this.localId = a(); - } - - public String getPort() { - return this.port; - } - - public void setPort(final String port) { - this.port = port; - } - - public String getId() { - return this.id; - } - - public void setId(final String id) { - this.id = id; - } - - public String getModules() { - return this.modules; - } - - public void setModules(final String modules) { - this.modules = modules; - } - - public int getAvailableNum() { - return this.availableNum; - } - - public void setAvailableNum(final int availableNum) { - this.availableNum = availableNum; - } - - public long getTime() { - return this.time; - } - - public void setTime(final long time) { - this.time = time; - } - - public String getLocalId() { - return this.localId; - } - - public String getCmdType() { - return this.cmdType; - } - - public void setCmdType(final String cmdType) { - this.cmdType = cmdType; - } - - public static String a() { - String string = ""; - try { - final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); - while (networkInterfaces.hasMoreElements()) { - final NetworkInterface networkInterface; - if (!(networkInterface = networkInterfaces.nextElement()).isLoopback() && !networkInterface.isVirtual() && networkInterface.isUp()) { - final Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses(); - final byte[] hardwareAddress; - if ((hardwareAddress = networkInterface.getHardwareAddress()) == null || networkInterface.getName().contains("docker")) { - continue; - } - while (inetAddresses.hasMoreElements()) { - final InetAddress inetAddress; - if ((inetAddress = inetAddresses.nextElement()) != null && inetAddress instanceof Inet4Address) { - final String a = a(inetAddress); - string = String.valueOf(inetAddress.getHostAddress()) + "|" + a; - if (!a.isEmpty()) { - return string; - } - continue; - } - } - } - } - } catch (SocketException ex) { - // - } - return string; - } - - private static String a(final InetAddress addr) { - String upperCase = ""; - try { - final byte[] hardwareAddress = NetworkInterface.getByInetAddress(addr).getHardwareAddress(); - final StringBuffer sb = new StringBuffer(""); - for (int i = 0; i < hardwareAddress.length; ++i) { - if (i != 0) { - sb.append("-"); - } - final String hexString; - if ((hexString = Integer.toHexString(hardwareAddress[i] & 0xFF)).length() == 1) { - sb.append("0".concat(String.valueOf(hexString))); - } else { - sb.append(hexString); - } - } - upperCase = sb.toString().toUpperCase(); - } catch (Exception ex) { - // - } - return upperCase; - } -} diff --git a/src/main/java/com/lf/server/entity/show/ApplyEntity.java b/src/main/java/com/lf/server/entity/show/ApplyEntity.java deleted file mode 100644 index 133beef..0000000 --- a/src/main/java/com/lf/server/entity/show/ApplyEntity.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.lf.server.entity.show; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鏁版嵁鐢宠 - * @author WWW - */ -public class ApplyEntity implements Serializable { - private static final long serialVersionUID = -849213119060365952L; - - private int id; - - private int userid; - - private String depids; - - private String tabs; - - private String entities; - - private String wkt; - - private String pwd; - - private int status; - - private int count; - - private String descr; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String uname; - - private Integer isVerify; - - private String depcode; - - private String dircodes; - - private String gids; - - private String filters; - - private String guid; - - public ApplyEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getUserid() { - return userid; - } - - public void setUserid(int userid) { - this.userid = userid; - } - - public String getDepids() { - return depids; - } - - public void setDepids(String depids) { - this.depids = depids; - } - - public String getTabs() { - return tabs; - } - - public void setTabs(String tabs) { - this.tabs = tabs; - } - - public String getEntities() { - return entities; - } - - public void setEntities(String entities) { - this.entities = entities; - } - - public String getWkt() { - return wkt; - } - - public void setWkt(String wkt) { - this.wkt = wkt; - } - - public String getPwd() { - return pwd; - } - - public void setPwd(String pwd) { - this.pwd = pwd; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public Integer getIsVerify() { - return isVerify; - } - - public void setIsVerify(Integer isVerify) { - this.isVerify = isVerify; - } - - public String getDepcode() { - return depcode; - } - - public void setDepcode(String depcode) { - this.depcode = depcode; - } - - public String getDircodes() { - return dircodes; - } - - public void setDircodes(String dircodes) { - this.dircodes = dircodes; - } - - public String getGids() { - return gids; - } - - public void setGids(String gids) { - this.gids = gids; - } - - public String getFilters() { - return filters; - } - - public void setFilters(String filters) { - this.filters = filters; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } -} diff --git a/src/main/java/com/lf/server/entity/show/ExportEntity.java b/src/main/java/com/lf/server/entity/show/ExportEntity.java deleted file mode 100644 index e1e410d..0000000 --- a/src/main/java/com/lf/server/entity/show/ExportEntity.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.lf.server.entity.show; - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - * 鍦ㄧ嚎鍒跺浘 - * @author WWW - */ -@AllArgsConstructor -@NoArgsConstructor -public class ExportEntity implements Serializable { - private static final long serialVersionUID = -2104359582441796685L; - - private String token; - - private String title; - - private String pageSize; - - private String province; - - private String scale; - - private String resolution; - - private String date; - - private String layers; - - private double rotation; - - private double xmin; - - private double ymin; - - private double ymax; - - private double xmax; - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getPageSize() { - return pageSize; - } - - public void setPageSize(String pageSize) { - this.pageSize = pageSize; - } - - public String getProvince() { - return province; - } - - public void setProvince(String province) { - this.province = province; - } - - public String getScale() { - return scale; - } - - public void setScale(String scale) { - this.scale = scale; - } - - public String getResolution() { - return resolution; - } - - public void setResolution(String resolution) { - this.resolution = resolution; - } - - public String getDate() { - return date; - } - - public void setDate(String date) { - this.date = date; - } - - public String getLayers() { - return layers; - } - - public void setLayers(String layers) { - this.layers = layers; - } - - public double getRotation() { - return rotation; - } - - public void setRotation(double rotation) { - this.rotation = rotation; - } - - public double getXmin() { - return xmin; - } - - public void setXmin(double xmin) { - this.xmin = xmin; - } - - public double getYmin() { - return ymin; - } - - public void setYmin(double ymin) { - this.ymin = ymin; - } - - public double getYmax() { - return ymax; - } - - public void setYmax(double ymax) { - this.ymax = ymax; - } - - public double getXmax() { - return xmax; - } - - public void setXmax(double xmax) { - this.xmax = xmax; - } -} diff --git a/src/main/java/com/lf/server/entity/show/FlowEntity.java b/src/main/java/com/lf/server/entity/show/FlowEntity.java deleted file mode 100644 index e03dc20..0000000 --- a/src/main/java/com/lf/server/entity/show/FlowEntity.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.lf.server.entity.show; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鐢宠娴佺▼ - * @author WWW - */ -public class FlowEntity implements Serializable { - private static final long serialVersionUID = -267684465864526336L; - - private int id; - - private int applyid; - - private String depcode; - - private int userid; - - private int status; - - private String descr; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String uname; - - private String depName; - - public FlowEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getApplyid() { - return applyid; - } - - public void setApplyid(int applyid) { - this.applyid = applyid; - } - - public String getDepcode() { - return depcode; - } - - public void setDepcode(String depcode) { - this.depcode = depcode; - } - - public int getUserid() { - return userid; - } - - public void setUserid(int userid) { - this.userid = userid; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } -} diff --git a/src/main/java/com/lf/server/entity/show/MarkEntity.java b/src/main/java/com/lf/server/entity/show/MarkEntity.java deleted file mode 100644 index 266739b..0000000 --- a/src/main/java/com/lf/server/entity/show/MarkEntity.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.lf.server.entity.show; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鏍囩粯 - * @author WWW - */ -public class MarkEntity implements Serializable { - private static final long serialVersionUID = -865286612354818048L; - - private int id; - - private String name; - - private String wkt; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - public MarkEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getWkt() { - return wkt; - } - - public void setWkt(String wkt) { - this.wkt = wkt; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } -} diff --git a/src/main/java/com/lf/server/entity/show/ModelEntity.java b/src/main/java/com/lf/server/entity/show/ModelEntity.java deleted file mode 100644 index 78a0fd0..0000000 --- a/src/main/java/com/lf/server/entity/show/ModelEntity.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.lf.server.entity.show; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 妯″瀷 - * @author WWW - */ -public class ModelEntity implements Serializable { - private static final long serialVersionUID = -41778639909708240L; - - private int id; - - private int layerid; - - private String modelid; - - private String guid; - - private String name; - - private String type; - - private String info; - - private String url; - - private String icon; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - public ModelEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getLayerid() { - return layerid; - } - - public void setLayerid(int layerid) { - this.layerid = layerid; - } - - public String getModelid() { - return modelid; - } - - public void setModelid(String modelid) { - this.modelid = modelid; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getInfo() { - return info; - } - - public void setInfo(String info) { - this.info = info; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } -} diff --git a/src/main/java/com/lf/server/entity/show/OneMapEntity.java b/src/main/java/com/lf/server/entity/show/OneMapEntity.java deleted file mode 100644 index 7850e96..0000000 --- a/src/main/java/com/lf/server/entity/show/OneMapEntity.java +++ /dev/null @@ -1,294 +0,0 @@ -package com.lf.server.entity.show; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 瀹樼綉涓�寮犲浘瀹炰綋 - * - * @author xing - * @date 2023/02/20 - */ -public class OneMapEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * value - */ - @JsonIgnore - private String value; - - /** - * key - */ - @JsonIgnore - private String key; - - private int id; - - private String eventid; - - private int metaid; - - private short ismeta; - - private String dircode; - - private String depcode; - - private int verid; - - private String name; - - private String type; - - private String guid; - - private String path; - - private double sizes; - - private String tab; - - private String layer; - - private int rows; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - private String geom; - - private String uname; - - private String depName; - - private String verName; - - private String dirName; - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getEventid() { - return eventid; - } - - public void setEventid(String eventid) { - this.eventid = eventid; - } - - public int getMetaid() { - return metaid; - } - - public void setMetaid(int metaid) { - this.metaid = metaid; - } - - public short getIsmeta() { - return ismeta; - } - - public void setIsmeta(short ismeta) { - this.ismeta = ismeta; - } - - public String getDircode() { - return dircode; - } - - public void setDircode(String dircode) { - this.dircode = dircode; - } - - public String getDepcode() { - return depcode; - } - - public void setDepcode(String depcode) { - this.depcode = depcode; - } - - public int getVerid() { - return verid; - } - - public void setVerid(int verid) { - this.verid = verid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public double getSizes() { - return sizes; - } - - public void setSizes(double sizes) { - this.sizes = sizes; - } - - public String getTab() { - return tab; - } - - public void setTab(String tab) { - this.tab = tab; - } - - public String getLayer() { - return layer; - } - - public void setLayer(String layer) { - this.layer = layer; - } - - public int getRows() { - return rows; - } - - public void setRows(int rows) { - this.rows = rows; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getGeom() { - return geom; - } - - public void setGeom(String geom) { - this.geom = geom; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } - - public String getVerName() { - return verName; - } - - public void setVerName(String verName) { - this.verName = verName; - } - - public String getDirName() { - return dirName; - } - - public void setDirName(String dirName) { - this.dirName = dirName; - } -} diff --git a/src/main/java/com/lf/server/entity/show/PipelineEntity.java b/src/main/java/com/lf/server/entity/show/PipelineEntity.java deleted file mode 100644 index 9a32f1c..0000000 --- a/src/main/java/com/lf/server/entity/show/PipelineEntity.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.lf.server.entity.show; - -import com.alibaba.fastjson.annotation.JSONField; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.io.Serializable; -import java.util.List; - -/** - * 绠¢亾鍒嗘瀽瀹炰綋绫� - * - * @author xingjinshuang@smartearth.cn - * @date 2022/12/26 - */ -public class PipelineEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 琛ㄥ悕 - */ - @JSONField(serialize = false) - @JsonInclude(JsonInclude.Include.NON_NULL) - private List<String> tabs; - - /** - * 瀵嗙爜 - */ - @JSONField(serialize = false) - @JsonInclude(JsonInclude.Include.NON_NULL) - private String pwd; - - /** - * 涓婚敭ID - */ - private Integer gid; - - /** - * 绠$嚎 - */ - private String pipeName; - - /** - * 绠℃ - */ - private String segName; - - /** - * 绌胯秺鍚嶇О - */ - private String acrossName; - - /** - * 绌胯秺闀垮害 - */ - private double acrossLength; - - /** - * 澶囨敞 - */ - private String remarks; - - /** - * wkt - */ - private String wkt; - - public Integer getGid() { - return gid; - } - - public void setGid(Integer gid) { - this.gid = gid; - } - - public List<String> getTabs() { - return tabs; - } - - public void setTabs(List<String> tabs) { - this.tabs = tabs; - } - - public String getPwd() { - return pwd; - } - - public void setPwd(String pwd) { - this.pwd = pwd; - } - - public String getPipeName() { - return pipeName; - } - - public void setPipeName(String pipeName) { - this.pipeName = pipeName; - } - - public String getSegName() { - return segName; - } - - public void setSegName(String segName) { - this.segName = segName; - } - - public String getAcrossName() { - return acrossName; - } - - public void setAcrossName(String acrossName) { - this.acrossName = acrossName; - } - - public double getAcrossLength() { - return acrossLength; - } - - public void setAcrossLength(double acrossLength) { - this.acrossLength = acrossLength; - } - - public String getRemarks() { - return remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public String getWkt() { - return wkt; - } - - public void setWkt(String wkt) { - this.wkt = wkt; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/ArgsEntity.java b/src/main/java/com/lf/server/entity/sys/ArgsEntity.java deleted file mode 100644 index 857d500..0000000 --- a/src/main/java/com/lf/server/entity/sys/ArgsEntity.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鍙傛暟璁剧疆 - * @author WWW - */ -public class ArgsEntity implements Serializable { - private static final long serialVersionUID = -832866207909836938L; - - private int id; - - private String name; - - private int cvalue; - - private int dvalue; - - private int minValue; - - private int maxValue; - - private int times; - - private String descr; - - private String mark; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - public ArgsEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getCvalue() { - return cvalue; - } - - public void setCvalue(int cvalue) { - this.cvalue = cvalue; - } - - public int getDvalue() { - return dvalue; - } - - public void setDvalue(int dvalue) { - this.dvalue = dvalue; - } - - public int getMinValue() { - return minValue; - } - - public void setMinValue(int minValue) { - this.minValue = minValue; - } - - public int getMaxValue() { - return maxValue; - } - - public void setMaxValue(int maxValue) { - this.maxValue = maxValue; - } - - public int getTimes() { - return times; - } - - public void setTimes(int times) { - this.times = times; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public String getMark() { - return mark; - } - - public void setMark(String mark) { - this.mark = mark; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/AttachEntity.java b/src/main/java/com/lf/server/entity/sys/AttachEntity.java deleted file mode 100644 index d81cc87..0000000 --- a/src/main/java/com/lf/server/entity/sys/AttachEntity.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 闄勪欢 - * @author WWW - */ -public class AttachEntity implements Serializable { - private static final long serialVersionUID = -106535972611296912L; - - private int id; - - private String name; - - private String tab; - - private String tabGuid; - - private String guid; - - private String path; - - private double sizes; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - public AttachEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getTab() { - return tab; - } - - public void setTab(String tab) { - this.tab = tab; - } - - public String getTabGuid() { - return tabGuid; - } - - public void setTabGuid(String tabGuid) { - this.tabGuid = tabGuid; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public double getSizes() { - return sizes; - } - - public void setSizes(double sizes) { - this.sizes = sizes; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/AuthEntity.java b/src/main/java/com/lf/server/entity/sys/AuthEntity.java deleted file mode 100644 index 6e77013..0000000 --- a/src/main/java/com/lf/server/entity/sys/AuthEntity.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鏉冮檺 - * @author sws - * @date 2022-09-28 - */ -public class AuthEntity implements Serializable { - private static final long serialVersionUID = 2590447372444367285L; - - private int id; - - private String name; - - private String tag; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - private String createName; - - private String updateName; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/BlacklistEntity.java b/src/main/java/com/lf/server/entity/sys/BlacklistEntity.java deleted file mode 100644 index a59419e..0000000 --- a/src/main/java/com/lf/server/entity/sys/BlacklistEntity.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 榛戝悕鍗� - * @author WWW - */ -public class BlacklistEntity implements Serializable { - private static final long serialVersionUID = -705887305878981632L; - - private int id; - - private String ip; - - private int type; - - private int visit; - - private String descr; - - private int createUser; - - private String createName; - - private Timestamp createTime; - - private int updateUser; - - private String updateName; - - private Timestamp updateTime; - - public BlacklistEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public int getVisit() { - return visit; - } - - public void setVisit(int visit) { - this.visit = visit; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/DepEntity.java b/src/main/java/com/lf/server/entity/sys/DepEntity.java deleted file mode 100644 index 6373386..0000000 --- a/src/main/java/com/lf/server/entity/sys/DepEntity.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.lf.server.entity.sys; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * sys_dep - * @author sws - * @date 2022-09-23 - */ - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class DepEntity implements Serializable { - private static final long serialVersionUID = -3673810416800666364L; - - private int id; - - private int pid; - - private String name; - - private String sname; - - private String code; - - private String uncode; - - private String addr; - - private String contact; - - private String fax; - - private String email; - - private String post; - - private String website; - - private int level; - - private int orderNum; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getPid() { - return pid; - } - - public void setPid(int pid) { - this.pid = pid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSname() { - return sname; - } - - public void setSname(String sname) { - this.sname = sname; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getUncode() { - return uncode; - } - - public void setUncode(String uncode) { - this.uncode = uncode; - } - - public String getAddr() { - return addr; - } - - public void setAddr(String addr) { - this.addr = addr; - } - - public String getContact() { - return contact; - } - - public void setContact(String contact) { - this.contact = contact; - } - - public String getFax() { - return fax; - } - - public void setFax(String fax) { - this.fax = fax; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getPost() { - return post; - } - - public void setPost(String post) { - this.post = post; - } - - public String getWebsite() { - return website; - } - - public void setWebsite(String website) { - this.website = website; - } - - public int getLevel() { - return level; - } - - public void setLevel(int level) { - this.level = level; - } - - public int getOrderNum() { - return orderNum; - } - - public void setOrderNum(int orderNum) { - this.orderNum = orderNum; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/DownlogEntity.java b/src/main/java/com/lf/server/entity/sys/DownlogEntity.java deleted file mode 100644 index eb289e6..0000000 --- a/src/main/java/com/lf/server/entity/sys/DownlogEntity.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 涓嬭浇鏃ュ織 - * @author WWW - */ -public class DownlogEntity implements Serializable { - private static final long serialVersionUID = -295796504381949312L; - - private int id; - - private int downid; - - private String ip; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String uname; - - private String name; - - private int type; - - private double sizes; - - public DownlogEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getDownid() { - return downid; - } - - public void setDownid(int downid) { - this.downid = downid; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public double getSizes() { - return sizes; - } - - public void setSizes(double sizes) { - this.sizes = sizes; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/LoginEntity.java b/src/main/java/com/lf/server/entity/sys/LoginEntity.java deleted file mode 100644 index 5f3ddc7..0000000 --- a/src/main/java/com/lf/server/entity/sys/LoginEntity.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鐧诲綍鏃ュ織琛� - * @author sws - * @date 2022-09-08 - */ - -public class LoginEntity implements Serializable { - private static final long serialVersionUID = 2156194736679188516L; - - private int id; - - private String uname; - - private int appid; - - private String ip; - - private int type; - - private int status; - - private String descr; - - private int userid; - - private Timestamp optime; - - - - private int count; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public int getAppid() { - return appid; - } - - public void setAppid(int appid) { - this.appid = appid; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public int getUserid() { - return userid; - } - - public void setUserid(int userid) { - this.userid = userid; - } - - public Timestamp getOptime() { - return optime; - } - - public void setOptime(Timestamp optime) { - this.optime = optime; - } - - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/MenuAuthEntity.java b/src/main/java/com/lf/server/entity/sys/MenuAuthEntity.java deleted file mode 100644 index da3d88c..0000000 --- a/src/main/java/com/lf/server/entity/sys/MenuAuthEntity.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鑿滃崟-鏉冮檺 - * @author WWW - */ -public class MenuAuthEntity implements Serializable { - private static final long serialVersionUID = -298515079682001408L; - - private int id; - - private int menuid; - - private int authid; - - private String name; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String authName; - - - public MenuAuthEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getMenuid() { - return menuid; - } - - public void setMenuid(int menuid) { - this.menuid = menuid; - } - - public int getAuthid() { - return authid; - } - - public void setAuthid(int authid) { - this.authid = authid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - public String getAuthName() { - return authName; - } - - public void setAuthName(String authName) { - this.authName = authName; - } - -} diff --git a/src/main/java/com/lf/server/entity/sys/MenuEntity.java b/src/main/java/com/lf/server/entity/sys/MenuEntity.java deleted file mode 100644 index 24d9035..0000000 --- a/src/main/java/com/lf/server/entity/sys/MenuEntity.java +++ /dev/null @@ -1,192 +0,0 @@ -package com.lf.server.entity.sys; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鑿滃崟 - * @author sws - * @date 2022-09-24 - */ - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class MenuEntity implements Serializable { - private static final long serialVersionUID = -4174396918804003518L; - - private int id; - - private int pid; - - private String cnName; - - private String enName; - - private String url; - - private String perms; - - private int type; - - private String css; - - private String icon; - - private int level; - - private int orderNum; - - private int isShow; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getPid() { - return pid; - } - - public void setPid(int pid) { - this.pid = pid; - } - - public String getCnName() { - return cnName; - } - - public void setCnName(String cnName) { - this.cnName = cnName; - } - - public String getEnName() { - return enName; - } - - public void setEnName(String enName) { - this.enName = enName; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getPerms() { - return perms; - } - - public void setPerms(String perms) { - this.perms = perms; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public String getCss() { - return css; - } - - public void setCss(String css) { - this.css = css; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public int getLevel() { - return level; - } - - public void setLevel(int level) { - this.level = level; - } - - public int getOrderNum() { - return orderNum; - } - - public void setOrderNum(int orderNum) { - this.orderNum = orderNum; - } - - public int getIsShow() { - return isShow; - } - - public void setIsShow(int isShow) { - this.isShow = isShow; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/MetaDownEntity.java b/src/main/java/com/lf/server/entity/sys/MetaDownEntity.java deleted file mode 100644 index 1c3f0ad..0000000 --- a/src/main/java/com/lf/server/entity/sys/MetaDownEntity.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鍏冩暟鎹�-涓嬭浇 - * @author WWW - */ -public class MetaDownEntity implements Serializable { - private static final long serialVersionUID = -254142742722361696L; - - private int id; - - private int metaid; - - private int downid; - - private int createUser; - - private Timestamp createTime; - - public MetaDownEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getMetaid() { - return metaid; - } - - public void setMetaid(int metaid) { - this.metaid = metaid; - } - - public int getDownid() { - return downid; - } - - public void setDownid(int downid) { - this.downid = downid; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/OperateEntity.java b/src/main/java/com/lf/server/entity/sys/OperateEntity.java deleted file mode 100644 index b87aa35..0000000 --- a/src/main/java/com/lf/server/entity/sys/OperateEntity.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鎿嶄綔鏃ュ織 - * @author sws - * @date 2022-09-28 - */ -public class OperateEntity implements Serializable { - private static final long serialVersionUID = -2335232554888606229L; - - private int id; - - private String uname; - - private String modular1; - - private String modular2; - - private String url; - - private String ip; - - private long exec; - - private String clazz; - - private int type; - - private int userid; - - private Timestamp optime; - - private String bak; - - private int count; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public String getModular1() { - return modular1; - } - - public void setModular1(String modular1) { - this.modular1 = modular1; - } - - public String getModular2() { - return modular2; - } - - public void setModular2(String modular2) { - this.modular2 = modular2; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getIp() { - return ip; - } - - public long getExec() { - return exec; - } - - public void setExec(long exec) { - this.exec = exec; - } - - public String getClazz() { - return clazz; - } - - public void setClazz(String clazz) { - this.clazz = clazz; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public int getUserid() { - return userid; - } - - public void setUserid(int userid) { - this.userid = userid; - } - - public Timestamp getOptime() { - return optime; - } - - public void setOptime(Timestamp optime) { - this.optime = optime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/ReportEntity.java b/src/main/java/com/lf/server/entity/sys/ReportEntity.java deleted file mode 100644 index aa3f971..0000000 --- a/src/main/java/com/lf/server/entity/sys/ReportEntity.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鎶ュ憡妯℃澘 - * @author WWW - */ -public class ReportEntity implements Serializable { - private static final long serialVersionUID = -976039118587988992L; - - private int id; - - private String name; - - private String type; - - private String code; - - private String fname; - - private String guid; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - private String createName; - - private String updateName; - - public ReportEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getFname() { - return fname; - } - - public void setFname(String fname) { - this.fname = fname; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/ResEntity.java b/src/main/java/com/lf/server/entity/sys/ResEntity.java deleted file mode 100644 index b0bae57..0000000 --- a/src/main/java/com/lf/server/entity/sys/ResEntity.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.lf.server.entity.sys; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * @author user - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ResEntity implements Serializable { - private static final long serialVersionUID = 9047079519693255710L; - - private int id; - - private String name; - - private String server; - - private String source; - - private int depid; - - private String depName; - - private int dirid; - - private String dirName; - - private String code; - - private String descr; - - private String img; - - private int createUser; - - private String createName; - - private Timestamp createTime; - - private int updateUser; - - private String updateName; - - private Timestamp updateTime; - - private String bak; - - - - private String fileGuid; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getServer() { - return server; - } - - public void setServer(String server) { - this.server = server; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public int getDepid() { - return depid; - } - - public void setDepid(int depid) { - this.depid = depid; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } - - public int getDirid() { - return dirid; - } - - public void setDirid(int dirid) { - this.dirid = dirid; - } - - public String getDirName() { - return dirName; - } - - public void setDirName(String dirName) { - this.dirName = dirName; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public String getImg() { - return img; - } - - public void setImg(String img) { - this.img = img; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getFileGuid() { - return fileGuid; - } - - public void setFileGuid(String fileGuid) { - this.fileGuid = fileGuid; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/ResOpEntity.java b/src/main/java/com/lf/server/entity/sys/ResOpEntity.java deleted file mode 100644 index 61eb73f..0000000 --- a/src/main/java/com/lf/server/entity/sys/ResOpEntity.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 璧勬簮鎿嶄綔 - * @author sws - * @date 2022-09-28 - */ - -public class ResOpEntity implements Serializable { - private static final long serialVersionUID = -7322438248126715583L; - - private int id; - - private String uname; - - private String name; - - private int resid; - - private int type; - - private String ip; - - private int userid; - - private Timestamp optime; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getResid() { - return resid; - } - - public void setResid(int resid) { - this.resid = resid; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public int getUserid() { - return userid; - } - - public void setUserid(int userid) { - this.userid = userid; - } - - public Timestamp getOptime() { - return optime; - } - - public void setOptime(Timestamp optime) { - this.optime = optime; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/RoleEntity.java b/src/main/java/com/lf/server/entity/sys/RoleEntity.java deleted file mode 100644 index d57b280..0000000 --- a/src/main/java/com/lf/server/entity/sys/RoleEntity.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 瑙掕壊琛� - * @author sws - * @date 2022-09-29 - */ -public class RoleEntity implements Serializable { - private static final long serialVersionUID = -1738125301491645446L; - - private int id; - - private int depid; - - private String name; - - private String descr; - - private int isAdmin; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - private String depName; - - private String createName; - - private String updateName; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getDepid() { - return depid; - } - - public void setDepid(int depid) { - this.depid = depid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescr() { - return descr; - } - - public void setDescr(String descr) { - this.descr = descr; - } - - public int getIsAdmin() { - return isAdmin; - } - - public void setIsAdmin(int isAdmin) { - this.isAdmin = isAdmin; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/RoleMenuAuthEntity.java b/src/main/java/com/lf/server/entity/sys/RoleMenuAuthEntity.java deleted file mode 100644 index ba72ff2..0000000 --- a/src/main/java/com/lf/server/entity/sys/RoleMenuAuthEntity.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 瑙掕壊-鑿滃崟 - * @author WWW - */ -public class RoleMenuAuthEntity implements Serializable { - private static final long serialVersionUID = -510981272678347904L; - - private int id; - - private int roleid; - - private int menuAuthId; - - private int menuid; - - private String name; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - public RoleMenuAuthEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getRoleid() { - return roleid; - } - - public void setRoleid(int roleid) { - this.roleid = roleid; - } - - public int getMenuAuthId() { - return menuAuthId; - } - - public void setMenuAuthId(int menuAuthId) { - this.menuAuthId = menuAuthId; - } - - public int getMenuid() { - return menuid; - } - - public void setMenuid(int menuid) { - this.menuid = menuid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/RoleResEntity.java b/src/main/java/com/lf/server/entity/sys/RoleResEntity.java deleted file mode 100644 index e974ba2..0000000 --- a/src/main/java/com/lf/server/entity/sys/RoleResEntity.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 瑙掕壊-璧勬簮 - * @author WWW - */ -public class RoleResEntity implements Serializable { - private static final long serialVersionUID = -634834740606525312L; - - private int id; - - private int roleid; - - private int resid; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String resName; - -private String server; - - - - public RoleResEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getRoleid() { - return roleid; - } - - public void setRoleid(int roleid) { - this.roleid = roleid; - } - - public int getResid() { - return resid; - } - - public void setResid(int resid) { - this.resid = resid; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getResName() { - return resName; - } - - public void setResName(String resName) { - this.resName = resName; - } - public String getServer() { - return server; - } - - public void setServer(String server) { - this.server = server; - } - -} diff --git a/src/main/java/com/lf/server/entity/sys/RoleUserEntity.java b/src/main/java/com/lf/server/entity/sys/RoleUserEntity.java deleted file mode 100644 index 201a113..0000000 --- a/src/main/java/com/lf/server/entity/sys/RoleUserEntity.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 瑙掕壊-鐢ㄦ埛 - * @author WWW - */ -public class RoleUserEntity implements Serializable { - private static final long serialVersionUID = -20966072576570360L; - - private int id; - - private int roleid; - - private int userid; - - private String uname; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - public RoleUserEntity() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getRoleid() { - return roleid; - } - - public void setRoleid(int roleid) { - this.roleid = roleid; - } - - public int getUserid() { - return userid; - } - - public void setUserid(int userid) { - this.userid = userid; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/TokenEntity.java b/src/main/java/com/lf/server/entity/sys/TokenEntity.java deleted file mode 100644 index fc178b5..0000000 --- a/src/main/java/com/lf/server/entity/sys/TokenEntity.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 浠ょ墝琛� - * @author sws - * @date 2022-09-28 - */ -public class TokenEntity implements Serializable { - private static final long serialVersionUID = 1419309705830103150L; - - private int id; - - private String uname; - - private String token; - - private int duration; - - private Timestamp expire; - - private int type; - - private String ip; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String createName; - - private String updateName; - - private int autoLogOut; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public int getDuration() { - return duration; - } - - public void setDuration(int duration) { - this.duration = duration; - } - - public Timestamp getExpire() { - return expire; - } - - public void setExpire(Timestamp expire) { - this.expire = expire; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getCreateName() { - return createName; - } - - public void setCreateName(String createName) { - this.createName = createName; - } - - public String getUpdateName() { - return updateName; - } - - public void setUpdateName(String updateName) { - this.updateName = updateName; - } - - public int getAutoLogOut() { - return autoLogOut; - } - - public void setAutoLogOut(int autoLogOut) { - this.autoLogOut = autoLogOut; - } -} diff --git a/src/main/java/com/lf/server/entity/sys/UserEntity.java b/src/main/java/com/lf/server/entity/sys/UserEntity.java deleted file mode 100644 index 20140a3..0000000 --- a/src/main/java/com/lf/server/entity/sys/UserEntity.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.lf.server.entity.sys; - -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 鐢ㄦ埛琛� - * @author sws - * @date 2022-09-27 - */ -public class UserEntity implements Serializable { - private static final long serialVersionUID = 5676976561729666299L; - - private int id; - - private int depid; - - private String depcode; - - private String uid; - - private String uname; - - private String pwd; - - private String salt; - - private String depName; - - private int sex; - - private String natives; - - private String contact; - - private String job; - - private String email; - - private String addr; - - private String edu; - - private String idcard; - - private int status; - - private int createUser; - - private Timestamp createTime; - - private int updateUser; - - private Timestamp updateTime; - - private String bak; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getDepid() { - return depid; - } - - public void setDepid(int depid) { - this.depid = depid; - } - - public String getDepcode() { - return depcode; - } - - public void setDepcode(String depcode) { - this.depcode = depcode; - } - - public String getUid() { - return uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - public String getUname() { - return uname; - } - - public void setUname(String uname) { - this.uname = uname; - } - - public String getPwd() { - return pwd; - } - - public void setPwd(String pwd) { - this.pwd = pwd; - } - - public String getSalt() { - return salt; - } - - public void setSalt(String salt) { - this.salt = salt; - } - - public String getDepName() { - return depName; - } - - public void setDepName(String depName) { - this.depName = depName; - } - - public int getSex() { - return sex; - } - - public void setSex(int sex) { - this.sex = sex; - } - - public String getNatives() { - return natives; - } - - public void setNatives(String natives) { - this.natives = natives; - } - - public String getContact() { - return contact; - } - - public void setContact(String contact) { - this.contact = contact; - } - - public String getJob() { - return job; - } - - public void setJob(String job) { - this.job = job; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getAddr() { - return addr; - } - - public void setAddr(String addr) { - this.addr = addr; - } - - public String getEdu() { - return edu; - } - - public void setEdu(String edu) { - this.edu = edu; - } - - public String getIdcard() { - return idcard; - } - - public void setIdcard(String idcard) { - this.idcard = idcard; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public int getCreateUser() { - return createUser; - } - - public void setCreateUser(int createUser) { - this.createUser = createUser; - } - - public Timestamp getCreateTime() { - return createTime; - } - - public void setCreateTime(Timestamp createTime) { - this.createTime = createTime; - } - - public int getUpdateUser() { - return updateUser; - } - - public void setUpdateUser(int updateUser) { - this.updateUser = updateUser; - } - - public Timestamp getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Timestamp updateTime) { - this.updateTime = updateTime; - } - - public String getBak() { - return bak; - } - - public void setBak(String bak) { - this.bak = bak; - } -} diff --git a/src/main/java/com/lf/server/extend/CustomizedSqlInjector.java b/src/main/java/com/lf/server/extend/CustomizedSqlInjector.java deleted file mode 100644 index 54ac506..0000000 --- a/src/main/java/com/lf/server/extend/CustomizedSqlInjector.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.lf.server.extend; - -import com.baomidou.mybatisplus.core.injector.AbstractMethod; -import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; -import com.baomidou.mybatisplus.core.metadata.TableInfo; - -import java.util.List; - -/** - * 鑷畾涔夋柟娉昐QL娉ㄥ叆鍣� - * @author WWW - */ -public class CustomizedSqlInjector extends DefaultSqlInjector { - /** - * 濡傛灉鍙渶澧炲姞鏂规硶锛屼繚鐣檓ybatis plus鑷甫鏂规硶锛� - * 鍙互鍏堣幏鍙杝uper.getMethodList()锛屽啀娣诲姞add - */ - @Override - public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) { - List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo); - methodList.add(new InsertBatchMethod()); - methodList.add(new UpdateBatchMethod()); - - return methodList; - } -} diff --git a/src/main/java/com/lf/server/extend/InsertBatchMethod.java b/src/main/java/com/lf/server/extend/InsertBatchMethod.java deleted file mode 100644 index 9031eba..0000000 --- a/src/main/java/com/lf/server/extend/InsertBatchMethod.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.lf.server.extend; - -import com.baomidou.mybatisplus.core.injector.AbstractMethod; -import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; -import com.baomidou.mybatisplus.core.metadata.TableInfo; -import com.lf.server.entity.all.StaticData; -import org.apache.ibatis.executor.keygen.NoKeyGenerator; -import org.apache.ibatis.mapping.MappedStatement; -import org.apache.ibatis.mapping.SqlSource; - -/** - * 鎵归噺鎻掑叆鏂规硶 - * @author WWW - */ -@SuppressWarnings("ALL") -public class InsertBatchMethod extends AbstractMethod { - /** - * insert into user(id, name, age) values (1, "a", 17), (2, "b", 18); - * <script> - * insert into user(id, name, age) values - * <foreach collection="list" item="item" index="index" open="(" separator="),(" close=")"> - * #{item.id}, #{item.name}, #{item.age} - * </foreach> - * </script> - */ - @Override - public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) { - final String sql = "<script>insert into %s %s values %s</script>"; - final String fieldSql = prepareFieldSql(tableInfo); - final String valueSql = prepareValuesSql(tableInfo); - final String sqlResult = String.format(sql, tableInfo.getTableName(), fieldSql, valueSql); - - SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass); - - // 绗笁涓弬鏁板繀椤诲拰RootMapper鐨勮嚜瀹氫箟鏂规硶鍚嶄竴鑷� - return this.addInsertMappedStatement(mapperClass, modelClass, "insertBatch", sqlSource, new NoKeyGenerator(), null, null); - } - - private String prepareFieldSql(TableInfo tableInfo) { - StringBuilder fieldSql = new StringBuilder(); - // fieldSql.append(tableInfo.getKeyColumn()).append(",") - // tableInfo.getFieldList().forEach(x -> fieldSql.append(x.getColumn()).append(",")) - for (TableFieldInfo f : tableInfo.getFieldList()) { - if (StaticData.INSERT_EXCLUDE_FIELDS.contains(f.getProperty())) { - continue; - } - - fieldSql.append(f.getColumn()).append(","); - } - - fieldSql.delete(fieldSql.length() - 1, fieldSql.length()); - fieldSql.insert(0, "("); - fieldSql.append(")"); - - return fieldSql.toString(); - } - - private String prepareValuesSql(TableInfo tableInfo) { - final StringBuilder valueSql = new StringBuilder(); - valueSql.append("<foreach collection=\"list\" item=\"item\" index=\"index\" open=\"(\" separator=\"),(\" close=\")\">"); - // valueSql.append("#{item.").append(tableInfo.getKeyProperty()).append("},") - // tableInfo.getFieldList().forEach(x -> valueSql.append("#{item.").append(x.getProperty()).append("},")) - for (TableFieldInfo f : tableInfo.getFieldList()) { - if (StaticData.INSERT_EXCLUDE_FIELDS.contains(f.getProperty())) { - continue; - } - - valueSql.append("geom".equals(f.getProperty()) ? "${item." : "#{item.").append(f.getProperty()).append("},"); - } - - valueSql.delete(valueSql.length() - 1, valueSql.length()); - valueSql.append("</foreach>"); - - return valueSql.toString(); - } -} diff --git a/src/main/java/com/lf/server/extend/UpdateBatchMethod.java b/src/main/java/com/lf/server/extend/UpdateBatchMethod.java deleted file mode 100644 index 2daa675..0000000 --- a/src/main/java/com/lf/server/extend/UpdateBatchMethod.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.lf.server.extend; - -import com.baomidou.mybatisplus.core.injector.AbstractMethod; -import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; -import com.baomidou.mybatisplus.core.metadata.TableInfo; -import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; -import com.lf.server.entity.all.StaticData; -import org.apache.ibatis.mapping.MappedStatement; -import org.apache.ibatis.mapping.SqlSource; - -/** - * 鎵归噺鏇存柊鏂规硶 - * @author WWW - */ -@SuppressWarnings("ALL") -public class UpdateBatchMethod extends AbstractMethod { - /** - * update user set name = "a", age = 17 where id = 1; - * update user set name = "b", age = 18 where id = 2; - * <script> - * <foreach collection="list" item="item" separator=";"> - * update user - * <set> - * <if test="item.name != null and item.name != ''"> - * name = #{item.name,jdbcType=VARCHAR}, - * </if> - * <if test="item.age != null"> - * age = #{item.age,jdbcType=INTEGER}, - * </if> - * </set> - * where id = #{item.id,jdbcType=INTEGER} - * </foreach> - * </script> - */ - @Override - public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) { - String sql = "<script>\n<foreach collection=\"list\" item=\"item\" separator=\";\">\nupdate %s %s where %s=#{%s} %s\n</foreach>\n</script>"; - String additional = tableInfo.isWithVersion() ? tableInfo.getVersionFieldInfo().getVersionOli("item", "item.") : "" + tableInfo.getLogicDeleteSql(true, true); - //String setSql = sqlSet(tableInfo.isWithLogicDelete(), false, tableInfo, false, "item", "item."); - String setSql = getSqlSet(tableInfo.isWithLogicDelete(), false, tableInfo, false, "item", "item."); - String sqlResult = String.format(sql, tableInfo.getTableName(), setSql, tableInfo.getKeyColumn(), "item." + tableInfo.getKeyProperty(), additional); - - // update %s %s where %s=#{%s} %s - // update tab set a=#{a} where gid=1 - - SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass); - - // 绗笁涓弬鏁板繀椤诲拰RootMapper鐨勮嚜瀹氫箟鏂规硶鍚嶄竴鑷� - return this.addUpdateMappedStatement(mapperClass, modelClass, "updateBatch", sqlSource); - } - - private String getSqlSet(boolean logic, boolean ew, TableInfo table, boolean judgeAliasNull, final String alias, final String prefix) { - // String sqlScript = table.getAllSqlSet(logic, prefix); - String sqlScript = getSqlSet(table); - if (judgeAliasNull) { - sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", alias), true); - } - if (ew) { - sqlScript = sqlScript + "\n"; - sqlScript = sqlScript + this.convertIfEwParam("ew.sqlSet", false); - } - - sqlScript = SqlScriptUtils.convertSet(sqlScript); - - return sqlScript; - } - - private String getSqlSet(TableInfo tableInfo) { - StringBuilder sb = new StringBuilder(); - for (TableFieldInfo f : tableInfo.getFieldList()) { - if (StaticData.UPDATE_EXCLUDE_FIELDS.contains(f.getProperty())) { - continue; - } - - if ("geom".equals(f.getProperty())) { - sb.append("<if test=\"item['geom'] != null\">geom=${item.geom},</if>\n"); - continue; - } - - sb.append(String.format("<if test=\"item['%s'] != null\">%s=#{item.%s},</if>\n", f.getProperty(), f.getColumn(), f.getProperty())); - } - sb.deleteCharAt(sb.length() - 1); - - return sb.toString(); - } -} diff --git a/src/main/java/com/lf/server/helper/AccessHelper.java b/src/main/java/com/lf/server/helper/AccessHelper.java deleted file mode 100644 index 49b648d..0000000 --- a/src/main/java/com/lf/server/helper/AccessHelper.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.lf.server.helper; - -import com.lf.server.entity.all.StaticData; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.sql.*; -import java.util.*; - -/** - * Access甯姪绫� - * @author WWW - */ -public class AccessHelper { - private final static Log log = LogFactory.getLog(AccessHelper.class); - - /** - * 璇诲彇.mdb鏂囦欢 - * - * @param mdbPath mdb鏂囦欢鍦板潃 - * @param username 鐢ㄦ埛鍚� - * @param password 瀵嗙爜 - */ - public static List<Map<String, Object>> readMdb(String mdbPath, String username, String password) { - List<Map<String, Object>> list = new ArrayList<>(); - - Connection conn = null; - PreparedStatement ps = null; - ResultSet tables = null; - ResultSet rs = null; - - try { - Properties prop = new Properties(); - prop.put("charSet", "UTF-8"); - prop.put("user", username); - prop.put("password", password); - - String dbUrl = "jdbc:ucanaccess://" + mdbPath; - Class.forName("net.ucanaccess.jdbc.UcanaccessDriver").newInstance(); - - conn = DriverManager.getConnection(dbUrl, prop); - tables = conn.getMetaData().getTables(mdbPath, null, null, new String[]{"TABLE"}); - while (tables.next()) { - Map<String, Object> tableMap = new HashMap<>(4); - Set<String> columnList = new HashSet<>(); - List<Map<String, String>> dataList = new ArrayList<>(); - - String tableName = tables.getString(3); - ps = conn.prepareStatement("select * from " + tableName); - rs = ps.executeQuery(); - - ResultSetMetaData data = rs.getMetaData(); - while (rs.next()) { - Map<String, String> map = new HashMap<>(5); - for (int i = 1; i <= data.getColumnCount(); i++) { - String columnName = data.getColumnName(i); - if (StaticData.MDB_EXCLUDE_FIELDS.contains(columnName)) { - continue; - } - - map.put(columnName, rs.getString(i)); - columnList.add(columnName); - } - dataList.add(map); - } - - tableMap.put("name", tableName); - tableMap.put("column", columnList); - tableMap.put("data", dataList); - list.add(tableMap); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } finally { - closeA1l(conn, ps, tables, rs); - } - - return list; - } - - /** - * 鍏抽棴鎵�鏈夌殑璧勬簮閾炬帴 - * - * @param conn 杩炴帴 - * @param ps 鎵ц璇彞 - * @param tables 缁撴灉闆� - * @param rs 缁撴灉闆� - */ - private static void closeA1l(Connection conn, PreparedStatement ps, ResultSet tables, ResultSet rs) { - try { - if (null != rs) { - rs.close(); - } - if (null != tables) { - tables.close(); - } - if (null != ps) { - ps.close(); - } - if (null != conn) { - conn.close(); - } - } catch (Exception ex) { - // - } - } -} \ No newline at end of file diff --git a/src/main/java/com/lf/server/helper/AesHelper.java b/src/main/java/com/lf/server/helper/AesHelper.java deleted file mode 100644 index 78efbfc..0000000 --- a/src/main/java/com/lf/server/helper/AesHelper.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.lf.server.helper; - -import javax.crypto.Cipher; -import javax.crypto.KeyGenerator; -import javax.crypto.spec.SecretKeySpec; -import java.util.Base64; - -/** - * AES鍔犲瘑甯姪 - * @author WWW - */ -@SuppressWarnings("restriction") -public class AesHelper { - /** - * 瀵嗛挜闀垮害蹇呴』鏄�16 - */ - private static final String DEFAULT_KEY = "A#s_lF_sErve_k.y"; - - private static final String KEY_ALGORITHM = "AES"; - - /** - * 绠楁硶 - */ - private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding"; - - /** - * aes瑙e瘑 - * - * @param encrypt 鍐呭 - * @return - * @throws Exception - */ - public static String decrypt(String encrypt) throws Exception { - return decrypt(encrypt, DEFAULT_KEY); - } - - /** - * aes鍔犲瘑 - * - * @param content 鍐呭 - * @return - * @throws Exception - */ - public static String encrypt(String content) throws Exception { - return encrypt(content, DEFAULT_KEY); - } - - /** - * base 64 encode - * - * @param bytes 寰呯紪鐮佺殑byte[] - * @return 缂栫爜鍚庣殑base64 code - */ - private static String base64Encode(byte[] bytes) { - return Base64.getEncoder().encodeToString(bytes); - } - - /** - * base 64 decode - * - * @param base64Code 寰呰В鐮佺殑base64 code - * @return 瑙g爜鍚庣殑byte[] - * @throws Exception - */ - private static byte[] base64Decode(String base64Code) { - return StringHelper.isEmpty(base64Code) ? null : Base64.getDecoder().decode(base64Code); - } - - /** - * AES鍔犲瘑 - * - * @param content 寰呭姞瀵嗙殑鍐呭 - * @param encryptKey 鍔犲瘑瀵嗛挜 - * @return 鍔犲瘑鍚庣殑byte[] - * @throws Exception - */ - private static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception { - // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) - // kGen.init(128) - - Cipher cipher = Cipher.getInstance(ALGORITHMSTR); - cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), KEY_ALGORITHM)); - - return cipher.doFinal(content.getBytes("utf-8")); - } - - /** - * AES鍔犲瘑涓篵ase 64 code - * - * @param content 寰呭姞瀵嗙殑鍐呭 - * @param encryptKey 鍔犲瘑瀵嗛挜 - * @return 鍔犲瘑鍚庣殑base 64 code - * @throws Exception - */ - public static String encrypt(String content, String encryptKey) throws Exception { - return base64Encode(aesEncryptToBytes(content, encryptKey)); - } - - /** - * 灏哹ase 64 code AES瑙e瘑 - * - * @param encryptStr 寰呰В瀵嗙殑base 64 code - * @param decryptKey 瑙e瘑瀵嗛挜 - * @return 瑙e瘑鍚庣殑string - * @throws Exception - */ - public static String decrypt(String encryptStr, String decryptKey) throws Exception { - return StringHelper.isEmpty(encryptStr) ? null : aesDecryptByBytes(base64Decode(encryptStr), decryptKey); - } - - /** - * AES瑙e瘑 - * - * @param encryptBytes 寰呰В瀵嗙殑byte[] - * @param decryptKey 瑙e瘑瀵嗛挜 - * @return 瑙e瘑鍚庣殑String - * @throws Exception - */ - private static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception { - // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) - // kGen.init(128) - - Cipher cipher = Cipher.getInstance(ALGORITHMSTR); - cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), KEY_ALGORITHM)); - byte[] decryptBytes = cipher.doFinal(encryptBytes); - - return new String(decryptBytes); - } -} diff --git a/src/main/java/com/lf/server/helper/ClassHelper.java b/src/main/java/com/lf/server/helper/ClassHelper.java deleted file mode 100644 index 6befd3a..0000000 --- a/src/main/java/com/lf/server/helper/ClassHelper.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.lf.server.helper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.mapper.all.GeomBaseMapper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.aop.support.AopUtils; - -import java.lang.reflect.Type; - -/** - * 绫诲府鍔╃被 - * @author WWW - */ -public class ClassHelper { - private final static Log log = LogFactory.getLog(ClassHelper.class); - - /** - * 鏍规嵁绫诲悕鍒涘缓瀹炰緥 - * - * @param className 绫诲悕 - * @return 瀹炰綋 - */ - public static Object createInstance(String className) { - try { - Class clazz = Class.forName(className); - Object obj = clazz.newInstance(); - - return obj; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } - } - - /** - * 鑾峰彇Bean - * - * @param className 绫诲悕 - * @return Bean - */ - public static Object getBean(String className) { - try { - Object obj = SpringContextHelper.getBean(className); - - return obj; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } - } - - /** - * 鑾峰彇鐖禡apper - * - * @param name Mapper鍚� - * @return BaseMapper - */ - public static BasicMapper getBasicMapper(String name) { - if (StringHelper.isEmpty(name)) { - return null; - } - - Object obj = getBean(name.trim() + "Mapper"); - if (!(obj instanceof BasicMapper)) { - return null; - } - - return (BasicMapper) obj; - } - - /** - * 鑾峰彇绌洪棿鐖禡apper - * - * @param name Mapper鍚� - * @return GeomBaseMapper - */ - public static GeomBaseMapper getGeoBaseMapper(String name) { - if (StringHelper.isEmpty(name)) { - return null; - } - - Object obj = getBean(name.trim() + "Mapper"); - if (!(obj instanceof GeomBaseMapper)) { - return null; - } - - return (GeomBaseMapper) obj; - } - - /** - * 鑾峰彇绫诲悕 - * - * @param baseMapper 鐖禡apper - * @return 绫诲悕 - */ - public static String getClassName(BaseMapper baseMapper) { - Type[] genericInterfaces = AopUtils.getTargetClass(baseMapper).getGenericInterfaces(); - - return genericInterfaces[0].getTypeName(); - } - - /** - * 鏍规嵁Mapper绫诲悕鑾峰彇瀹炰綋绫荤殑Class - * - * @param className Mapper绫诲悕 - * @return 瀹炰綋绫荤殑Class - */ - public static Class getEntityClass(String className) { - try { - className = className.replace(".mapper", ".entity").replace("Mapper", "Entity"); - Class clazz = Class.forName(className); - - return clazz; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } - } - - - /** - * 鏍规嵁BaseMapper鍒涘缓瀹炰綋绫� - * - * @param baseMapper 鐖禡apper - * @return 瀹炰綋绫� - */ - public static Object createEntityByMapper(BaseMapper baseMapper) { - String className = getClassName(baseMapper); - className = className.replace(".mapper", ".entity").replace("Mapper", "Entity"); - - return createInstance(className); - } -} diff --git a/src/main/java/com/lf/server/helper/EnumHelper.java b/src/main/java/com/lf/server/helper/EnumHelper.java deleted file mode 100644 index 824757e..0000000 --- a/src/main/java/com/lf/server/helper/EnumHelper.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.lf.server.helper; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.lang.reflect.Method; - -/** - * 鏋氫妇甯姪绫� - * @author WWW - */ -public class EnumHelper { - private static final String GETTER_PREFIX = "get"; - - private static Log log = LogFactory.getLog(EnumHelper.class); - - /** - * 鏍规嵁鍚嶇О鑾峰彇鏋氫妇 - * - * @param clazz 鏋氫妇绫诲瀷 - * @param name 鏋氫妇鐨勫悕绉帮紝濡傦細SqlParamType涓殑AND - * @return 杩斿洖鏋氫妇鍊� - */ - public static <T extends Enum<T>> T nameOf(Class<T> clazz, String name) { - return Enum.valueOf(clazz, name); - } - - /** - * 鏍规嵁灞炴�у悕+鍊艰幏鍙栨灇涓� - * - * @param clazz 鏋氫妇绫诲瀷 - * @param propertyName 瀛楁,濡俷ame,id - * @param value 鍊�,濡傚紶涓� - * @return 杩斿洖鏋氫妇鍊� - */ - public static <T extends Enum<T>> T getByString(Class<T> clazz, String propertyName, String value) { - String getterMethodName = GETTER_PREFIX + StringHelper.firstCharToUpperCase(propertyName); - T result = null; - try { - T[] arr = clazz.getEnumConstants(); - Method targetMethod = clazz.getDeclaredMethod(getterMethodName); - String typeCodeVal = null; - for (T entity : arr) { - typeCodeVal = targetMethod.invoke(entity).toString(); - if (typeCodeVal.contentEquals(value)) { - result = entity; - break; - } - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - - return result; - } - - /** - * 鏍规嵁鏁存暟鑾峰彇鏋氫妇 - * - * @param clazz 鏋氫妇绫诲瀷 - * @param propertyName 瀛楁,濡� age - * @param value 鍊�,濡�18 - * @return 杩斿洖鏋氫妇鍊� - */ - public static <T extends Enum<T>> T getByInt(Class<T> clazz, String propertyName, int value) { - String getterMethodName = GETTER_PREFIX + StringHelper.firstCharToUpperCase(propertyName); - T result = null; - try { - T[] arr = clazz.getEnumConstants(); - Method targetMethod = clazz.getDeclaredMethod(getterMethodName); - int typeCodeVal; - for (T entity : arr) { - typeCodeVal = Integer.parseInt(targetMethod.invoke(entity).toString()); - if (typeCodeVal == value) { - result = entity; - break; - } - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - return result; - } -} diff --git a/src/main/java/com/lf/server/helper/ExcelHelper.java b/src/main/java/com/lf/server/helper/ExcelHelper.java deleted file mode 100644 index 060653c..0000000 --- a/src/main/java/com/lf/server/helper/ExcelHelper.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.lf.server.helper; - -import com.alibaba.excel.EasyExcel; -import com.alibaba.excel.ExcelReader; -import com.alibaba.excel.ExcelWriter; -import com.alibaba.excel.context.AnalysisContext; -import com.alibaba.excel.enums.WriteDirectionEnum; -import com.alibaba.excel.event.AnalysisEventListener; -import com.alibaba.excel.read.metadata.ReadSheet; -import com.alibaba.excel.write.metadata.WriteSheet; -import com.alibaba.excel.write.metadata.fill.FillConfig; -import com.alibaba.excel.write.metadata.fill.FillWrapper; -import com.lf.server.annotation.ExcelHead; - -import java.util.*; - -/** - * Excel甯姪绫� - * @author WWW - */ -public class ExcelHelper { - /** - * 璇诲彇Excel - * - * @param pathName 鏂囦欢璺緞 - * @param <T> 娉涘瀷绫� - * @return 娉涘瀷绫婚泦鍚� - */ - public static <T> List<T> readExcel(Class<?> clazz, String pathName) { - ExcelHead head = getExcelHead(clazz); - int headRowNumber = head == null ? 1 : head.headRows(); - String[] strs = null == head || StringHelper.isEmpty(head.excludeSheets()) ? null : head.excludeSheets().split(","); - List<String> excludeSheets = null == strs ? null : Arrays.asList(strs); - - List<T> list = new ArrayList<T>(); - ExcelReader reader = EasyExcel.read(pathName, clazz, new AnalysisEventListener<T>() { - @Override - public void invoke(T t, AnalysisContext context) { - list.add(t); - } - - @Override - public void doAfterAllAnalysed(AnalysisContext analysisContext) { - // - } - }).headRowNumber(headRowNumber).build(); - - List<ReadSheet> sheets = reader.excelExecutor().sheetList(); - for (ReadSheet sheet : sheets) { - if (strs != null && excludeSheets.contains(sheet.getSheetName())) { - continue; - } - - reader.read(sheet); - } - reader.finish(); - - return list; - } - - /** - * 鑾峰彇Excel澶存敞瑙g被 - * - * @param clazz Class - * @param <T> 娉涘瀷绫� - * @return 澶磋鏁� - */ - public static <T> ExcelHead getExcelHead(Class<?> clazz) { - ExcelHead head = clazz.getAnnotation(ExcelHead.class); - - return head; - } - - /** - * 鍐欏叆Excel妯℃澘 - * - * @param source 婧愭枃浠讹紙妯℃澘锛� - * @param target 鐩綍鏂囦欢 - * @param map 鏁版嵁婧� - */ - public static <T> void writeToTemplate(String source, String target, Map<String, List<T>> map) { - // 鏍规嵁妯℃澘鍐欏叆鏁版嵁锛屽鏋滅洰鏍囨枃浠朵笉瀛樺湪锛屽垯鑷姩鍒涘缓鏂囦欢 - ExcelWriter excelWriter = EasyExcel.write(target).withTemplate(source).build(); - - // 鍦ㄥ伐浣滅翱0涓啓鍏ユ暟鎹紝濡傛灉妯℃澘涓笉瀛樺湪缁冧範宸ヤ綔绨匡紝鍒欎細鍦ㄧ洰鏍囨枃浠朵腑鑷姩鍒涘缓 - WriteSheet writeSheet = EasyExcel.writerSheet(0).build(); - - // 鍨傜洿鍐欏叆鏁版嵁锛屽鏋滆姘村钩鍐欏叆锛屽皢VERTICAL鏇挎崲涓篐ORIZONTAL - FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).build(); - - // 鍐欏叆鏁版嵁 - map.forEach((k, v) -> excelWriter.fill(new FillWrapper(k, v), fillConfig, writeSheet)); - - // 缁撴潫鍐欏叆 - excelWriter.finish(); - } -} diff --git a/src/main/java/com/lf/server/helper/FileHelper.java b/src/main/java/com/lf/server/helper/FileHelper.java deleted file mode 100644 index 5c3f682..0000000 --- a/src/main/java/com/lf/server/helper/FileHelper.java +++ /dev/null @@ -1,449 +0,0 @@ -package com.lf.server.helper; - -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.data.MetaFileEntity; -import com.twmacinta.util.MD5; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.io.*; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.text.DecimalFormat; -import java.util.List; -import java.util.Objects; - -/** - * 鏂囦欢甯姪绫� - * @author WWW - */ -public class FileHelper { - private final static Log log = LogFactory.getLog(FileHelper.class); - - /** - * 鑾峰彇鏂囦欢鍚� - * - * @param file - * @return - */ - public static String getFileName(String file) { - int idx = file.lastIndexOf(File.separator); - if (idx > -1) { - return file.substring(idx + 1); - } - - return ""; - } - - /** - * 鑾峰彇鏂囦欢鎵╁睍鍚� - */ - public static String getExtension(File file) { - if (file == null) { - return null; - } - - String fileName = file.getName().toLowerCase(); - - int idx = fileName.indexOf(StaticData.POINT); - if (idx == -1) { - return ""; - } - - return fileName.substring(idx); - } - - /** - * 鑾峰彇鏂囦欢鎵╁睍鍚� - */ - public static String getExtension(String fileName) { - if (StringHelper.isEmpty(fileName)) { - return ""; - } - - int idx = fileName.lastIndexOf(StaticData.POINT); - if (idx == -1) { - return ""; - } - - return fileName.substring(idx).toLowerCase(); - } - - /** - * 鑾峰彇澶氱敤閫斾簰鑱旂綉閭欢鎵╁睍绫诲瀷 - * - * @param ext 鏂囦欢鎵╁睍鍚� - * @return - */ - public static String getMime(String ext) { - switch (ext) { - // 鍥剧墖 - case ".tif": - case ".tiff": - return "image/tiff"; - case ".img": - return "application/x-img"; - case ".gif": - return "image/gif"; - case ".jpg": - case ".jpeg": - return "image/jpeg"; - case ".png": - return "image/png"; - // 闊�/瑙嗛 - case ".mp3": - return "audio/mp3"; - case ".mp4": - return "video/mpeg4"; - case ".avi": - return "video/avi"; - case ".mpg": - case ".mpeg": - return "video/mpg"; - case ".wav": - return "audio/wav"; - case ".wma": - return "audio/x-ms-wma"; - case ".swf": - return "application/x-shockwave-flash"; - case ".wmv": - return "video/x-ms-wmv"; - case ".rm": - return "application/vnd.rn-realmedia"; - case ".rmvb": - return "application/vnd.rn-realmedia-vbr"; - // 缃戦〉 - case ".js": - return "application/x-javascript"; - case ".css": - return "text/css"; - case ".asp": - return "text/asp"; - case ".mht": - return "message/rfc822"; - case ".jsp": - case ".htm": - case ".html": - case ".xhtml": - return "text/html"; - case ".xml": - case ".svg": - return "text/xml"; - // 鏂囦欢 - case ".txt": - return "text/plain"; - case ".dbf": - return "application/x-dbf"; - case ".mdb": - return "application/msaccess"; - case ".pdf": - return "application/pdf"; - case ".ppt": - case ".pptx": - return "application/x-ppt"; - case ".doc": - case ".docx": - return "application/msword"; - case ".xls": - case ".xlsx": - return "application/vnd.ms-excel"; - case ".dgn": - return "application/x-dgn"; - case ".dwg": - return "application/x-dwg"; - case ".ext": - return "application/x-msdownload"; - // 榛樿 - default: - return "application/octet-stream"; - } - } - - /** - * 瀛楄妭鍗曚綅鎹㈢畻 - */ - public static String formatByte(long byteNumber) { - double kbNumber = byteNumber / StaticData.D1024; - if (kbNumber < StaticData.D1024) { - return new DecimalFormat("#.##KB").format(kbNumber); - } - double mbNumber = kbNumber / StaticData.D1024; - if (mbNumber < StaticData.D1024) { - return new DecimalFormat("#.##MB").format(mbNumber); - } - double gbNumber = mbNumber / StaticData.D1024; - if (gbNumber < StaticData.D1024) { - return new DecimalFormat("#.##GB").format(gbNumber); - } - double tbNumber = gbNumber / StaticData.D1024; - - return new DecimalFormat("#.##TB").format(tbNumber); - } - - /** - * 鑾峰彇鏂囦欢澶у皬 - */ - public static String getSizes(double mbNumber) { - if (mbNumber < StaticData.D1024) { - return new DecimalFormat("#.##MB").format(mbNumber); - } - - double gbNumber = mbNumber / StaticData.D1024; - if (gbNumber < StaticData.D1024) { - return new DecimalFormat("#.##GB").format(gbNumber); - } - - double tbNumber = gbNumber / StaticData.D1024; - - return new DecimalFormat("#.##TB").format(tbNumber); - } - - /** - * byte杞琈B - */ - public static double sizeToMb(long size) { - if (size < StaticData.D1050) { - return 0.001; - } - - String str = String.format("%.3f", size / StaticData.D1024 / StaticData.D1024); - - return Double.parseDouble(str); - } - - /** - * 3.鑾峰彇鏂囦欢MD5鐮侊紙JDK锛� - */ - public static String getMd5ByJdk(String filePath) throws IOException { - FileInputStream fileStream = new FileInputStream(filePath); - String md5 = DigestUtils.md5Hex(fileStream); - fileStream.close(); - - return md5; - } - - /** - * 2.鑾峰彇蹇�� MD5 鐮� - */ - public static String getFastMd5(String filePath) throws IOException { - String hash = MD5.asHex(MD5.getHash(new File(filePath))); - - MD5 md5 = new MD5(); - md5.Update(hash, null); - - return md5.asHex(); - } - - /** - * 鍒犻櫎鏂囦欢 - */ - public static void deleteFiles(List<MetaFileEntity> list) { - try { - for (MetaFileEntity mf : list) { - File f = new File(mf.getPath()); - if (f.exists()) { - f.delete(); - } - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 鍒犻櫎鏂囦欢澶� - * - * @param dir 鏂囦欢澶� - */ - public static void deleteDir(String dir) { - File file = new File(dir); - - deleteFiles(file); - } - - /** - * 绾ц仈鍒犻櫎鏂囦欢 - * - * @param file 鏂囦欢 - */ - public static void deleteFiles(File file) { - if (null == file || !file.exists()) { - return; - } - - if (file.isDirectory()) { - File[] files = file.listFiles(); - if (null != files && files.length > 0) { - for (File f : files) { - if (f.isDirectory()) { - deleteFiles(f); - } else { - f.delete(); - } - } - } - } - - file.delete(); - } - - /** - * 鑾峰彇鐩稿璺緞 - * - * @param file 鏂囦欢 - * @return 鐩稿璺緞 - */ - public static String getRelativePath(String file) { - if (StringHelper.isEmpty(file)) { - return null; - } - - int idx = file.lastIndexOf(File.separator); - int start = file.lastIndexOf(File.separator, idx - 1); - - return file.substring(start + 1); - } - - /** - * 鑾峰彇璺緞 - * - * @param file 鏂囦欢 - * @return 鏂囦欢璺緞 - */ - public static String getPath(String file) { - if (StringHelper.isEmpty(file)) { - return null; - } - - int end = file.lastIndexOf(File.separator); - - return file.substring(0, end); - } - - /** - * 1.鑾峰彇鏂囦欢鐨凪D5 - */ - @SuppressWarnings("unused") - public static String getFileMd5(String filePath) { - FileInputStream fis = null; - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - - fis = new FileInputStream(new File(filePath)); - FileChannel fChannel = fis.getChannel(); - ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 1024); - - while (fChannel.read(buffer) != -1) { - buffer.flip(); - md.update(buffer); - buffer.compact(); - } - byte[] b = md.digest(); - - return byteToHexString(b); - } catch (Exception ex) { - ex.printStackTrace(); - return null; - } finally { - try { - if (null != fis) { - fis.close(); - } - } catch (IOException ex) { - ex.printStackTrace(); - } - } - } - - /** - * 瀛楄妭鐮佽浆16杩涘埗 - */ - public static String byteToHexString(byte[] tmp) { - // 姣忎釜瀛楄妭鐢� 16 杩涘埗琛ㄧず鐨勮瘽锛屼娇鐢ㄤ袱涓瓧绗︼紝 - char[] str = new char[16 * 2]; - - // 鎵�浠ヨ〃绀烘垚 16 杩涘埗闇�瑕� 32 涓瓧绗︼紝琛ㄧず杞崲缁撴灉涓搴旂殑瀛楃浣嶇疆 - int k = 0; - // 浠庣涓�涓瓧鑺傚紑濮嬶紝瀵� MD5 鐨勬瘡涓�涓瓧鑺� - for (int i = 0; i < StaticData.SIXTEEN; i++) { - // 杞崲鎴� 16 杩涘埗瀛楃鐨勮浆鎹� - byte byte0 = tmp[i]; - // 鍙栧瓧鑺備腑楂� 4 浣嶇殑鏁板瓧杞崲 - str[k++] = StaticData.HEX_DIGITS[byte0 >>> 4 & 0xf]; - // >>> 涓洪�昏緫鍙崇Щ锛屽皢绗﹀彿浣嶄竴璧峰彸绉伙紝 鍙栧瓧鑺備腑浣� 4 浣嶇殑鏁板瓧杞崲 - str[k++] = StaticData.HEX_DIGITS[byte0 & 0xf]; - } - // 鎹㈠悗鐨勭粨鏋滆浆鎹负瀛楃涓� - return new String(str); - } - - /** - * 鑾峰彇瀛楃涓茬殑MD5鐮� - */ - public static String getStringMd5(String text) { - StringBuilder builder = new StringBuilder(); - try { - MessageDigest md5 = MessageDigest.getInstance("MD5"); - - byte[] bytes = md5.digest(text.getBytes(StandardCharsets.UTF_8)); - for (byte aByte : bytes) { - builder.append(Integer.toHexString((0x000000FF & aByte) | 0xFFFFFF00).substring(6)); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - - return builder.toString(); - } - - /** - * 鏍规嵁璺緞鑾峰彇鏂囦欢 - */ - public static void getFilesByPath(List<File> list, String path) { - File file = new File(path); - if (file.isDirectory()) { - File[] files = file.listFiles(); - if (null == files) { - return; - } - - for (File f : files) { - if (f.isDirectory()) { - getFilesByPath(list, f.getPath()); - } else { - list.add(f); - } - } - } else { - list.add(file); - } - } - - /** - * 澶嶅埗鏂囦欢 - * - * @param src 婧愭枃浠� - * @param dest 鐩綍鏂囦欢 - */ - public static void copyFile(File src, File dest) throws IOException { - InputStream is = null; - OutputStream os = null; - try { - is = new FileInputStream(src); - os = new FileOutputStream(dest); - - byte[] buffer = new byte[1024]; - - int length; - while ((length = is.read(buffer)) > 0) { - os.write(buffer, 0, length); - } - } finally { - os.close(); - is.close(); - } - } -} diff --git a/src/main/java/com/lf/server/helper/GdalHelper.java b/src/main/java/com/lf/server/helper/GdalHelper.java deleted file mode 100644 index c03235f..0000000 --- a/src/main/java/com/lf/server/helper/GdalHelper.java +++ /dev/null @@ -1,371 +0,0 @@ -package com.lf.server.helper; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.gdal.gdal.Band; -import org.gdal.gdal.Driver; -import org.gdal.gdal.gdal; -import org.gdal.gdal.Dataset; -import org.gdal.gdalconst.gdalconstConstants; -import org.gdal.ogr.*; -import org.gdal.osr.SpatialReference; - -import java.io.File; -import java.sql.Time; -import java.sql.Timestamp; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * GDAL甯姪绫� - * @author WWW - */ -@SuppressWarnings("ALL") -public class GdalHelper { - private final static Log log = LogFactory.getLog(GdalHelper.class); - - public static void init(String gdalPath) { - // 鏀寔涓枃璺緞 - gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - // 灞炴�ц〃鏀寔涓枃锛欳P936 - gdal.SetConfigOption("SHAPE_ENCODING", ""); - gdal.SetConfigOption("PGEO_DRIVER_TEMPLATE", "DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=%s"); - gdal.SetConfigOption("MDB_DRIVER_TEMPLATE", "DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=%s"); - - // 閰嶇疆鐜鍙橀噺 - if (!StringHelper.isEmpty(gdalPath)) { - gdal.SetConfigOption("GDAL_DATA", gdalPath + File.separator + "gdal-data"); - gdal.SetConfigOption("PROJ_LIB", gdalPath + File.separator + "proj7" + File.separator + "share"); - //System.setProperty("PROJ_LIB", gdalPath + File.separator + "proj7" + File.separator + "share") - gdal.SetConfigOption("GDAL_DRIVER_PATH", gdalPath + File.separator + "gdalplugins"); - - String path = System.getenv("PATH"); - if (!path.contains(gdalPath)) { - System.setProperty("PATH", path + ";" + gdalPath); - } - } - - // 娉ㄥ唽鎵�鏈夌殑椹卞姩 - gdal.AllRegister(); - ogr.RegisterAll(); - } - - /** - * 璇诲彇tif鏂囦欢 - * - * @param fileName - */ - public static void readTif(String fileName) { - // 璇诲彇褰卞儚鏁版嵁 - Dataset dataset = gdal.Open(fileName, gdalconstConstants.GA_ReadOnly); - if (dataset == null) { - System.out.println("read fail!"); - return; - } - - // providing various methods for a format specific driver. - Driver driver = dataset.GetDriver(); - System.out.println("driver name: " + driver.getLongName()); - - // 璇诲彇褰卞儚淇℃伅 - int xSize = dataset.getRasterXSize(); - int ySzie = dataset.getRasterYSize(); - int rasterCount = dataset.getRasterCount(); - System.out.println("dataset xSize: " + xSize + ", ySzie = " + ySzie + ", rasterCount = " + rasterCount); - - Band band = dataset.GetRasterBand(1); - // the data type of the band. - int type = band.GetRasterDataType(); - System.out.println("data type = " + type + ", " + (type == gdalconstConstants.GDT_Byte)); - - // Frees the native resource associated to a Dataset object and close the file. - dataset.delete(); - - gdal.GDALDestroyDriverManager(); - } - - /** - * 璇诲彇shp鏂囦欢 - * - * @param filePath - */ - public static void readShp(String filePath) { - try { - org.gdal.ogr.Driver driver = ogr.GetDriverByName("ESRI shapefile"); - if (driver == null) { - System.out.println(" ESRI shapefile椹卞姩涓嶅彲鐢紒\n"); - System.out.println("fail"); - } - - DataSource dataSource = driver.Open(filePath); - Layer layer = dataSource.GetLayer(0); - - String layerName = layer.GetName(); - System.out.println("鍥惧眰鍚嶇О锛�" + layerName); - - SpatialReference spatialReference = layer.GetSpatialRef(); - // System.out.println(spatialReference) - System.out.println("绌洪棿鍙傝�冨潗鏍囩郴锛�" + spatialReference.GetAttrValue("AUTHORITY", 0) + spatialReference.GetAttrValue("AUTHORITY", 1)); - - double[] layerExtent = layer.GetExtent(); - System.out.println("鍥惧眰鑼冨洿锛歮inx:" + layerExtent[0] + ",maxx:" + layerExtent[1] + ",miny:" + layerExtent[2] + ",maxy:" + layerExtent[3]); - - FeatureDefn featureDefn = layer.GetLayerDefn(); - Map<String, Object> fieldMap = new HashMap(5); - for (int i = 0, count = featureDefn.GetFieldCount(); i < count; i++) { - FieldDefn fieldDefn = featureDefn.GetFieldDefn(i); - //寰楀埌灞炴�у瓧娈电被鍨� - int fieldType = fieldDefn.GetFieldType(); - String fieldTypeName = fieldDefn.GetFieldTypeName(fieldType); - //寰楀埌灞炴�у瓧娈靛悕绉� - String fieldName = fieldDefn.GetName(); - - fieldMap.put(fieldTypeName, fieldName); - } - - long featureCount = layer.GetFeatureCount(); - System.out.println("鍥惧眰瑕佺礌涓暟锛�" + featureCount); - for (int i = 0; i < featureCount; i++) { - Feature feature = layer.GetFeature(i); - Object[] arr = fieldMap.values().toArray(); - for (int k = 0; k < arr.length; k++) { - String value = feature.GetFieldAsString(arr[k].toString()); - System.out.print(" 灞炴�у悕绉�:" + arr[k].toString() + ",灞炴�у��:" + value); - } - System.out.println(); - break; - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - public static void getLayerDto(String filePath) { - org.gdal.ogr.Driver driver = ogr.GetDriverByName("OpenFileGDB"); - if (driver == null) { - return; - } - - List<Map> list = new ArrayList<>(); - List<Map<String, String>> mapList = new ArrayList<>(); - DataSource dataSource = null; - try { - dataSource = driver.Open(filePath, 0); - int num = dataSource.GetLayerCount(); - for (int i = 0; i < num; i++) { - // 鑾峰彇鍥惧眰 - Layer layer = dataSource.GetLayer(i); - // 琛ㄥ悕绉� - String strlayerName = layer.GetName(); - // 鑾峰彇鍥惧眰瑕佹暟涓暟 - long count = layer.GetFeatureCount(); - if (0 != count) { - do { - // 鑾峰彇鍥惧眰涓嬬殑瑕佺礌 - Feature feature = layer.GetNextFeature(); - if (null == feature) { - break; - } - // 鑾峰彇杈圭晫鍧愭爣 - Geometry geometry = feature.GetGeometryRef(); - if (geometry != null) { - String geometryJson = geometry.ExportToJson(); - String str = geometryJson.substring(geometryJson.lastIndexOf(":") + 1, geometryJson.length()); - if (!" [ [ ] ] }".equals(str)) { - String s1 = str.substring(7, str.length() - 8); - String[] split = s1.replaceAll(" ", "").replaceAll("\\[", "").replaceAll("]", "").split(","); - List<String> xList = new ArrayList(); - List<String> yList = new ArrayList(); - Map<String, String> map1 = new HashMap(5); - for (int j = 0; j < split.length; j++) { - if (j != (split.length - 1) && j % 2 == 0) { - map1.put(split[j], split[j + 1]); - } - } - mapList.add(map1); - } - } - Map map = new HashMap(5); - //鑾峰彇灞炴�� - for (int p = 0; p < feature.GetFieldCount(); p++) { - map.put(feature.GetFieldDefnRef(p).GetName(), getProperty(feature, p)); - } - list.add(map); - feature.delete(); - } while (true); - } - //layerDto.setLayerName(strlayerName); - //layerDto.setList(list); - //layerDto.setCount(count); - //layerDto.setMap(mapList); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } finally { - if (dataSource != null) { - dataSource.delete(); - } - } - } - - /** - * 璇诲彇gdb鏂囦欢 - * - * @param filePath - */ - public static void readGdb(String filePath) { - try { - org.gdal.ogr.Driver driver = ogr.GetDriverByName("OpenFileGDB"); - if (driver == null) { - return; - } - DataSource dataSource = driver.Open(filePath, 0); - - for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { - // 鑾峰彇鍥惧眰 - Layer layer = dataSource.GetLayer(i); - System.out.println(i + "\t" + layer.GetName()); - do { - // 鑾峰彇鍥惧眰涓嬬殑瑕佺礌 - Feature feature = layer.GetNextFeature(); - if (null == feature) { - break; - } - // 鑾峰彇鏍峰紡锛岃繖閲屾槸绌猴紝寰呯‘瀹� - System.out.println(feature.GetStyleString()); - // 鑾峰彇geometry锛屼篃鍙互ExportToWkb() gml绛夌瓑 - System.out.println(feature.GetGeometryRef().ExportToWkt()); - // 鑾峰彇灞炴�� - System.out.println("----------------------------------"); - for (int p = 0; p < feature.GetFieldCount(); p++) { - System.out.println(feature.GetFieldDefnRef(p).GetName() + "\t" + getProperty(feature, p)); - } - System.out.println("----------------------------------"); - break; - } while (true); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - public static Object getProperty(Feature feature, int index) { - int type = feature.GetFieldType(index); - - PropertyGetter propertyGetter; - if (type < 0 || type >= PROPERTY_GETTERS.length) { - propertyGetter = STRING_PROPERTY_GETTER; - } else { - propertyGetter = PROPERTY_GETTERS[type]; - } - - try { - return propertyGetter.get(feature, index); - } catch (Exception ex) { - // ex.printStackTrace() - log.error(ex.getMessage(), ex); - - return null; - } - } - - /** - * 灞炴�ц幏鍙栧櫒 - */ - @FunctionalInterface - private interface PropertyGetter { - /** - * 鑾峰彇灞炴�� - * - * @param feature - * @param index - * @return - */ - Object get(Feature feature, int index); - } - - private static final PropertyGetter STRING_PROPERTY_GETTER = (feature, index) -> feature.GetFieldAsString(index); - - /** - * feature.GetFieldType(index)寰楀埌涓�涓睘鎬х被鍨嬬殑int鍊�,璇ュ�煎搴斿叿浣撶被鍨� - */ - private static final PropertyGetter[] PROPERTY_GETTERS = new PropertyGetter[]{ - // 0-Integer - (feature, index) -> feature.GetFieldAsInteger(index), - // 1-IntegerList - (feature, index) -> feature.GetFieldAsIntegerList(index), - // 2-Real - (feature, index) -> feature.GetFieldAsDouble(index), - // 3-RealList - (feature, index) -> feature.GetFieldAsDoubleList(index), - // 4-String - STRING_PROPERTY_GETTER, - // 5-StringList - (feature, index) -> feature.GetFieldAsStringList(index), - // 6-unknown - STRING_PROPERTY_GETTER, - // 7-unknown - STRING_PROPERTY_GETTER, - // 8-Binary - (feature, index) -> feature.GetFieldAsBinary(index), - // 9-Date - (feature, index) -> { - int[] pnYear = new int[1]; - int[] pnMonth = new int[1]; - int[] pnDay = new int[1]; - int[] pnHour = new int[1]; - int[] pnMinute = new int[1]; - float[] pfSecond = new float[1]; - int[] pnTZFlag = new int[1]; - feature.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTZFlag); - java.sql.Date date = java.sql.Date.valueOf(LocalDate.of(pnYear[0], pnMonth[0], pnDay[0])); - return date; - }, - // 10-Time - (feature, index) -> { - int[] pnYear = new int[1]; - int[] pnMonth = new int[1]; - int[] pnDay = new int[1]; - int[] pnHour = new int[1]; - int[] pnMinute = new int[1]; - float[] pfSecond = new float[1]; - int[] pnTZFlag = new int[1]; - feature.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTZFlag); - float fSecond = pfSecond[0]; - int s = (int) fSecond; - int ns = (int) (1000000000 * fSecond - s); - Time time = Time.valueOf(LocalTime.of(pnHour[0], pnMinute[0], s, ns)); - return time; - }, - // 11-DateTime - (feature, index) -> { - int[] pnYear = new int[1]; - int[] pnMonth = new int[1]; - int[] pnDay = new int[1]; - int[] pnHour = new int[1]; - int[] pnMinute = new int[1]; - float[] pfSecond = new float[1]; - int[] pnTZFlag = new int[1]; - feature.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTZFlag); - float fSecond = pfSecond[0]; - int s = (int) fSecond; - int ns = (int) (1000000000 * fSecond - s); - LocalDateTime localDateTime = LocalDateTime.of( - LocalDate.of(pnYear[0], pnMonth[0], pnDay[0]), - LocalTime.of(pnHour[0], pnMinute[0], s, ns) - ); - Timestamp timestamp = Timestamp.valueOf(localDateTime); - return timestamp; - }, - // 12-Integer64 - (feature, index) -> feature.GetFieldAsInteger64(index), - // 13 Integer64List - (feature, index) -> feature.GetFieldAsIntegerList(index) - // >=14 (unknown) - }; -} diff --git a/src/main/java/com/lf/server/helper/GdbHelper.java b/src/main/java/com/lf/server/helper/GdbHelper.java deleted file mode 100644 index 1d1a06c..0000000 --- a/src/main/java/com/lf/server/helper/GdbHelper.java +++ /dev/null @@ -1,622 +0,0 @@ -package com.lf.server.helper; - -import com.lf.server.entity.all.BaseGeoEntity; -import com.lf.server.entity.all.StaticData; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.mapper.all.GeomBaseMapper; -import com.lf.server.service.all.BaseQueryService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.gdal.ogr.*; -import org.gdal.osr.SpatialReference; - -import java.lang.reflect.Field; -import java.math.BigDecimal; -import java.sql.Timestamp; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.*; - -/** - * GDB甯姪绫� - * @author WWW - */ -public class GdbHelper { - private final static Log log = LogFactory.getLog(GdbHelper.class); - - /** - * 閿�姣佽祫婧� - */ - public static void delete(Layer layer) { - try { - if (null != layer) { - layer.delete(); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 閿�姣佽祫婧� - */ - public static void delete(DataSource dataSource, Driver driver) { - try { - if (null != dataSource) { - dataSource.delete(); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - - try { - if (null != driver) { - driver.delete(); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 閿�姣佽祫婧� - */ - public static void delete(Layer layer, DataSource dataSource, Driver driver) { - delete(layer); - delete(dataSource, driver); - } - - /** - * 鑾峰彇琛ㄥ悕 - */ - public static List<String> getTabNames(String filePath) { - List<String> list = new ArrayList<>(); - - Driver driver = null; - DataSource dataSource = null; - try { - // driver = ogr.GetDriverByName("OpenFileGDB") - driver = ogr.GetDriverByName("FileGDB"); - if (null == driver) { - log.error("GdbHelper.getTabNames.driver is null."); - return list; - } - - dataSource = driver.Open(filePath, 0); - if (null == dataSource) { - log.error("GdbHelper.getTabNames.dataSource is null. " + filePath); - return list; - } - - for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { - Layer layer = dataSource.GetLayer(i); - list.add(layer.GetName()); - - layer.delete(); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } finally { - GdbHelper.delete(dataSource, driver); - } - - return list; - } - - /** - * 璇诲彇鏁版嵁 - */ - public static <T> List<T> readData(Class clazz, String filePath, String layerName) { - List<T> list = new ArrayList<>(); - - Driver driver = null; - DataSource dataSource = null; - try { - // driver = ogr.GetDriverByName("OpenFileGDB") - driver = ogr.GetDriverByName("FileGDB"); - if (null == driver) { - return list; - } - - dataSource = driver.Open(filePath, 0); - if (null == dataSource) { - return list; - } - - for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { - Layer layer = dataSource.GetLayer(i); - if (layer.GetName().equals(layerName)) { - GdbHelper.readLayer(clazz, layer, list); - break; - } - - layer.delete(); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } finally { - GdbHelper.delete(dataSource, driver); - } - - return list; - } - - /** - * 璇诲彇鍥惧眰 - */ - public static <T> void readLayer(Class clazz, Layer layer, List<T> list) { - try { - Field gField = getGeomField(clazz); - - Map<Integer, Field> map = new HashMap<>(3); - getFieldMapper(clazz, layer, map); - if (map.isEmpty() || 0 == layer.GetFeatureCount()) { - return; - } - - do { - Feature f = layer.GetNextFeature(); - if (null == f) { - break; - } - - T t = (T) clazz.newInstance(); - readFeature(t, f, map, gField); - list.add(t); - } while (true); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } finally { - GdbHelper.delete(layer); - } - } - - /** - * 鑾峰彇 geom 瀛楁 - */ - private static Field getGeomField(Class clazz) { - try { - Field gField = clazz.getSuperclass().getDeclaredField("geom"); - gField.setAccessible(true); - - return gField; - } catch (Exception ex) { - return null; - } - } - - /** - * 鑾峰彇瀛楁鏄犲皠 - */ - private static void getFieldMapper(Class clazz, Layer layer, Map<Integer, Field> map) { - try { - FeatureDefn fd = layer.GetLayerDefn(); - for (int i = 0, count = fd.GetFieldCount(); i < count; i++) { - FieldDefn fieldDefn = fd.GetFieldDefn(i); - try { - String name = fieldDefn.GetName().toLowerCase(); - if (StaticData.READ_EXCLUDE_FIELDS.contains(name)) { - continue; - } - - Field field = clazz.getDeclaredField(name); - field.setAccessible(true); - - map.put(i, field); - } catch (Exception e) { - // - } - } - - if (!StaticData.OBJECT.equals(clazz.getSuperclass().getName())) { - getFieldMapper(clazz.getSuperclass(), layer, map); - } - } catch (Exception ex) { - // - } - } - - /** - * 璇诲彇Feature - */ - private static <T> void readFeature(T t, Feature f, Map<Integer, Field> map, Field gField) { - for (Integer i : map.keySet()) { - try { - Field field = map.get(i); - setValue(t, f, field, i); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } - - if (null != gField) { - setGeom(t, f, gField); - } - } - - /** - * 璁剧疆鍊� - */ - public static <T> void setValue(T t, Feature f, Field field, Integer i) throws Exception { - switch (field.getType().getName()) { - case "java.math.BigDecimal": - double dd = f.GetFieldAsDouble(i); - field.set(t, BigDecimal.valueOf(dd)); - break; - case "java.lang.Double": - case "double": - field.set(t, f.GetFieldAsDouble(i)); - break; - case "java.lang.Long": - case "long": - field.set(t, f.GetFieldAsInteger64(i)); - break; - case "java.lang.Integer": - case "int": - field.set(t, f.GetFieldAsInteger(i)); - break; - case "java.sql.Timestamp": - Timestamp ts = getTimestamp(f, i); - if (null != ts) { - field.set(t, ts); - } - break; - case "java.time.LocalDate": - LocalDate ld = getLocalDate(f, i); - if (null != ld) { - field.set(t, ld); - } - break; - default: - field.set(t, f.GetFieldAsString(i)); - break; - } - } - - /** - * 璁剧疆 geom 瀛楁鍊� - * <p> - * wkbUnknown = 0, - * wkbPoint = 1, - * wkbLineString = 2, - * wkbPolygon = 3, - * wkbMultiPoint = 4, - * wkbMultiLineString = 5, - * wkbMultiPolygon = 6, - * wkbGeometryCollection = 7, - * wkbNone = 100, - * wkbLinearRing = 101 - */ - private static <T> void setGeom(T t, Feature f, Field gField) { - try { - String geo = "null"; - if (null != f.GetGeometryRef()) { - String wkt = f.GetGeometryRef().ExportToWkt(); - // f.GetGeometryRef().GetGeometryType() - if (wkt.contains(StaticData.LINESTRING) && !wkt.contains(StaticData.MULTILINESTRING)) { - wkt = wkt.replace("LINESTRING (", "MULTILINESTRING ((") + ")"; - } - if (wkt.contains(StaticData.POLYGON) && !wkt.contains(StaticData.MULTIPOLYGON)) { - wkt = wkt.replace("POLYGON (", "MULTIPOLYGON ((") + ")"; - } - wkt = wkt.replace(" 0,", ",").replace(" 0)", ")"); - - geo = String.format("ST_GeomFromText('%s')", wkt); - } - - gField.set(t, geo); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 鑾峰彇 Timestamp - */ - public static Timestamp getTimestamp(Feature f, int index) { - int[] pnYear = new int[1]; - int[] pnMonth = new int[1]; - int[] pnDay = new int[1]; - int[] pnHour = new int[1]; - int[] pnMinute = new int[1]; - float[] pfSecond = new float[1]; - int[] pnTzFlag = new int[1]; - - f.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTzFlag); - - float fSecond = pfSecond[0]; - int s = (int) fSecond; - int ns = (int) (1000000000 * fSecond - s); - - if (pnYear[0] > StaticData.I2050 || pnMonth[0] > StaticData.I12 || pnDay[0] > StaticData.I31 || pnHour[0] > StaticData.I24 || pnMinute[0] > StaticData.I60) { - return null; - } - - LocalDateTime localDateTime = LocalDateTime.of( - LocalDate.of(pnYear[0], pnMonth[0], pnDay[0]), - LocalTime.of(pnHour[0], pnMinute[0], s, ns) - ); - - return Timestamp.valueOf(localDateTime); - } - - /** - * 鑾峰彇 LocalDate - */ - public static LocalDate getLocalDate(Feature f, int index) { - int[] pnYear = new int[1]; - int[] pnMonth = new int[1]; - int[] pnDay = new int[1]; - int[] pnHour = new int[1]; - int[] pnMinute = new int[1]; - float[] pfSecond = new float[1]; - int[] pnTzFlag = new int[1]; - - f.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTzFlag); - if (pnYear[0] > StaticData.I2050 || pnMonth[0] > StaticData.I12 || pnDay[0] > StaticData.I31) { - return null; - } - - return LocalDate.of(pnYear[0], pnMonth[0], pnDay[0]); - } - - /** - * 鍒涘缓GDB - */ - public static void createGdb(String filePath, Map<String, List<?>> map) throws Exception { - Driver driver = null; - DataSource dataSource = null; - try { - driver = ogr.GetDriverByName("FileGDB"); - if (null == driver) { - log.error("GdbHelper.createGdb.driver(FileGDB) is null."); - return; - } - dataSource = driver.CreateDataSource(filePath, null); - if (null == dataSource) { - log.error("GdbHelper.createGdb.dataSource is null. " + filePath); - return; - } - - for (String key : map.keySet()) { - Layer layer = null; - try { - BasicMapper baseMapper = ClassHelper.getBasicMapper(key); - if (null == baseMapper) { - continue; - } - layer = createLayer(dataSource, baseMapper); - if (null == layer) { - continue; - } - - String className = ClassHelper.getClassName(baseMapper); - Class clazz = ClassHelper.getEntityClass(className); - if (null == clazz) { - continue; - } - - List<Field> fields = new ArrayList<>(); - getFields(clazz, fields, StaticData.GDB_EXCLUDE_FIELDS); - addLayerField(layer, fields); - - setLayerData(layer, fields, map.get(key)); - } finally { - if (null != layer) { - layer.delete(); - } - } - } - - dataSource.SyncToDisk(); - dataSource.FlushCache(); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - throw ex; - } finally { - GdbHelper.delete(dataSource, driver); - } - } - - /** - * 鍒涘缓鍥惧眰 - */ - private static Layer createLayer(DataSource dataSource, BasicMapper baseMapper ) { - String tab = BaseQueryService.getTabName(baseMapper); - if (StringHelper.isNull(tab)) { - return null; - } - - Integer srid = null; - String geomType = null; - if (baseMapper instanceof GeomBaseMapper) { - GeomBaseMapper geomMapper = (GeomBaseMapper) baseMapper; - geomType = geomMapper.selectGeometryType(tab); - - srid = geomMapper.selectSrid(tab); - } - - SpatialReference sr = new SpatialReference(); - sr.ImportFromEPSG(null == srid ? 4490 : srid); - - return dataSource.CreateLayer(tab.replace(".", "_"), sr, getGeomType(geomType), null); - } - - /** - * 鑾峰彇Geom绫诲埆 - */ - private static Integer getGeomType(String geomType) { - if (StringHelper.isEmpty(geomType)) { - return ogr.wkbPoint; - } - - switch (geomType) { - case "ST_Point": - return ogr.wkbPoint; - case "ST_MultiPoint": - return ogr.wkbMultiPoint; - case "ST_LineString": - return ogr.wkbLineString; - case "ST_MultiLineString": - return ogr.wkbMultiLineString; - case "ST_Polygon": - return ogr.wkbPolygon; - case "ST_MultiPolygon": - return ogr.wkbMultiPolygon; - default: - return ogr.wkbUnknown; - } - } - - /** - * 鑾峰彇瀛楁 - */ - public static void getFields(Class clazz, List<Field> list, List<String> excludeFields) { - try { - Field[] fields = clazz.getDeclaredFields(); - for (Field f : fields) { - if (excludeFields.contains(f.getName())) { - continue; - } - - f.setAccessible(true); - list.add(f); - } - - if (!StaticData.OBJECT.equals(clazz.getSuperclass().getName())) { - getFields(clazz.getSuperclass(), list, excludeFields); - } - } catch (Exception ex) { - // - } - } - - /** - * 娣诲姞鍥惧眰瀛楁 - */ - public static void addLayerField(Layer layer, List<Field> list) { - for (int i = 0, c = list.size(); i < c; i++) { - Field f = list.get(i); - - int fieldType = getFieldType(f); - FieldDefn fd = new FieldDefn(f.getName(), fieldType); - - layer.CreateField(fd, i + 1); - } - } - - /** - * 鑾峰彇瀛楁绫诲瀷 - */ - private static Integer getFieldType(Field f) { - switch (f.getType().getName()) { - case "java.math.BigDecimal": - case "java.lang.Double": - case "double": - return ogr.OFTReal; - case "java.lang.Long": - case "long": - return ogr.OFTInteger64; - case "java.lang.Integer": - case "int": - return ogr.OFTInteger; - case "java.sql.Timestamp": - return ogr.OFTDateTime; - case "java.time.LocalDate": - return ogr.OFTDate; - default: - return ogr.OFTString; - } - } - - /** - * 璁剧疆鍥惧眰鏁版嵁 - */ - private static <T> void setLayerData(Layer layer, List<Field> fields, List<T> list) throws Exception { - for (T t : list) { - Feature f = new Feature(layer.GetLayerDefn()); - - if (t instanceof BaseGeoEntity) { - BaseGeoEntity geoEntity = (BaseGeoEntity) t; - if (!StringHelper.isEmpty(geoEntity.getGeom())) { - Geometry geom = Geometry.CreateFromWkt(geoEntity.getGeom()); - f.SetGeometry(geom); - } - } - - setFeatureData(f, fields, t); - layer.CreateFeature(f); - } - } - - /** - * 璁剧疆瑕佺礌鐨勬暟鎹� - */ - public static <T> void setFeatureData(Feature f, List<Field> fields, T t) throws Exception { - for (int i = 0, c = fields.size(); i < c; i++) { - Field field = fields.get(i); - Object val = field.get(t); - if (null == val) { - continue; - } - - switch (field.getType().getName()) { - case "java.math.BigDecimal": - BigDecimal big = (BigDecimal) val; - f.SetField(i, big.doubleValue()); - break; - case "java.lang.Double": - case "double": - double d = (double) val; - f.SetField(i, d); - break; - case "java.lang.Long": - case "long": - long l = (long) val; - f.SetField(i, l); - break; - case "java.lang.Integer": - case "int": - int n = (int) val; - f.SetField(i, n); - break; - case "java.sql.Timestamp": - Timestamp timestamp = (Timestamp) field.get(t); - setTimestamp(f, i, timestamp); - break; - case "java.time.LocalDate": - LocalDate localDate = (LocalDate) field.get(t); - setLocalDate(f, i, localDate); - break; - default: - String str = (String) val; - f.SetField(i, str); - break; - } - } - } - - /** - * 璁剧疆Timestamp - */ - private static void setTimestamp(Feature f, int i, Timestamp time) { - if (null == time) { - return; - } - - LocalDateTime local = time.toLocalDateTime(); - f.SetField(i, local.getYear(), local.getMonthValue(), local.getDayOfMonth(), local.getHour(), local.getMinute(), local.getSecond(), 8); - } - - /** - * 璁剧疆LocalDate - */ - private static void setLocalDate(Feature f, int i, LocalDate local) { - if (null == local) { - return; - } - - f.SetField(i, local.getYear(), local.getMonthValue(), local.getDayOfMonth(), 0, 0, 0, 8); - } -} diff --git a/src/main/java/com/lf/server/helper/HttpHelper.java b/src/main/java/com/lf/server/helper/HttpHelper.java deleted file mode 100644 index 6cef7fc..0000000 --- a/src/main/java/com/lf/server/helper/HttpHelper.java +++ /dev/null @@ -1,278 +0,0 @@ -package com.lf.server.helper; - -import org.apache.http.*; -import org.apache.http.client.config.CookieSpecs; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.utils.URIUtils; -import org.apache.http.entity.InputStreamEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.message.BasicHeader; -import org.apache.http.message.BasicHttpEntityEnclosingRequest; -import org.apache.http.message.BasicHttpRequest; -import org.apache.http.message.HeaderGroup; -import org.apache.http.util.EntityUtils; - -import javax.servlet.ServletException; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.OutputStream; -import java.net.HttpCookie; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Enumeration; - -/** - * Http甯姪绫� - * @author WWW - */ -public class HttpHelper { - private final static String HTTP_SLASH2 = "://"; - - private final static String HTTP_SLASH = "/"; - - private final static Integer THREE = 3; - - protected static final HeaderGroup HOP_HEADERS; - - static { - HOP_HEADERS = new HeaderGroup(); - - String[] headers = new String[]{ - "Connection", "Keep-Alive", "Proxy-Authenticate", "Proxy-Authorization", - "TE", "Trailers", "Transfer-Encoding", "Upgrade", - //"X-RateLimit-Burst-Capacity", "X-RateLimit-Remaining", "X-RateLimit-Replenish-Rate", - "Access-Control-Allow-Origin", "Access-Control-Allow-Credentials", "Access-Control-Allow-Headers"}; - - for (String header : headers) { - HOP_HEADERS.addHeader(new BasicHeader(header, null)); - } - } - - public void service(HttpServletRequest request, HttpServletResponse response, String url, String cookie) throws ServletException, IOException { - HttpRequest proxyRequest; - if (request.getHeader(HttpHeaders.CONTENT_LENGTH) != null || request.getHeader(HttpHeaders.TRANSFER_ENCODING) != null) { - proxyRequest = newProxyRequestWithEntity(request, url); - } else { - proxyRequest = new BasicHttpRequest(request.getMethod(), url); - } - - HttpHost host = this.getTargetHost(url); - // copyRequestHeaders(request, proxyRequest, host); - //setXrForwardedForHeader(request, proxyRequest); - - if (!StringHelper.isEmpty(cookie)) { - proxyRequest.addHeader("Cookie", cookie + "; "); - } - - CloseableHttpClient client = null; - HttpResponse proxyResponse = null; - - try { - client = this.createHttpClient(); - proxyResponse = client.execute(host, proxyRequest); - - int statusCode = proxyResponse.getStatusLine().getStatusCode(); - // response.setStatus(statusCode, proxyResponse.getStatusLine().getReasonPhrase()) - response.setStatus(statusCode); - - copyResponseHeaders(proxyResponse, request, response, url); - - if (statusCode == HttpServletResponse.SC_NOT_MODIFIED) { - response.setIntHeader(HttpHeaders.CONTENT_LENGTH, 0); - } else { - copyResponseEntity(proxyResponse, response); - } - } catch (Exception ex) { - throw new ServletException(ex.getMessage()); - } finally { - if (proxyResponse != null) { - EntityUtils.consumeQuietly(proxyResponse.getEntity()); - } - if (client != null) { - client.close(); - } - } - } - - protected HttpRequest newProxyRequestWithEntity(HttpServletRequest request, String url) throws IOException { - String method = request.getMethod(); - HttpEntityEnclosingRequest proxyRequest = new BasicHttpEntityEnclosingRequest(method, url); - proxyRequest.setEntity(new InputStreamEntity(request.getInputStream(), getContentLength(request))); - //String str = EntityUtils.toString(proxyRequest.getEntity(), "UTF-8") - - return proxyRequest; - } - - private long getContentLength(HttpServletRequest request) { - String contentLengthHeader = request.getHeader("Content-Length"); - if (contentLengthHeader != null) { - return Long.parseLong(contentLengthHeader); - } - - return -1L; - } - - protected void copyRequestHeaders(HttpServletRequest request, HttpRequest proxyRequest, HttpHost host) { - @SuppressWarnings("unchecked") - Enumeration<String> enumerationOfHeaderNames = request.getHeaderNames(); - - while (enumerationOfHeaderNames.hasMoreElements()) { - String headerName = enumerationOfHeaderNames.nextElement(); - copyRequestHeader(request, proxyRequest, host, headerName); - } - } - - protected void copyRequestHeader(HttpServletRequest request, HttpRequest proxyRequest, HttpHost host, String headerName) { - if (headerName.equalsIgnoreCase(HttpHeaders.CONTENT_LENGTH) || HOP_HEADERS.containsHeader(headerName)) { - return; - } - - @SuppressWarnings("unchecked") - Enumeration<String> headers = request.getHeaders(headerName); - while (headers.hasMoreElements()) { - String headerValue = headers.nextElement(); - if (headerName.equalsIgnoreCase(HttpHeaders.HOST)) { - headerValue = host.getHostName(); - if (host.getPort() != -1) { - headerValue += ":" + host.getPort(); - } - } else if (headerName.equalsIgnoreCase(org.apache.http.cookie.SM.COOKIE)) { - headerValue = getRealCookie(headerValue); - } - - proxyRequest.addHeader(headerName, headerValue); - } - } - - protected HttpHost getTargetHost(String url) throws ServletException { - try { - URI uri = new URI(url); - - return URIUtils.extractHost(uri); - } catch (URISyntaxException ex) { - throw new ServletException(ex.getMessage()); - } - } - - protected String getRealCookie(String cookieValue) { - StringBuilder escapedCookie = new StringBuilder(); - - String[] cookies = cookieValue.split("[;,]"); - for (String cookie : cookies) { - String[] cookieSplit = cookie.split("="); - if (cookieSplit.length == 2) { - String cookieName = cookieSplit[0].trim(); - if (cookieName.startsWith(cookieName)) { - cookieName = cookieName.substring(cookieName.length()); - if (escapedCookie.length() > 0) { - escapedCookie.append("; "); - } - escapedCookie.append(cookieName).append("=").append(cookieSplit[1].trim()); - } - } - } - - return escapedCookie.toString(); - } - - private void setXrForwardedForHeader(HttpServletRequest request, HttpRequest proxyRequest) { - String forHeaderName = "X-Forwarded-For"; - String forHeader = request.getRemoteAddr(); - String existingForHeader = request.getHeader(forHeaderName); - if (existingForHeader != null) { - forHeader = existingForHeader + ", " + forHeader; - } - proxyRequest.setHeader(forHeaderName, forHeader); - - String protoHeaderName = "X-Forwarded-Proto"; - String protoHeader = request.getScheme(); - proxyRequest.setHeader(protoHeaderName, protoHeader); - } - - protected CloseableHttpClient createHttpClient() { - RequestConfig requestConfig = RequestConfig.custom() - .setRedirectsEnabled(false) - .setCookieSpec(CookieSpecs.IGNORE_COOKIES) - .setConnectTimeout(-1) - .setSocketTimeout(-1) - .build(); - - // return HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build() - return HttpClients.custom() - .setDefaultRequestConfig(requestConfig) - .build(); - } - - protected void copyResponseHeaders(HttpResponse proxyResponse, HttpServletRequest request, HttpServletResponse response, String url) { - for (Header header : proxyResponse.getAllHeaders()) { - copyResponseHeader(request, response, header, url); - } - } - - protected void copyResponseHeader(HttpServletRequest request, HttpServletResponse response, Header header, String url) { - String headerName = header.getName(); - if (HOP_HEADERS.containsHeader(headerName)) { - return; - } - - String headerValue = header.getValue(); - if (headerName.equalsIgnoreCase(org.apache.http.cookie.SM.SET_COOKIE) || headerName.equalsIgnoreCase(org.apache.http.cookie.SM.SET_COOKIE2)) { - copyProxyCookie(request, response, headerValue); - } else if (headerName.equalsIgnoreCase(HttpHeaders.LOCATION)) { - response.addHeader(headerName, rewriteUrlFromResponse(request, url, headerValue)); - } else { - response.addHeader(headerName, headerValue); - } - } - - protected void copyProxyCookie(HttpServletRequest request, HttpServletResponse response, String headerValue) { - String path = request.getContextPath() + request.getServletPath(); - if (path.isEmpty()) { - path = "/"; - } - - for (HttpCookie cookie : HttpCookie.parse(headerValue)) { - Cookie servletCookie = new Cookie(cookie.getName(), cookie.getValue()); - servletCookie.setComment(cookie.getComment()); - servletCookie.setMaxAge((int) cookie.getMaxAge()); - servletCookie.setPath(path); - - servletCookie.setSecure(cookie.getSecure()); - servletCookie.setVersion(cookie.getVersion()); - response.addCookie(servletCookie); - } - } - - protected String rewriteUrlFromResponse(HttpServletRequest request, String targetUri, String theUrl) { - if (theUrl.startsWith(targetUri)) { - StringBuffer curUrl = request.getRequestURL(); - - int pos; - if ((pos = curUrl.indexOf(HTTP_SLASH2)) >= 0) { - if ((pos = curUrl.indexOf(HTTP_SLASH, pos + THREE)) >= 0) { - curUrl.setLength(pos); - } - } - - curUrl.append(request.getContextPath()); - curUrl.append(request.getServletPath()); - curUrl.append(theUrl, targetUri.length(), theUrl.length()); - - return curUrl.toString(); - } - - return theUrl; - } - - protected void copyResponseEntity(HttpResponse proxyResponse, HttpServletResponse response) throws IOException { - HttpEntity entity = proxyResponse.getEntity(); - if (entity != null) { - //String str = EntityUtils.toString(entity, "UTF-8") - OutputStream servletOutputStream = response.getOutputStream(); - entity.writeTo(servletOutputStream); - } - } -} diff --git a/src/main/java/com/lf/server/helper/JsonHelper.java b/src/main/java/com/lf/server/helper/JsonHelper.java deleted file mode 100644 index ea75613..0000000 --- a/src/main/java/com/lf/server/helper/JsonHelper.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.lf.server.helper; - -import com.alibaba.fastjson.JSONObject; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; - -/** - * Json甯姪绫� - * @author WWW - */ -public class JsonHelper { - /** - * json涓诧紝杞负LinkedHashMap - * @param json - * @return - * @throws IOException - */ - @SuppressWarnings("unchecked") - public static LinkedHashMap<String, Object> json2Map(String json) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true).configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - return mapper.readValue(json, LinkedHashMap.class); - } - - /** - * 瀵硅薄杞琷son - * @param obj - * @return - * @throws IOException - */ - public static String map2Json(Object obj) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true).configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - return mapper.writeValueAsString(obj); - } - - /** - * json涓诧紝杞负List<LinkedHashMap<String, Object>> - * @param json - * @return - * @throws IOException - */ - @SuppressWarnings("unchecked") - public static List<LinkedHashMap<String, Object>> json2ListMap(String json) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true).configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - return mapper.readValue(json, List.class); - } - - /** - * 灏唈son瀛楃涓茶浆涓哄璞� - * @param json - * @param valueType - * @param <T> - * @return - * @throws IOException - */ - public static <T> T json2Object(String json, Class<T> valueType) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true).configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - return mapper.readValue(json, valueType); - } - - /** - * fastjson 杞璞� - * - * @param obj - * @param valueType - * @param <T> - * @return - */ - public static <T> T obj2Vo(Object obj, Class<T> valueType) { - return JSONObject.parseObject(JSONObject.toJSONString(obj), valueType); - } -} diff --git a/src/main/java/com/lf/server/helper/LicHelper.java b/src/main/java/com/lf/server/helper/LicHelper.java deleted file mode 100644 index 747bece..0000000 --- a/src/main/java/com/lf/server/helper/LicHelper.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.lf.server.helper; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.crypto.Cipher; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.Charset; - -/** - * 璁稿彲甯姪绫� - * @author WWW - */ -public class LicHelper { - private String a; - private String b; - private static String c; - private static String d; - private static String e; - private static final Logger f; - - static { - c = "utf-8"; - d = "AES"; - e = "AES/CBC/PKCS5Padding"; - f = LoggerFactory.getLogger(LicHelper.class); - } - - private IvParameterSpec a() { - try { - return new IvParameterSpec(this.b.getBytes(c)); - } catch (Exception ex) { - return null; - } - } - - public final String a(final String s) { - String str = null; - try { - // final Cipher instance - // (instance = Cipher.getInstance(e)).init(1, new SecretKeySpec(this.a.getBytes(c), d), this.a()) - // str = a(instance.doFinal(s.getBytes(Charset.forName(c)))) - - Cipher instance = Cipher.getInstance(e); - IvParameterSpec ips = this.a(); - SecretKeySpec sks = new SecretKeySpec(this.a.getBytes(c), d); - instance.init(1, sks, ips); - - byte[] bytes = s.getBytes(Charset.forName(c)); - str = a(instance.doFinal(bytes)); - } catch (Exception ex) { - System.out.println(ex.getStackTrace()); - } - return str; - } - - public final String b(final String s) { - String s2 = null; - try { - final Cipher instance; - (instance = Cipher.getInstance(e)).init(2, new SecretKeySpec(this.a.getBytes(c), d), this.a()); - s2 = new String(instance.doFinal(this.e(s)), c); - } catch (Exception ex) { - String str = ex.getMessage(); - } - return s2; - } - - private static String a(final byte[] array) { - final StringBuilder sb = new StringBuilder(); - for (int i = 0; i < array.length; ++i) { - final String hexString; - if ((hexString = Integer.toHexString(array[i] & 0xFF)).length() < 2) { - sb.append("0"); - } - sb.append(hexString); - } - return sb.toString(); - } - - private byte[] e(String upperCase) { - final int n = (upperCase = upperCase.toUpperCase()).length() / 2; - final char[] charArray = upperCase.toCharArray(); - final byte[] array = new byte[n]; - for (int i = 0; i < n; ++i) { - final int n2 = i << 1; - array[i] = (byte) ((byte) "0123456789ABCDEF".indexOf(charArray[n2]) << 4 | (byte) "0123456789ABCDEF".indexOf(charArray[n2 + 1])); - } - return array; - } - - public final void c(String string) { - final String substring = (string = string).substring(2, 5); - final StringBuilder sb; - (sb = new StringBuilder(string)).replace(2, 5, string.substring(7, 10)); - sb.replace(7, 10, substring); - string = sb.toString(); - this.a = string; - } - - public final void d(final String b) { - this.b = b; - } -} diff --git a/src/main/java/com/lf/server/helper/Md5Helper.java b/src/main/java/com/lf/server/helper/Md5Helper.java deleted file mode 100644 index 8854519..0000000 --- a/src/main/java/com/lf/server/helper/Md5Helper.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.lf.server.helper; - -import org.apache.commons.codec.binary.Hex; - -import java.security.MessageDigest; -import java.util.Random; - -/** - * MD5甯姪绫� - * @author WWW - */ -public class Md5Helper { - private final static int M3 = 3; - - private final static int M16 = 16; - - private final static int M48 = 48; - - /** - * 鐢熸垚鍚湁闅忔満鐩愮殑瀵嗙爜 - * - * @param password - * @return - */ - public static String generate(String password) { - Random r = new Random(); - StringBuilder sb = new StringBuilder(16); - sb.append(r.nextInt(99999999)).append(r.nextInt(99999999)); - - int len = sb.length(); - if (len < M16) { - for (int i = 0; i < M16 - len; i++) { - sb.append("0"); - } - } - - String salt = sb.toString(); - password = md5Hex(password + salt); - char[] cs = new char[48]; - for (int i = 0; i < M48; i += M3) { - cs[i] = password.charAt(i / 3 * 2); - char c = salt.charAt(i / 3); - cs[i + 1] = c; - cs[i + 2] = password.charAt(i / 3 * 2 + 1); - } - - return new String(cs); - } - - /** - * 鏍¢獙瀵嗙爜鏄惁姝g‘ - * - * @param password - * @param md5 - * @return - */ - public static boolean verify(String password, String md5) { - char[] cs1 = new char[32]; - char[] cs2 = new char[16]; - for (int i = 0; i < M48; i += M3) { - cs1[i / 3 * 2] = md5.charAt(i); - cs1[i / 3 * 2 + 1] = md5.charAt(i + 2); - cs2[i / 3] = md5.charAt(i + 1); - } - String salt = new String(cs2); - - return md5Hex(password + salt).equals(new String(cs1)); - } - - /** - * 鑾峰彇鍗佸叚杩涘埗瀛楃涓插舰寮忕殑MD5鎽樿 - * - * @param src - * @return - */ - public static String md5Hex(String src) { - try { - MessageDigest md5 = MessageDigest.getInstance("MD5"); - byte[] bs = md5.digest(src.getBytes()); - - return new String(new Hex().encode(bs)); - } catch (Exception e) { - return null; - } - } - - /** - * 鍙嶈浆 - * - * @param pass - * @return - */ - public static String reverse(String pass) { - StringBuilder sb = new StringBuilder(pass); - - return sb.reverse().toString(); - } - - /** - * 楠岃瘉瀵嗙爜 - * - * @param originalPassword - * @param dbPassword - * @return - */ - public static boolean validatePassword(String originalPassword, String dbPassword) { - return verify(originalPassword, reverse(dbPassword)); - } -} diff --git a/src/main/java/com/lf/server/helper/MdbHelper.java b/src/main/java/com/lf/server/helper/MdbHelper.java deleted file mode 100644 index 535896b..0000000 --- a/src/main/java/com/lf/server/helper/MdbHelper.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.lf.server.helper; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.gdal.ogr.DataSource; -import org.gdal.ogr.Driver; -import org.gdal.ogr.Layer; -import org.gdal.ogr.ogr; - -import java.util.ArrayList; -import java.util.List; - -/** - * MDB甯姪绫� - * @author WWW - */ -public class MdbHelper { - private final static Log log = LogFactory.getLog(MdbHelper.class); - - /** - * 鑾峰彇琛ㄥ悕 - */ - public static List<String> getTabNames(String filePath) { - List<String> list = new ArrayList<>(); - - Driver driver = null; - DataSource dataSource = null; - try { - driver = ogr.GetDriverByName("PGeo"); - if (null == driver) { - log.error("MdbHelper.getTabNames: PGeo is null"); - return list; - } - - dataSource = driver.Open(filePath, 0); - if (null == dataSource) { - log.error("MdbHelper.getTabNames.dataSource is null. " + filePath); - return list; - } - - for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { - Layer layer = dataSource.GetLayer(i); - list.add(layer.GetName()); - - layer.delete(); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } finally { - GdbHelper.delete(dataSource, driver); - } - - return list; - } - - /** - * 璇诲彇鏁版嵁 - */ - public static <T> List<T> readData(Class clazz, String filePath, String layerName) { - List<T> list = new ArrayList<>(); - - Driver driver = null; - DataSource dataSource = null; - try { - driver = ogr.GetDriverByName("PGeo"); - if (null == driver) { - return list; - } - - dataSource = driver.Open(filePath, 0); - if (null == dataSource) { - return list; - } - - for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { - Layer layer = dataSource.GetLayer(i); - if (layer.GetName().equals(layerName)) { - GdbHelper.readLayer(clazz, layer, list); - break; - } - - layer.delete(); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } finally { - GdbHelper.delete(dataSource, driver); - } - - return list; - } -} diff --git a/src/main/java/com/lf/server/helper/PathHelper.java b/src/main/java/com/lf/server/helper/PathHelper.java deleted file mode 100644 index 2d70eee..0000000 --- a/src/main/java/com/lf/server/helper/PathHelper.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.lf.server.helper; - -import com.lf.server.config.PropertiesConfig; -import com.lf.server.entity.all.SettingData; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.util.Date; - -/** - * 璺緞甯姪绫� - * @author WWW - */ -@Component -public class PathHelper { - @Autowired - private PropertiesConfig config; - - private static int downloadPath = 1; - - private static int uploadPath = 1; - - private final static double D80 = 80; - - private final static Log log = LogFactory.getLog(PathHelper.class); - - public PropertiesConfig getConfig() { - return config; - } - - public static int getDownloadPath() { - return downloadPath; - } - - public static int getUploadPath() { - return uploadPath; - } - - /** - * 鍒濆鍖� - */ - public void init() { - downloadPath = getSubPath(config.getDownloadPath(), downloadPath); - uploadPath = getSubPath(config.getUploadPath(), uploadPath); - } - - private static int getSubPath(String parentPath, int subPath) { - while (true) { - String path = parentPath + File.separator + subPath; - - File file = new File(path); - if (!file.exists() && !file.isDirectory()) { - file.mkdirs(); - return subPath; - } - - File[] files = file.listFiles(); - if (null == files || files.length < SettingData.MAX_FILES) { - return subPath; - } - - subPath++; - } - } - - /** - * 鑾峰彇涓嬭浇瀹屾暣鐩綍 - */ - public String getDownloadFullPath() { - downloadPath = getSubPath(config.getDownloadPath(), downloadPath); - - return config.getDownloadPath() + File.separator + downloadPath; - } - - /** - * 鑾峰彇涓婁紶瀹屾暣鐩綍 - */ - public String getUploadFullPath() { - uploadPath = getSubPath(config.getUploadPath(), uploadPath); - - return config.getUploadPath() + File.separator + uploadPath; - } - - /** - * 鑾峰彇涓存椂璺緞 - */ - public String getTempPath() { - String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); - String path = config.getTempPath() + File.separator + tempName; - - File file = new File(path); - if (!file.exists() && !file.isDirectory()) { - file.mkdirs(); - } - - deleteOldPath(config.getTempPath()); - - return path; - } - - /** - * 鑾峰彇涓存椂璺緞 - */ - public String getTempPath(String subPath) { - if (!StringHelper.isEmpty(subPath)) { - String path = config.getTempPath() + File.separator + subPath; - - File file = new File(path); - if (file.exists() && file.isDirectory()) { - return path; - } - } - - deleteOldPath(config.getTempPath()); - - return getTempPath(); - } - - /** - * 鑾峰彇涓存椂璺緞鍚嶇О - */ - public String getTempPathName() { - String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); - String path = config.getTempPath() + File.separator + tempName; - - File file = new File(path); - if (!file.exists() && !file.isDirectory()) { - file.mkdirs(); - } - - deleteOldPath(config.getTempPath()); - - return tempName; - } - - /** - * 鍒犻櫎鏃ц矾寰� - */ - public void deleteOldPath(String tempPath) { - try { - double ran = Math.random() * 99; - if (ran < D80) { - return; - } - - File file = new File(tempPath); - String str = StringHelper.YMD2_FORMAT.format(new Date()); - - File[] files = file.listFiles(); - if (null != files) { - for (File f : files) { - if (f.getPath().contains(str)) { - continue; - } - - FileHelper.deleteFiles(f); - } - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } -} diff --git a/src/main/java/com/lf/server/helper/RestHelper.java b/src/main/java/com/lf/server/helper/RestHelper.java deleted file mode 100644 index d8e24d1..0000000 --- a/src/main/java/com/lf/server/helper/RestHelper.java +++ /dev/null @@ -1,259 +0,0 @@ -package com.lf.server.helper; - -import com.lf.server.entity.all.StaticData; -import io.swagger.models.HttpMethod; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpEntity; -import org.apache.http.NameValuePair; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.springframework.web.client.RestTemplate; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * Rest鏈嶅姟甯姪绫� - * @author WWW - */ -public class RestHelper { - private static RestTemplate restTemplate; - - private final static Log log = LogFactory.getLog(RestHelper.class); - - /** - * 鑾峰彇RestTemplate - * - * @return RestTemplate - */ - public static RestTemplate getRestTemplate() { - if (restTemplate == null) { - restTemplate = SpringContextHelper.getBean(RestTemplate.class); - } - - return restTemplate; - } - - /** - * Get璇锋眰-HttpURLConnection - * - * @param url URL鍦板潃 - * @return 瀛楃涓� - * @throws IOException IO寮傚父 - */ - public static String getForConn(String url) throws IOException { - BufferedReader br = null; - HttpURLConnection conn = null; - - try { - URL restUrl = new URL(url); - - conn = (HttpURLConnection) restUrl.openConnection(); - // POST,GET,PUT,DELETE - conn.setRequestMethod("GET"); - conn.setRequestProperty("Accept", "application/json"); - - br = new BufferedReader(new InputStreamReader(conn.getInputStream())); - - String line; - StringBuilder sb = new StringBuilder(); - while ((line = br.readLine()) != null) { - sb.append(line); - } - - return sb.toString(); - } finally { - if (br != null) { - br.close(); - } - if (conn != null) { - conn.disconnect(); - } - } - } - - /** - * Post璇锋眰-HttpURLConnection - * - * @param url URL鍦板潃 - * @param query 鏌ヨ鏉′欢 - * @return 瀛楃涓� - * @throws IOException IO寮傚父 - */ - public static String postForConn(String url, String query) throws IOException { - BufferedReader br = null; - HttpURLConnection conn = null; - - try { - URL restUrl = new URL(url); - - conn = (HttpURLConnection) restUrl.openConnection(); - // POST,GET,PUT,DELETE - conn.setRequestMethod("POST"); - conn.setRequestProperty("Content-Type", "application/json"); - conn.setDoOutput(true); - - PrintStream ps = new PrintStream(conn.getOutputStream()); - ps.print(query); - ps.close(); - - // OutputStream out = conn.getOutputStream() - // out.write(query.getBytes()) - // out.close() - - br = new BufferedReader(new InputStreamReader(conn.getInputStream())); - - String line; - StringBuilder sb = new StringBuilder(); - while ((line = br.readLine()) != null) { - sb.append(line); - } - - return sb.toString(); - } finally { - if (br != null) { - br.close(); - } - if (conn != null) { - conn.disconnect(); - } - } - } - - /** - * Get璇锋眰-CloseableHttpClient - * - * @param uri Uri鍦板潃 - * @return 鍝嶅簲瀛楃涓� - */ - public static String get(String uri) { - try { - CloseableHttpClient httpClient = HttpClients.custom().build(); - - HttpGet httpGet = new HttpGet(uri); - - CloseableHttpResponse closeResponse = httpClient.execute(httpGet); - // 鍙栧嚭杩斿洖浣� - HttpEntity entity = closeResponse.getEntity(); - - return EntityUtils.toString(entity, StaticData.TEXT_ENCODER); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - - return getErrorInfo(uri, ex); - } - } - - /** - * Post璇锋眰-CloseableHttpClient - * - * @param uri Uri鍦板潃 - * @param postData 寰呭彂閫佹暟鎹� - * @return 鍝嶅簲瀛楃涓� - */ - public static String post(String uri, List<NameValuePair> postData) { - try { - CloseableHttpClient httpClient = HttpClients.custom().build(); - - UrlEncodedFormEntity postEntity = new UrlEncodedFormEntity(postData, StaticData.TEXT_ENCODER); - HttpPost httpPost = new HttpPost(uri); - httpPost.setEntity(postEntity); - - CloseableHttpResponse closeResponse = httpClient.execute(httpPost); - - // 鍙栧嚭杩斿洖浣� - HttpEntity entity = closeResponse.getEntity(); - - return EntityUtils.toString(entity, StaticData.TEXT_ENCODER); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - - return getErrorInfo(uri, ex); - } - } - - /** - * 鑾峰彇閿欒淇℃伅 - * - * @param uri Uri鍦板潃 - * @param ex 寮傚父 - * @return 閿欒淇℃伅 - */ - public static String getErrorInfo(String uri, Exception ex) { - Map<String, Object> map = new LinkedHashMap<>(); - map.put("result", null); - map.put("message", ex.getMessage()); - map.put("code", 400); - map.put("uri", uri); - //map.put("tag", StaticData.CACHE_PREFIX) - - return map.toString(); - } - - /** - * GET璇锋眰锛圧EST锛� - */ - public static String getForRest(String uri) { - RestTemplate rest = getRestTemplate(); - - return rest.getForObject(uri, String.class); - } - - /** - * GET璇锋眰锛圧EST锛� - */ - public static <T> T getForRest(String uri, Class<T> clazz) { - RestTemplate rest = getRestTemplate(); - - return rest.getForObject(uri, clazz); - } - - /** - * POST璇锋眰锛圧EST锛� - */ - public static String postForRest(String uri, Map<String, Object> map) { - RestTemplate rest = getRestTemplate(); - - return rest.postForObject(uri, map, String.class); - } - - /** - * POST璇锋眰锛圧EST锛� - */ - public static <T> String postForRest(String uri, List<T> list) { - RestTemplate rest = getRestTemplate(); - - return rest.postForObject(uri, list, String.class); - } - - /** - * POST璇锋眰锛圧EST锛� - */ - public static <T> String postForRest(String uri, T t) { - RestTemplate rest = getRestTemplate(); - - return rest.postForObject(uri, t, String.class); - } - - /** - * DELETE璇锋眰锛圧EST锛� - */ - public static void deleteForRest(String uri) { - RestTemplate rest = getRestTemplate(); - - rest.delete(uri); - } -} diff --git a/src/main/java/com/lf/server/helper/RsaHelper.java b/src/main/java/com/lf/server/helper/RsaHelper.java deleted file mode 100644 index 0b10dd5..0000000 --- a/src/main/java/com/lf/server/helper/RsaHelper.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.lf.server.helper; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.core.io.ClassPathResource; - -import javax.crypto.Cipher; -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.security.*; -import java.security.interfaces.RSAPrivateKey; -import java.security.interfaces.RSAPublicKey; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.HashMap; -import java.util.Map; - -/** - * RSA宸ュ叿绫� - * @author WWW - */ -public class RsaHelper { - /** - * 绉侀挜 - */ - private static String privateKey; - - /** - * 鍏挜 - */ - private static String publicKey; - - /** - * 瀵嗛挜绠楁硶 - */ - private static final String KEY_ALGORITHM = "RSA"; - - /** - * RSA瀵嗛挜闀垮害锛�1024 鎴� 2048 - */ - private static final int DEFAULT_RSA_KEY_SIZE = 1024; - - /** - * 鏃ュ織 - */ - private final static Log log = LogFactory.getLog(RsaHelper.class); - - /** - * 鐢熸垚鍏閽� - */ - public static void generate() { - Map<String, String> result = generateRsaKey(DEFAULT_RSA_KEY_SIZE); - System.out.println("鍏挜涓猴細" + result.get("publicKey")); - System.out.println("绉侀挜涓猴細" + result.get("privateKey")); - } - - /** - * 鑾峰彇RSA鍔犲瘑绉侀挜 - * - * @return - * @throws IOException - */ - public static String getPrivateKey() throws IOException { - if (privateKey == null) { - InputStream inPrivate = new ClassPathResource("config" + File.separator + "rsa_private_key.txt").getInputStream(); - privateKey = inputStream2String(inPrivate); - inPrivate.close(); - } - - return privateKey; - } - - /** - * 鑾峰彇RSA鍔犲瘑鍏挜 - * - * @return - * @throws IOException - */ - public static String getPublicKey() throws IOException { - if (publicKey == null) { - InputStream inPrivate = new ClassPathResource("config" + File.separator + "rsa_public_key.txt").getInputStream(); - publicKey = inputStream2String(inPrivate); - inPrivate.close(); - } - - return publicKey; - } - - /** - * 璇诲彇鏂囨湰鏂囦欢 - * - * @param fileName 鏂囦欢璺緞 - * @return - * @throws IOException - */ - public static String readFile(String fileName) throws IOException { - File file = new File(fileName); - BufferedReader br = new BufferedReader(new FileReader(file)); - - StringBuilder result = new StringBuilder(); - - String line = null; - while ((line = br.readLine()) != null) { - result.append(System.lineSeparator() + line); - } - br.close(); - - return result.toString(); - } - - /** - * 鎶奿nputStream杞垚String - * - * @param is - * @return - * @throws IOException - */ - private static String inputStream2String(InputStream is) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - int i = -1; - while ((i = is.read()) != -1) { - baos.write(i); - } - - String str = baos.toString(); - baos.close(); - - return str; - } - - /** - * 鐢熸垚RSA鐨勫叕绉侀挜 - * - * @param keySize 1025 鎴� 2048 - * @return - */ - public static Map<String, String> generateRsaKey(int keySize) { - Map<String, String> result = new HashMap<>(2); - try { - KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); - - // 鍒濆鍖栧瘑閽ュ鐢熸垚鍣紝瀵嗛挜澶у皬涓�1024 2048浣� - keyPairGen.initialize(keySize, new SecureRandom()); - - // 鐢熸垚涓�涓瘑閽ュ锛屼繚瀛樺湪keyPair涓� - KeyPair keyPair = keyPairGen.generateKeyPair(); - - // 寰楀埌鍏挜瀛楃涓� - String pub = new String(Base64.encodeBase64(keyPair.getPublic().getEncoded())); - result.put("publicKey", pub); - - // 寰楀埌绉侀挜瀛楃涓� - String pri = new String(Base64.encodeBase64(keyPair.getPrivate().getEncoded())); - result.put("privateKey", pri); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - - return result; - } - - /** - * RSA绉侀挜瑙e瘑 - * - * @param str 鍔犲瘑鐨勫瓧绗︿覆 - * @return 瑙e瘑瀛楃涓� - * @throws Exception 鍔犲瘑杩囩▼涓殑寮傚父淇℃伅 - */ - public static String decrypt(String str) throws Exception { - // 64浣嶈В鐮佸姞瀵嗗悗鐨勫瓧绗︿覆 - byte[] inputByte = Base64.decodeBase64(str.getBytes(StandardCharsets.UTF_8)); - - // Base64缂栫爜鐨勭閽� - byte[] decoded = Base64.decodeBase64(getPrivateKey()); - RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded)); - - // RSA瑙e瘑锛歊SA/ECB/NoPadding - Cipher cipher = Cipher.getInstance("RSA"); - cipher.init(Cipher.DECRYPT_MODE, priKey); - - String outStr = new String(cipher.doFinal(inputByte)); - - return outStr; - } - - /** - * RSA鍏挜鍔犲瘑 - * - * @param str 闇�瑕佸姞瀵嗙殑瀛楃涓� - * @return 瀵嗘枃 - * @throws Exception 鍔犲瘑杩囩▼涓殑寮傚父淇℃伅 - */ - public static String encrypt(String str) throws Exception { - // Base64缂栫爜鐨勫叕閽� - byte[] decoded = Base64.decodeBase64(getPublicKey()); - - RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded)); - - // RSA鍔犲瘑锛歊SA/ECB/NoPadding - Cipher cipher = Cipher.getInstance("RSA"); - cipher.init(Cipher.ENCRYPT_MODE, pubKey); - - String outStr = Base64.encodeBase64String(cipher.doFinal(str.getBytes(StandardCharsets.UTF_8))); - - return outStr; - } -} diff --git a/src/main/java/com/lf/server/helper/ShpHelper.java b/src/main/java/com/lf/server/helper/ShpHelper.java deleted file mode 100644 index c953132..0000000 --- a/src/main/java/com/lf/server/helper/ShpHelper.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.lf.server.helper; - -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.MarkJsonEntity; -import com.lf.server.entity.ctrl.ShpRecordEntity; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.gdal.ogr.*; -import org.gdal.osr.SpatialReference; - -import java.io.File; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * ShapeFile甯姪绫� - * @author WWW - */ -public class ShpHelper { - private final static Log log = LogFactory.getLog(ShpHelper.class); - - /** - * 璇诲彇Shp绗竴鏉¤褰曠殑WKT - */ - public static ShpRecordEntity readShpFirstRecord(String filePath) { - Driver driver = null; - DataSource dataSource = null; - Layer layer = null; - try { - driver = ogr.GetDriverByName("ESRI shapefile"); - if (null == driver) { - return null; - } - - dataSource = driver.Open(filePath); - if (null == dataSource) { - return null; - } - - layer = dataSource.GetLayer(0); - if (layer.GetFeatureCount() < 1) { - return null; - } - - SpatialReference spatialReference = layer.GetSpatialRef(); - String csid = spatialReference.GetAttrValue("AUTHORITY", 1); - - Feature feature = layer.GetFeature(0); - String wkt = feature.GetGeometryRef().ExportToWkt(); - - return new ShpRecordEntity(wkt, csid); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } finally { - GdbHelper.delete(layer, dataSource, driver); - } - } - - /** - * 璇诲彇ShapeFile鏂囦欢鑾峰彇Mark瀹炰綋绫� - */ - public static List<MarkJsonEntity> readShpForMarks(String filePath) { - Driver driver = null; - DataSource dataSource = null; - Layer layer = null; - try { - driver = ogr.GetDriverByName("ESRI shapefile"); - if (null == driver) { - return null; - } - - dataSource = driver.Open(filePath); - if (null == dataSource) { - return null; - } - - layer = dataSource.GetLayer(0); - if (layer.GetFeatureCount() == 0) { - return null; - } - - Map<Integer, Field> fields = getShpFields(layer); - - return setMarkJsonEntity(layer, fields); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } finally { - GdbHelper.delete(layer, dataSource, driver); - } - } - - /** - * 鑾峰彇shp瀛楁淇℃伅 - */ - private static Map<Integer, Field> getShpFields(Layer layer) { - FeatureDefn featureDefn = layer.GetLayerDefn(); - - Map<Integer, Field> fields = new HashMap(3); - for (int i = 0, count = featureDefn.GetFieldCount(); i < count; i++) { - try { - FieldDefn fieldDefn = featureDefn.GetFieldDefn(i); - Field field = MarkJsonEntity.class.getDeclaredField(fieldDefn.GetName()); - field.setAccessible(true); - - fields.put(i, field); - } catch (Exception e) { - // - } - } - - return fields; - } - - /** - * 璁剧疆鏍囩粯瀹炰綋绫� - */ - private static List<MarkJsonEntity> setMarkJsonEntity(Layer layer, Map<Integer, Field> fieldMap) throws Exception { - List<MarkJsonEntity> list = new ArrayList<>(); - for (int i = 0; i < layer.GetFeatureCount(); i++) { - Feature f = layer.GetFeature(i); - - MarkJsonEntity me = new MarkJsonEntity(i + 1); - for (Integer key : fieldMap.keySet()) { - Field field = fieldMap.get(key); - GdbHelper.setValue(me, f, field, key); - } - me.setWkt(f.GetGeometryRef().ExportToWkt()); - - list.add(me); - } - - return list; - } - - /** - * 鍒涘缓ShapeFile鏂囦欢 - * - * @param list 鏍囩粯JSON瀹炰綋绫婚泦鍚� - * @param path 璺緞 - * @param type 绫诲瀷锛歅OINT,LINESTRING,POLYGON - * @return ShapeFile鏂囦欢鍚� - */ - public static String createShp(List<MarkJsonEntity> list, String path, String type) { - Driver driver = null; - DataSource dataSource = null; - Layer layer = null; - try { - driver = ogr.GetDriverByName("ESRI shapefile"); - if (null == driver) { - return null; - } - - String filePath = path + File.separator + type.toLowerCase() + ".shp"; - // DataSource ds = driver.Open(filePath, 0) - dataSource = driver.CreateDataSource(filePath, null); - if (null == dataSource) { - return null; - } - - SpatialReference sr = new SpatialReference(); - sr.ImportFromEPSG(4326); - - int geoType = getGeometryType(type); - layer = dataSource.CreateLayer(type.toLowerCase(), sr, geoType); - if (null == layer) { - return null; - } - - List<Field> fields = new ArrayList<>(); - GdbHelper.getFields(MarkJsonEntity.class, fields, StaticData.MARK_EXCLUDE_FIELDS); - GdbHelper.addLayerField(layer, fields); - - FeatureDefn featureDefn = layer.GetLayerDefn(); - for (MarkJsonEntity t : list) { - Feature f = new Feature(featureDefn); - GdbHelper.setFeatureData(f, fields, t); - - Geometry geo = Geometry.CreateFromWkt(t.getWkt()); - f.SetGeometry(geo); - - layer.CreateFeature(f); - } - - return filePath; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } finally { - GdbHelper.delete(layer, dataSource, driver); - } - } - - /** - * 鑾峰彇鍥惧舰绫诲瀷 - */ - private static int getGeometryType(String type) { - switch (type) { - case "POINT": - return ogr.wkbPoint; - case "LINESTRING": - return ogr.wkbLineString; - case "POLYGON": - return ogr.wkbPolygon; - default: - return ogr.wkbUnknown; - } - } - - /** - * 璇诲彇鏁版嵁 - */ - public static <T> List<T> readData(Class clazz, String filePath) { - List<T> list = new ArrayList<>(); - - Driver driver = null; - DataSource dataSource = null; - try { - driver = ogr.GetDriverByName("ESRI shapefile"); - if (null == driver) { - return list; - } - - dataSource = driver.Open(filePath); - if (null == dataSource) { - return list; - } - - Layer layer = dataSource.GetLayer(0); - GdbHelper.readLayer(clazz, layer, list); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } finally { - GdbHelper.delete(dataSource, driver); - } - - return list; - } -} diff --git a/src/main/java/com/lf/server/helper/SpringContextHelper.java b/src/main/java/com/lf/server/helper/SpringContextHelper.java deleted file mode 100644 index 4a2032e..0000000 --- a/src/main/java/com/lf/server/helper/SpringContextHelper.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.lf.server.helper; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; - -/** - * Spring涓婁笅鏂囧府鍔╃被 - * @author WWW - */ -@Component -public class SpringContextHelper implements ApplicationContextAware { - private static ApplicationContext context = null; - - /** - * 璁剧疆搴旂敤绋嬪簭涓婁笅鏂� - * - * @param applicationContext - * @throws BeansException - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - context = applicationContext; - } - - /** - * 鏍规嵁鍚嶇О鑾峰彇Bean - * - * @param name 绫诲悕绉� - * @return - */ - public static <T> T getBean(String name) { - return (T) context.getBean(name); - } - - /** - * 鏍规嵁绫诲瀷鑾峰彇Bean - * - * @param clazz 绫� - * @param <T> 娉涘瀷 - * @return - */ - public static <T> T getBean(Class<T> clazz) { - return context.getBean(clazz); - } - - /** - * 鍒ゆ柇鏄惁鍖呭惈瀵瑰簲鍚嶇О鐨凚ean瀵硅薄 - * - * @param name Bean鍚嶇О - * @return 鍖呭惈锛氳繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse銆� - */ - public static boolean containsBean(String name) { - return context.containsBean(name); - } - - /** - * 鑾峰彇瀵瑰簲Bean鍚嶇О鐨勭被鍨� - * - * @param name Bean鍚嶇О - * @return 杩斿洖瀵瑰簲鐨凚ean绫诲瀷 - */ - public static Class<?> getType(String name) { - return context.getType(name); - } - - /** - * 鑾峰彇涓婁笅鏂囧璞★紝鍙繘琛屽悇绉峉pring鐨勪笂涓嬫枃鎿嶄綔 - * - * @return Spring涓婁笅鏂囧璞� - */ - public static ApplicationContext getContext() { - return context; - } - - - /** - * 鑾峰彇褰撳墠鐜 - * - * @return Profile - */ - public static String getActiveProfile() { - return context.getEnvironment().getActiveProfiles()[0]; - } -} diff --git a/src/main/java/com/lf/server/helper/StringHelper.java b/src/main/java/com/lf/server/helper/StringHelper.java deleted file mode 100644 index d9e83ba..0000000 --- a/src/main/java/com/lf/server/helper/StringHelper.java +++ /dev/null @@ -1,229 +0,0 @@ -package com.lf.server.helper; - -import com.lf.server.entity.all.StaticData; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * 瀛楃涓插府鍔╃被 - * @author WWW - */ -public class StringHelper { - /** - * 鏁板瓧姝e垯 - */ - public static final Pattern NUMBER_PATTERN = Pattern.compile("-?\\d+(\\.\\d+)?"); - - /** - * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 1 - */ - public static final SimpleDateFormat YMD_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); - - /** - * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 2 - */ - public static final SimpleDateFormat YMDHMS_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - /** - * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 3 - */ - public static final SimpleDateFormat YMD2_FORMAT = new SimpleDateFormat("yyyyMMdd"); - - /** - * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 4 - */ - public static final SimpleDateFormat YMDHMS2_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss"); - - /** - * 鍒ゆ柇瀛楃涓�,鏄惁涓烘暣鏁� - */ - public static boolean isInteger(String str) { - return str != null && str.matches("[0-9]+"); - } - - /** - * 鍒ゆ柇瀛楃涓�,鏄惁涓烘诞鐐规暟 - */ - public static boolean isNumeric(String str) { - return str != null && str.matches("-?\\d+(\\.\\d+)?"); - } - - /** - * 鍒ゆ柇瀛楃涓�,鏄惁涓烘诞鐐规暟 - */ - public static boolean isNumeric2(String str) { - return str != null && NUMBER_PATTERN.matcher(str).matches(); - } - - /** - * 鏃ユ湡姝e垯 - */ - public static Pattern datePattern = Pattern.compile("^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/]((((0?[13578])|(1[02]))[\\-\\/]((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/]((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/]((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/]((((0?[13578])|(1[02]))[\\-\\/]((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/]((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/]((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s(((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$"); - - /** - * SQL姝e垯 - */ - public static Pattern sqlPattern = Pattern.compile("|and|exec|execute|insert|select|delete|update|count|drop|\\*|%|chr|mid|master|truncate|char|declare|sitename|net user|xp_cmdshell|;|or|-|\\+|,|like"); - - /** - * 瀛楃涓茶浆涓烘棩鏈� - */ - public static Date parseDate(String str) { - try { - return YMD_FORMAT.parse(str); - } catch (Exception ex) { - return null; - } - } - - /** - * 瀛楃涓茶浆涓烘棩鏈熸椂闂� - */ - public static Date parseTime(String str) { - try { - return YMDHMS_FORMAT.parse(str); - } catch (Exception e) { - return null; - } - } - - /** - * 鍒ゆ柇鍊兼槸鍚︿负鏃ユ湡鏍煎紡 - */ - public static boolean isDate(String strDate) { - Matcher m = datePattern.matcher(strDate); - - return m.matches(); - } - - /** - * 瀛楃涓诧紝鏄惁涓簄ull 鎴� "" - */ - public static boolean isNull(String str) { - return null == str || str.length() == 0; - } - - /** - * 瀛楃涓�,鏄惁涓虹┖null鍜岀┖鏍� - */ - public static boolean isEmpty(String str) { - return null == str || "".equals(str.trim()); - } - - /** - * 鑾峰彇 like 瀛楃涓� - */ - public static String getLikeStr(String str) { - return StringHelper.isEmpty(str) ? null : "%" + str.trim() + "%"; - } - - /** - * 鑾峰彇 like 瀛楃涓� - */ - public static String getLikeUpperStr(String str) { - return StringHelper.isEmpty(str) ? null : "%" + str.trim().toUpperCase() + "%"; - } - - /** - * 鑾峰彇 鍙砽ike 瀛楃涓� - */ - public static String getRightLike(String str) { - return StringHelper.isEmpty(str) ? null : str.trim() + "%"; - } - - /** - * 鑾峰彇鍥惧舰鐨刉KT瀛楃涓� - * - * @param wkt - * @return - */ - public static String getGeomWkt(String wkt) { - if (StringHelper.isEmpty(wkt)) { - return "null"; - } - - return String.format("ST_GeomFromText('%s')", wkt); - } - - /** - * 棣栧瓧姣嶅ぇ鍐� - */ - public static String firstCharToUpperCase(String str) { - return str.substring(0, 1).toUpperCase() + str.substring(1); - } - - /** - * 棣栧瓧姣嶅皬鍐� - */ - public static String firstCharToLowerCase(String str) { - return str.substring(0, 1).toLowerCase() + str.substring(1); - } - - /** - * 鍒ゆ柇鍊兼槸鍚﹀瓨鍦⊿QL娉ㄥ叆 - * - * @param str 瀛楃涓� - * @return 鏄�/鍚� - */ - public static boolean isSqlInjection(String str) { - if (null == str) { - return false; - } - - Matcher m = sqlPattern.matcher(str); - - return m.matches(); - } - - /** - * 鏍¢獙瀵嗙爜鏄�/鍚﹀悎娉� - * - * @param pwd 瀵嗙爜 - * @return 鏄�/鍚︿负鏃犳晥鐨� - */ - public static boolean isPwdInvalid(String pwd) { - return !Pattern.matches(StaticData.PWD_REG, pwd); - } - - /** - * 鑾峰彇GUID - * - * @return - */ - public static String getGuid() { - return UUID.randomUUID().toString(); - } - - /** - * 杩炴帴List闆嗗悎 - * - * @param list list 鏁存暟闆嗗悎 - * @param join join 杩炴帴瀛楃 - * @param <T> 娉涘瀷绫� - * @return 瀛楃涓� - */ - public static <T> String join(List<T> list, String join) { - if (null == list || list.isEmpty()) { - return ""; - } - - StringBuilder sb = new StringBuilder(); - for (T t : list) { - if (null != t) { - sb.append(t.toString() + join); - } - } - - if (sb.length() > 0 && sb.lastIndexOf(join) == sb.length() - join.length()) { - // 鍒犻櫎浠庣储寮� start 寮�濮嬪埌 end 涔嬮棿鐨勫瓧绗︼紝鍗� 鍓嶅寘鎷� 鍚庝笉鍖呮嫭銆� - sb.delete(sb.length() - join.length(), sb.length()); - } - - return sb.toString(); - } -} diff --git a/src/main/java/com/lf/server/helper/WebHelper.java b/src/main/java/com/lf/server/helper/WebHelper.java deleted file mode 100644 index c47a45a..0000000 --- a/src/main/java/com/lf/server/helper/WebHelper.java +++ /dev/null @@ -1,405 +0,0 @@ -package com.lf.server.helper; - -import com.alibaba.fastjson.JSON; -import com.lf.server.entity.all.HttpStatus; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.SettingData; -import com.lf.server.entity.all.StaticData; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -import javax.servlet.ServletContext; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLEncoder; -import java.sql.Timestamp; -import java.util.*; - -/** - * Web甯姪绫� - * @author WWW - */ -public class WebHelper { - private final static String UNKNOWN = "unknown"; - - private final static String COMMA = ","; - - private final static Log log = LogFactory.getLog(WebHelper.class); - - /** - * 鑾峰彇GUID - */ - public static String getGuid() { - return UUID.randomUUID().toString(); - } - - /** - * 鑾峰彇鐢ㄦ埛ip - */ - public static String getIpAddress(HttpServletRequest request) { - String ip = request.getHeader("X-Forwarded-For"); - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_X_FORWARDED_FOR"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_X_FORWARDED"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_X_CLUSTER_CLIENT_IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_CLIENT_IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_FORWARDED_FOR"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_FORWARDED"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_VIA"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("REMOTE_ADDR"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); - } - if (ip.contains(COMMA)) { - return ip.split(",")[0]; - } - - return ip; - } - - /** - * 鑾峰彇褰撳墠鏃堕棿鐨凾imestamp - */ - public static Timestamp getCurrentTimestamp() { - return new Timestamp(System.currentTimeMillis()); - } - - /** - * 鑾峰彇褰撳墠鏃堕棿鎸囧畾鍒嗛挓鏁板悗鐨凾imestamp - */ - public static Timestamp getTimestamp(int min) { - Calendar now = Calendar.getInstance(); - now.add(Calendar.MINUTE, min); - - return new Timestamp(now.getTimeInMillis()); - } - - /** - * 浠嶤ookie涓幏鍙杢oken - */ - public static String getTokenFromCookie(HttpServletRequest request) { - Cookie[] cookies = request.getCookies(); - if (cookies == null || cookies.length == 0) { - return null; - } - - for (Cookie cookie : cookies) { - switch (cookie.getName()) { - case StaticData.TOKEN_COOKIE_KEY: - return cookie.getValue(); - default: - break; - } - } - - return null; - } - - /** - * 鍚慍ookie涓坊鍔爐oken - */ - public static void saveToken2Cookie(String token, HttpServletRequest request, HttpServletResponse response) { - // 鍏堝垹闄� - deleteCookies(request, response); - - // 鍐嶄繚瀛� - saveCookie(StaticData.TOKEN_COOKIE_KEY, token, response); - } - - /** - * 淇濆瓨Cookie - */ - public static void saveCookie(String key, String value, HttpServletResponse response) { - Cookie cookie = new Cookie(key, value); - // 璁剧疆cookie澶辨晥鏃堕棿锛屽崟浣嶄负绉� - cookie.setMaxAge(SettingData.COOKIE_MAX_AGE); - cookie.setHttpOnly(false); - cookie.setPath("/"); - //cookie.setDomain("*") - - response.setHeader("P3P", "CP=CAO PSA OUR"); - response.addCookie(cookie); - } - - /** - * 鍒犻櫎cookie涓殑鍊� - */ - public static void deleteCookie(String cookieKey, HttpServletRequest request, HttpServletResponse response) { - Cookie[] cookies = request.getCookies(); - if (cookies != null && cookies.length > 0) { - for (Cookie c : cookies) { - if (cookieKey.equalsIgnoreCase(c.getName())) { - c.setMaxAge(0); - c.setPath("/"); - response.addCookie(c); - } - } - } - } - - /** - * 鍒犻櫎鎵�鏈塁ookie - */ - public static void deleteCookies(HttpServletRequest request, HttpServletResponse response) { - Cookie[] cookies = request.getCookies(); - if (cookies != null && cookies.length > 0) { - for (Cookie c : cookies) { - c.setMaxAge(0); - c.setPath("/"); - response.addCookie(c); - } - } - } - - /** - * 鏍规嵁閿幏鍙朇ookie鍊� - */ - public static String getCookieByKey(String key, HttpServletRequest request) { - Cookie[] cookies = request.getCookies(); - if (cookies == null || cookies.length == 0) { - return null; - } - - for (Cookie c : cookies) { - if (key.equals(c.getName())) { - return c.getValue(); - } - } - - return null; - } - - /** - * 鑾峰彇Token - */ - public static String getToken(HttpServletRequest request) { - // 1.浠巙rl鍙傛暟涓紝鑾峰彇token - String token = request.getParameter(StaticData.TOKEN_KEY); - - // 2.涓虹┖锛屽垯浠巋eader閲岃幏鍙� - if (token == null) { - token = request.getHeader(StaticData.TOKEN_KEY); - } - - // 3.杩樹负绌猴紝鍒欎粠cookie閲岃幏鍙� - if (token == null) { - token = getTokenFromCookie(request); - } - - return token; - } - - /** - * 鑾峰彇Request - */ - public static HttpServletRequest getRequest() { - ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); - - return servletRequestAttributes.getRequest(); - } - - /** - * 鑾峰彇Response - */ - public static HttpServletResponse getResponse() { - ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); - - return servletRequestAttributes.getResponse(); - } - - /** - * 鑾峰彇Session - */ - public static HttpSession getSession() { - return getRequest().getSession(); - } - - /** - * 鑾峰彇鐪熷疄璺緞 - */ - public static String getRealPath(String path) { - HttpServletRequest req = getRequest(); - ServletContext ctx = req.getSession().getServletContext(); - - return ctx.getRealPath("/" + path); - } - - /** - * 杈撳嚭str鑷冲墠绔� - */ - public static boolean writeStr2Page(HttpServletResponse res, String str) { - try { - res.setContentType("application/json;charset=UTF-8"); - res.setHeader("Cache-Control", "no-cache"); - res.setHeader("Pragma", "No-cache"); - res.setDateHeader("Expires", 0); - - PrintWriter out = res.getWriter(); - out.print(str); - - out.flush(); - out.close(); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - - return false; - } - - /** - * 杈撳嚭json鑷冲墠绔� - */ - public static void writeJson2Page(HttpServletResponse res, String str) { - String json = JSON.toJSONString(new ResponseMsg<>(HttpStatus.ERROR, str)); - writeStr2Page(res, json); - } - - /** - * 鑾峰彇閿欒JSON - */ - public static String getErrJson(HttpStatus status, String msg) { - return JSON.toJSONString(new ResponseMsg<String>(status, msg)); - } - - /** - * 鍐欏搷搴斾俊鎭� - */ - public static void writeInfo(HttpStatus status, String info, HttpServletResponse res) { - WebHelper.writeStr2Page(res, WebHelper.getErrJson(status, info)); - } - - /** - * 鑾峰彇闅忔満鏁存暟 - */ - public static int getRandomInt(int min, int max) { - return new Random().nextInt(max) % (max - min + 1) + min; - } - - /** - * 涓嬭浇鏂囦欢 - */ - public static void download(String file, String fileName, HttpServletResponse res) throws Exception { - download(file, fileName, false, res); - } - - /** - * 涓嬭浇鏂囦欢 - * - * @param file 鏂囦欢 - * @param fileName 鏂囦欢鍚� - * @param res 鍝嶅簲 - * @throws Exception 寮傚父 - */ - public static void download(String file, String fileName, boolean inline, HttpServletResponse res) throws Exception { - if (StringHelper.isEmpty(fileName)) { - fileName = StringHelper.YMDHMS2_FORMAT.format(new Date()); - } - fileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20"); - String dispose = inline ? "inline" : "attachment"; - - // 璁剧疆鍝嶅簲澶翠腑鏂囦欢鐨勪笅杞芥柟寮忎负闄勪欢鏂瑰紡锛屼互鍙婅缃枃浠跺悕 - res.setHeader("Content-Disposition", dispose + "; filename*=UTF-8''" + fileName); - // 璁剧疆鍝嶅簲澶寸殑缂栫爜鏍煎紡涓� UTF-8 - res.setCharacterEncoding("UTF-8"); - - // 閫氳繃response瀵硅薄璁剧疆鍝嶅簲鏁版嵁鏍煎紡(濡傦細"text/plain; charset=utf-8") - String ext = FileHelper.getExtension(file); - String mime = FileHelper.getMime(ext); - res.setContentType(mime); - - // 閫氳繃response瀵硅薄锛岃幏鍙栧埌杈撳嚭娴� - ServletOutputStream outputStream = res.getOutputStream(); - // 瀹氫箟杈撳叆娴侊紝閫氳繃杈撳叆娴佽鍙栨枃浠跺唴瀹� - FileInputStream fileInputStream = new FileInputStream(file); - - int len = 0; - byte[] bytes = new byte[1024]; - while ((len = fileInputStream.read(bytes)) != -1) { - // 閫氳繃杈撳叆娴佽鍙栨枃浠舵暟鎹紝鐒跺悗閫氳繃涓婅堪鐨勮緭鍑烘祦鍐欏洖娴忚鍣� - outputStream.write(bytes, 0, len); - outputStream.flush(); - } - - // 鍏抽棴璧勬簮 - fileInputStream.close(); - outputStream.close(); - } - - /** - * 鎵ц鍛戒护 - * - * @param cmd 鍛戒护 - */ - public static void exec(String cmd) { - try { - Runtime.getRuntime().exec(cmd); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 鑾峰彇璇锋眰鐨勫弬鏁板�� - * - * @param req 璇锋眰 - * @param key 鍙傛暟鍚� - * @return 鍙傛暟鍊� - */ - public static String getReqParamVal(HttpServletRequest req, String key) { - Map<String, String[]> maps = req.getParameterMap(); - for (Map.Entry<String, String[]> entry : maps.entrySet()) { - if (entry.getKey().equalsIgnoreCase(key)) { - return null == entry.getValue() || 0 == entry.getValue().length ? null : entry.getValue()[0]; - } - } - - return null; - } - - /** - * 鑾峰彇璇锋眰鐨勫弬鏁板�� - * - * @param req 璇锋眰 - * @param key 鍙傛暟鍚� - * @return 鍙傛暟鍊� - */ - public static String[] getReqParamVals(HttpServletRequest req, String key) { - Map<String, String[]> maps = req.getParameterMap(); - for (Map.Entry<String, String[]> entry : maps.entrySet()) { - if (entry.getKey().equalsIgnoreCase(key)) { - return entry.getValue(); - } - } - - return null; - } -} diff --git a/src/main/java/com/lf/server/helper/WordHelper.java b/src/main/java/com/lf/server/helper/WordHelper.java deleted file mode 100644 index 5704e07..0000000 --- a/src/main/java/com/lf/server/helper/WordHelper.java +++ /dev/null @@ -1,346 +0,0 @@ -package com.lf.server.helper; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.poi.xwpf.usermodel.*; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; - -import java.io.*; -import java.util.List; -import java.util.Map; - -/** - * Word甯姪绫� - * @author WWW - */ -public class WordHelper { - private final static Log log = LogFactory.getLog(WordHelper.class); - - /** - * 閫氳繃word妯℃澘鐢熸垚word鐨勪富鏂规硶 - */ - public static void generateWord(String inputFile, String outPutFile, Map<String, String> insertTextMap, List<String[]> addList) { - FileInputStream inputStream = null; - FileOutputStream outputStream = null; - - try { - inputStream = new FileInputStream(inputFile); - outputStream = new FileOutputStream(outPutFile); - - // 鑾峰彇docx瑙f瀽瀵硅薄 - XWPFDocument xwpfDocument = new XWPFDocument(inputStream); - - // 澶勭悊鎵�鏈夋枃娈垫暟鎹紝闄や簡琛ㄦ牸 - if (null != insertTextMap && insertTextMap.size() > 0) { - handleParagraphs(xwpfDocument, insertTextMap); - } - - // 澶勭悊琛ㄦ牸鏁版嵁 - handleTable(xwpfDocument, insertTextMap, addList); - - // 鍐欏叆鏁版嵁 - xwpfDocument.write(outputStream); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } finally { - try { - if (outputStream != null) { - outputStream.close(); - } - if (inputStream != null) { - inputStream.close(); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } - } - - /** - * 澶勭悊鎵�鏈夋枃娈垫暟鎹紝闄や簡琛ㄦ牸 - */ - public static void handleParagraphs(XWPFDocument xwpfDocument, Map<String, String> insertTextMap) { - for (XWPFParagraph paragraph : xwpfDocument.getParagraphs()) { - String text = paragraph.getText(); - if (isReplacement(text)) { - for (XWPFRun run : paragraph.getRuns()) { - // 鍒ゆ柇甯︽湁 ${} 鐨剅un - run.setText(matchesValue(run.text(), insertTextMap), 0); - } - } - } - } - - /** - * 澶勭悊琛ㄦ牸鏁版嵁鏂规硶 - */ - public static void handleTable(XWPFDocument xwpfDocument, Map<String, String> map, List<String[]> addList) { - List<XWPFTable> tables = xwpfDocument.getTables(); - for (XWPFTable table : tables) { - List<XWPFTableRow> rows = table.getRows(); - if (rows.size() < 2) { - continue; - } - - if (isReplacement(table.getText())) { - if (null == map || map.isEmpty()) { - continue; - } - - replaceData(rows, map); - } else { - insertData(table, addList); - } - } - } - - /** - * 鏇挎崲鏁版嵁 - */ - private static void replaceData(List<XWPFTableRow> rows, Map<String, String> map) { - for (XWPFTableRow row : rows) { - List<XWPFTableCell> tableCells = row.getTableCells(); - for (XWPFTableCell tableCell : tableCells) { - if (isReplacement(tableCell.getText())) { - List<XWPFParagraph> paragraphs = tableCell.getParagraphs(); - for (XWPFParagraph paragraph : paragraphs) { - List<XWPFRun> runs = paragraph.getRuns(); - for (XWPFRun run : runs) { - run.setText(matchesValue(tableCell.getText(), map), 0); - } - } - } - } - } - } - - /** - * 鎻掑叆鏁版嵁 - */ - private static void insertData(XWPFTable table, List<String[]> addList) { - for (int i = 1, c = addList.size(); i < c; i++) { - table.createRow(); - } - - List<XWPFTableCell> oldCells = table.getRow(1).getTableCells(); - List<XWPFTableRow> rowList = table.getRows(); - for (int i = 0, c = addList.size(); i < c; i++) { - XWPFTableRow xwpfTableRow = rowList.get(i + 1); - - List<XWPFTableCell> tableCells = xwpfTableRow.getTableCells(); - for (int j = 0; j < tableCells.size(); j++) { - XWPFTableCell oldCell = oldCells.get(j); - XWPFTableCell newCell = tableCells.get(j); - - if (0 == i) { - // newCell.setText(addList.get(i)[j]) - setCellText(newCell, addList.get(i)[j]); - } else { - setCellText(oldCell, newCell, addList.get(i)[j]); - } - } - } - } - - /** - * 璁剧疆鍗曞厓鏍兼枃鏈� - */ - private static void setCellText(XWPFTableCell cell, String text) { - List<XWPFParagraph> paragraphs = cell.getParagraphs(); - for (XWPFParagraph paragraph : paragraphs) { - List<XWPFRun> runs = paragraph.getRuns(); - for (XWPFRun run : runs) { - run.setText(text, 0); - } - } - } - - /** - * 鏈�${}鐨勫�煎尮閰嶅嚭鏇挎崲鐨勬暟鎹紝娌℃湁${}灏辫繑鍥炲師鏉ョ殑鏁版嵁 - * - * @param wordValue ${...} 甯�${}鐨勫彉閲� - * @param map 瀛樺偍闇�瑕佹浛鎹㈢殑鏁版嵁 - * @return java.lang.String - */ - public static String matchesValue(String wordValue, Map<String, String> map) { - for (String s : map.keySet()) { - String s1 = "${" + s + "}"; - if (s1.equals(wordValue)) { - wordValue = map.get(s); - } - } - - return wordValue; - } - - /** - * 娴嬭瘯鏄惁鍖呭惈闇�瑕佹浛鎹㈢殑鏁版嵁 - */ - public static boolean isReplacement(String text) { - return text.contains("$"); - } - - /** - * 澶嶅埗妯℃澘琛岀殑灞炴�� - */ - private static void setCellText(XWPFTableCell tmpCell, XWPFTableCell cell, String text) { - CTTc cttc2 = tmpCell.getCTTc(); - CTTcPr ctPr2 = cttc2.getTcPr(); - CTTc cttc = cell.getCTTc(); - CTTcPr ctPr = cttc.addNewTcPr(); - if (ctPr2.getTcW() != null) { - ctPr.addNewTcW().setW(ctPr2.getTcW().getW()); - } - if (ctPr2.getVAlign() != null) { - ctPr.addNewVAlign().setVal(ctPr2.getVAlign().getVal()); - } - if (ctPr2.getTcBorders() != null) { - ctPr.setTcBorders(ctPr2.getTcBorders()); - } - - XWPFParagraph tmpP = tmpCell.getParagraphs().get(0); - XWPFParagraph cellP = cell.getParagraphs().get(0); - XWPFRun tmpR = null; - if (tmpP.getRuns() != null && tmpP.getRuns().size() > 0) { - tmpR = tmpP.getRuns().get(0); - } - XWPFRun cellR = cellP.createRun(); - cellR.setText(text); - - // 澶嶅埗瀛椾綋淇℃伅 - copyFontInfo(cellR, tmpR); - - // 澶嶅埗娈佃惤淇℃伅 - cellP.setAlignment(tmpP.getAlignment()); - cellP.setVerticalAlignment(tmpP.getVerticalAlignment()); - cellP.setBorderBetween(tmpP.getBorderBetween()); - cellP.setBorderBottom(tmpP.getBorderBottom()); - cellP.setBorderLeft(tmpP.getBorderLeft()); - cellP.setBorderRight(tmpP.getBorderRight()); - cellP.setBorderTop(tmpP.getBorderTop()); - cellP.setPageBreak(tmpP.isPageBreak()); - - if (tmpP.getCTP() != null&&tmpP.getCTP().getPPr() != null) { - CTPPr tmpPpr = tmpP.getCTP().getPPr(); - CTPPr cellPpr = cellP.getCTP().getPPr() != null ? cellP.getCTP().getPPr() : cellP.getCTP().addNewPPr(); - - // 澶嶅埗娈佃惤闂磋窛淇℃伅 - copySpacing(tmpPpr, cellPpr); - - // 澶嶅埗娈佃惤缂╄繘淇℃伅 - copyParagraph(tmpPpr, cellPpr); - } - } - - /** - * 澶嶅埗瀛椾綋淇℃伅 - */ - private static void copyFontInfo(XWPFRun cellR, XWPFRun tmpR) { - if (tmpR == null) { - return; - } - if (!cellR.isBold()) { - cellR.setBold(tmpR.isBold()); - } - cellR.setItalic(tmpR.isItalic()); - cellR.setUnderline(tmpR.getUnderline()); - cellR.setColor(tmpR.getColor()); - cellR.setTextPosition(tmpR.getTextPosition()); - if (tmpR.getFontSize() != -1) { - cellR.setFontSize(tmpR.getFontSize()); - } - if (tmpR.getFontFamily() != null) { - cellR.setFontFamily(tmpR.getFontFamily()); - } - if (tmpR.getCTR() != null) { - if (tmpR.getCTR().isSetRPr()) { - CTRPr tmpRpr = tmpR.getCTR().getRPr(); - if (tmpRpr.isSetRFonts()) { - CTFonts tmpFonts = tmpRpr.getRFonts(); - CTRPr cellRpr = cellR.getCTR().isSetRPr() ? cellR - .getCTR().getRPr() : cellR.getCTR().addNewRPr(); - CTFonts cellFonts = cellRpr.isSetRFonts() ? cellRpr - .getRFonts() : cellRpr.addNewRFonts(); - cellFonts.setAscii(tmpFonts.getAscii()); - cellFonts.setAsciiTheme(tmpFonts.getAsciiTheme()); - cellFonts.setCs(tmpFonts.getCs()); - cellFonts.setCstheme(tmpFonts.getCstheme()); - cellFonts.setEastAsia(tmpFonts.getEastAsia()); - cellFonts.setEastAsiaTheme(tmpFonts.getEastAsiaTheme()); - cellFonts.setHAnsi(tmpFonts.getHAnsi()); - cellFonts.setHAnsiTheme(tmpFonts.getHAnsiTheme()); - } - } - } - } - - /** - * 澶嶅埗娈佃惤闂磋窛淇℃伅 - */ - private static void copySpacing(CTPPr tmpPpr, CTPPr cellPpr) { - CTSpacing tmpSpacing = tmpPpr.getSpacing(); - if (tmpSpacing != null) { - CTSpacing cellSpacing = cellPpr.getSpacing() != null ? cellPpr.getSpacing() : cellPpr.addNewSpacing(); - if (tmpSpacing.getAfter() != null) { - cellSpacing.setAfter(tmpSpacing.getAfter()); - } - if (tmpSpacing.getAfterAutospacing() != null) { - cellSpacing.setAfterAutospacing(tmpSpacing - .getAfterAutospacing()); - } - if (tmpSpacing.getAfterLines() != null) { - cellSpacing.setAfterLines(tmpSpacing.getAfterLines()); - } - if (tmpSpacing.getBefore() != null) { - cellSpacing.setBefore(tmpSpacing.getBefore()); - } - if (tmpSpacing.getBeforeAutospacing() != null) { - cellSpacing.setBeforeAutospacing(tmpSpacing - .getBeforeAutospacing()); - } - if (tmpSpacing.getBeforeLines() != null) { - cellSpacing.setBeforeLines(tmpSpacing.getBeforeLines()); - } - if (tmpSpacing.getLine() != null) { - cellSpacing.setLine(tmpSpacing.getLine()); - } - if (tmpSpacing.getLineRule() != null) { - cellSpacing.setLineRule(tmpSpacing.getLineRule()); - } - } - } - - /** - * 澶嶅埗娈佃惤缂╄繘淇℃伅 - */ - private static void copyParagraph(CTPPr tmpPpr, CTPPr cellPpr) { - CTInd tmpInd = tmpPpr.getInd(); - if (tmpInd != null) { - CTInd cellInd = cellPpr.getInd() != null ? cellPpr.getInd() : cellPpr.addNewInd(); - if (tmpInd.getFirstLine() != null) { - cellInd.setFirstLine(tmpInd.getFirstLine()); - } - if (tmpInd.getFirstLineChars() != null) { - cellInd.setFirstLineChars(tmpInd.getFirstLineChars()); - } - if (tmpInd.getHanging() != null) { - cellInd.setHanging(tmpInd.getHanging()); - } - if (tmpInd.getHangingChars() != null) { - cellInd.setHangingChars(tmpInd.getHangingChars()); - } - if (tmpInd.getLeft() != null) { - cellInd.setLeft(tmpInd.getLeft()); - } - if (tmpInd.getLeftChars() != null) { - cellInd.setLeftChars(tmpInd.getLeftChars()); - } - if (tmpInd.getRight() != null) { - cellInd.setRight(tmpInd.getRight()); - } - if (tmpInd.getRightChars() != null) { - cellInd.setRightChars(tmpInd.getRightChars()); - } - } - } -} diff --git a/src/main/java/com/lf/server/helper/Zip4jHelper.java b/src/main/java/com/lf/server/helper/Zip4jHelper.java deleted file mode 100644 index 5440578..0000000 --- a/src/main/java/com/lf/server/helper/Zip4jHelper.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.lf.server.helper; - -import net.lingala.zip4j.ZipFile; -import net.lingala.zip4j.exception.ZipException; -import net.lingala.zip4j.model.ZipParameters; -import net.lingala.zip4j.model.enums.AesKeyStrength; -import net.lingala.zip4j.model.enums.CompressionLevel; -import net.lingala.zip4j.model.enums.CompressionMethod; -import net.lingala.zip4j.model.enums.EncryptionMethod; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.io.File; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; - -/** - * Zip4j甯姪绫� - * @author WWW - */ -public class Zip4jHelper { - private final static Log log = LogFactory.getLog(Zip4jHelper.class); - - /** - * Zip鍘嬬缉 - * - * @param zipFile zip鏂囦欢 - * @param sourcePath 婧愯矾寰� - * @param pwd 瀵嗙爜 - * @return 鎴愬姛鏄惁 - */ - public static boolean zip(String zipFile, String sourcePath, String pwd) { - try { - ZipFile zip = StringHelper.isEmpty(pwd) ? new ZipFile(zipFile) : new ZipFile(zipFile, pwd.toCharArray()); - zip.setCharset(StandardCharsets.UTF_8); - - File f = zip.getFile(); - if (!f.getParentFile().exists()) { - f.getParentFile().mkdirs(); - } - if (f.exists()) { - f.delete(); - } - - ZipParameters params = getZipParams(!StringHelper.isEmpty(pwd)); - - // 瑕佹墦鍖呯殑鏂囦欢鎴栨枃浠跺す - File currentFile = new File(sourcePath); - if (currentFile.isDirectory()) { - zip.addFolder(currentFile, params); - } else { - zip.addFile(currentFile, params); - } - - return true; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return false; - } - } - - /** - * 鍒涘缓ZipFile - */ - public static ZipFile createZipFile(String zipFile, String pwd) { - try { - ZipFile zip = StringHelper.isEmpty(pwd) ? new ZipFile(zipFile) : new ZipFile(zipFile, pwd.toCharArray()); - // zip.setCharset(Charset.forName("GBK")) - zip.setCharset(StandardCharsets.UTF_8); - - File f = zip.getFile(); - if (!f.getParentFile().exists()) { - f.getParentFile().mkdirs(); - } - if (f.exists()) { - f.delete(); - } - - return zip; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } - } - - /** - * 鑾峰彇ZipParameters - */ - public static ZipParameters getZipParams(boolean hasPwd) { - // 璁剧疆鍘嬬缉鏂囦欢鍙傛暟 - ZipParameters params = new ZipParameters(); - // 鍘嬬缉鏂瑰紡 - params.setCompressionMethod(CompressionMethod.DEFLATE); - // 鍘嬬缉绾у埆 - params.setCompressionLevel(CompressionLevel.MAXIMUM); - - if (hasPwd) { - // 鏄惁璁剧疆鍔犲瘑鏂囦欢 - params.setEncryptFiles(true); - // 璁剧疆AES鍔犲瘑寮哄害锛欿EY_STRENGTH_256 - params.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_128); - // 璁剧疆鍔犲瘑绠楁硶 - params.setEncryptionMethod(EncryptionMethod.AES); - } - - return params; - } - - /** - * 娣诲姞鏂囦欢鑷冲帇缂╁寘 - * - * @param zip ZipFile - * @param params ZipParameters - * @param file File - * @throws ZipException - */ - private static void addZipFile(ZipFile zip, ZipParameters params, File file) throws ZipException { - if (file.isDirectory()) { - File[] files = file.listFiles(); - for (File f : files) { - addZipFile(zip, params, f); - } - } else { - zip.addFile(file, params); - } - } - - /** - * Zip瑙e帇 - * - * @param zipFile zip鏂囦欢 - * @param toPath 瑙e帇璺緞 - * @param password 瀵嗙爜 - * @return 鎴愬姛鏄�/鍚� - */ - public static boolean unzip(String zipFile, String toPath, String password) { - try { - // 鐢熸垚鐨勫帇缂╂枃浠� - ZipFile zip = new ZipFile(zipFile); - - // 璁剧疆瀵嗙爜 - if (!StringHelper.isEmpty(password)) { - zip.setPassword(password.toCharArray()); - } - - // 瑙e帇缂╂墍鏈夋枃浠朵互鍙婃枃浠跺す - zip.extractAll(toPath); - - return true; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return false; - } - } -} diff --git a/src/main/java/com/lf/server/helper/ZipHelper.java b/src/main/java/com/lf/server/helper/ZipHelper.java deleted file mode 100644 index f03db12..0000000 --- a/src/main/java/com/lf/server/helper/ZipHelper.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.lf.server.helper; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.io.*; -import java.nio.charset.Charset; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; -import java.util.zip.ZipOutputStream; - -/** - * Zip甯姪绫� - * @author WWW - */ -public class ZipHelper { - private final static int BUFFER_SIZE = 1024; - - private final static byte[] BUFFER = new byte[1024]; - - private final static Log log = LogFactory.getLog(ZipHelper.class); - - /** - * Zip瑙e帇 - * - * @param filePath zip鏂囦欢 - * @param zipDir 瑙e帇璺緞 - * @return 鎴愬姛鏄�/鍚� - */ - public static boolean unzip(String filePath, String zipDir) { - ZipFile zipFile = null; - try { - File dir = new File(zipDir); - if (!dir.exists() || !dir.isDirectory()) { - dir.mkdirs(); - } - - int count; - zipFile = new ZipFile(filePath, Charset.forName("GBK")); - Enumeration e = zipFile.entries(); - while (e.hasMoreElements()) { - ZipEntry entry = (ZipEntry) e.nextElement(); - if (entry.isDirectory()) { - File f = new File(zipDir + File.separator + entry.getName()); - if (!f.exists()) { - f.mkdirs(); - } - continue; - } - - BufferedInputStream is = new BufferedInputStream(zipFile.getInputStream(entry)); - FileOutputStream fos = new FileOutputStream(zipDir + File.separator + entry.getName()); - BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE); - while ((count = is.read(BUFFER, 0, BUFFER_SIZE)) != -1) { - dest.write(BUFFER, 0, count); - } - - dest.flush(); - dest.close(); - fos.close(); - is.close(); - } - - return true; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return false; - } finally { - try { - if (null != zipFile) { - zipFile.close(); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } - } - - /** - * Zip鍘嬬缉 - * - * @param zipFile zip婧愭枃浠� - * @param sourceDir 婧愭枃浠跺す - * @return 鎴愬姛鏄�/鍚� - */ - public static boolean zip(String zipFile, String sourceDir) { - FileOutputStream fos = null; - ZipOutputStream zos = null; - try { - fos = new FileOutputStream(zipFile); - zos = new ZipOutputStream(fos); - - File sourceFile = new File(sourceDir); - compress(sourceFile, zos, sourceFile.getName()); - - return true; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return false; - } finally { - try { - if (null != zos) { - zos.close(); - } - if (null != fos) { - fos.close(); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } - } - - /** - * Zip鍘嬬缉 - * - * @param sourceFile zip婧愭枃浠� - * @param zos zip杈撳嚭娴� - * @param name zip鏂囦欢鍚嶇О - * @throws Exception - */ - public static void compress(File sourceFile, ZipOutputStream zos, String name) throws Exception { - if (sourceFile.isFile()) { - // 鍚憐ip杈撳嚭娴佷腑娣诲姞涓�涓獄ip瀹炰綋锛屾瀯閫犲櫒涓璶ame涓簔ip瀹炰綋鐨勬枃浠剁殑鍚嶅瓧 - zos.putNextEntry(new ZipEntry(name)); - - // copy鏂囦欢鍒皕ip杈撳嚭娴佷腑 - int len; - FileInputStream in = new FileInputStream(sourceFile); - while ((len = in.read(BUFFER)) != -1) { - zos.write(BUFFER, 0, len); - } - zos.closeEntry(); - in.close(); - } else { - File[] listFiles = sourceFile.listFiles(); - if (listFiles == null || listFiles.length == 0) { - // 绌烘枃浠跺す鐨勫鐞嗭細娌℃湁鏂囦欢锛屼笉闇�瑕佹枃浠剁殑copy - zos.putNextEntry(new ZipEntry(name + "/")); - zos.closeEntry(); - } else { - for (File file : listFiles) { - compress(file, zos, name + "/" + file.getName()); - } - } - } - } -} diff --git a/src/main/java/com/lf/server/interceptor/AuthInterceptor.java b/src/main/java/com/lf/server/interceptor/AuthInterceptor.java deleted file mode 100644 index 3d55891..0000000 --- a/src/main/java/com/lf/server/interceptor/AuthInterceptor.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.lf.server.interceptor; - -import com.alibaba.fastjson.JSON; -import com.lf.server.entity.all.*; -import com.lf.server.entity.sys.TokenEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.service.all.SysService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.method.HandlerMethod; -import org.springframework.web.servlet.HandlerInterceptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 韬唤璁よ瘉鎷︽埅鍣� - * @author WWW - */ -@Configuration -public class AuthInterceptor implements HandlerInterceptor { - private final SysService sysService; - - private static final Log log = LogFactory.getLog(AuthInterceptor.class); - - private static final String NO_TOKEN = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.TOKEN_ERROR, "鎵句笉鍒颁护鐗�")); - - private static final String NO_LOGIN = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NO_LOGIN_ERROR, "鐢ㄦ埛鏈櫥褰�")); - - private static final String USER_LOCK = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.USER_LOCK_ERROR, "鐢ㄦ埛ID宸茬鐢�")); - - private static final String NO_AUTH = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NO_AUTH_ERROR, "鏃犳潈闄愯闂�")); - - private static final String IP_NULL = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.UNAUTHORIZED, "IP鍦板潃涓虹┖")); - - private static final String BLACK_LIST = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.UNAUTHORIZED, "璇P鍏ラ粦鍚嶅崟")); - - private static final String ILLEGAL_TOKEN = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.UNAUTHORIZED, "浠ょ墝鏉ユ簮闈炴硶")); - - public AuthInterceptor(SysService sysService) { - this.sysService = sysService; - } - - /** - * Controller鎵ц涔嬪墠鎵ц锛屽鏋滆繑鍥炲�兼槸true鍒欎唬琛ㄦ斁琛岋紝杩斿洖false鍒欐嫤鎴� - */ - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { - // noinspection AlibabaRemoveCommentedCode - try { - // 1.闈炴柟娉� 鎴� 鏃犻渶鎺堟潈锛屾棤闇�鎷︽埅 - if (!(handler instanceof HandlerMethod) || noNeedAuth(request)) { - return true; - } - - // 2.鑾峰彇浠ょ墝 - String token = WebHelper.getToken(request); - if (StringHelper.isNull(token)) { - return WebHelper.writeStr2Page(response, NO_TOKEN); - } - - // 3.鑾峰彇鐢ㄦ埛浠ょ墝 - UserEntity ue = sysService.tokenService.getCurrentUser(request); - if (ue == null) { - return WebHelper.writeStr2Page(response, NO_LOGIN); - } - - // 4.鑾峰彇IP - String ip = WebHelper.getIpAddress(request); - if (StringHelper.isEmpty(ip)) { - return WebHelper.writeStr2Page(response, IP_NULL); - } - - // 5.妫�鏌ラ粦鍚嶅崟 - if (!checkBlackList(ip, request)) { - return WebHelper.writeStr2Page(response, BLACK_LIST); - } - - // 6.admin璺宠繃鏉冮檺妫�娴� - if (StaticData.ADMIN.equals(ue.getUid())) { - return true; - } - - // 7.妫�鏌ョ櫧鍚嶅崟 - if (!checkWhiteList(ip, request)) { - // 妫�鏌P涓�鑷存�� - if (!checkIpSource(ip, token)) { - return WebHelper.writeStr2Page(response, ILLEGAL_TOKEN); - } - } - - // 8.妫�鏌ョ敤鎴稩D鏄惁绂佺敤 - if (sysService.tokenService.isUidDisable(ue)) { - return WebHelper.writeStr2Page(response, USER_LOCK); - } - - // 9.鏉冮檺鏍¢獙 - if (!checkPerms(ue, request)) { - System.out.println("鏃犳潈闄愯闂細" + request.getRequestURI().toLowerCase()); - return WebHelper.writeStr2Page(response, NO_AUTH); - } - - return true; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return false; - } - } - - /** - * 鏃犻渶鎺堟潈 - */ - private static boolean noNeedAuth(HttpServletRequest request) { - String uri = request.getRequestURI().toLowerCase(); - for (String page : StaticData.EXCLUDE_PATH) { - if (uri.contains(page)) { - return true; - } - } - - return false; - } - - /** - * 妫�鏌ユ潈闄� - */ - private boolean checkPerms(UserEntity ue, HttpServletRequest request) { - List<String> list = sysService.permsService.selectPerms(ue.getUid()); - if (list == null || list.size() == 0) { - return false; - } - - String url = request.getRequestURI(); - for (String perm : list) { - if (url.contains(perm)) { - return true; - } - } - - return false; - } - - /** - * 妫�鏌ラ粦鍚嶅崟 - */ - private boolean checkBlackList(String ip, HttpServletRequest request) { - List<String> blackList = sysService.blacklistService.selectIpList(1); - if (blackList == null || blackList.isEmpty()) { - return true; - } - if (blackList.contains(ip)) { - return false; - } - - return true; - } - - /** - * 妫�鏌ョ櫧鍚嶅崟 - */ - private boolean checkWhiteList(String ip, HttpServletRequest request) { - List<String> whiteList = sysService.blacklistService.selectIpList(2); - if (whiteList == null || whiteList.isEmpty()) { - return false; - } - - return whiteList.contains(ip); - } - - /** - * 妫�鏌P涓�鑷存�� - */ - private boolean checkIpSource(String ip, String token) { - TokenEntity te = sysService.tokenService.getEntityByToken(token); - - return te.getIp().equals(ip); - } -} diff --git a/src/main/java/com/lf/server/interceptor/CrosFilter.java b/src/main/java/com/lf/server/interceptor/CrosFilter.java deleted file mode 100644 index cdfa887..0000000 --- a/src/main/java/com/lf/server/interceptor/CrosFilter.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.lf.server.interceptor; - -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * 璺ㄥ煙杩囨护鍣� - * @author WWW - * @date 2022-09-27 - */ -public class CrosFilter implements Filter { - private static final String OPTIONS = "OPTIONS"; - - @Override - public void init(FilterConfig filterConfig) { - // - } - - @Override - public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { - HttpServletResponse response = (HttpServletResponse) res; - HttpServletRequest request = (HttpServletRequest) req; - if (OPTIONS.equalsIgnoreCase(request.getMethod())) { - response.setHeader("Access-Control-Allow-Origin", "*"); - response.setHeader("Access-Control-Allow-Credentials", "true"); - response.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS"); - response.setHeader("Access-Control-Max-Age", "3600"); - response.setHeader("Access-Control-Allow-Headers", "*"); - - response.setStatus(HttpServletResponse.SC_OK); - } else { - chain.doFilter(req, res); - } - } - - @Override - public void destroy() { - // - } -} diff --git a/src/main/java/com/lf/server/mapper/all/BaseQueryMapper.java b/src/main/java/com/lf/server/mapper/all/BaseQueryMapper.java deleted file mode 100644 index 4b5f780..0000000 --- a/src/main/java/com/lf/server/mapper/all/BaseQueryMapper.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.lf.server.mapper.all; - -import com.lf.server.entity.ctrl.IdNameEntity; -import com.lf.server.entity.ctrl.KeyValueEntity; -import com.lf.server.entity.ctrl.TabEntity; -import com.lf.server.entity.data.DictEntity; -import com.lf.server.entity.data.DomainEntity; -import com.lf.server.entity.sys.AttachEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鐖舵煡璇apper - * @author WWW - */ -@Mapper -@Repository -public interface BaseQueryMapper { - /** - * 妯$硦鎼滅储鐢ㄦ埛 - * - * @param name 鐢ㄦ埛鍚� - * @return 瀹炰綋绫婚泦鍚� - */ - public List<IdNameEntity> selectUserFuzzy(String name); - - /** - * 妯$硦鎼滅储鍗曚綅 - * - * @param name 鍗曚綅鍚� - * @return 瀹炰綋绫婚泦鍚� - */ - public List<IdNameEntity> selectDepFuzzy(String name); - - /** - * 鏍规嵁琛ㄥ悕鏌ヨ璁板綍鏁� - * - * @param tab 琛ㄥ悕 - * @param field 瀛楁 - * @return - */ - public Integer selectTabsForCount(String tab, String field); - - /** - * 鏍规嵁琛ㄥ悕鍒嗛〉鏌ヨ - * - * @param tab 琛ㄥ悕 - * @param field 瀛楁 - * @param filters 杩囨护鏉′欢 - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return - */ - public List<TabEntity> selectTabsByPage(String tab, String field, String filters, Integer limit, Integer offset); - - /** - * 鏌ヨ瀛楁淇℃伅 - * - * @param ns 鍚嶇О绌洪棿 - * @param tab 琛ㄥ悕 - * @return 瀹炰綋绫婚泦鍚� - */ - public List<DictEntity> selectFields(String ns, String tab); - - /** - * 鏌ヨ鍊煎煙淇℃伅 - * - * @param ns 鍚嶇О绌洪棿 - * @param tab 琛ㄥ悕 - * @return 瀹炰綋绫婚泦鍚� - */ - public List<DomainEntity> selectDomains(String ns, String tab); - - /** - * 鏌ヨ璺綉 - * - * @param x1 X1 - * @param y1 Y1 - * @param x2 X2 - * @param y2 Y2 - * @return 澶氱嚎 - */ - public String selectRoute(double x1, double y1, double x2, double y2); - - /** - * 鏌ヨ浣嶇疆 - * - * @param wkt WKT瀛楃涓� - * @return 浣嶇疆 - */ - public List<KeyValueEntity> selectLocation(String wkt); - - /** - * 鏌ヨ鐩綍绫诲埆 - * - * @param name - * @return - */ - public List<KeyValueEntity> selectDirTypes(String name); - - /** - * 鏍规嵁琛ㄥ悕鏌ヨ闄勪欢 - * - * @param tab 琛ㄥ悕 - * @param gids Gid瀛楃涓� - * @return 闄勪欢 - */ - public List<AttachEntity> selectAnnexByTab(String tab, String gids); -} diff --git a/src/main/java/com/lf/server/mapper/all/BasicMapper.java b/src/main/java/com/lf/server/mapper/all/BasicMapper.java deleted file mode 100644 index 478a315..0000000 --- a/src/main/java/com/lf/server/mapper/all/BasicMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.lf.server.mapper.all; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.lf.server.entity.sys.AttachEntity; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - -import java.util.List; - -/** - * 鍩虹Mapper - * @author WWW - * @param <T> 娉涘瀷 - */ -public interface BasicMapper<T> extends BaseMapper<T> { - /** - * 妯$硦鎼滅储瀛楁 - * - * @param tab 琛ㄥ悕 - * @param field 瀛楁 - * @param value 鍊� - * @return 缁撴灉鍒楄〃 - */ - @Select("select ${field} from ${tab} where upper(${field}) like #{value} order by ${field} limit 10") - public List<String> selectFieldFuzzy(@Param("tab") String tab, @Param("field") String field, @Param("value") String value); - - /** - * 鑷畾涔夋壒閲忔彃鍏� - * 濡傛灉瑕佽嚜鍔ㄥ~鍏咃紝@Param(xx) xx鍙傛暟鍚嶅繀椤绘槸 list/collection/array 3涓殑鍏朵腑涔嬩竴 - * - * @param list - * @return - */ - public int insertBatch(@Param("list") List<T> list); - - /** - * 鑷畾涔夋壒閲忔洿鏂帮紝鏉′欢涓轰富閿� - * 濡傛灉瑕佽嚜鍔ㄥ~鍏咃紝@Param(xx) xx鍙傛暟鍚嶅繀椤绘槸 list/collection/array 3涓殑鍏朵腑涔嬩竴 - * - * @param list - * @return - */ - public int updateBatch(@Param("list") List<T> list); - - /** - * 鏌ヨ闄勪欢 - * - * @param tab 琛ㄥ悕 - * @param wrapper 鏌ヨ鍖呰鍣� - * @return - */ - @Select("select * from lf.sys_attach where tab = #{tab} and tab_guid in (select eventid from ${tab} ${ew.customSqlSegment})") - public List<AttachEntity> selectAnnex(@Param("tab") String tab, @Param("ew") QueryWrapper wrapper); -} diff --git a/src/main/java/com/lf/server/mapper/all/GeomBaseMapper.java b/src/main/java/com/lf/server/mapper/all/GeomBaseMapper.java deleted file mode 100644 index 7ec2db1..0000000 --- a/src/main/java/com/lf/server/mapper/all/GeomBaseMapper.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.lf.server.mapper.all; - -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Update; - -import java.util.List; - -/** - * 绌洪棿鍩虹Mapper - * @author WWW - * @param <T> 娉涘瀷 - */ -public interface GeomBaseMapper<T> extends BasicMapper<T> { - /** - * 鏍规嵁ID鏌ヨWKT - * - * @param tab 琛ㄥ悕 - * @param gid GID - * @return WKT - */ - @Select("select ST_AsText(geom) geom from ${tab} where gid = #{gid} limit 1") - public String selectWktById(@Param("tab") String tab, @Param("gid") Integer gid); - - /** - * 鏍规嵁琛ㄥ悕鏌ヨ绌洪棿鍙傝�� - * - * @param tab 琛ㄥ悕 - * @return SRID - */ - @Select("select ST_SRID(geom) from ${tab} where geom is not null limit 1") - public Integer selectSrid(@Param("tab") String tab); - - /** - * 鏍规嵁琛ㄥ悕鏌ヨ绌洪棿绫诲瀷 - * - * @param tab 琛ㄥ悕 - * @return SRID - */ - @Select("select ST_GeometryType(geom) from ${tab} where geom is not null limit 1") - public String selectGeometryType(@Param("tab") String tab); - - /** - * 鏌ヨDB涓孩鍑虹殑鍗曚綅ID - * - * @param tab 琛ㄥ悕 - * @param depid 鍗曚綅ID - * @param geoFilter 绌洪棿杩囨护鏉′欢 - * @return 婧㈠嚭鐨勫崟浣岻D - */ - @Select("<script>" + - " select depid from ${tab} where depid is not null and depid not like '${depid}%'" + - " <if test='geoFilter != null'>" + - " and ${geoFilter}" + - " </if>" + - " group by depid" + - "</script>") - public List<Integer> selectDbOverflowDep(@Param("tab") String tab, @Param("depid") String depid, @Param("geoFilter") String geoFilter); - - /** - * 鏇存柊绌洪棿浣嶇疆 - * - * @param tab 琛ㄥ悕 - * @param gid GID - * @param wkt WKT - * @return 褰卞搷琛屾暟 - */ - @Update("update ${tab} set geom = ST_GeomFromText('${wkt}') where gid = #{gid} limit 1") - public Integer updateGeom(@Param("tab") String tab, @Param("gid") Integer gid, @Param("wkt") String wkt); -} diff --git a/src/main/java/com/lf/server/mapper/all/PermsMapper.java b/src/main/java/com/lf/server/mapper/all/PermsMapper.java deleted file mode 100644 index 8574af9..0000000 --- a/src/main/java/com/lf/server/mapper/all/PermsMapper.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.lf.server.mapper.all; - -import com.lf.server.entity.all.MenusAuthEntity; -import com.lf.server.entity.all.PermsAuthEntity; -import com.lf.server.entity.all.ResAuthEntity; -import com.lf.server.entity.sys.MenuEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鎺堟潈绠$悊 - * @author WWW - */ -@Mapper -@Repository -public interface PermsMapper { - /** - * 鏍规嵁鐢ㄦ埛Uid鏌ヨ璧勬簮鎺堟潈 - * - * @param uid - * @return - */ - public List<ResAuthEntity> selectRes(String uid); - - /** - * 鏍规嵁鐢ㄦ埛Uid鏌ヨ鑿滃崟鎺堟潈 - * - * @param uid - * @return - */ - public List<MenusAuthEntity> selectMenus(String uid); - - /** - * 鏍规嵁鐢ㄦ埛Uid鏌ヨ鏉冮檺鎺堟潈 - * - * @param uid - * @return - */ - public List<String> selectPerms(String uid); - - /** - * 鏍规嵁鐢ㄦ埛Uid鏌ヨ鏉冮檺鎺堟潈瀹炰綋闆嗗悎 - * - * @param uid - * @return - */ - public List<PermsAuthEntity> selectPermsEntity(String uid); - - /** - * 鏍规嵁鐢ㄦ埛Uid鏌ヨ瑙掕壊ID - * - * @param uid - * @return - */ - public List<Integer> selectRoles(String uid); - - /** - * 鏍规嵁鐢ㄦ埛Uid閫掑綊鏌ヨ鑿滃崟闆嗗悎 - * - * @param id - * @param uid - * @return - */ - public List<MenuEntity> selectMenuRecursive(int id, String uid); -} diff --git a/src/main/java/com/lf/server/mapper/data/DictMapper.java b/src/main/java/com/lf/server/mapper/data/DictMapper.java deleted file mode 100644 index 244534a..0000000 --- a/src/main/java/com/lf/server/mapper/data/DictMapper.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.ctrl.TabEntity; -import com.lf.server.entity.data.DictEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 瀛楀吀绠$悊 - * @author WWW - */ -@Mapper -@Repository -public interface DictMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param ns 琛ㄧ┖闂� - * @param tab 琛ㄥ悕 - * @return 璁板綍鏁� - */ - public Integer selectCount(String ns, String tab); - - /** - * 鍒嗛〉鏌ヨ - * - * @param ns 琛ㄧ┖闂� - * @param tab 琛ㄥ悕 - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<DictEntity> selectByPage(String ns, String tab, Integer limit, Integer offset); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public DictEntity selectById(int id); - - /** - * 鏌ヨ瀛楀吀琛ㄧ粨鏋� - * - * @param name - * @param field - * @return - */ - public List<TabEntity> selectDictTab(String name, String field); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(DictEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<DictEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(DictEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<DictEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/data/DirMapper.java b/src/main/java/com/lf/server/mapper/data/DirMapper.java deleted file mode 100644 index 45859be..0000000 --- a/src/main/java/com/lf/server/mapper/data/DirMapper.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.data.DirEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * Dir - * @author sws - * @date 2022-09-24 - */ - -@Mapper -@Repository -public interface DirMapper { - /** - * 鎻掑叆涓�鏉� - * - * @param dirEntity - * @return - */ - public Integer insert(DirEntity dirEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<DirEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteDir(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteDirs(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param dirEntity - * @return - */ - public Integer update(DirEntity dirEntity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<DirEntity> list); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public DirEntity selectDir(int id); - - /** - * 鏍规嵁Code鏌ヨ鐩綍 - * - * @param code - * @return - */ - public DirEntity selectByCode(String code); - - /** - * 鏌ヨ澶氭潯鏁版嵁 - * - * @return - */ - public List<DirEntity> selectDirAll(); - - /** - * 鏌ヨ鏍圭洰褰� - * - * @return - */ - public List<DirEntity> selectDirRoot(); - - /** - * 鏌ヨ椤圭洰 - * - * @param name - * @return - */ - public List<DirEntity> selectProject(String name); - - /** - * 閫掑綊鏌ヨ - * - * @param id - * @return - */ - public List<DirEntity> selectRecursiveById(Integer id); - - /** - * 鏌ヨ椤圭洰鐩綍鏍� - * - * @return - */ - public List<DirEntity> selectDirsForPrj(); -} diff --git a/src/main/java/com/lf/server/mapper/data/DomainMapper.java b/src/main/java/com/lf/server/mapper/data/DomainMapper.java deleted file mode 100644 index 298ba9b..0000000 --- a/src/main/java/com/lf/server/mapper/data/DomainMapper.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.ctrl.TabEntity; -import com.lf.server.entity.data.DomainEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鍊煎煙 - * @author WWW - */ -@Mapper -@Repository -public interface DomainMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param ns 鍚嶇О绌洪棿 - * @param tab 琛ㄥ悕 - * @param name 鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectCount(String ns, String tab, String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param ns 鍚嶇О绌洪棿 - * @param tab 琛ㄥ悕 - * @param name 鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<DomainEntity> selectByPage(String ns, String tab, String name, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<DomainEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public DomainEntity selectById(int id); - - /** - * 鏍规嵁琛ㄥ悕鏌ヨ鍊煎煙鍚嶇О - * - * @param ns 鍚嶇О绌洪棿 - * @param tab 琛ㄥ悕 - * @return 鍊煎煙鍚嶇О闆嗗悎 - */ - public List<String> selectDomainNames(String ns, String tab); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(DomainEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<DomainEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(DomainEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<DomainEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/data/DownloadMapper.java b/src/main/java/com/lf/server/mapper/data/DownloadMapper.java deleted file mode 100644 index a20c113..0000000 --- a/src/main/java/com/lf/server/mapper/data/DownloadMapper.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.data.DownloadEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 涓嬭浇璁板綍 - * @author WWW - */ -@Mapper -@Repository -public interface DownloadMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name 鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectCount(String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name 鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<DownloadEntity> selectByPage(String name, Integer limit, Integer offset); - - /** - * 鏍规嵁鐢ㄦ埛ID鏌ヨ璁板綍鏁帮紙鍦ㄧ嚎鍒跺浘锛� - * - * @param createUser 鐢ㄦ埛ID - * @param types 绫诲埆 - * @param name 鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectCountForUser(Integer createUser, String types, String name); - - /** - * 鏍规嵁鐢ㄦ埛ID鍒嗛〉鏌ヨ锛堝湪绾垮埗鍥撅級 - * - * @param createUser 鐢ㄦ埛ID - * @param types 绫诲埆 - * @param name 鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<DownloadEntity> selectByPageForUser(Integer createUser, String types, String name, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<DownloadEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public DownloadEntity selectById(int id); - - /** - * 鏍规嵁Guid鏌ヨ - * - * @param guid - * @return - */ - public DownloadEntity selectByGuid(String guid); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(DownloadEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<DownloadEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(DownloadEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<DownloadEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/data/LayerMapper.java b/src/main/java/com/lf/server/mapper/data/LayerMapper.java deleted file mode 100644 index 9b357c9..0000000 --- a/src/main/java/com/lf/server/mapper/data/LayerMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.data.LayerEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鍥惧眰 - * @author WWW - */ -@Mapper -@Repository -public interface LayerMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param cnName 涓枃鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectCount(String cnName); - - /** - * 鍒嗛〉鏌ヨ - * - * @param cnName 涓枃鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<LayerEntity> selectByPage(String cnName, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<LayerEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public LayerEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(LayerEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<LayerEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(LayerEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<LayerEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/data/MetaMapper.java b/src/main/java/com/lf/server/mapper/data/MetaMapper.java deleted file mode 100644 index a56c4ac..0000000 --- a/src/main/java/com/lf/server/mapper/data/MetaMapper.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.data.MetaEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鍏冩暟鎹� - * @author WWW - */ -@Mapper -@Repository -public interface MetaMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param depcode 鍗曚綅缂栫爜 - * @param dircode 鐩綍缂栫爜 - * @param verid 鐗堟湰ID - * @param name 鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectCount(String depcode, String dircode, Integer verid, String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param depcode 鍗曚綅缂栫爜 - * @param dircode 鐩綍缂栫爜 - * @param verid 鐗堟湰ID - * @param name 鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<MetaEntity> selectByPage(String depcode, String dircode, Integer verid, String name, Integer limit, Integer offset); - - /** - * 鏌ヨ璁板綍鏁� - * - * @param depcode - * @param dirs - * @param name - * @return - */ - public Integer selectMetasForCount(String depcode, String dirs, String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param depcode - * @param dirs - * @param name - * @param limit - * @param offset - * @return - */ - public List<MetaEntity> selectMetasForPage(String depcode, String dirs, String name, Integer limit, Integer offset); - - /** - * 鏌ヨ涓婁紶璁板綍鏁� - * - * @param name 鍚嶇О - * @param createUser 鐢ㄦ埛ID - * @param types 鏂囦欢绫诲瀷 - * @return 璁板綍鏁� - */ - public Integer selectCountForUpload(String name, Integer createUser, String types); - - /** - * 鍒嗛〉鏌ヨ涓婁紶璁板綍 - * - * @param name 鍚嶇О - * @param createUser 鐢ㄦ埛ID - * @param types 鏂囦欢绫诲瀷 - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<MetaEntity> selectByPageForUpload(String name, Integer createUser, String types, Integer limit, Integer offset); - - /** - * 鏍规嵁鐖禝D鏌ヨ璁板綍鏁� - * - * @param metaid - * @param name - * @return - */ - public Integer selectCountByPid(Integer metaid, String name); - - /** - * 鏍规嵁鐖禝D鍒嗛〉鏌ヨ - * - * @param metaid - * @param name - * @param limit - * @param offset - * @return - */ - public List<MetaEntity> selectPageByPid(Integer metaid, String name, Integer limit, Integer offset); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public MetaEntity selectById(int id); - - /** - * 鏍规嵁GUID鏌ヨ - * - * @param guid 鏂囦欢GUID - * @param dircode 鐩綍缂栫爜 - * @param tab 琛ㄥ悕 - * @return - */ - public MetaEntity selectByGuid(String guid, String dircode, String tab); - - /** - * 鏍规嵁澶氫釜ID鏌ヨ鍏冩暟鎹紙鏁版嵁琛級 - * - * @param ids - * @return - */ - public List<MetaEntity> selectByIdsForTab(String ids); - - /** - * 鏌ヨ鍏冩暟鎹枃浠� - * - * @param ids 鍏冩暟鎹甀D闆嗗悎 - * @return 鍏冩暟鎹枃浠堕泦鍚� - */ - public List<MetaEntity> selectMetaFiles(List<Integer> ids); - - /** - * 鏌ヨExcel鍏冩暟鎹� - * - * @param ids 鍏冩暟鎹甀D闆嗗悎 - * @param tabs 琛ㄥ悕瀛楃涓� - * @return 鍏冩暟鎹枃浠堕泦鍚� - */ - public List<MetaEntity> selectXlsAnnex(Integer[] ids, String tabs); - - /** - * 鏍规嵁鐩綍缂栫爜鏌ヨ鍏冩暟鎹枃浠� - * - * @param dircode - * @return - */ - public List<MetaEntity> selectMetasByDirCode(String dircode); - - /** - * 鏌ヨ鍏冩暟鎹腑婧㈠嚭鐨勫崟浣岻D - * - * @param ids - * @param depcode - * @return - */ - public List<String> selectMetaOverflowDep(String ids, String depcode); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(MetaEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<MetaEntity> list); - - /** - * 鍒犻櫎澶氭潯 - * - * @param sql - * @param ids - * @return - */ - public Integer deletes(String sql, String ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(MetaEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<MetaEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/data/PublishMapper.java b/src/main/java/com/lf/server/mapper/data/PublishMapper.java deleted file mode 100644 index 2801eb5..0000000 --- a/src/main/java/com/lf/server/mapper/data/PublishMapper.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.data.PublishEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鏁版嵁鍙戝竷 - * @author WWW - */ -@Mapper -@Repository -public interface PublishMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name 鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectCount(String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name 鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<PublishEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public PublishEntity selectById(int id); - - /** - * 鏍规嵁ID瀛楃涓叉煡璇� - * - * @param ids ID瀛楃涓� - * @return 璁板綍闆嗗悎 - */ - public List<PublishEntity> selectByIds(String ids); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(PublishEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<PublishEntity> list); - - /** - * 鎻掑叆鏁版嵁鍙戝竷-涓嬭浇琛� - * - * @param pubid - * @param downid - * @param createUser - * @return - */ - public Integer insertPubDown(Integer pubid, Integer downid, Integer createUser); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(String ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(PublishEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<PublishEntity> list); - - /** - * 鏌ヨ鍏冩暟鎹褰曟暟 - * - * @param depcode 鍗曚綅缂栫爜 - * @param dircode 鐩綍缂栫爜 - * @param verid 鐗堟湰ID - * @param types 绫诲埆 - * @param name 鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectMetasByCount(String depcode, String dircode, Integer verid, String types, String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param depcode 鍗曚綅缂栫爜 - * @param dircode 鐩綍缂栫爜 - * @param verid 鐗堟湰ID - * @param types 绫诲埆 - * @param name 鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<MetaEntity> selectMetasByPage(String depcode, String dircode, Integer verid, String types, String name, Integer limit, Integer offset); -} diff --git a/src/main/java/com/lf/server/mapper/data/StyleMapper.java b/src/main/java/com/lf/server/mapper/data/StyleMapper.java deleted file mode 100644 index 9db0b55..0000000 --- a/src/main/java/com/lf/server/mapper/data/StyleMapper.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.data.StyleEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.List; - -/** - * 鏍峰紡绠$悊 - * @author sws - * @date 2022-09-26 - */ -@Mapper -@ResponseBody -public interface StyleMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name 鏍峰紡鍚� - * @return 璁板綍鏁� - */ - public Integer selectCount(String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name 鏍峰紡鍚� - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<StyleEntity> selectByPage(String name, Integer limit, Integer offset); - - /** - * 鎻掑叆涓�鏉� - * - * @param styleEntity - * @return - */ - public Integer insertStyle(StyleEntity styleEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertStyles(List<StyleEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteStyle(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteStyles(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param styleEntity - * @return - */ - public Integer updateStyle(StyleEntity styleEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public StyleEntity selectStyle(int id); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<StyleEntity> selectStyleAll(); -} diff --git a/src/main/java/com/lf/server/mapper/data/UploadMapper.java b/src/main/java/com/lf/server/mapper/data/UploadMapper.java deleted file mode 100644 index 573863b..0000000 --- a/src/main/java/com/lf/server/mapper/data/UploadMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.data.CoordEntity; -import com.lf.server.entity.data.DirEntity; -import com.lf.server.entity.data.FmeLogEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.List; - -/** - * 鏁版嵁涓婁紶 - * @author WWW - */ -@Mapper -@ResponseBody -public interface UploadMapper { - /** - * 鏌ヨ鍧愭爣绯� - * - * @param zoning - * @return - */ - public List<CoordEntity> selectCoords(String zoning); - - /** - * 鏍规嵁EPSG缂栫爜缁熻 - * - * @param epsgCode - * @return - */ - public Integer selectCount4Coord(String epsgCode); - - /** - * 鏌ヨ椤圭洰鍚嶇О - * - * @return - */ - public List<DirEntity> selectProject(); - - /** - * 鏌ヨFME鏃ュ織 - * - * @param parentid - * @return - */ - public List<FmeLogEntity> selectFmeLog(String parentid); -} diff --git a/src/main/java/com/lf/server/mapper/data/VerMapper.java b/src/main/java/com/lf/server/mapper/data/VerMapper.java deleted file mode 100644 index c3445e0..0000000 --- a/src/main/java/com/lf/server/mapper/data/VerMapper.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.lf.server.mapper.data; - -import com.lf.server.entity.data.VerEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.List; - -/** - * 鐗堟湰琛� - * @author sws - * @date 2022-09-29 - */ -@Mapper -@ResponseBody -public interface VerMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param dirid 鐩綍ID - * @param name 鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectCount(Integer dirid, String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param dirid 鐩綍ID - * @param name 鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<VerEntity> selectByPage(Integer dirid, String name, Integer limit, Integer offset); - - /** - * 鏍规嵁鐩綍ID鏌ヨ鐗堟湰鍒楄〃 - * - * @param dirid - * @return - */ - public List<VerEntity> selectByDirid(Integer dirid); - - /** - * 鎻掑叆涓�鏉� - * - * @param verEntity - * @return - */ - public Integer insertVersion(VerEntity verEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertVersions(List<VerEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteVersion(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteVersions(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param verEntity - * @return - */ - public Integer updateVersion(VerEntity verEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public VerEntity selectVersion(int id); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<VerEntity> selectVersionAll(); -} diff --git a/src/main/java/com/lf/server/mapper/show/ApplyMapper.java b/src/main/java/com/lf/server/mapper/show/ApplyMapper.java deleted file mode 100644 index 55eeaa3..0000000 --- a/src/main/java/com/lf/server/mapper/show/ApplyMapper.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.lf.server.mapper.show; - -import com.lf.server.entity.show.ApplyEntity; -import com.lf.server.entity.show.FlowEntity; -import com.lf.server.entity.sys.UserEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.sql.Timestamp; -import java.util.List; - -/** - * 鏁版嵁鐢宠 - * @author WWW - */ -@Mapper -@Repository -public interface ApplyMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param uname 鐢ㄦ埛鍚� - * @param status 瀹℃牳鐘舵�� - * @param start 寮�濮嬫椂闂� - * @param end 缁撴潫鏃堕棿 - * @return 璁板綍鏁� - */ - public Integer selectCount(String uname, Integer status, Timestamp start, Timestamp end); - - /** - * 鍒嗛〉鏌ヨ - * - * @param userid 鐢ㄦ埛ID - * @param uname 鐢ㄦ埛鍚� - * @param status 瀹℃牳鐘舵�� - * @param start 寮�濮嬫椂闂� - * @param end 缁撴潫鏃堕棿 - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<ApplyEntity> selectByPage(Integer userid, String uname, Integer status, Timestamp start, Timestamp end, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<ApplyEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public ApplyEntity selectById(int id); - - /** - * 鏍规嵁鍗曚綅缂栫爜鏌ヨ鐢ㄦ埛 - * - * @param depcode 鍗曚綅缂栫爜 - * @return 鐢ㄦ埛 - */ - public UserEntity selectUserByDepcode(String depcode); - - /** - * 鏌ヨ寰呭鏍告暟 - * - * @param userid 鐢ㄦ埛ID - * @return 寰呭鏍告暟 - */ - public Integer selectSubmits(Integer userid); - - /** - * 鏌ヨ娴佺▼ - * - * @param applyid 鏁版嵁鐢宠ID - * @return 鏁版嵁娴佺▼ - */ - public List<FlowEntity> selectFlows(Integer applyid); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(ApplyEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<ApplyEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(ApplyEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<ApplyEntity> list); - - /** - * 搴熷純鐢宠 - * - * @param userid 鐢ㄦ埛ID - * @param id 鏁版嵁鐢宠ID - * @return 琛屾暟 - */ - public Integer updateForDiscard(Integer userid, Integer id); - - /** - * 閲嶆柊鎻愪氦 - * - * @param userid 鐢ㄦ埛ID - * @param id 鏁版嵁鐢宠ID - * @return 琛屾暟 - */ - public Integer updateForResubmit(Integer userid, Integer id); - - /** - * 鎻愪氦娴佺▼ - * - * @param userid 鐢ㄦ埛ID - * @param applyid 鐢宠娴佺▼ID - * @param flowId 鐢宠娴佺▼ID - * @return 琛屾暟 - */ - public Integer updateForSubmit(Integer userid, Integer applyid, Integer flowId); - - /** - * 鎵撳洖娴佺▼ - * - * @param userid 鐢ㄦ埛ID - * @param applyid 鐢宠娴佺▼ID - * @param flowId 鐢宠娴佺▼ID - * @return 琛屾暟 - */ - public Integer updateForReject(Integer userid, Integer applyid, Integer flowId); -} diff --git a/src/main/java/com/lf/server/mapper/show/FlowMapper.java b/src/main/java/com/lf/server/mapper/show/FlowMapper.java deleted file mode 100644 index 8d02b4b..0000000 --- a/src/main/java/com/lf/server/mapper/show/FlowMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.lf.server.mapper.show; - -import com.lf.server.entity.show.FlowEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鐢宠娴佺▼ - * @author WWW - */ -@Mapper -@Repository -public interface FlowMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param userid 鐢ㄦ埛ID - * @return 璁板綍鏁� - */ - public Integer selectCount(Integer userid); - - /** - * 鍒嗛〉鏌ヨ - * - * @param userid 鐢ㄦ埛ID - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<FlowEntity> selectByPage(Integer userid, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<FlowEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public FlowEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(FlowEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<FlowEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(FlowEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<FlowEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/show/MarkMapper.java b/src/main/java/com/lf/server/mapper/show/MarkMapper.java deleted file mode 100644 index f5ad5c8..0000000 --- a/src/main/java/com/lf/server/mapper/show/MarkMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.lf.server.mapper.show; - -import com.lf.server.entity.show.MarkEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鏍囩粯 - * @author WWW - */ -@Mapper -@Repository -public interface MarkMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param uid 鐢ㄦ埛ID - * @return 璁板綍鏁� - */ - public Integer selectCount(Integer uid); - - /** - * 鍒嗛〉鏌ヨ - * - * @param uid 鐢ㄦ埛ID - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<MarkEntity> selectByPage(Integer uid, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<MarkEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public MarkEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(MarkEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<MarkEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(MarkEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<MarkEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/show/ModelMapper.java b/src/main/java/com/lf/server/mapper/show/ModelMapper.java deleted file mode 100644 index 5bb801e..0000000 --- a/src/main/java/com/lf/server/mapper/show/ModelMapper.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.lf.server.mapper.show; - -import com.lf.server.entity.show.ModelEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 妯″瀷 - * @author WWW - */ -@Mapper -@Repository -public interface ModelMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param layerid 鍥惧眰ID - * @return 璁板綍鏁� - */ - public Integer selectCount(Integer layerid); - - /** - * 鍒嗛〉鏌ヨ - * - * @param layerid 鍥惧眰ID - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<ModelEntity> selectByPage(Integer layerid, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<ModelEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public ModelEntity selectById(int id); - - /** - * 鏍规嵁Guid鏌ヨ妯″瀷 - * - * @param layerid - * @param modelid - * @return - */ - public ModelEntity selectModelByGuid(int layerid, String modelid); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(ModelEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<ModelEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(ModelEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<ModelEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/show/OneMapMapper.java b/src/main/java/com/lf/server/mapper/show/OneMapMapper.java deleted file mode 100644 index ca8428c..0000000 --- a/src/main/java/com/lf/server/mapper/show/OneMapMapper.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.lf.server.mapper.show; - -import com.lf.server.entity.show.OneMapEntity; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 绠$綉涓�寮犲浘Mapper - * - * @author 閭㈤敠鍙� - */ -@Mapper -@Repository -public interface OneMapMapper { - /** - * 椤圭洰绫诲埆conut - * - * @return {@link List}<{@link String}> - */ - public List<String> projectCategoryCount(); - - /** - * 椤圭洰浣嶇疆conut - * - * @return {@link List}<{@link String}> - */ - public List<String> projectLocationCount(); - - /** - * 鍥藉缁村害conut - * - * @return {@link List}<{@link String}> - */ - public List<String> countryDimensionCount(); - - /** - * 鐪佺淮conut - * - * @return {@link List}<{@link String}> - */ - public List<String> provinceDimensionCount(); - - /** - * 鍏ㄥ浗缁村害-鎸夌収椤硅嚜绫诲瀷缁熻涓嶅悓椤圭洰涓暟 - * - * @return {@link List}<{@link String}> - */ - public List<String> countProjectTypeNumber(); - - /** - * 鏁版嵁瀛樺偍conut - * - * @return {@link List}<{@link String}> - */ - public List<String> dataStorageCount(); - - /** - * 缁熻鏁版嵁绫诲埆 - * - * @return {@link List}<{@link String}> - */ - public List<String> statisticalDataCategories(); - - /** - * 缁熻鏁版嵁鏈嶅姟绫诲瀷 - * - * @return {@link List}<{@link String}> - */ - public List<String> statisticalDataServiceType(); - - /** - * 鐧诲綍浜烘暟缁熻 - * - * @return {@link List}<{@link String}> - */ - public List<String> loginNumberStatistics(); - - /** - * 鏂囦欢鏍煎紡conut - * - * @return {@link List}<{@link String}> - */ - public List<String> fileFormatCount(); - - /** - * 鏁版嵁鐢宠conut - * - * @return {@link List}<{@link String}> - */ - public List<String> dataApplyCount(); - - /** - * 鏁版嵁璁块棶conut - * - * @return {@link List}<{@link String}> - */ - public List<String> dataVisitCount(); - - /** - * 涓嬭浇鏁扮粺璁� - * - * @return {@link List}<{@link String}> - */ - public List<String> countDownloads(); - - /** - * 缁熻椤圭洰鏄剧ず - * - * @return {@link List}<{@link String}> - */ - public List<String> countProjectDisplay(); - - /** - * 閫夋嫨椤圭洰鍙傝鍒楄〃 - * - * @return {@link List}<{@link String}> - */ - public List<String> selectProjectTour(); - - /** - * 缁熻椤圭洰绫诲瀷 - * - * @return {@link List}<{@link String}> - */ - public List<OneMapEntity> selectProjectType1(); - - /** - * 閫夋嫨椤圭洰绫诲瀷 - * - * @param endSql 鏈�缁坰ql - * @return {@link List}<{@link OneMapEntity}> - */ - public List<OneMapEntity> selectProjectTypeOne(@Param("endSql") String endSql); - - /** - * 鏌ヨ琛ㄤ俊鎭� - * - * @param tableName - * @return {@link List}<{@link String}> - */ - public List<String> queryTableInfo(@Param("tableName") String tableName); - - /** - * 璁$畻鍏ㄧ悆绠¢亾鍥� - * - * @return {@link List}<{@link String}> - */ - public List<String> countGlobalPipeMap(); - - /** - * 璁$畻鍏ㄥ浗绠¢亾鍥� - * - * @return {@link List}<{@link String}> - */ - public List<String> countNationalPipeMap(); - - /** - * 鍏ㄥ浗绠$綉鍥捐緭閫佷粙璐ㄩ暱搴� - * - * @return {@link List}<{@link String}> - */ - public List<String> countZhPipeMapLenByMed(); - - /** - * 鍏ㄥ浗绔欏満搴ф暟銆侀榾瀹ゃ�佺閬撴暟绛� - * - * @return {@link List}<{@link String}> - */ - public List<String> countZhPipeStations(); - - /** - * 鎸夐」鐩粺璁¢」鐩瓨鍌ㄩ噺 - * - * @return {@link List}<{@link String}> - */ - public List<String> countStorageByProject(); - - /** - * 閫夋嫨椤圭洰淇℃伅 - * 鏌ヨ椤圭洰淇℃伅 - * - * @param projectCode 椤圭洰缂栫爜 - * @return {@link List}<{@link String}> - */ - public List<String> selectProjectInfo(String projectCode); - - /** - * 閫夋嫨椤圭洰鏂囦欢鍒楄〃 - * - * @return {@link List}<{@link String}> - */ - public List<String> selectProjectFileList(); - - /** - * 璁$畻瀛樺偍椤圭洰 - * - * @param projectCode 椤圭洰浠g爜 - * @return {@link List}<{@link String}> - */ - public List<String> countProjectStorage(String projectCode); - - /** - * 鍗曚釜椤圭洰鏂囦欢鏁伴噺 - * - * @param projectCode 椤圭洰浠g爜 - * @return {@link List}<{@link String}> - */ - public List<String> countProjectType(String projectCode); - - /** - * 缁熻椤圭洰涓� - * - * @param projectCode 椤圭洰浠g爜 - * @return {@link List}<{@link String}> - */ - public List<String> countProjectDown(String projectCode); -} diff --git a/src/main/java/com/lf/server/mapper/show/PipelineMapper.java b/src/main/java/com/lf/server/mapper/show/PipelineMapper.java deleted file mode 100644 index b3c50b4..0000000 --- a/src/main/java/com/lf/server/mapper/show/PipelineMapper.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.lf.server.mapper.show; - -import com.lf.server.entity.show.PipelineEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 绠¢亾鍒嗘瀽鏄犲皠绫� - * @author WWW - */ -@Mapper -@Repository -public interface PipelineMapper { - /** - * 鏌ヨ绠¢亾 - * - * @param name - * @return - */ - public List<PipelineEntity> selectPipelines(String name); - - /** - * 鏌ヨ绠℃ - * - * @return 绠$嚎瀹炰綋绫婚泦鍚� - */ - public List<PipelineEntity> selectSegNames(); - - /** - * 鏌ヨ绠$嚎鍒嗘瀽 - * - * @param tab 琛ㄥ悕 - * @param gid ID - * @return 绠$嚎瀹炰綋绫婚泦鍚� - */ - public List<PipelineEntity> selectPipeAnalysis(String tab, Integer gid); -} diff --git a/src/main/java/com/lf/server/mapper/sys/ArgsMapper.java b/src/main/java/com/lf/server/mapper/sys/ArgsMapper.java deleted file mode 100644 index 9076a73..0000000 --- a/src/main/java/com/lf/server/mapper/sys/ArgsMapper.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.ArgsEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鍙傛暟璁剧疆 - * @author WWW - */ -@Mapper -@Repository -public interface ArgsMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name 鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectCount(String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name 鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<ArgsEntity> selectByPage(String name, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<ArgsEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public ArgsEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(ArgsEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<ArgsEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(ArgsEntity entity); - - /** - * 鏇存柊鏁板�� - * - * @param entity - * @return - */ - public Integer updateForValue(ArgsEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<ArgsEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/sys/AttachMapper.java b/src/main/java/com/lf/server/mapper/sys/AttachMapper.java deleted file mode 100644 index 1dd4808..0000000 --- a/src/main/java/com/lf/server/mapper/sys/AttachMapper.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.data.FmeLogEntity; -import com.lf.server.entity.sys.AttachEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 闄勪欢 - * @author WWW - */ -@Mapper -@Repository -public interface AttachMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name 鏂囦欢鍚� - * @return 璁板綍鏁� - */ - public Integer selectCount(String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name 鏂囦欢鍚� - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<AttachEntity> selectByPage(String name, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<AttachEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public AttachEntity selectById(int id); - - /** - * 鏍规嵁Guid鏌ヨ - * - * @param guid - * @return - */ - public AttachEntity selectByGuid(String guid); - - /** - * 鏍规嵁Guid鏁扮粍鏌ヨ - * - * @param guids - * @return - */ - public List<AttachEntity> selectByGuids(List<String> guids); - - /** - * 鏍规嵁琛ㄥ悕鍜孏UID鏌ヨ - * - * @param tab - * @param tabGuid - * @param guid - * @return - */ - public AttachEntity selectByTabAndGuid(String tab, String tabGuid, String guid); - - /** - * 鏍规嵁琛ㄥ悕鍜孏UID鏁扮粍鏌ヨ - * - * @param tab - * @param guids - * @return - */ - public List<AttachEntity> selectByTabGuids(String tab, List<String> guids); - - /** - * 鏍规嵁琛ㄥ拰GUID鏌ヨ - * - * @param tab - * @param guid - * @return - */ - public List<AttachEntity> selectByTab(String tab, String guid); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(AttachEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<AttachEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(AttachEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<AttachEntity> list); - - /** - * 鏌ヨFME鏃ュ織 - * - * @param tabs - * @return - */ - public List<FmeLogEntity> selectFmeLogs(String tabs); - - /** - * 鏇存柊FME鏃ュ織 - * - * @param id ID - * @return - */ - public Integer updateFmeLog(Integer id); - - /** - * 鏍规嵁鍏冩暟鎹悕绉版彃鍏ラ檮浠� - * - * @param tab - * @param tabGuid - * @param metaName - * @param dirid - * @return - */ - public Integer insertAttachByMeta(String tab, String tabGuid, String metaName, String dirid); -} diff --git a/src/main/java/com/lf/server/mapper/sys/AuthMapper.java b/src/main/java/com/lf/server/mapper/sys/AuthMapper.java deleted file mode 100644 index f0cfc37..0000000 --- a/src/main/java/com/lf/server/mapper/sys/AuthMapper.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.AuthEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.List; - -/** - * 鏉冮檺琛� - * @author - */ - -@Mapper -@ResponseBody -public interface AuthMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name 鍚嶇О - * @return 璁板綍鏁� - */ - public Integer selectCount(String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name 鍚嶇О - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<AuthEntity> selectByPage(String name, Integer limit, Integer offset); - - /** - * 鏍规嵁鑿滃崟鏌ヨ璁板綍鏁� - * - * @param menuid - * @return - */ - public Integer selectCountForMenu(Integer menuid); - - /** - * 鏍规嵁鑿滃崟鍒嗛〉鏌ヨ - * - * @param menuid - * @param limit - * @param offset - * @return - */ - public List<AuthEntity> selectByPageForMenu(Integer menuid, Integer limit, Integer offset); - - /** - * 鎻掑叆涓�鏉� - * - * @param authEntity - * @return - */ - public Integer insertAuth(AuthEntity authEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertAuths(List<AuthEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteAuth(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteAuths(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param authEntity - * @return - */ - public Integer updateAuth(AuthEntity authEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public AuthEntity selectAuth(int id); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<AuthEntity> selectAuthAll(); -} diff --git a/src/main/java/com/lf/server/mapper/sys/BlacklistMapper.java b/src/main/java/com/lf/server/mapper/sys/BlacklistMapper.java deleted file mode 100644 index 1ddcc75..0000000 --- a/src/main/java/com/lf/server/mapper/sys/BlacklistMapper.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.BlacklistEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 榛戝悕鍗� - * @author WWW - */ -@Mapper -@Repository -public interface BlacklistMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param ip IP鍦板潃 - * @param type 绫诲埆 - * @return 璁板綍鏁� - */ - public Integer selectCount(String ip, Integer type); - - /** - * 鍒嗛〉鏌ヨ - * - * @param ip IP鍦板潃 - * @param type 绫诲埆 - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<BlacklistEntity> selectByPage(String ip, Integer type, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<BlacklistEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public BlacklistEntity selectById(int id); - - /** - * 鏌ヨIP鍒楄〃 - * @param type 绫诲埆 - * @return - */ - public List<String> selectIpList(Integer type); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(BlacklistEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<BlacklistEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(BlacklistEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<BlacklistEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/sys/DepMapper.java b/src/main/java/com/lf/server/mapper/sys/DepMapper.java deleted file mode 100644 index c02ddc8..0000000 --- a/src/main/java/com/lf/server/mapper/sys/DepMapper.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.ctrl.IdNameEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; -import com.lf.server.entity.sys.DepEntity; - -import java.util.List; - -/** - * 缁勭粐鏈烘瀯 - * @author sws - * @date 2022-09-23 - */ - -@Mapper -@Repository -public interface DepMapper { - /** - * 鎻掑叆涓�鏉� - * - * @param depEntity - * @return - */ - public Integer insertDep(DepEntity depEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertDeps(List<DepEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteDep(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteDeps(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param depEntity - * @return - */ - public Integer updateDep(DepEntity depEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public DepEntity selectDep(int id); - - /** - * 鏍规嵁鍗曚綅缂栫爜鏁扮粍鏌ヨ - * - * @param codes - * @return - */ - public List<IdNameEntity> selectDepsByCodes(String[] codes); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<DepEntity> selectDepAll(); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updateDeps(List<DepEntity> list); - - /** - * 閫掑綊鏌ヨ - * - * @param name - * @return - */ - public List<DepEntity> selectDepRecursive(String name); -} diff --git a/src/main/java/com/lf/server/mapper/sys/DownlogMapper.java b/src/main/java/com/lf/server/mapper/sys/DownlogMapper.java deleted file mode 100644 index c25bc9b..0000000 --- a/src/main/java/com/lf/server/mapper/sys/DownlogMapper.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.DownlogEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.sql.Timestamp; -import java.util.List; - -/** - * 涓嬭浇鏃ュ織 - * @author WWW - */ -@Mapper -@Repository -public interface DownlogMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param uname - * @param type - * @param start - * @param end - * @return - */ - public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end); - - /** - * 鍒嗛〉鏌ヨ - * - * @param uname - * @param type - * @param start - * @param end - * @param limit - * @param offset - * @return - */ - public List<DownlogEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<DownlogEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public DownlogEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(DownlogEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<DownlogEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(DownlogEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<DownlogEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/sys/LoginMapper.java b/src/main/java/com/lf/server/mapper/sys/LoginMapper.java deleted file mode 100644 index 197ed25..0000000 --- a/src/main/java/com/lf/server/mapper/sys/LoginMapper.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.LoginEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.sql.Timestamp; -import java.util.List; - -/** - * 鐧诲綍鏃ュ織 - * @author sws - * @date 2022-09-28 - */ -@Mapper -@ResponseBody -public interface LoginMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param uname - * @param type - * @param start - * @param end - * @return - */ - public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end); - - /** - * 鍒嗛〉鏌ヨ - * - * @param uname - * @param type - * @param start - * @param end - * @param limit - * @param offset - * @return - */ - public List<LoginEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); - - /** - * 鎻掑叆涓�鏉� - * - * @param loginEntity - * @return - */ - public Integer insertLogin(LoginEntity loginEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertLogins(List<LoginEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteLogin(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteLogins(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param loginEntity - * @return - */ - public Integer updateLogin(LoginEntity loginEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public LoginEntity selectLogin(int id); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<LoginEntity> selectLoginAll(); - - - /** - * 鐢ㄦ埛鐧诲綍鐘舵�� - * - * @return - */ - public List<LoginEntity> selectLoginCounts(); - -} diff --git a/src/main/java/com/lf/server/mapper/sys/MenuAuthMapper.java b/src/main/java/com/lf/server/mapper/sys/MenuAuthMapper.java deleted file mode 100644 index 35e8f88..0000000 --- a/src/main/java/com/lf/server/mapper/sys/MenuAuthMapper.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.MenuAuthEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鑿滃崟-鏉冮檺 - * @author WWW - */ -@Mapper -@Repository -public interface MenuAuthMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param menuid 鑿滃崟ID - * @return 璁板綍鏁� - */ - public Integer selectCount(Integer menuid); - - /** - * 鍒嗛〉鏌ヨ - * - * @param menuid 鑿滃崟ID - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<MenuAuthEntity> selectByPage(Integer menuid, Integer limit, Integer offset); - - /** - * 鏍规嵁瑙掕壊ID+鑿滃崟ID鏌ヨ璁板綍鏁� - * - * @param roleid - * @param menuid - * @return - */ - public Integer selectCountForRole(Integer roleid, Integer menuid); - - /** - * 鏍规嵁瑙掕壊ID+鑿滃崟ID鍒嗛〉鏌ヨ - * - * @param roleid - * @param menuid - * @param limit - * @param offset - * @return - */ - public List<MenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<MenuAuthEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public MenuAuthEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(MenuAuthEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<MenuAuthEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(MenuAuthEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<MenuAuthEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/sys/MenuMapper.java b/src/main/java/com/lf/server/mapper/sys/MenuMapper.java deleted file mode 100644 index 8b23314..0000000 --- a/src/main/java/com/lf/server/mapper/sys/MenuMapper.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.MenuEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鑿滃崟 - * @author sws - * @date 2022.09.24 - */ -@Mapper -@Repository -public interface MenuMapper { - /** - * 鎻掑叆涓�鏉� - * @param menuEntity - * @return - */ - public Integer insertMenu(MenuEntity menuEntity); - - /** - * 鎻掑叆澶氭潯 - * @param list - * @return - */ - public Integer insertMenus(List<MenuEntity> list); - /** - * 鍒犻櫎涓�鏉� - * @param id - * @return - */ - public Integer deleteMenu(int id); - - /** - * 鍒犻櫎澶氭潯 - * @param ids - * @return - */ - public Integer deleteMenus(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * @param menuEntity - * @return - */ - public Integer updateMenu(MenuEntity menuEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * @param id - * @return - */ - public MenuEntity selectMenu(int id); - - /** - * 鏌ヨ鎵�鏈� - * @return - */ - public List<MenuEntity> selectMenuAll(); - - /** - * 鏇存柊澶氭潯 - * @param list - * @return - */ - public Integer updateMenus(List<MenuEntity> list); - - /** - * 閫掑綊鏌ヨ - * @param name - * @return - */ - public List<MenuEntity> selectMenuRecursive(String name); -} diff --git a/src/main/java/com/lf/server/mapper/sys/MetaDownMapper.java b/src/main/java/com/lf/server/mapper/sys/MetaDownMapper.java deleted file mode 100644 index 835bc2c..0000000 --- a/src/main/java/com/lf/server/mapper/sys/MetaDownMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.MetaDownEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鍏冩暟鎹�-涓嬭浇 - * @author WWW - */ -@Mapper -@Repository -public interface MetaDownMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param metaid 鍏冩暟鎹甀D - * @return 璁板綍鏁� - */ - public Integer selectCount(Integer metaid); - - /** - * 鍒嗛〉鏌ヨ - * - * @param metaid 鍏冩暟鎹甀D - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<MetaDownEntity> selectByPage(Integer metaid, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<MetaDownEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public MetaDownEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(MetaDownEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<MetaDownEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(MetaDownEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<MetaDownEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/sys/OperateMapper.java b/src/main/java/com/lf/server/mapper/sys/OperateMapper.java deleted file mode 100644 index 4f4db6b..0000000 --- a/src/main/java/com/lf/server/mapper/sys/OperateMapper.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.OperateEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.sql.Timestamp; -import java.util.List; - -/** - * 鎿嶄綔鏃ュ織 - * @author sws - * @date 2022-09-28 - */ -@Mapper -@ResponseBody -public interface OperateMapper { - /** - * 鏌ヨ璁板綍鏁� - * @param uname - * @param type - * @param start - * @param end - * @return - */ - public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end); - - /** - * 鍒嗛〉鏌ヨ - * @param uname - * @param type - * @param start - * @param end - * @param limit - * @param offset - * @return - */ - public List<OperateEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); - - /** - * 鎻掑叆涓�鏉� - * - * @param operateEntity - * @return - */ - public Integer insertOperate(OperateEntity operateEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertOperates(List<OperateEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteOperate(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteOperates(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param operateEntity - * @return - */ - public Integer updateOperate(OperateEntity operateEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public OperateEntity selectOperate(int id); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<OperateEntity> selectOperateAll(); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<OperateEntity> operateCount(); - - -} diff --git a/src/main/java/com/lf/server/mapper/sys/ReportMapper.java b/src/main/java/com/lf/server/mapper/sys/ReportMapper.java deleted file mode 100644 index 3b03c0a..0000000 --- a/src/main/java/com/lf/server/mapper/sys/ReportMapper.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.ctrl.CountEntity; -import com.lf.server.entity.sys.ReportEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鎶ュ憡妯℃澘 - * @author WWW - */ -@Mapper -@Repository -public interface ReportMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name 鍚嶇О - * @param code 缂栫爜 - * @return 璁板綍鏁� - */ - public Integer selectCount(String name, String code); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name 鍚嶇О - * @param code 缂栫爜 - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<ReportEntity> selectByPage(String name, String code, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<ReportEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public ReportEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(ReportEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<ReportEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(ReportEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<ReportEntity> list); - - /** - * 鏁版嵁閲忕粺璁� - * - * @return - */ - public List<CountEntity> countSizes(); - - /** - * 鏈嶅姟璋冪敤閲忕粺璁� - * - * @return - */ - public List<CountEntity> countServices(); - - /** - * 鐢ㄦ埛娴侀噺缁熻 - * - * @return - */ - public List<CountEntity> countOperates(); -} diff --git a/src/main/java/com/lf/server/mapper/sys/ResMapper.java b/src/main/java/com/lf/server/mapper/sys/ResMapper.java deleted file mode 100644 index 57ad431..0000000 --- a/src/main/java/com/lf/server/mapper/sys/ResMapper.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.ResEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.List; - -/** - * 璧勬簮琛� - * @author sws - * @date 2022-09-28 - */ -@Mapper -@ResponseBody -public interface ResMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name 琛ㄥ悕 - * @return 璁板綍鏁� - */ - public Integer selectCount(String name); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name 琛ㄥ悕 - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<ResEntity> selectByPage(String name, Integer limit, Integer offset); - - /** - * 鏍规嵁瑙掕壊鏌ヨ璁板綍鏁� - * - * @param roleid - * @return - */ - public Integer selectCountForRole(Integer roleid); - - /** - * 鏍规嵁瑙掕壊鍒嗛〉鏌ヨ - * - * @param roleid - * @param limit - * @param offset - * @return - */ - public List<ResEntity> selectByPageForRole(Integer roleid, Integer limit, Integer offset); - - /** - * 鎻掑叆涓�鏉� - * - * @param resEntity - * @return - */ - public Integer insertRes(ResEntity resEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertRess(List<ResEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteRes(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteRess(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param resEntity - * @return - */ - public Integer updateRes(ResEntity resEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public ResEntity selectRes(int id); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<ResEntity> selectResAll(); - - - -} diff --git a/src/main/java/com/lf/server/mapper/sys/ResOpMapper.java b/src/main/java/com/lf/server/mapper/sys/ResOpMapper.java deleted file mode 100644 index 3de8a7a..0000000 --- a/src/main/java/com/lf/server/mapper/sys/ResOpMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.ResOpEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.sql.Timestamp; -import java.util.List; - -/** - * 璧勬簮鎿嶄綔 - * @author sws - * @date 2022-09-28 - */ -@Mapper -@ResponseBody -public interface ResOpMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name - * @param type - * @param start - * @param end - * @return - */ - public Integer selectCount(String name, Integer type, Timestamp start, Timestamp end); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name - * @param type - * @param start - * @param end - * @param limit - * @param offset - * @return - */ - public List<ResOpEntity> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); - - /** - * 鎻掑叆涓�鏉� - * - * @param resOpEntity - * @return - */ - public Integer insertResOp(ResOpEntity resOpEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertResOps(List<ResOpEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteResOp(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteResOps(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param resOpEntity - * @return - */ - public Integer updateResOp(ResOpEntity resOpEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public ResOpEntity selectResOp(int id); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<ResOpEntity> selectResOpAll(); -} diff --git a/src/main/java/com/lf/server/mapper/sys/RoleMapper.java b/src/main/java/com/lf/server/mapper/sys/RoleMapper.java deleted file mode 100644 index 05bcc10..0000000 --- a/src/main/java/com/lf/server/mapper/sys/RoleMapper.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.RoleEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.List; - -/** - * 瑙掕壊琛� - * @author sws - * @date 2022-09-29 - */ -@Mapper -@ResponseBody -public interface RoleMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name 鍚嶇О - * @param depid 鍗曚綅ID - * @return 璁板綍鏁� - */ - public Integer selectCount(String name, Integer depid); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name 鍚嶇О - * @param depid 鍗曚綅ID - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<RoleEntity> selectByPage(String name, Integer depid, Integer limit, Integer offset); - - /** - * 鎻掑叆涓�鏉� - * - * @param roleEntity - * @return - */ - public Integer insertRole(RoleEntity roleEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertRoles(List<RoleEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteRole(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteRoles(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param roleEntity - * @return - */ - public Integer updateRole(RoleEntity roleEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public RoleEntity selectRole(int id); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<RoleEntity> selectRoleAll(); -} diff --git a/src/main/java/com/lf/server/mapper/sys/RoleMenuAuthMapper.java b/src/main/java/com/lf/server/mapper/sys/RoleMenuAuthMapper.java deleted file mode 100644 index 9e25f34..0000000 --- a/src/main/java/com/lf/server/mapper/sys/RoleMenuAuthMapper.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.RoleMenuAuthEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 瑙掕壊-鑿滃崟 - * @author WWW - */ -@Mapper -@Repository -public interface RoleMenuAuthMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param roleid 瑙掕壊ID - * @return 璁板綍鏁� - */ - public Integer selectCount(Integer roleid); - - /** - * 鍒嗛〉鏌ヨ - * - * @param roleid 瑙掕壊ID - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<RoleMenuAuthEntity> selectByPage(Integer roleid, Integer limit, Integer offset); - - /** - * 鏍规嵁瑙掕壊ID+鑿滃崟ID鏌ヨ璁板綍鏁� - * - * @param roleid - * @param menuid - * @return - */ - public Integer selectCountForRole(Integer roleid, Integer menuid); - - /** - * 鏍规嵁瑙掕壊ID+鑿滃崟ID鍒嗛〉鏌ヨ - * - * @param roleid - * @param menuid - * @param limit - * @param offset - * @return - */ - public List<RoleMenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<RoleMenuAuthEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public RoleMenuAuthEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(RoleMenuAuthEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<RoleMenuAuthEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(RoleMenuAuthEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<RoleMenuAuthEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/sys/RoleResMapper.java b/src/main/java/com/lf/server/mapper/sys/RoleResMapper.java deleted file mode 100644 index f841afa..0000000 --- a/src/main/java/com/lf/server/mapper/sys/RoleResMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.RoleResEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 瑙掕壊-璧勬簮 - * @author WWW - */ -@Mapper -@Repository -public interface RoleResMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param roleid 瑙掕壊ID - * @return 璁板綍鏁� - */ - public Integer selectCount(Integer roleid); - - /** - * 鍒嗛〉鏌ヨ - * - * @param roleid 瑙掕壊ID - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<RoleResEntity> selectByPage(Integer roleid, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<RoleResEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public RoleResEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(RoleResEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<RoleResEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(RoleResEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<RoleResEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/sys/RoleUserMapper.java b/src/main/java/com/lf/server/mapper/sys/RoleUserMapper.java deleted file mode 100644 index faca9be..0000000 --- a/src/main/java/com/lf/server/mapper/sys/RoleUserMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.RoleUserEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 瑙掕壊-鐢ㄦ埛 - * @author WWW - */ -@Mapper -@Repository -public interface RoleUserMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param roleid 瑙掕壊ID - * @return 璁板綍鏁� - */ - public Integer selectCount(Integer roleid); - - /** - * 鍒嗛〉鏌ヨ - * - * @param roleid 瑙掕壊ID - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<RoleUserEntity> selectByPage(Integer roleid, Integer limit, Integer offset); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<RoleUserEntity> selectAll(); - - /** - * 鏍规嵁ID鏌ヨ - * - * @param id - * @return - */ - public RoleUserEntity selectById(int id); - - /** - * 鎻掑叆涓�鏉� - * - * @param entity - * @return - */ - public Integer insert(RoleUserEntity entity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer inserts(List<RoleUserEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer delete(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deletes(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param entity - * @return - */ - public Integer update(RoleUserEntity entity); - - /** - * 鏇存柊澶氭潯 - * - * @param list - * @return - */ - public Integer updates(List<RoleUserEntity> list); -} diff --git a/src/main/java/com/lf/server/mapper/sys/TokenMapper.java b/src/main/java/com/lf/server/mapper/sys/TokenMapper.java deleted file mode 100644 index 0be1a6f..0000000 --- a/src/main/java/com/lf/server/mapper/sys/TokenMapper.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.TokenEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.List; - -/** - * 浠ょ墝琛� - * @author sws - * @date 2022-09-28 - */ - -@Mapper -@ResponseBody -public interface TokenMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param name - * @param type - * @return - */ - public Integer selectCount(String name, Integer type); - - /** - * 鍒嗛〉鏌ヨ - * - * @param name - * @param type - * @param limit - * @param offset - * @return - */ - public List<TokenEntity> selectByPage(String name, Integer type, Integer limit, Integer offset); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public TokenEntity selectToken(int id); - - /** - * 鏍规嵁token鍊兼煡璇竴鏉¤褰� - * - * @param token - * @return - */ - public TokenEntity selectOneByToken(String token); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<TokenEntity> selectTokenAll(); - - /** - * 鎻掑叆涓�鏉� - * - * @param tokenEntity - * @return - */ - public Integer insertToken(TokenEntity tokenEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param list - * @return - */ - public Integer insertTokens(List<TokenEntity> list); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteToken(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteTokens(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param tokenEntity - * @return - */ - public Integer updateToken(TokenEntity tokenEntity); - - /** - * 鏇存柊浠ょ墝涓哄け鏁� - * - * @param tokenEntity - * @return - */ - public Integer updateTokenExpire(TokenEntity tokenEntity); -} diff --git a/src/main/java/com/lf/server/mapper/sys/UserMapper.java b/src/main/java/com/lf/server/mapper/sys/UserMapper.java deleted file mode 100644 index d94f5df..0000000 --- a/src/main/java/com/lf/server/mapper/sys/UserMapper.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.lf.server.mapper.sys; - -import com.lf.server.entity.sys.RoleEntity; -import com.lf.server.entity.sys.UserEntity; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 鐢ㄦ埛绠$悊 - * @author sws - * @date 2022-09-27 - */ -@Mapper -@Repository -public interface UserMapper { - /** - * 鏌ヨ璁板綍鏁� - * - * @param uname 鐢ㄦ埛鍚� - * @param depcode 鍗曚綅缂栫爜 - * @return 璁板綍鏁� - */ - public Integer selectCount(String uname, String depcode); - - /** - * 鍒嗛〉鏌ヨ - * - * @param uname 鐢ㄦ埗鍚� - * @param depcode 鍗曚綅缂栫爜 - * @param limit 璁板綍鏁� - * @param offset 鍋忕Щ閲� - * @return 鍒楄〃 - */ - public List<UserEntity> selectByPage(String uname, String depcode, Integer limit, Integer offset); - - /** - * 鏍规嵁token鏈夋晥鏈熸煡璇� - * - * @param token - * @return - */ - public UserEntity selectByToken(String token); - - /** - * 鏌ヨ鏄�/鍚︿负Admin - * - * @param id ID - * @return 缁熻鏁� - */ - public Integer selectForIsAdmin(Integer id); - - /** - * 鏌ヨ绠$悊鍛樼敤鎴� - * - * @param type 绠$悊鍛樼被鍒� - * @return - */ - public List<UserEntity> selectAdminUsers(Integer type); - - /** - * 鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊 - * - * @param id 鐢ㄦ埛ID - * @return 瑙掕壊闆嗗悎 - */ - public List<RoleEntity> selectRoleByUserId(Integer id); - - /** - * 鏍规嵁瑙掕壊鏌ヨ鐢ㄦ埛 - * - * @param roleId 瑙掕壊ID - * @return 鐢ㄦ埛闆嗗悎 - */ - public List<UserEntity> selectUserByRoleId(Integer roleId); - - /** - * 鎻掑叆涓�鏉� - * - * @param userEntity - * @return - */ - public Integer insertUser(UserEntity userEntity); - - /** - * 鎻掑叆澶氭潯 - * - * @param userEntity - * @return - */ - public Integer insertUsers(List<UserEntity> userEntity); - - /** - * 鍒犻櫎涓�鏉� - * - * @param id - * @return - */ - public Integer deleteUser(int id); - - /** - * 鍒犻櫎澶氭潯 - * - * @param ids - * @return - */ - public Integer deleteUsers(List<Integer> ids); - - /** - * 鏇存柊涓�鏉� - * - * @param userEntity - * @return - */ - public Integer updateUser(UserEntity userEntity); - - /** - * 鏌ヨ鍗曟潯鏁版嵁 - * - * @param id - * @return - */ - public UserEntity selectUser(int id); - - /** - * 鏍规嵁uid鏌ヨ - * - * @param uid - * @return - */ - public UserEntity selectByUid(String uid); - - /** - * 鏌ヨ鎵�鏈� - * - * @return - */ - public List<UserEntity> selectUserAll(); - - /** - * 鏍规嵁瑙掕壊+鍗曚綅鏌ヨ璁板綍鏁� - * - * @param uname - * @param roleid - * @param depcode - * @return - */ - public Integer selectCountForRole(String uname, Integer roleid, String depcode); - - /** - * 鏍规嵁瑙掕壊+鍗曚綅鍒嗛〉鏌ヨ - * - * @param uname - * @param roleid - * @param depcode - * @param limit - * @param offset - * @return - */ - public List<UserEntity> selectByPageForRole(String uname, Integer roleid, String depcode, Integer limit, Integer offset); - - /** - * 鏇存柊澶氫釜鐢ㄦ埛瀵嗙爜 - * - * @param updateUser - * @param pwd - * @param ids - * @return - */ - public Integer updateUsersPwd(Integer updateUser, String pwd, List<Integer> ids); -} \ No newline at end of file diff --git a/src/main/java/com/lf/server/service/all/BaseQueryService.java b/src/main/java/com/lf/server/service/all/BaseQueryService.java deleted file mode 100644 index 7564465..0000000 --- a/src/main/java/com/lf/server/service/all/BaseQueryService.java +++ /dev/null @@ -1,312 +0,0 @@ -package com.lf.server.service.all; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.lf.server.entity.all.RedisCacheKey; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.IdNameEntity; -import com.lf.server.entity.ctrl.KeyValueEntity; -import com.lf.server.entity.ctrl.TabEntity; -import com.lf.server.entity.data.DictEntity; -import com.lf.server.entity.data.DomainEntity; -import com.lf.server.entity.sys.AttachEntity; -import com.lf.server.helper.AesHelper; -import com.lf.server.helper.ClassHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.all.BaseQueryMapper; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.mapper.all.GeomBaseMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; -import java.util.concurrent.TimeUnit; - -/** - * 鐖舵煡璇㈡湇鍔$被 - * @author WWW - */ -@Service -public class BaseQueryService implements BaseQueryMapper { - @Autowired - BaseQueryMapper baseQueryMapper; - - @Autowired - RedisService redisService; - - /** - * 琛ㄥ悕Map - */ - private static Map<String, String> tabMap = new HashMap<>(3); - - /** - * 娣诲姞杩囨护鏉′欢 - * - * @param wrapper QueryWrapper - * @param filter 鍘熷杩囨护鏉′欢瀛楃涓� - */ - public void addFilterWrapper(QueryWrapper wrapper, String filter) { - if (StringHelper.isEmpty(filter)) { - return; - } - - String[] strs = filter.trim().split(" (?i)and "); - for (String str : strs) { - int start = str.indexOf(" "); - if (start == -1) { - continue; - } - int end = str.indexOf(" ", start + 1); - if (end == -1) { - continue; - } - - String field = str.substring(0, start).trim(); - String express = str.substring(start + 1, end).trim().toLowerCase(); - String value = str.substring(end + 1).trim(); - - addWrapper(wrapper, field, express, getObjectVal(express, value)); - } - } - - /** - * 鑾峰彇鍊煎璞� - * - * @param val 鍊� - * @return 瀵硅薄 - */ - private Object getObjectVal(String express, String val) { - if (StringHelper.isInteger(val)) { - return Long.parseLong(val); - } - if (StringHelper.isNumeric(val)) { - return Double.parseDouble(val); - } - if (StaticData.IN.equals(express)) { - return val; - } - - return val.replace("'", ""); - } - - /** - * 娣诲姞鍖呰鍣� - * - * @param wrapper QueryWrapper - * @param field 瀛楁 - * @param express 琛ㄨ揪寮� - * @param val 鍊� - */ - private void addWrapper(QueryWrapper wrapper, String field, String express, Object val) { - if (StringHelper.isDate(val.toString())) { - wrapper.apply(String.format("%s %s '%s'", field, express, val)); - return; - } - - switch (express) { - case "like": - wrapper.like("UPPER(" + field + ")", val.toString().toUpperCase()); - break; - case ">": - wrapper.gt(field, val); - break; - case ">=": - wrapper.ge(field, val); - break; - case "<>": - case "!=": - wrapper.ne(field, val); - break; - case "=": - wrapper.eq(field, val); - break; - case "<": - wrapper.lt(field, val); - break; - case "<=": - wrapper.le(field, val); - break; - case "in": - if (val.toString().contains(StaticData.SINGLE_QUOTES)) { - wrapper.in(field, getStringList(val.toString())); - } else { - wrapper.in(field, getIntegerList(val.toString())); - } - break; - default: - break; - } - } - - /** - * 鑾峰彇瀛楃涓插垪琛� - */ - private List<String> getStringList(String val) { - return Arrays.asList(val.replace(StaticData.SINGLE_QUOTES, "").split(StaticData.COMMA)); - } - - /** - * 鑾峰彇鏁存暟鍒楄〃 - */ - private List<Integer> getIntegerList(String val) { - List<Integer> list = new ArrayList<>(); - for (String str : val.split(StaticData.COMMA)) { - list.add(Integer.parseInt(str)); - } - - return list; - } - - /** - * 娣诲姞绌洪棿杩囨护鏉′欢 - * - * @param basicMapper 鐖禡apper - * @param wrapper QueryWrapper - * @param wkt WKT锛堣憲鍚嶆枃鏈級 - * @throws Exception 寮傚父 - */ - public void addGeomWrapper(BasicMapper basicMapper, QueryWrapper wrapper, String wkt) throws Exception { - if (basicMapper instanceof GeomBaseMapper && !StringHelper.isEmpty(wkt)) { - wkt = AesHelper.decrypt(wkt); - - Integer srid = getSrid((GeomBaseMapper) basicMapper); - wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid)); - } - } - - /** - * 鑾峰彇鍑犱綍瀵硅薄鐨勭┖闂村弬鑰� - * - * @param basicMapper 绌洪棿鍩虹Mapper - * @return SRID - */ - public Integer getSrid(GeomBaseMapper basicMapper) { - String tab = getTabName(basicMapper); - String key = RedisCacheKey.sridKey(tab); - - Object obj = redisService.get(key); - if (obj instanceof Integer) { - return (Integer) obj; - } - - Integer srid = basicMapper.selectSrid(tab); - if (null == srid) { - return StaticData.I4490; - } - redisService.put(key, srid, 5, TimeUnit.MINUTES); - - return srid; - } - - /** - * 鏍规嵁Mapper鑾峰彇琛ㄥ悕 - * - * @param basicMapper Mapper - * @return 琛ㄥ悕 - */ - public static String getTabName(BasicMapper basicMapper) { - String className = ClassHelper.getClassName(basicMapper); - if (tabMap.containsKey(className)) { - return tabMap.get(className); - } - - return getTabName(className); - } - - /** - * 鏍规嵁Mapper鑾峰彇琛ㄥ悕 - * - * @param className Mapper绫诲悕 - * @return 琛ㄥ悕 - */ - private static String getTabName(String className) { - Class clazz = ClassHelper.getEntityClass(className); - if (clazz == null) { - return null; - } - - TableName annotation = (TableName) clazz.getAnnotation(TableName.class); - - String tabName = annotation.value(); - if (tabName != null && !tabMap.containsKey(className)) { - tabMap.put(className, tabName); - } - - return tabName; - } - - /** - * 娣诲姞缂撳啿鍖鸿繃婊ゆ潯浠� - * - * @param baseMapper 鐖禡apper - * @param wrapper QueryWrapper - * @param wkt WKT锛堣憲鍚嶆枃鏈級 - */ - public void addBufferWrapper(GeomBaseMapper baseMapper, QueryWrapper wrapper, String wkt, double buffer) { - Integer srid = getSrid(baseMapper); - // buffer = buffer * 0.00000899928 - buffer = buffer / 1852 / 60; - - wrapper.apply(String.format("ST_Intersects(geom, ST_Buffer(ST_GeomFromText('%s', %d), %f, 'endcap=round join=round'))", wkt, srid, buffer)); - } - - @Override - public List<IdNameEntity> selectUserFuzzy(String name) { - name = StringHelper.getLikeUpperStr(name); - - return baseQueryMapper.selectUserFuzzy(name); - } - - @Override - public List<IdNameEntity> selectDepFuzzy(String name) { - name = StringHelper.getLikeUpperStr(name); - - return baseQueryMapper.selectDepFuzzy(name); - } - - @Override - public Integer selectTabsForCount(String tab, String field) { - tab = StringHelper.getLikeUpperStr(tab); - - return baseQueryMapper.selectTabsForCount(tab, field); - } - - @Override - public List<TabEntity> selectTabsByPage(String tab, String field, String filters, Integer limit, Integer offset) { - tab = StringHelper.getLikeUpperStr(tab); - - return baseQueryMapper.selectTabsByPage(tab, field, filters, limit, offset); - } - - @Override - public List<DictEntity> selectFields(String ns, String tab) { - return baseQueryMapper.selectFields(ns, tab); - } - - @Override - public List<DomainEntity> selectDomains(String ns, String tab) { - return baseQueryMapper.selectDomains(ns, tab); - } - - @Override - public String selectRoute(double x1, double y1, double x2, double y2) { - return baseQueryMapper.selectRoute(x1, y1, x2, y2); - } - - @Override - public List<KeyValueEntity> selectLocation(String wkt) { - return baseQueryMapper.selectLocation(wkt); - } - - @Override - public List<KeyValueEntity> selectDirTypes(String name) { - name = StringHelper.getLikeUpperStr(name); - - return baseQueryMapper.selectDirTypes(name); - } - - @Override - public List<AttachEntity> selectAnnexByTab(String tab, String gids) { - return baseQueryMapper.selectAnnexByTab(tab, gids); - } -} diff --git a/src/main/java/com/lf/server/service/all/BaseUploadService.java b/src/main/java/com/lf/server/service/all/BaseUploadService.java deleted file mode 100644 index 7f68fdc..0000000 --- a/src/main/java/com/lf/server/service/all/BaseUploadService.java +++ /dev/null @@ -1,538 +0,0 @@ -package com.lf.server.service.all; - -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.data.DirEntity; -import com.lf.server.entity.data.MetaFileEntity; -import com.lf.server.entity.data.VerEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.service.data.DirService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.lang.reflect.Field; -import java.sql.Timestamp; -import java.util.*; - -/** - * 鐖朵笂浼犳湇鍔� - * @author WWW - */ -@Service -public class BaseUploadService { - @Autowired - protected DirService dirService; - - @Autowired - protected PathHelper pathHelper; - - public final Log log = LogFactory.getLog(getClass()); - - /** - * 鏌ヨ鐩綍 - */ - public String selectPath() { - return pathHelper.getTempPathName(); - } - - /** - * 涓婁紶鏂囦欢 - */ - public <T> List<MetaFileEntity> uploadData(T t, String path, boolean isGetGuid, HttpServletRequest req, HttpServletResponse res) throws Exception { - StandardMultipartHttpServletRequest request = (StandardMultipartHttpServletRequest) req; - req.setCharacterEncoding("utf-8"); - res.setContentType("application/json;charset=utf-8"); - - if (t != null) { - setEntity(t, request); - } - - return getFiles(path, isGetGuid, request); - } - - /** - * 璁剧疆瀹炰綋绫� - */ - private <T> void setEntity(T t, StandardMultipartHttpServletRequest req) { - Enumeration<String> enumeration = req.getParameterNames(); - while (enumeration.hasMoreElements()) { - String key = enumeration.nextElement(); - - try { - Field field = t.getClass().getDeclaredField(key); - field.setAccessible(true); - String value = req.getParameter(key); - - switch (field.getType().toString()) { - case "double": - field.set(t, Double.valueOf(value)); - break; - case "long": - field.set(t, Long.valueOf(value)); - break; - case "int": - field.set(t, Integer.valueOf(value)); - break; - case "class java.sql.Timestamp": - field.set(t, Timestamp.valueOf(value)); - break; - //case "class java.lang.String": - default: - field.set(t, value); - break; - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } - - /** - * 鑾峰彇鏂囦欢 - */ - public List<MetaFileEntity> getFiles(String subPath, boolean isGetGuid, StandardMultipartHttpServletRequest req) throws Exception { - List<MetaFileEntity> list = new ArrayList<>(); - - String path = pathHelper.getTempPath(subPath); - Iterator<String> iterator = req.getFileNames(); - while (iterator.hasNext()) { - MultipartFile file = req.getFile(iterator.next()); - if (null == file || StringHelper.isEmpty(file.getOriginalFilename())) { - continue; - } - - MetaFileEntity mf = new MetaFileEntity(); - mf.setName(file.getOriginalFilename()); - - double sizes = FileHelper.sizeToMb(file.getSize()); - mf.setSizes(sizes); - mf.setPath(path + File.separator + mf.getName()); - - file.transferTo(new File(mf.getPath())); - if (isGetGuid) { - mf.setGuid(FileHelper.getFileMd5(mf.getPath())); - } - - list.add(mf); - } - - return list; - } - - /** - * 鏌ヨ鏂囦欢 - */ - public List<MetaFileEntity> selectFiles(String subPath) { - String root = pathHelper.getConfig().getTempPath() + File.separator + subPath; - - File file = new File(root); - if (!file.exists() && !file.isDirectory()) { - return null; - } - File[] files = file.listFiles(); - if (null == files || files.length == 0) { - return null; - } - - List<MetaFileEntity> list = new ArrayList<>(); - for (File f : files) { - String fileName = FileHelper.getFileName(f.getPath()); - String extName = FileHelper.getExtension(fileName); - if (!isExtValid(extName)) { - continue; - } - - MetaFileEntity mf = new MetaFileEntity(); - mf.setName(fileName); - mf.setExtName(extName); - mf.setSizes(FileHelper.sizeToMb(f.length())); - mf.setPath(subPath + File.separator + fileName); - if (!StaticData.ZIP.equals(extName)) { - mf.setGuid(FileHelper.getFileMd5(f.getPath())); - } - - list.add(mf); - } - - return list; - } - - /** - * 鍒犻櫎鏂囦欢 - */ - public Integer deleteFiles(List<MetaFileEntity> list) { - String root = pathHelper.getConfig().getTempPath(); - - int count = 0; - for (MetaFileEntity entity : list) { - if (!StringHelper.isEmpty(entity.getPath())) { - String file = root + File.separator + entity.getPath(); - - File f = new File(file); - if (f.exists()) { - f.delete(); - count++; - } - } - } - - return count; - } - - /** - * 鏌ヨ鏄犲皠 - */ - public List<MetaFileEntity> selectMappers(UserEntity ue, String path, DirEntity dir, VerEntity ver, String epsgCode) { - List<MetaFileEntity> metas = selectFiles(path); - if (null == metas || metas.isEmpty()) { - return null; - } - - List<MetaFileEntity> list = new ArrayList<>(); - List<DirEntity> dirs = dirService.selectRecursiveById(dir.getId()); - for (MetaFileEntity meta : metas) { - meta.setEventid(StringHelper.getGuid()); - meta.setDircode(dir.getCode()); - meta.setDepcode(ue.getDepcode()); - meta.setVerid(ver.getId()); - meta.setCreateUser(ue.getId()); - meta.setEpsgCode(epsgCode); - - if (StaticData.ZIP.equals(meta.getExtName())) { - List<MetaFileEntity> subs = getMapperFiles(path, dir, dirs, meta); - if (null != subs && subs.size() > 0) { - list.addAll(subs); - continue; - } - } - - list.add(meta); - } - setMetaType(list); - - return list; - } - - /** - * 鑾峰彇鏄犲皠鏂囦欢 - */ - private List<MetaFileEntity> getMapperFiles(String path, DirEntity dir, List<DirEntity> dirs, MetaFileEntity meta) { - String tempPath = pathHelper.getConfig().getTempPath(); - String zipFile = tempPath + File.separator + meta.getPath(); - File file = new File(zipFile); - if (!file.exists() || file.isDirectory()) { - return null; - } - - File zipFolder = new File(pathHelper.getConfig().getTempPath() + File.separator + path + "_zip"); - if (!zipFolder.exists() || !zipFolder.isDirectory()) { - zipFolder.mkdirs(); - } - - // String subPath = zipFolder + File.separator + meta.getName().toLowerCase().replace(".zip", "") .replace("锛�","").replace("锛�","").replace(" ","") - String subPath = zipFolder.getPath(); - ZipHelper.unzip(zipFile, subPath); - - List<File> files = new ArrayList<>(); - getFilesByPath(files, subPath); - - return getMapperFiles(files, dir, dirs, meta, tempPath.length() + 1); - } - - /** - * 鏍规嵁璺緞鑾峰彇鏂囦欢 - */ - private void getFilesByPath(List<File> list, String path) { - File file = new File(path); - if (!file.isDirectory()) { - String extName = FileHelper.getExtension(file); - if (isExtValid(extName)) { - list.add(file); - } - return; - } - - if (isGdbFile(file)) { - list.add(file); - return; - } - - File[] files = file.listFiles(); - if (null == files) { - return; - } - for (File f : files) { - if (f.isDirectory()) { - getFilesByPath(list, f.getPath()); - } else { - String extName = FileHelper.getExtension(f); - if (isExtValid(extName)) { - list.add(f); - } - } - } - } - - /** - * 鎵╁睍鏄惁鏈夋晥 - */ - private boolean isExtValid(String extName) { - return StaticData.ALL_EXTENSION.contains(extName) && !StaticData.MAPPER_EXCLUDE_EXT.contains(extName); - } - - /** - * 鑾峰彇鏄犲皠鏂囦欢 - */ - private List<MetaFileEntity> getMapperFiles(List<File> files, DirEntity dir, List<DirEntity> dirs, MetaFileEntity meta, int start) { - List<MetaFileEntity> list = new ArrayList<>(); - for (File f : files) { - boolean isGdb = isGdbFile(f); - if (!isGdb && f.isDirectory()) { - continue; - } - - String fileName = FileHelper.getFileName(f.getPath()); - String extName = FileHelper.getExtension(fileName); - if (!isExtValid(extName) || fileName.startsWith("~")) { - continue; - } - - String dircode = getDirByPath(f.getPath(), fileName, dir, dirs); - boolean isShp = StaticData.SHP.equals(extName); - if (isGdb) { - List<MetaFileEntity> rs = getGdbMappers(f, meta, dircode, start); - if (null != rs && rs.size() > 0) { - list.addAll(rs); - } - continue; - } - - MetaFileEntity mf = createMetaFileEntity(meta); - mf.setDircode(dircode); - mf.setEventid(StringHelper.getGuid()); - mf.setName(fileName); - mf.setExtName(extName); - mf.setPath(f.getPath().substring(start)); - - if (isShp) { - List<String> shpFiles = getShpFiles(f.getPath()); - mf.setTab(fileName.replace(StaticData.SHP, "")); - mf.setSizes(getFilesSize(shpFiles)); - mf.setGuid(getFilesMd5(shpFiles)); - } else { - mf.setSizes(FileHelper.sizeToMb(f.length())); - mf.setGuid(FileHelper.getFileMd5(f.getPath())); - } - list.add(mf); - } - - return list; - } - - /** - * 鍒涘缓鍏冩暟鎹枃浠跺疄浣撶被 - */ - private MetaFileEntity createMetaFileEntity(MetaFileEntity meta) { - MetaFileEntity mf = new MetaFileEntity(); - mf.setDircode(meta.getDircode()); - mf.setDepcode(meta.getDepcode()); - mf.setVerid(meta.getVerid()); - mf.setCreateUser(meta.getCreateUser()); - mf.setEpsgCode(meta.getEpsgCode()); - - return mf; - } - - /** - * 鏍规嵁鏂囦欢璺緞鑾峰彇鐩綍ID - */ - private String getDirByPath(String filePath,String fileName, DirEntity dir, List<DirEntity> dirs) { - if (0 != dir.getPid() || null == dirs || dirs.isEmpty()) { - return dir.getCode(); - } - if (StaticData.SLASH.equals(File.separator)) { - filePath = filePath.replace("/", "\\"); - } - - fileName = fileName.toLowerCase(); - filePath = filePath.toLowerCase(); - for (DirEntity entity : dirs) { - if (filePath.contains(entity.getFullName().toLowerCase() + "\\" + fileName)) { - return entity.getCode(); - } - } - - return dir.getCode(); - } - - /** - * 鑾峰彇SHP鏂囦欢闆嗗悎 - */ - private List<String> getShpFiles(String shpPath) { - List<String> list = new ArrayList<>(); - list.add(shpPath); - - for (int i = 0, c = StaticData.SHP_EXT.size(); i < c; i++) { - String path = shpPath.replace(".shp", StaticData.SHP_EXT.get(i)); - - File f = new File(path); - if (f.exists() && !f.isDirectory()) { - list.add(path); - } - } - - return list; - } - - /** - * 鑾峰彇GDB鏂囦欢闆嗗悎 - */ - private List<String> getGdbFiles(String path) { - List<String> list = new ArrayList<>(); - - File[] files = new File(path).listFiles(); - if (null == files || files.length == 0) { - return list; - } - for (File f : files) { - list.add(f.getPath()); - } - - return list; - } - - /** - * 鑾峰彇澶氭枃浠剁殑MD5 - */ - private String getFilesMd5(List<String> files) { - List<String> list = new ArrayList<>(); - for (String file : files) { - String md5 = FileHelper.getFileMd5(file); - if (null != md5) { - list.add(md5); - } - } - - if (list.size() > 0) { - String str = StringHelper.join(list, ","); - return FileHelper.getStringMd5(str); - } - - return StringHelper.getGuid(); - } - - /** - * 鑾峰彇澶氭枃浠剁殑澶у皬 - */ - private double getFilesSize(List<String> files) { - long size = 0L; - for (String file : files) { - File f = new File(file); - if (f.exists() && !f.isDirectory()) { - size += f.length(); - } - } - - return FileHelper.sizeToMb(size); - } - - /** - * 鑾峰彇GDB鏂囦欢鏄犲皠 - */ - private List<MetaFileEntity> getGdbMappers(File f, MetaFileEntity meta, String dircode, int start) { - List<String> tabs = GdbHelper.getTabNames(f.getPath()); - if (null == tabs || tabs.size() == 0) { - return null; - } - - String fileName = FileHelper.getFileName(f.getPath()); - String extName = FileHelper.getExtension(fileName); - - List<String> gdbFiles = getGdbFiles(f.getPath()); - String md5 = getFilesMd5(gdbFiles); - double sizes = getFilesSize(gdbFiles); - - List<MetaFileEntity> list = new ArrayList<>(); - for (String tab : tabs) { - MetaFileEntity mf = createMetaFileEntity(meta); - mf.setDircode(dircode); - mf.setEventid(StringHelper.getGuid()); - mf.setName(fileName); - mf.setExtName(extName); - mf.setSizes(FileHelper.sizeToMb(f.length())); - mf.setPath(f.getPath().substring(start)); - mf.setTab(tab); - mf.setSizes(sizes); - mf.setGuid(md5); - list.add(mf); - } - - return list; - } - - /** - * 鏄�/鍚︿负GDB鏂囦欢 - */ - private boolean isGdbFile(File f) { - if (f.isDirectory() && f.getName().toLowerCase().endsWith(StaticData.GDB)) { - File[] files = f.listFiles(); - if (null == files || files.length == 0) { - return false; - } - - for (File file : files) { - if ("gdb".equals(file.getName())) { - return true; - } - } - } - - return false; - } - - /** - * 璁剧疆鍏冩暟鎹枃浠剁殑绫诲瀷 - */ - private void setMetaType(List<MetaFileEntity> list) { - for (MetaFileEntity mf : list) { - if (null != mf.getExtName()) { - mf.setType(mf.getExtName().replace(".", "")); - } - } - } - - /** - * 澶勭悊鐩綍 - */ - public void copePath(List<MetaFileEntity> list) { - String basePath = pathHelper.getConfig().getTempPath() + File.separator; - for (MetaFileEntity mf : list) { - mf.setPath(mf.getPath().replace(basePath, "")); - } - } - - /** - * 鑾峰彇鍙傛暟 * - * Enumeration<String> headers = req.getHeaderNames(); - * Enumeration<String> attributes = req.getAttributeNames(); - */ - public Map<String, String> getParams(StandardMultipartHttpServletRequest req) { - Map<String, String> map = new HashMap<>(3); - - Enumeration<String> enumeration = req.getParameterNames(); - while (enumeration.hasMoreElements()) { - String key = enumeration.nextElement(); - String value = req.getParameter(key); - map.put(key, value); - } - - return map; - } -} diff --git a/src/main/java/com/lf/server/service/all/CommonsFileuploadService.java b/src/main/java/com/lf/server/service/all/CommonsFileuploadService.java deleted file mode 100644 index e86abd4..0000000 --- a/src/main/java/com/lf/server/service/all/CommonsFileuploadService.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.lf.server.service.all; - -import com.lf.server.entity.ctrl.FileInfoEntity; -import com.lf.server.helper.PathHelper; -import com.lf.server.helper.StringHelper; -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.fileupload.servlet.ServletFileUpload; -import org.apache.commons.fileupload.servlet.ServletRequestContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * CommonsFileupload涓婁紶鏈嶅姟 - * @author WWW - */ -@Service -public class CommonsFileuploadService { - @Autowired - PathHelper pathHelper; - - private final static Log log = LogFactory.getLog(CommonsFileuploadService.class); - - public Object fileUpload(HttpServletRequest req, HttpServletResponse res) throws Exception { - List<FileItem> items = getFileItem(req, res); - - return copeFileItems(items, req); - } - - /** - * 鑾峰彇鏂囦欢椤� - */ - private List<FileItem> getFileItem(HttpServletRequest req, HttpServletResponse res) throws Exception { - // 澶勭悊涓枃涔辩爜闂 - req.setCharacterEncoding("utf-8"); - // text/html;charset=utf-8 - res.setContentType("application/json;charset=utf-8"); - - // 妫�鏌ヨ姹傛槸/鍚︿负multipart/form-data绫诲瀷 - if (!ServletFileUpload.isMultipartContent(req)) { - throw new RuntimeException("琛ㄥ崟鐨別nctype灞炴�т笉鏄痬ultipart/form-data绫诲瀷"); - } - - // 鍒涘缓涓婁紶鎵�闇�瑕佺殑涓や釜瀵硅薄锛氱鐩樻枃浠跺璞�+鏂囦欢涓婁紶瀵硅薄 - DiskFileItemFactory factory = new DiskFileItemFactory(); - ServletFileUpload sfu = new ServletFileUpload(factory); - ServletRequestContext ctx = new ServletRequestContext(req); - - // 璁剧疆缂栫爜鏂瑰紡 - sfu.setHeaderEncoding("utf-8"); - factory.setSizeThreshold(4096); - - // 鑾峰彇琛ㄥ崟涓殑鎵�鏈夋暟鎹俊鎭� - List<FileItem> list = sfu.parseRequest(ctx); - - return list; - } - - /** - * 澶勭悊瑙f瀽鍐呭锛氬鐞嗘櫘閫氳〃鍗曞煙鍜屾枃浠惰〃鍗曞煙 - */ - private Object copeFileItems(List<FileItem> items, HttpServletRequest req) throws Exception { - Map<String, String> map = new HashMap<String, String>(3); - List<FileInfoEntity> list = new ArrayList<FileInfoEntity>(); - - String path = pathHelper.getTempPath(); - for (FileItem item : items) { - if (item.isFormField()) { - String key = item.getFieldName(); - String value = item.getString("utf-8"); - map.put(key, value); - continue; - } - - FileInfoEntity fi = copeFile(item, path, req); - if (fi != null) { - list.add(fi); - } - } - - return map; - } - - /** - * 澶勭悊鏂囦欢 - */ - private FileInfoEntity copeFile(FileItem item, String path, HttpServletRequest req) { - try { - // 鑾峰彇鏂囦欢鍚嶏紝鍒ゆ柇鏄惁鍚堟硶 - FileInfoEntity fi = new FileInfoEntity(item.getName()); - if (StringHelper.isEmpty(fi.getFileName())) { - return null; - } - - fi.setSize(item.getSize()); - fi.setPath(path + File.separator + fi.getFileName()); - item.write(new File(fi.getPath())); - - return fi; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } - } -} diff --git a/src/main/java/com/lf/server/service/all/PermsService.java b/src/main/java/com/lf/server/service/all/PermsService.java deleted file mode 100644 index 4b62e45..0000000 --- a/src/main/java/com/lf/server/service/all/PermsService.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.lf.server.service.all; - -import com.lf.server.entity.all.*; -import com.lf.server.entity.sys.MenuEntity; -import com.lf.server.mapper.all.PermsMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * 鎺堟潈鏈嶅姟 - * @author WWW - */ -@Service -public class PermsService implements PermsMapper { - @Autowired - PermsMapper permsMapper; - - @Autowired - RedisService redisService; - - @Override - public List<ResAuthEntity> selectRes(String uid) { - String key = RedisCacheKey.permsResKey(uid); - Object obj = redisService.get(key); - if (obj instanceof List<?>) { - return (List<ResAuthEntity>) obj; - } - - List<ResAuthEntity> list = permsMapper.selectRes(uid); - if (list != null && list.size() > 0) { - redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); - } - - return list; - } - - @Override - public List<MenusAuthEntity> selectMenus(String uid) { - String key = RedisCacheKey.permsMenusKey(uid); - Object obj = redisService.get(key); - if (obj instanceof List<?>) { - return (List<MenusAuthEntity>) obj; - } - - List<MenusAuthEntity> list = permsMapper.selectMenus(uid); - if (list != null && list.size() > 0) { - redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); - } - - return list; - } - - @Override - public List<String> selectPerms(String uid) { - String key = RedisCacheKey.permsPermsKey(uid); - Object obj = redisService.get(key); - if (obj instanceof List<?>) { - return (List<String>) obj; - } - - List<String> list = permsMapper.selectPerms(uid); - if (list != null && list.size() > 0) { - redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); - } - - return list; - } - - @Override - public List<PermsAuthEntity> selectPermsEntity(String uid) { - String key = RedisCacheKey.permsPermsEntityKey(uid); - Object obj = redisService.get(key); - if (obj instanceof List<?>) { - return (List<PermsAuthEntity>) obj; - } - - List<PermsAuthEntity> list = permsMapper.selectPermsEntity(uid); - if (list != null && list.size() > 0) { - redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); - } - - return list; - } - - @Override - public List<Integer> selectRoles(String uid) { - return permsMapper.selectRoles(uid); - } - - @Override - public List<MenuEntity> selectMenuRecursive(int id, String uid) { - return permsMapper.selectMenuRecursive(id, uid); - } - - public void clearResCache() { - redisService.clearKeys(RedisCacheKey.permsResKey("")); - } - - public void clearPermsCache() { - redisService.clearKeys(RedisCacheKey.permsMenusKey("")); - redisService.clearKeys(RedisCacheKey.permsPermsKey("")); - redisService.clearKeys(RedisCacheKey.permsPermsEntityKey("")); - } - - public void clearAllCache() { - redisService.clearKeys(RedisCacheKey.permsRootKey()); - } -} diff --git a/src/main/java/com/lf/server/service/all/RedisService.java b/src/main/java/com/lf/server/service/all/RedisService.java deleted file mode 100644 index 2405e0b..0000000 --- a/src/main/java/com/lf/server/service/all/RedisService.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.lf.server.service.all; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; - -import java.util.Set; -import java.util.concurrent.TimeUnit; - -/** - * Redis鏈嶅姟绫� - * @author WWW - */ -@Service("redisService") -public class RedisService { - @Autowired - private RedisTemplate<String, Object> redisTemplate; - - /** - * 鑾峰彇Redis妯℃澘 - * - * @return - */ - public RedisTemplate<String, Object> getRedisTemplate() { - return redisTemplate; - } - - /** - * 璁剧疆鍊煎埌redis涓� - * - * @param key 閿� - * @param value 鍊� - */ - public void put(String key, Object value) { - redisTemplate.opsForValue().set(key, value); - } - - /** - * 璁剧疆鍊煎埌redis涓�,骞惰缃繃鏈熸椂闂� - * - * @param key 閿� - * @param value 鍊� - * @param timeout 鏃堕棿 - * @param unit 鍗曚綅 - */ - public void put(String key, Object value, long timeout, TimeUnit unit) { - redisTemplate.opsForValue().set(key, value, timeout, unit); - } - - /** - * 鏍规嵁key鑾峰彇value - * - * @param key 閿� - * @return - */ - public Object get(String key) { - return redisTemplate.opsForValue().get(key); - } - - /** - * 鏄惁瀛樺湪key - * - * @param key 閿� - * @return - */ - public boolean hasKey(String key) { - return redisTemplate.hasKey(key); - } - - /** - * 绉婚櫎key - * - * @param key 閿� - */ - public void delete(String key) { - redisTemplate.delete(key); - } - - /** - * 娓呯┖鎸囧畾閿墠缂� - * - * @param subKeyString 閿墠缂� - */ - public void clearKeys(String subKeyString) { - Set<String> keys = redisTemplate.keys(subKeyString + "*"); - redisTemplate.delete(keys); - } - - /** - * 娓呯┖鎵�鏈� - */ - public void clearAll() { - Set<String> keys = redisTemplate.keys("*"); - redisTemplate.delete(keys); - } -} diff --git a/src/main/java/com/lf/server/service/all/ScheduleService.java b/src/main/java/com/lf/server/service/all/ScheduleService.java deleted file mode 100644 index 1382d29..0000000 --- a/src/main/java/com/lf/server/service/all/ScheduleService.java +++ /dev/null @@ -1,249 +0,0 @@ -package com.lf.server.service.all; - -import com.lf.server.entity.all.RedisCacheKey; -import com.lf.server.entity.sys.LoginEntity; -import com.lf.server.entity.sys.OperateEntity; -import com.lf.server.entity.sys.ResEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.FileHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.sys.LoginService; -import com.lf.server.service.sys.OperateService; -import com.lf.server.service.sys.ResService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; -import com.alibaba.fastjson.JSONObject; -import org.springframework.stereotype.Service; - -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.SocketAddress; -import java.net.URI; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import oshi.SystemInfo; -import oshi.hardware.CentralProcessor; -import oshi.hardware.GlobalMemory; - -/** - * 鏃ョ▼鏈嶅姟绫� - * @author WWW - */ -@Service -public class ScheduleService { - @Autowired - private ResService resService; - - @Autowired - private LoginService loginService; - - @Autowired - private OperateService operateService; - - @Autowired - private RedisTemplate<String, Object> redisTemplate; - - private static final Log log = LogFactory.getLog(ScheduleService.class); - - /** - * 鏌ヨ鏈嶅姟鍣ㄧ姸鎬� - */ - public JSONObject selectServerStatus() throws InterruptedException { - JSONObject json = new JSONObject(); - json.put("cpuInfo", selectCpuInfo()); - json.put("memInfo", selectMemInfo()); - - return json; - } - - /** - * 鏌ヨCpu淇℃伅 - */ - public JSONObject selectCpuInfo() throws InterruptedException { - SystemInfo systemInfo = new SystemInfo(); - CentralProcessor processor = systemInfo.getHardware().getProcessor(); - long[] prevTicks = processor.getSystemCpuLoadTicks(); - - // 鐫$湢1s - TimeUnit.SECONDS.sleep(1); - long[] ticks = processor.getSystemCpuLoadTicks(); - long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()]; - long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()]; - long softIrq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()]; - long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()]; - long cSys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()]; - long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()]; - long ioWait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()]; - long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()]; - long totalCpu = user + nice + cSys + idle + ioWait + irq + softIrq + steal; - - JSONObject map = new JSONObject(); - map.put("cpuCore", processor.getLogicalProcessorCount()); - map.put("cpuSysUsage", new DecimalFormat("#.##%").format(cSys * 1.0 / totalCpu)); - map.put("cpuUserUsage", new DecimalFormat("#.##%").format(user * 1.0 / totalCpu)); - map.put("cpuRtcWaitUsage", new DecimalFormat("#.##%").format(ioWait * 1.0 / totalCpu)); - map.put("cpuRtcUseUsage", new DecimalFormat("#.##%").format(1.0 - (idle * 1.0 / totalCpu))); - - return map; - } - - /** - * 鏌ヨ鍐呭瓨淇℃伅 - */ - public JSONObject selectMemInfo() { - JSONObject map = new JSONObject(); - SystemInfo systemInfo = new SystemInfo(); - GlobalMemory memory = systemInfo.getHardware().getMemory(); - - // 鎬诲唴瀛� - long totalByte = memory.getTotal(); - - // 鍓╀綑 - long surplusByte = memory.getAvailable(); - map.put("totalMem", FileHelper.formatByte(totalByte)); - map.put("use", FileHelper.formatByte(totalByte - surplusByte)); - map.put("remainMem", FileHelper.formatByte(surplusByte)); - map.put("usage", new DecimalFormat("#.##%").format((totalByte - surplusByte) * 1.0 / totalByte)); - - return map; - } - - /** - * 鏌ヨ鍦ㄧ嚎鐢ㄦ埛 - */ - public List<JSONObject> selectOnlineUsers() { - List<JSONObject> list = new ArrayList<JSONObject>(); - - Set<String> keys = redisTemplate.keys(RedisCacheKey.signUserKey("*")); - for (String key : keys) { - Object obj = redisTemplate.opsForValue().get(key); - if (obj instanceof UserEntity) { - UserEntity ue = (UserEntity) obj; - - JSONObject map = new JSONObject(); - map.put("uid", ue.getUid()); - map.put("uname", ue.getUname()); - map.put("loginTime", ue.getBak()); - - list.add(map); - } - } - - return list; - } - - /** - * 缁熻鍦ㄧ嚎鐢ㄦ埛鏁� - * @return - */ - public int countOnlineUsers() { - Set<String> keys = redisTemplate.keys(RedisCacheKey.signUserKey("*")); - - return null == keys ? 0 : keys.size(); - } - - /** - * 鏌ヨ鏈嶅姟璧勬簮鐘舵�� - */ - public List<ResEntity> selectResStatus() { - List<ResEntity> resList = resService.selectResAll(); - - return testResStatus(resList); - } - - private List<ResEntity> testResStatus(List<ResEntity> resList) { - List<ResEntity> list = new ArrayList<ResEntity>(); - for (ResEntity re : resList) { - Socket socket = new Socket(); - try { - if (StringHelper.isEmpty(re.getServer())) { - list.add(re); - continue; - } - - URI uri = new URI(re.getServer()); - SocketAddress add = new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()); - - // Ping閫氬湴鍧� - socket.connect(add, 2000); - } catch (Exception e) { - log.error(e.getMessage()); - list.add(re); - } finally { - try { - socket.close(); - } catch (Exception ex) { - log.error(ex.getMessage()); - } - } - } - - return list; - } - - /** - * 缁熻鏈嶅姟璧勬簮鐘舵�� - */ - public JSONObject countResStatus() { - List<ResEntity> resList = resService.selectResAll(); - List<ResEntity> unableList = testResStatus(resList); - - JSONObject jsonObject = new JSONObject(); - - // 璧勬簮鍙敤 - jsonObject.put("resAbleCount", resList.size() - unableList.size()); - // 璧勬簮涓嶅彲鐢� - jsonObject.put("resUnableCount", unableList.size()); - - return jsonObject; - } - - /** - * 璧勬簮鎿嶄綔鐘舵�� - */ - public JSONObject operateCount() { - List<OperateEntity> list = operateService.operateCount(); - JSONObject jsonObject = new JSONObject(); - if (list.isEmpty()) { - return null; - } else { - List<JSONObject> lister = new ArrayList<JSONObject>(); - for (OperateEntity key : list) { - JSONObject map = new JSONObject(); - map.put("count", key.getCount()); - map.put("modular2", key.getModular2()); - lister.add(map); - } - jsonObject.put("operateCount", lister); - return jsonObject; - } - } - - /** - * 鐢ㄦ埛鐧诲綍鐘舵�� - */ - public JSONObject userLoginCount() { - List<LoginEntity> list = loginService.selectLoginCounts(); - if (list == null || list.isEmpty()) { - return null; - } - - JSONObject jsonObject = new JSONObject(); - List<JSONObject> lister = new ArrayList<JSONObject>(); - for (LoginEntity key : list) { - JSONObject map = new JSONObject(); - map.put("count", key.getCount()); - map.put("optime", key.getOptime()); - lister.add(map); - } - jsonObject.put("userLoginCount", lister); - - return jsonObject; - } -} diff --git a/src/main/java/com/lf/server/service/all/SignService.java b/src/main/java/com/lf/server/service/all/SignService.java deleted file mode 100644 index bba4155..0000000 --- a/src/main/java/com/lf/server/service/all/SignService.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.lf.server.service.all; - -import com.lf.server.config.PropertiesConfig; -import com.lf.server.entity.all.StaticData; -import com.lf.server.helper.WebHelper; -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.NameValuePair; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.util.EntityUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.List; - -/** - * 绛惧悕鏈嶅姟绫� - * @author WWW - */ -@Service -public class SignService { - @Autowired - PropertiesConfig propertiesConfig; - - private final static String SUCCESS = "success"; - - /** - * 鑷姩鐧诲綍Druid - */ - public void loginDruid(HttpServletRequest req, HttpServletResponse res) throws Exception { - List<NameValuePair> list = new ArrayList<>(); - list.add(new BasicNameValuePair("loginUsername", propertiesConfig.getDruidUser())); - list.add(new BasicNameValuePair("loginPassword", propertiesConfig.getDruidPwd())); - - String url = req.getRequestURL().toString().replace("/sign/toDruid", "/druid/submitLogin"); - CloseableHttpClient httpClient = HttpClients.custom().build(); - - UrlEncodedFormEntity postEntity = new UrlEncodedFormEntity(list, StaticData.TEXT_ENCODER); - HttpPost httpPost = new HttpPost(url); - httpPost.setEntity(postEntity); - - CloseableHttpResponse closeResponse = httpClient.execute(httpPost); - HttpEntity entity = closeResponse.getEntity(); - - String rs = EntityUtils.toString(entity, StaticData.TEXT_ENCODER); - if (!SUCCESS.equals(rs)) { - return; - } - - Header[] headers = closeResponse.getAllHeaders(); - for (int i = 0; i < headers.length; i++) { - Header header = headers[i]; - if ("Set-Cookie".equals(header.getName())) { - String val = header.getValue(); - String sessionId = val.substring(val.indexOf("=") + 1, val.indexOf(";")); - WebHelper.saveCookie(StaticData.DRUID_COOKIE_KEY, sessionId, res); - break; - } - } - } -} diff --git a/src/main/java/com/lf/server/service/all/SysService.java b/src/main/java/com/lf/server/service/all/SysService.java deleted file mode 100644 index 95f6234..0000000 --- a/src/main/java/com/lf/server/service/all/SysService.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.lf.server.service.all; - -import com.lf.server.service.sys.BlacklistService; -import com.lf.server.service.sys.TokenService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * 绯荤粺鏈嶅姟绫� - * @author WWW - */ -@Service -public class SysService { - @Autowired - public TokenService tokenService; - - @Autowired - public RedisService redisService; - - @Autowired - public PermsService permsService; - - @Autowired - public BlacklistService blacklistService; -} diff --git a/src/main/java/com/lf/server/service/all/TestService.java b/src/main/java/com/lf/server/service/all/TestService.java deleted file mode 100644 index 907351e..0000000 --- a/src/main/java/com/lf/server/service/all/TestService.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.lf.server.service.all; - -import com.lf.server.entity.all.MenusAuthEntity; -import com.lf.server.entity.all.PermsAuthEntity; -import com.lf.server.entity.all.ResAuthEntity; -import com.lf.server.entity.data.CoordEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.data.MetaFileEntity; -import com.lf.server.helper.*; -import com.lf.server.service.data.MetaService; -import com.lf.server.service.data.UploadService; -import com.lf.server.service.sys.ArgsService; -import com.lf.server.service.sys.BlacklistService; -import com.lf.server.service.sys.ReportService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; - -/** - * 娴嬭瘯鏈嶅姟绫� - * @author WWW - */ -@Service -@SuppressWarnings("AlibabaRemoveCommentedCode") -public class TestService { - @Autowired - PathHelper pathHelper; - - @Autowired - ArgsService argsService; - - @Autowired - PermsService permsService; - - @Autowired - BlacklistService blacklistService; - - @Autowired - BaseQueryService baseQueryService; - - @Autowired - Environment env; - - @Autowired - ReportService reportService; - - @Autowired - UploadService uploadService; - - @Autowired - MetaService metaService; - - private final static Log log = LogFactory.getLog(TestService.class); - - public void testGdal() { - GdalHelper.readTif("E:\\data\\7.Insar\\insartest.tif"); - GdalHelper.readShp("E:\\data\\13.cppe\\shps\\addr.shp"); - GdalHelper.readGdb("E:\\Test\\addr.gdb"); - //GdalHelper.readShpFirstRecord("D:\\LF\\data\\shp\\extent.shp"); - com.lf.server.helper.RsaHelper.generate(); - //FloatServerController.test(); - - testReadExcel(); - 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"); - } - - public void testMeta() { - List<MetaEntity> list = metaService.selectByIdsForTab("1501,1500,1491,1492"); - String sql = metaService.getDelTabsSql(list); - } - - public void testReadShp() { - MetaFileEntity mf = new MetaFileEntity(); - //mf.setPath("D:\\model_data\\m_sitepoint.shp"); - mf.setPath("D:\\shpto\\m_sitepoint.shp"); - mf.setEntity("msitepoint"); - mf.setGuid("msitepoint"); - mf.setTab("bs.m_sitepoint"); - mf.setExtName(".shp"); - - uploadService.loadSpatialData(mf); - } - - public 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); - } - } - - public void testPerms() { - List<ResAuthEntity> raeList = permsService.selectRes("admin"); - List<ResAuthEntity> raeList2 = permsService.selectRes("admin"); - - List<MenusAuthEntity> maeList = permsService.selectMenus("admin"); - List<MenusAuthEntity> maeList2 = permsService.selectMenus("admin"); - - List<String> pList = permsService.selectPerms("admin"); - List<String> pList2 = permsService.selectPerms("admin"); - - List<PermsAuthEntity> pauList = permsService.selectPermsEntity("admin"); - List<PermsAuthEntity> pauList2 = permsService.selectPermsEntity("admin"); - - permsService.clearResCache(); - permsService.clearPermsCache(); - - raeList = permsService.selectRes("admin"); - maeList = permsService.selectMenus("admin"); - pList = permsService.selectPerms("admin"); - pauList = permsService.selectPermsEntity("admin"); - permsService.clearAllCache(); - } - - public void testBlacklist() { - List<String> list1 = blacklistService.selectIpList(1); - List<String> list2 = blacklistService.selectIpList(1); - List<String> list3 = blacklistService.selectIpList(2); - List<String> list4 = blacklistService.selectIpList(2); - blacklistService.clearCache(); - List<String> list5 = blacklistService.selectIpList(1); - } - - public void testReadExcel() { - List<?> listMdZxcg = ExcelHelper.readExcel(CoordEntity.class, "D:\\LF\\data\\xls\\娴嬬粯\\1-椤圭洰鎴愭灉-瑗夸笁涓璡\1-1涓嚎鎴愭灉琛╘\娴峰師鍘夸腑绾挎垚鏋滆〃.xlsx"); - int r1 = listMdZxcg.size(); - - //List<MdGdcgEntity> listGdcg = ExcelHelper.readExcel(MdGdcgEntity.class, "D:\\LF\\data\\xls\\娴嬬粯\\2-鍦颁笅绠$嚎鎺㈡祴鎴愭灉\\2-2 绠$嚎鎴愭灉琛�.xlsx"); - //int r2 = listGdcg.size(); - - String entityName = "Gxcg"; - String xls = "D:\\LF\\data\\xls\\娴嬬粯\\2-鍦颁笅绠$嚎鎺㈡祴鎴愭灉\\2-2 绠$嚎鎴愭灉琛�.xlsx"; - - String className = "com.lf.server.entity.bs." + entityName; - Object obj = ClassHelper.createInstance(className); - - List<?> list = ExcelHelper.readExcel(obj.getClass(), xls); - int r3 = list.size(); - } - - public void testAccess() { - List<Map<String, Object>> list = AccessHelper.readMdb("D:\\LF\\data\\test.mdb", "", ""); - int count = null == list || list.isEmpty() ? 0 : list.size(); - } - - public void testMd5() { - try { - String file = "E:\\data\\mpt\\A4mpt20131125.mpt"; - - long stime = System.currentTimeMillis(); - // 2a0befb05146cd30213ee4b95038aca0 - String md51 = FileHelper.getFileMd5(file); - long etime = System.currentTimeMillis(); - String s1 = String.format("鎵ц鏃堕暱锛�%d 姣.", (etime - stime)); - - stime = System.currentTimeMillis(); - // 2a0befb05146cd30213ee4b95038aca0 - String md52 = FileHelper.getMd5ByJdk(file); - etime = System.currentTimeMillis(); - String s2 = String.format("鎵ц鏃堕暱锛�%d 姣.", (etime - stime)); - - stime = System.currentTimeMillis(); - // 9f1b7f050f41598710ffc08252484397 - String md53 = FileHelper.getFastMd5(file); - etime = System.currentTimeMillis(); - String s3 = String.format("鎵ц鏃堕暱锛�%d 姣.", (etime - stime)); - - etime = System.currentTimeMillis(); - } catch (Exception ex) { - // - } - } -} diff --git a/src/main/java/com/lf/server/service/all/UploadAttachService.java b/src/main/java/com/lf/server/service/all/UploadAttachService.java deleted file mode 100644 index 062f2c6..0000000 --- a/src/main/java/com/lf/server/service/all/UploadAttachService.java +++ /dev/null @@ -1,512 +0,0 @@ -package com.lf.server.service.all; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.all.*; -import com.lf.server.entity.ctrl.KeyValueEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.data.MetaFileEntity; -import com.lf.server.entity.sys.AttachEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.mapper.data.DownloadMapper; -import com.lf.server.service.sys.AttachService; -import net.lingala.zip4j.ZipFile; -import net.lingala.zip4j.model.FileHeader; -import net.lingala.zip4j.model.ZipParameters; -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.lang.reflect.Field; -import java.util.*; - -/** - * 涓婁紶闄勪欢鏈嶅姟绫� - * @author WWW - */ -@Service -public class UploadAttachService { - @Autowired - PathHelper pathHelper; - - @Autowired - AttachService attachService; - - @Autowired - DownloadMapper downloadMapper; - - private static String tabs = "''"; - - public final static Map<String, String> ATTACH_TABS = new HashMap<>(); - - private final static Log log = LogFactory.getLog(UploadAttachService.class); - - /** - * 鑾峰彇琛ㄥ悕 - */ - public static String getTabs() { - return tabs; - } - - /** - * 鍒濆鍖栭檮浠惰〃 - */ - public static void init(String cfg) { - if (StringHelper.isEmpty(cfg)) { - return; - } - - String[] strs = cfg.split(StaticData.COMMA); - if (strs.length == 0) { - return; - } - - List<String> keys = new ArrayList<>(); - for (String str : strs) { - if (ATTACH_TABS.containsKey(str)) { - continue; - } - - ATTACH_TABS.put(str, str.contains("bd.") ? "materiname" : "photono"); - keys.add("'" + str + "'"); - } - tabs = StringHelper.join(keys, ","); - } - - /** - * 涓婁紶鏂囦欢 - */ - public ResponseMsg<String> upload(UserEntity ue, String tab, MultipartFile file, BaseController ctrl) { - try { - if (file == null && file.isEmpty()) { - return ctrl.fail("鏂囦欢涓婁紶涓虹┖", null); - } - if (file.getSize() > SettingData.MAX_FILE_SIZE) { - return ctrl.fail(String.format("鏂囦欢澶т簬 %d MB", SettingData.MAX_FILE_SIZE / 1024 / 1024), null); - } - - // 浼犺緭鏂囦欢 - String oldName = file.getOriginalFilename(); - String filePath = pathHelper.getTempPath() + File.separator + oldName; - File newFile = new File(filePath); - file.transferTo(newFile); - double sizes = FileHelper.sizeToMb(file.getSize()); - - // 鑾峰彇MD5 - String md5 = FileHelper.getFileMd5(filePath); - AttachEntity entity = attachService.selectByGuid(md5); - if (entity != null) { - newFile.delete(); - return ctrl.success("鏂囦欢宸插瓨鍦�", md5); - } - - AttachEntity ae = getAttachEntity(ue, tab, oldName, md5, sizes); - String targetPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); - newFile.renameTo(new File(targetPath)); - - int rows = attachService.insert(ae); - - return rows > 0 ? ctrl.success(md5) : ctrl.fail("淇濆瓨鏂囦欢澶辫触", null); - } catch (Exception ex) { - return ctrl.fail(ex.getMessage(), null); - } - } - - /** - * 鑾峰彇闄勪欢瀹炰綋绫� - */ - protected AttachEntity getAttachEntity(UserEntity ue, String tab, String oldName, String md5, double sizes) { - AttachEntity entity = new AttachEntity(); - entity.setName(oldName); - entity.setTab(tab); - entity.setGuid(md5); - String subPath = PathHelper.getUploadPath() + File.separator + md5 + FileHelper.getExtension(oldName); - entity.setPath(subPath); - entity.setSizes(sizes); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - return entity; - } - - /** - * 涓嬭浇鏂囦欢 - */ - public void download(String guid, HttpServletResponse res) { - download(guid, false, res); - } - - /** - * 涓嬭浇鏂囦欢 - */ - public void download(String guid, boolean inline, HttpServletResponse res) { - try { - if (StringHelper.isEmpty(guid)) { - WebHelper.writeStr2Page(res, StaticData.NO_FILE); - return; - } - - AttachEntity entity = attachService.selectByGuid(guid); - if (entity == null) { - WebHelper.writeStr2Page(res, StaticData.NO_FILE); - return; - } - - String filePath = pathHelper.getConfig().getUploadPath() + File.separator + entity.getPath(); - File file = new File(filePath); - if (!file.exists() || file.isDirectory()) { - WebHelper.writeJson2Page(res, "鏂囦欢涓嶅瓨鍦�"); - } - - WebHelper.download(filePath, entity.getName(), inline, res); - } catch (Exception ex) { - WebHelper.writeJson2Page(res, "鏂囦欢涓嬭浇鍑洪敊"); - log.error(ex.getMessage(), ex); - } - } - - /** - * 涓婁紶Excel闄勪欢 - */ - public List<KeyValueEntity> uploadXlsAnnex(UserEntity ue, List<MetaEntity> ms, List<MetaFileEntity> list, String path) { - List<String> files = getAttachFiles(list, path); - if (files.size() == 0) { - return null; - } - - List<KeyValueEntity> rs = new ArrayList<>(); - for (MetaEntity meta : ms) { - int rows = uploadXlsAnnex(ue, meta, files); - rs.add(new KeyValueEntity(meta.getName(), String.valueOf(rows))); - } - - return rs; - } - - /** - * 鑾峰彇闄勪欢鏂囦欢 - */ - private List<String> getAttachFiles(List<MetaFileEntity> list, String path) { - List<String> files = new ArrayList<>(); - - for (MetaFileEntity mf : list) { - if (mf.getName().contains(StaticData.ZIP)) { - List<String> subs = getZipFiles(mf, path); - if (null != subs && subs.size() > 0) { - files.addAll(subs); - } - continue; - } - - files.add(mf.getPath()); - } - - return files; - } - - /** - * 鑾峰彇zip涓殑鏂囦欢 - */ - private List<String> getZipFiles(MetaFileEntity mf, String path) { - File file = new File(mf.getPath()); - if (!file.exists() || file.isDirectory()) { - return null; - } - - File zipFolder = new File(pathHelper.getConfig().getTempPath() + File.separator + path + "_zip"); - if (!zipFolder.exists() || !zipFolder.isDirectory()) { - zipFolder.mkdirs(); - } - - String subPath = zipFolder + File.separator + mf.getName().toLowerCase().replace(".zip", ""); - ZipHelper.unzip(mf.getPath(), subPath); - - List<String> files = new ArrayList<>(); - getFilesByPath(files, subPath); - - return files; - } - - /** - * 鏍规嵁璺緞鑾峰彇鏂囦欢 - */ - private void getFilesByPath(List<String> list, String path) { - File file = new File(path); - if (!file.isDirectory()) { - list.add(file.getPath()); - return; - } - - File[] files = file.listFiles(); - if (null == files) { - return; - } - - for (File f : files) { - if (f.isDirectory()) { - getFilesByPath(list, f.getPath()); - } else { - list.add(f.getPath()); - } - } - } - - /** - * 涓婁紶Excel闄勪欢 - */ - private int uploadXlsAnnex(UserEntity ue, MetaEntity meta, List<String> files) { - List<?> list = queryXlsData(meta); - if (null == list || list.size() == 0) { - return 0; - } - - Field field = getAnnexField(list.get(0), meta.getTab()); - String folder = meta.getName().split("\\.")[0].trim().toLowerCase() + File.separator; - - int rows = 0; - for (Object obj : list) { - String[] names = getNames(getAnnexName(obj, field)); - if (null == names || names.length == 0) { - continue; - } - - for (String name : names) { - String file = findAnnexFile(name, folder, files); - if (null == file) { - continue; - } - - rows += insertXlsAnnex(ue, meta, (BaseEntity) obj, file); - } - } - - return rows; - } - - /** - * 鑾峰彇鍚嶇О - */ - public static String[] getNames(String str) { - if (StringHelper.isEmpty(str)) { - return null; - } - - return str.replace("锛�", ",").replace("锛�", ",").split(","); - } - - /** - * 鏌ヨExcel鏁版嵁 - */ - private List<?> queryXlsData(MetaEntity meta) { - String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); - BasicMapper basicMapper = ClassHelper.getBasicMapper(entity); - if (null == basicMapper) { - return null; - } - - QueryWrapper wrapper = new QueryWrapper(); - wrapper.eq("parentid", meta.getEventid()); - - List<?> list = basicMapper.selectList(wrapper); - if (null == list || list.size() == 0) { - return null; - } - if (!(list.get(0) instanceof BaseEntity)) { - return null; - } - - return list; - } - - /** - * 鑾峰彇闄勪欢瀛楁 - */ - public static Field getAnnexField(Object obj, String tab) { - try { - String str = ATTACH_TABS.get(tab); - - Field field = obj.getClass().getDeclaredField(str); - field.setAccessible(true); - - return field; - } catch (Exception ex) { - return null; - } - } - - /** - * 鑾峰彇闄勪欢鍚嶇О - */ - public static String getAnnexName(Object obj, Field field) { - try { - Object val = field.get(obj); - - return null == val ? null : val.toString().trim(); - } catch (Exception ex) { - return null; - } - } - - /** - * 鏌ユ壘闄勪欢鏂囦欢 - */ - private String findAnnexFile(String name, String folder, List<String> files) { - name = File.separator + name.split("\\.")[0].trim().toLowerCase(); - for (String file : files) { - if (file.toLowerCase().contains(folder) && file.toLowerCase().contains(name)) { - return file; - } - } - for (String file : files) { - if (file.toLowerCase().contains(name)) { - return file; - } - } - - return null; - } - - /** - * 鎻掑叆Excel闄勪欢 - */ - private int insertXlsAnnex(UserEntity ue, MetaEntity meta, BaseEntity be, String file) { - File f = new File(file); - if (!f.exists() || f.isDirectory()) { - return 0; - } - - String md5 = FileHelper.getFileMd5(file); - AttachEntity old = attachService.selectByTabAndGuid(meta.getTab(), be.getEventid(), md5); - if (null != old) { - return 0; - } - - String fileName = FileHelper.getFileName(file); - double sizes = FileHelper.sizeToMb(f.length()); - - AttachEntity ae = getAttachEntity(ue, meta.getTab(), be.getEventid(), fileName, md5, sizes); - String targetPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); - - try { - FileUtils.copyFile(f, new File(targetPath)); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - - return attachService.insert(ae); - } - - /** - * 鑾峰彇闄勪欢瀹炰綋绫� - */ - protected AttachEntity getAttachEntity(UserEntity ue, String tabName, String eventid, String fileName, String md5, double sizes) { - AttachEntity entity = new AttachEntity(); - entity.setTab(tabName); - entity.setTabGuid(eventid); - entity.setName(fileName); - entity.setGuid(md5); - String subPath = PathHelper.getUploadPath() + File.separator + md5 + FileHelper.getExtension(fileName); - entity.setPath(subPath); - entity.setSizes(sizes); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - return entity; - } - - /** - * 璇锋眰涓嬭浇 - */ - public String downloadReqForGuids(UserEntity ue, List<String> guids) { - List<AttachEntity> list = attachService.selectByGuids(guids); - - return downloadReq(ue, list); - } - - /** - * 璇锋眰涓嬭浇 - */ - public String downloadReqForTabGuids(UserEntity ue, String tab, List<String> guids) { - List<AttachEntity> list = attachService.selectByTabGuids(tab, guids); - - return downloadReq(ue, list); - } - - /** - * 璇锋眰涓嬭浇 - */ - protected String downloadReq(UserEntity ue, List<AttachEntity> list) { - if (null == list || list.isEmpty()) { - return null; - } - - String zipName = StringHelper.YMDHMS2_FORMAT.format(new Date()) + ".zip"; - String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName; - - ZipFile zip = Zip4jHelper.createZipFile(zipFile, null); - ZipParameters params = Zip4jHelper.getZipParams(false); - addZipFiles(zip, params, list); - - DownloadEntity downloadEntity = getDownloadEntity(ue, zipFile, null); - int rows = downloadMapper.insert(downloadEntity); - - return rows > 0 ? downloadEntity.getGuid() : null; - } - - /** - * 娣诲姞Zip鏂囦欢 - */ - private void addZipFiles(ZipFile zip, ZipParameters params, List<AttachEntity> list) { - int i = 1; - String uploadPath = pathHelper.getConfig().getUploadPath(); - for (AttachEntity ae : list) { - try { - String filePath = uploadPath + File.separator + ae.getPath(); - - File file = new File(filePath); - if (!file.exists() || file.isDirectory()) { - continue; - } - - zip.addFile(file, params); - FileHeader header = zip.getFileHeader(file.getName()); - if (null != header) { - zip.renameFile(header, i + "_" + ae.getName()); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } - - /** - * 鑾峰彇涓嬭浇瀹炰綋绫� - */ - private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { - DownloadEntity de = new DownloadEntity(); - de.setName(FileHelper.getFileName(file)); - // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 - de.setType(7); - de.setSizes(FileHelper.sizeToMb(new File(file).length())); - de.setDepid(ue.getDepid()); - de.setDcount(0); - de.setPwd(pwd); - de.setUrl(FileHelper.getRelativePath(file)); - de.setDescr("闄勪欢鏂囦欢"); - de.setGuid(FileHelper.getFileMd5(file)); - de.setCreateUser(ue.getId()); - // de.setGeom(null) - - return de; - } -} diff --git a/src/main/java/com/lf/server/service/all/WebSocketService.java b/src/main/java/com/lf/server/service/all/WebSocketService.java deleted file mode 100644 index 82d0338..0000000 --- a/src/main/java/com/lf/server/service/all/WebSocketService.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.lf.server.service.all; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import javax.websocket.*; -import javax.websocket.server.ServerEndpoint; -import java.io.IOException; -import java.util.concurrent.CopyOnWriteArraySet; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * WebSocket鏈嶅姟绫� - * @author WWW - */ -@ServerEndpoint(value = "/ws/select") -@Component -public class WebSocketService { - @PostConstruct - public void init() { - System.out.println("websocket 鍔犺浇"); - } - - private final static Logger log = LoggerFactory.getLogger(WebSocketService.class); - - private static final AtomicInteger ONLINE_COUNT = new AtomicInteger(0); - - /** - * 鐢ㄦ潵瀛樻斁姣忎釜瀹㈡埛绔搴旂殑Session瀵硅薄锛堢嚎绋嬪畨鍏⊿et锛� - */ - private final static CopyOnWriteArraySet<Session> SESSION_SET = new CopyOnWriteArraySet<Session>(); - - /** - * 杩炴帴寤虹珛鎴愬姛璋冪敤鐨勬柟娉� - */ - @OnOpen - public void onOpen(Session session) { - SESSION_SET.add(session); - - int cnt = ONLINE_COUNT.incrementAndGet(); - log.info("鏈夎繛鎺ュ姞鍏ワ紝褰撳墠杩炴帴鏁颁负锛歿}", cnt); - sendMessage(session, "杩炴帴鎴愬姛"); - } - - /** - * 杩炴帴鍏抽棴璋冪敤鐨勬柟娉� - */ - @OnClose - public void onClose(Session session) { - SESSION_SET.remove(session); - - int cnt = ONLINE_COUNT.decrementAndGet(); - log.info("鏈夎繛鎺ュ叧闂紝褰撳墠杩炴帴鏁颁负锛歿}", cnt); - } - - /** - * 鏀跺埌瀹㈡埛绔秷鎭悗璋冪敤鐨勬柟娉� - * - * @param message 瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅 - */ - @OnMessage - public void onMessage(String message, Session session) { - log.info("鏉ヨ嚜瀹㈡埛绔殑娑堟伅锛歿}", message); - sendMessage(session, "鏀跺埌娑堟伅锛屾秷鎭唴瀹癸細" + message); - } - - /** - * 鍑虹幇閿欒 - * - * @param session - * @param error - */ - @OnError - public void onError(Session session, Throwable error) { - log.error("鍙戠敓閿欒锛歿}锛孲ession ID锛� {}", error.getMessage(), session.getId()); - } - - /** - * 鍙戦�佹秷鎭紝瀹炶返琛ㄦ槑锛屾瘡娆℃祻瑙堝櫒鍒锋柊锛宻ession浼氬彂鐢熷彉鍖栥�� - * - * @param session - * @param message - */ - public static void sendMessage(Session session, String message) { - try { - session.getBasicRemote().sendText(String.format("%s", message)); - } catch (Exception ex) { - log.error("鍙戦�佹秷鎭嚭閿欙細{}", ex.getMessage()); - } - } - - /** - * 缇ゅ彂娑堟伅 - * - * @param message - * @throws IOException - */ - public static void broadCastInfo(String message) throws IOException { - for (Session session : SESSION_SET) { - if (session.isOpen()) { - sendMessage(session, message); - } - } - } - - /** - * 鎸囧畾Session鍙戦�佹秷鎭� - * - * @param sessionId - * @param message - * @throws IOException - */ - public static void sendMessage(String message, String sessionId) throws IOException { - Session session = null; - for (Session s : SESSION_SET) { - if (s.getId().equals(sessionId)) { - session = s; - break; - } - } - - if (session != null) { - sendMessage(session, message); - } else { - log.info("娌℃湁鎵惧埌浣犳寚瀹欼D鐨勪細璇濓細{}", sessionId); - } - } -} diff --git a/src/main/java/com/lf/server/service/data/DataQueryService.java b/src/main/java/com/lf/server/service/data/DataQueryService.java deleted file mode 100644 index 283a1de..0000000 --- a/src/main/java/com/lf/server/service/data/DataQueryService.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.all.SettingData; -import com.lf.server.entity.sys.AttachEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.FileHelper; -import com.lf.server.helper.PathHelper; -import com.lf.server.service.sys.AttachService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletRequest; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * 鏁版嵁妫�绱㈡湇鍔� - * @author WWW - */ -@Service -public class DataQueryService { - @Autowired - PathHelper pathHelper; - - @Autowired - AttachService attachService; - - /** - * 涓婁紶鏂囦欢 - */ - public Integer uploadFiles(UserEntity ue, String tabName, String eventid, MultipartFile[] files, HttpServletRequest req) throws IOException { - List<AttachEntity> list = new ArrayList<AttachEntity>(); - for (MultipartFile file : files) { - if (file.getSize() > SettingData.MAX_FILE_SIZE) { - continue; - } - - // 浼犺緭鏂囦欢 - String fileName = file.getOriginalFilename(); - String filePath = pathHelper.getTempPath() + File.separator + fileName; - File newFile = new File(filePath); - file.transferTo(newFile); - double sizes = FileHelper.sizeToMb(file.getSize()); - - // 鑾峰彇MD5 - String md5 = FileHelper.getFileMd5(filePath); - AttachEntity entity = attachService.selectByGuid(md5); - - AttachEntity ae = getAttachEntity(ue, tabName, eventid, fileName, md5, sizes); - if (entity != null) { - ae.setPath(entity.getPath()); - - String oldPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); - File f = new File(oldPath); - if (!f.exists() || f.isDirectory()) { - newFile.renameTo(new File(oldPath)); - } else { - newFile.delete(); - } - } else { - String targetPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); - newFile.renameTo(new File(targetPath)); - } - - list.add(ae); - } - - return attachService.inserts(list); - } - - /** - * 鑾峰彇闄勪欢瀹炰綋绫� - */ - protected AttachEntity getAttachEntity(UserEntity ue, String tabName, String eventid, String fileName, String md5, double sizes) { - AttachEntity entity = new AttachEntity(); - entity.setTab(tabName); - entity.setTabGuid(eventid); - entity.setName(fileName); - entity.setGuid(md5); - String subPath = PathHelper.getUploadPath() + File.separator + md5 + FileHelper.getExtension(fileName); - entity.setPath(subPath); - entity.setSizes(sizes); - if (ue != null) { - entity.setCreateUser(ue.getId()); - } - - return entity; - } -} diff --git a/src/main/java/com/lf/server/service/data/DictService.java b/src/main/java/com/lf/server/service/data/DictService.java deleted file mode 100644 index c70753f..0000000 --- a/src/main/java/com/lf/server/service/data/DictService.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.ctrl.TabEntity; -import com.lf.server.entity.data.DictEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.data.DictMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 瀛楀吀 - * @author WWW - */ -@Service -public class DictService implements DictMapper { - @Autowired - DictMapper dictMapper; - - @Override - public Integer selectCount(String ns, String tab) { - ns = StringHelper.isNull(ns) ? null : ns.trim(); - tab = StringHelper.getLikeUpperStr(tab); - - return dictMapper.selectCount(ns, tab); - } - - @Override - public List<DictEntity> selectByPage(String ns, String tab, Integer limit, Integer offset) { - ns = StringHelper.isNull(ns) ? null : ns.trim(); - tab = StringHelper.getLikeUpperStr(tab); - - return dictMapper.selectByPage(ns, tab, limit, offset); - } - - @Override - public DictEntity selectById(int id) { - return dictMapper.selectById(id); - } - - @Override - public List<TabEntity> selectDictTab(String name, String field) { - name = StringHelper.getLikeUpperStr(name); - - return dictMapper.selectDictTab(name, field); - } - - @Override - public Integer insert(DictEntity entity) { - return dictMapper.insert(entity); - } - - @Override - public Integer inserts(List<DictEntity> list) { - return dictMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return dictMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return dictMapper.deletes(ids); - } - - @Override - public Integer update(DictEntity entity) { - return dictMapper.update(entity); - } - - @Override - public Integer updates(List<DictEntity> list) { - return dictMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/data/DirService.java b/src/main/java/com/lf/server/service/data/DirService.java deleted file mode 100644 index f435d3f..0000000 --- a/src/main/java/com/lf/server/service/data/DirService.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.data.DirEntity; -import com.lf.server.helper.PathHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.Zip4jHelper; -import com.lf.server.mapper.data.DirMapper; -import net.lingala.zip4j.ZipFile; -import net.lingala.zip4j.model.ZipParameters; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.util.Date; -import java.util.List; - -/** - * dir - * @author sws - * @date 2022-09-24 - */ - -@Service -public class DirService implements DirMapper { - @Autowired - PathHelper pathHelper; - - @Autowired - DirMapper dirMapper; - - @Override - public Integer insert(DirEntity dirEntity) { - return dirMapper.insert(dirEntity); - } - - @Override - public Integer inserts(List<DirEntity> dirEntity) { - return dirMapper.inserts(dirEntity); - } - - @Override - public Integer deleteDir(int id) { - return dirMapper.deleteDir(id); - } - - @Override - public Integer deleteDirs(List<Integer> ids) { - return dirMapper.deleteDirs(ids); - } - - @Override - public Integer update(DirEntity dirEntity) { - return dirMapper.update(dirEntity); - } - - @Override - public Integer updates(List<DirEntity> dirEntity) { - return dirMapper.updates(dirEntity); - } - - @Override - public DirEntity selectDir(int id) { - return dirMapper.selectDir(id); - } - - @Override - public DirEntity selectByCode(String code) { - return dirMapper.selectByCode(code); - } - - @Override - public List<DirEntity> selectDirAll() { - return dirMapper.selectDirAll(); - } - - @Override - public List<DirEntity> selectDirRoot() { - return dirMapper.selectDirRoot(); - } - - @Override - public List<DirEntity> selectProject(String name) { - name = StringHelper.getLikeUpperStr(name); - - return dirMapper.selectProject(name); - } - - @Override - public List<DirEntity> selectRecursiveById(Integer id) { - return dirMapper.selectRecursiveById(id); - } - - @Override - public List<DirEntity> selectDirsForPrj() { - return dirMapper.selectDirsForPrj(); - } - - /** - * 鍒涘缓鏁版嵁鐩綍 - */ - public String createDirs(int id) throws Exception { - List<DirEntity> list = selectRecursiveById(id); - if (null == list || list.isEmpty()) { - return null; - } - - String tempPath = pathHelper.getTempPath(); - for (DirEntity dir : list) { - String path = tempPath + File.separator + dir.getFullName(); - File f = new File(path); - if (f.exists() && f.isDirectory()) { - continue; - } - - f.mkdirs(); - } - - File file = new File(tempPath + File.separator + list.get(0).getName()); - if (!file.exists() || !file.isDirectory()) { - file.mkdirs(); - } - - String zipFile = tempPath + File.separator + list.get(0).getName() + ".zip"; - ZipFile zip = Zip4jHelper.createZipFile(zipFile, null); - ZipParameters params = Zip4jHelper.getZipParams(false); - zip.addFolder(file, params); - - return zipFile; - } -} diff --git a/src/main/java/com/lf/server/service/data/DomainService.java b/src/main/java/com/lf/server/service/data/DomainService.java deleted file mode 100644 index b111576..0000000 --- a/src/main/java/com/lf/server/service/data/DomainService.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.data.DomainEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.data.DomainMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鍊煎煙 - * @author WWW - */ -@Service -public class DomainService implements DomainMapper { - @Autowired - DomainMapper domainMapper; - - @Override - public Integer selectCount(String ns, String tab, String name) { - name = StringHelper.getLikeUpperStr(name); - - return domainMapper.selectCount(ns, tab, name); - } - - @Override - public List<DomainEntity> selectByPage(String ns, String tab, String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return domainMapper.selectByPage(ns, tab, name, limit, offset); - } - - @Override - public List<DomainEntity> selectAll() { - return domainMapper.selectAll(); - } - - @Override - public DomainEntity selectById(int id) { - return domainMapper.selectById(id); - } - - @Override - public List<String> selectDomainNames(String ns, String tab) { - return domainMapper.selectDomainNames(ns, tab); - } - - @Override - public Integer insert(DomainEntity entity) { - return domainMapper.insert(entity); - } - - @Override - public Integer inserts(List<DomainEntity> list) { - return domainMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return domainMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return domainMapper.deletes(ids); - } - - @Override - public Integer update(DomainEntity entity) { - return domainMapper.update(entity); - } - - @Override - public Integer updates(List<DomainEntity> list) { - return domainMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/data/DownloadService.java b/src/main/java/com/lf/server/service/data/DownloadService.java deleted file mode 100644 index 6d4e5f3..0000000 --- a/src/main/java/com/lf/server/service/data/DownloadService.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.all.AbstractPwdEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.show.PipelineEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.data.DownloadMapper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.util.*; - -/** - * 涓嬭浇璁板綍 - * @author WWW - */ -@Service -public class DownloadService implements DownloadMapper { - @Autowired - PathHelper pathHelper; - - @Autowired - DownloadMapper downloadMapper; - - private final static Log log = LogFactory.getLog(DownloadService.class); - - @Override - public Integer selectCount(String name) { - name = StringHelper.getLikeUpperStr(name); - - return downloadMapper.selectCount(name); - } - - @Override - public List<DownloadEntity> selectByPage(String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return downloadMapper.selectByPage(name, limit, offset); - } - - @Override - public Integer selectCountForUser(Integer createUser, String types, String name) { - name = StringHelper.getLikeUpperStr(name); - - return downloadMapper.selectCountForUser(createUser, types, name); - } - - @Override - public List<DownloadEntity> selectByPageForUser(Integer createUser, String types, String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return downloadMapper.selectByPageForUser(createUser, types, name, limit, offset); - } - - @Override - public List<DownloadEntity> selectAll() { - return downloadMapper.selectAll(); - } - - @Override - public DownloadEntity selectById(int id) { - return downloadMapper.selectById(id); - } - - @Override - public DownloadEntity selectByGuid(String guid) { - return downloadMapper.selectByGuid(guid); - } - - @Override - public Integer insert(DownloadEntity entity) { - return downloadMapper.insert(entity); - } - - @Override - public Integer inserts(List<DownloadEntity> list) { - return downloadMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return downloadMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return downloadMapper.deletes(ids); - } - - @Override - public Integer update(DownloadEntity entity) { - return downloadMapper.update(entity); - } - - @Override - public Integer updates(List<DownloadEntity> list) { - return downloadMapper.updates(list); - } - - /** - * 鑾峰彇涓嬭浇鏂囦欢璺緞 - * - * @param de 涓嬭浇瀹炰綋绫� - * @return 涓嬭浇鏂囦欢璺緞 - */ - public String getDownloadFilePath(DownloadEntity de) { - return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); - } - - /** - * 瑙e瘑 - * - * @param entity 瀵嗙爜鎶借薄绫� - * @return 鏄�/鍚﹁В瀵嗘垚鍔� - */ - public static boolean decryptPwd(AbstractPwdEntity entity) { - try { - String pwd = RsaHelper.decrypt(entity.getPwd()); - if (StringHelper.isEmpty(pwd)) { - return false; - } - - entity.setPwd(pwd); - - return true; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return false; - } - } - - /** - * 瑙e瘑 - * - * @param pe 绠¢亾鍒嗘瀽瀹炰綋绫� - * @return 鏄�/鍚﹁В瀵嗘垚鍔� - */ - public static boolean decryptPwd(PipelineEntity pe) { - try { - String pwd = RsaHelper.decrypt(pe.getPwd()); - if (StringHelper.isEmpty(pwd)) { - return false; - } - - pe.setPwd(pwd); - - return true; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return false; - } - } - - /** - * 瑙e瘑 - * - * @param pwd 鍔犲瘑瀵嗙爜 - * @return 鍘熷瀵嗙爜 - */ - public static String decryptPwd(String pwd) { - try { - return RsaHelper.decrypt(pwd); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } - } -} diff --git a/src/main/java/com/lf/server/service/data/FmeService.java b/src/main/java/com/lf/server/service/data/FmeService.java deleted file mode 100644 index 3d380bc..0000000 --- a/src/main/java/com/lf/server/service/data/FmeService.java +++ /dev/null @@ -1,344 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.ctrl.FmeReqEntity; -import com.lf.server.entity.ctrl.NameValueEntity; -import com.lf.server.entity.ctrl.RegisterEntity; -import com.lf.server.entity.data.MetaFileEntity; -import com.lf.server.helper.RestHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * FME鏈嶅姟绫� - * @author WWW - */ -@Service -public class FmeService { - @Value("${sys.fmeUrl}") - private String fmeUrl; - - /** - * 鑾峰彇浠诲姟鐘舵�� - */ - public Object getTaskStatus(String id, HttpServletRequest req) { - String url = getUrl("datax/task/get", req) + "&id=" + id; - - return RestHelper.getForRest(url, Object.class); - } - - /** - * 涓嬭浇璐ㄦ閿欒缁撴灉 - */ - public String getDownloadUrl(String id, HttpServletRequest req) { - return getUrl("datax/task/downloadResult", req) + "&id=" + id; - } - - /** - * 1.OSGB妫�鏌ワ細.osgb + *鍊炬枩鎽勫奖*.xls/.xlsx - */ - public String checkOsgb(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/A8鎴愭灉璐ㄦ_OSGB妫�鏌�", req); - - List<NameValueEntity> list = getKeyValues("OSGB妫�鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - list.add(new NameValueEntity("DMYX_FBL", fme.imgResolution)); - - return RestHelper.postForRest(url, list); - } - - /** - * 2.琛ㄦ牸鏁版嵁妫�鏌ワ細.xls/.xlsx锛堟帓闄ゅ厓鏁版嵁锛� - */ - public String checkXls(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/A3鎴愭灉璐ㄦ_琛ㄦ牸鏁版嵁妫�鏌�", req); - - List<NameValueEntity> list = getKeyValues("琛ㄦ牸鏁版嵁妫�鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("SJZY", fme.sjzy)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - - return RestHelper.postForRest(url, list); - } - - /** - * 3.鐐逛簯妫�鏌ワ細.laz + *婵�鍏夌偣浜�*.xls/.xlsx - */ - public String checkLaz(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/A9鎴愭灉璐ㄦ_鐐逛簯妫�鏌�", req); - - List<NameValueEntity> list = getKeyValues("鐐逛簯妫�鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - list.add(new NameValueEntity("LAZ_MD", fme.lazDensity)); - - return RestHelper.postForRest(url, list); - } - - /** - * 4.楂樼▼妫�鏌ワ細.tif/.prj/.tfw/.tif.ovr + *鍦板舰鍥�*.dwg - */ - public String checkDem(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/A6鎴愭灉璐ㄦ_楂樼▼妫�鏌�", req); - - List<NameValueEntity> list = getKeyValues("楂樼▼妫�鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - list.add(new NameValueEntity("GCZWC", fme.demTolerance)); - list.add(new NameValueEntity("ChangeRate", fme.demChangeRate)); - - return RestHelper.postForRest(url, list); - } - - /** - * 5.灞炴�ф鏌ワ細*dlg*.gdb + *鍦板舰鍥�*.dwg - */ - public String checkAttrs(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/A5鎴愭灉璐ㄦ_灞炴�ф鏌�", req); - - List<NameValueEntity> list = getKeyValues("灞炴�ф鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("SJZY", fme.sjzy)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - - return RestHelper.postForRest(url, list); - } - - /** - * 6.鎷撴墤妫�鏌ワ細*鍦板舰鍥�*.dwg - */ - public String checkTopology(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/A4鎴愭灉璐ㄦ_鎷撴墤妫�鏌�", req); - - List<NameValueEntity> list = getKeyValues("鎷撴墤妫�鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - list.add(new NameValueEntity("S_MCDRC", fme.tolerance)); - list.add(new NameValueEntity("S_XCDRC", fme.tolerance)); - list.add(new NameValueEntity("S_DCDRC", fme.tolerance)); - list.add(new NameValueEntity("OFFSET_GCD", fme.gcdOffset)); - list.add(new NameValueEntity("OFFSET_KZD", fme.kzdOffset)); - list.add(new NameValueEntity("Range_OFFSET", fme.rangeOffset)); - list.add(new NameValueEntity("XG_MAX", fme.xgMax)); - - return RestHelper.postForRest(url, list); - } - - /** - * 7.鍥鹃潰鏁撮グ妫�鏌ワ細.dwg - */ - public String checkDecorate(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/A10鎴愭灉璐ㄦ_鍥鹃潰鏁撮グ妫�鏌�", req); - - List<NameValueEntity> list = getKeyValues("鍥鹃潰鏁撮グ妫�鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - list.add(new NameValueEntity("S_XLS", "$(ZJPZWJ)\\璐ㄦ閰嶇疆琛ㄦ��.xlsx")); - list.add(new NameValueEntity("S_XLS2", "D:\\Project\\Data\\LF\\temp\\20230107010101\\鏂囦欢娓呭崟.xlsx")); - - return RestHelper.postForRest(url, list); - } - - /** - * 8.鍘熺偣妫�鏌ワ細*鍓栭潰鍥�*.dwg - */ - public String checkOrigin(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/A11鎴愭灉璐ㄦ_鍘熺偣妫�鏌�", req); - - List<NameValueEntity> list = getKeyValues("鍘熺偣妫�鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - - return RestHelper.postForRest(url, list); - } - - /** - * 9.鏍呮牸妫�鏌ワ細.tif/.prj/.tfw/.tif.ovr + .xls/.xlsx - */ - public String checkDom(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/A7鎴愭灉璐ㄦ_鏍呮牸妫�鏌�", req); - - List<NameValueEntity> list = getKeyValues("鏍呮牸妫�鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("SJZY", fme.sjzy)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - list.add(new NameValueEntity("S_CoordinateSystem", fme.coordinateSystem)); - list.add(new NameValueEntity("DMYX_FBL", fme.imgResolution)); - - return RestHelper.postForRest(url, list); - } - - /** - * 10.鏁板鍩虹妫�鏌ワ細.shp, .gdb, *鍏冩暟鎹�*.xls/.xlsx - */ - public String checkMath(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/B1鍏ュ簱璐ㄦ_鏁板鍩虹妫�鏌�", req); - - List<NameValueEntity> list = getKeyValues("鏁板鍩虹妫�鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("SJZY", fme.sjzy)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - - return RestHelper.postForRest(url, list); - } - - /** - * 11.鍏冩暟鎹鏌ワ細*鍏冩暟鎹�*.xls/.xlsx - */ - public String checkMeta(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/B5鍏ュ簱璐ㄦ_鍏冩暟鎹鏌�", req); - - List<NameValueEntity> list = getKeyValues("鍏冩暟鎹鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("SJZY", fme.sjzy)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - - return RestHelper.postForRest(url, list); - } - - /** - * 12.鎬昏川妫�锛�.zip/.7z + .xls/.xlsx - */ - public String checkMain(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/B0鍏ュ簱璐ㄦ__鎬�", req); - - List<NameValueEntity> list = getKeyValues("鎬昏川妫�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("SJZY", fme.sjzy)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - list.add(new NameValueEntity("S_WBSBG", fme.wbsPath)); - list.add(new NameValueEntity("S_DZDK", fme.isDiZai)); - list.add(new NameValueEntity("DZ_ZLLX", fme.diZaiType)); - - return RestHelper.postForRest(url, list); - } - - /** - * 13.閫昏緫涓�鑷存�ф鏌ワ細.dwg/.xls/.xlsx - */ - public String checkLogical(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/B3鍏ュ簱璐ㄦ_閫昏緫涓�鑷存�ф鏌�", req); - - List<NameValueEntity> list = getKeyValues("閫昏緫涓�鑷存�ф鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("SJZY", fme.sjzy)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - - return RestHelper.postForRest(url, list); - } - - /** - * 14.鍗曢」鎴愭灉瀹屾暣鎬ф鏌ワ細.* - */ - public String checkSingleIntegrity(FmeReqEntity fme, HttpServletRequest req) { - String url = getUrl("datax/task/run/B6鍏ュ簱璐ㄦ_鍗曢」鎴愭灉瀹屾暣鎬ф鏌�", req); - - List<NameValueEntity> list = getKeyValues("鍗曢」鎴愭灉瀹屾暣鎬ф鏌�"); - list.add(new NameValueEntity("XMMC", fme.xmmc)); - list.add(new NameValueEntity("SJZY", fme.sjzy)); - list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); - list.add(new NameValueEntity("SJFL", fme.sjfl)); - - return RestHelper.postForRest(url, list); - } - - /** - * a.琛ㄦ牸鍏ュ簱锛歋_RKBG銆乨irid銆乸arentid锛屽涓互鑻辨枃閫楀彿闅斿紑 - */ - public String excelLoader(MetaFileEntity meta, HttpServletRequest req) { - String url = getUrl("datax/task/run/琛ㄦ牸鍏ュ簱", req); - - List<NameValueEntity> list = getKeyValues("琛ㄦ牸鍏ュ簱"); - list.add(new NameValueEntity("S_RKBG", meta.getPath())); - list.add(new NameValueEntity("COORDSYS", meta.getEpsgCode())); - list.add(new NameValueEntity("dirid", meta.getName())); - list.add(new NameValueEntity("depid", meta.getDepcode())); - list.add(new NameValueEntity("verid", meta.getVerid())); - list.add(new NameValueEntity("createuser", meta.getCreateUser())); - list.add(new NameValueEntity("parentid", meta.getEventid())); - - return RestHelper.postForRest(url, list); - } - - /** - * b.CRDS骞冲彴浜や粯 - */ - public String crdsPackaging(String dirCode, String major, String isCut, HttpServletRequest req) { - // datax/task/run/CRDS骞冲彴浜や粯_娴嬭瘯 - String url = getUrl("datax/task/run/CRDS骞冲彴浜や粯_code娴嬭瘯", req); - - List<NameValueEntity> list = getKeyValues("CRDS骞冲彴浜や粯"); - list.add(new NameValueEntity("S_FFXMMC", dirCode)); - list.add(new NameValueEntity("MBZY", major)); - list.add(new NameValueEntity("P_WBFW", isCut)); - - return RestHelper.postForRest(url, list); - } - - /** - * c.鏈嶅姟娉ㄥ唽 - */ - public RegisterEntity serverRegister(String name, String serverUri, String type, HttpServletRequest req) { - String url = getUrl("resource/res/item", req); - - RegisterEntity entity = new RegisterEntity(name, serverUri, type); - - String resid = RestHelper.postForRest(url, entity); - entity.setSerialnum(resid); - - return entity; - } - - /** - * d.鏈嶅姟鐢宠 - */ - public void serverApply(String id, Integer pubid, HttpServletRequest req) { - String url = getUrl("resource/res/request", req) + "&resourceid=" + id; - - RegisterEntity entity = new RegisterEntity(pubid); - - RestHelper.postForRest(url, entity); - } - - /** - * e.鍒犻櫎璧勬簮 - */ - public void deleteRes(String id, HttpServletRequest req) { - String url = getUrl("resource/res/hashid", req) + "&hashid=" + id; - - RestHelper.deleteForRest(url); - } - - /** - * 鑾峰彇Url - */ - public String getUrl(String subUrl, HttpServletRequest req) { - String token = WebHelper.getToken(req); - - return fmeUrl + subUrl + "?token=" + token; - } - - /** - * 鑾峰彇鍚嶇О鍊煎闆嗗悎 - */ - public List<NameValueEntity> getKeyValues(String name) { - List<NameValueEntity> list = new ArrayList<>(); - list.add(new NameValueEntity("_name", String.format("%s_%s", name, StringHelper.YMDHMS2_FORMAT.format(new Date())))); - list.add(new NameValueEntity("_priority", 100)); - list.add(new NameValueEntity("_terminate_on_error", false)); - list.add(new NameValueEntity("IID", "")); - list.add(new NameValueEntity("FANOUT_DIR", "$(OrgResultStorage)")); - list.add(new NameValueEntity("IID_JL", "$(ZJPZWJ)\\IID璁板綍琛�.xlsx")); - list.add(new NameValueEntity("S_ZJXZ", "$(ZJPZWJ)\\璐ㄦ缁嗗垯鎬�.xlsx")); - list.add(new NameValueEntity("S_BZPZB", "$(ZJPZWJ)\\璐ㄦ閰嶇疆琛ㄦ��.xlsx")); - - return list; - } -} diff --git a/src/main/java/com/lf/server/service/data/LayerService.java b/src/main/java/com/lf/server/service/data/LayerService.java deleted file mode 100644 index bbb6aa5..0000000 --- a/src/main/java/com/lf/server/service/data/LayerService.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.data.LayerEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.data.LayerMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鍥惧眰 - * @author WWW - */ -@Service -public class LayerService implements LayerMapper { - @Autowired - LayerMapper layerMapper; - - @Override - public Integer selectCount(String cnName) { - cnName = StringHelper.getLikeUpperStr(cnName); - - return layerMapper.selectCount(cnName); - } - - @Override - public List<LayerEntity> selectByPage(String cnName, Integer limit, Integer offset) { - cnName = StringHelper.getLikeUpperStr(cnName); - - return layerMapper.selectByPage(cnName, limit, offset); - } - - @Override - public List<LayerEntity> selectAll() { - return layerMapper.selectAll(); - } - - @Override - public LayerEntity selectById(int id) { - return layerMapper.selectById(id); - } - - @Override - public Integer insert(LayerEntity entity) { - return layerMapper.insert(entity); - } - - @Override - public Integer inserts(List<LayerEntity> list) { - return layerMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return layerMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return layerMapper.deletes(ids); - } - - @Override - public Integer update(LayerEntity entity) { - return layerMapper.update(entity); - } - - @Override - public Integer updates(List<LayerEntity> list) { - return layerMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/data/MetaService.java b/src/main/java/com/lf/server/service/data/MetaService.java deleted file mode 100644 index 61b5b5d..0000000 --- a/src/main/java/com/lf/server/service/data/MetaService.java +++ /dev/null @@ -1,631 +0,0 @@ -package com.lf.server.service.data; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.DownloadReqEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.sys.AttachEntity; -import com.lf.server.entity.sys.MetaDownEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.mapper.all.GeomBaseMapper; -import com.lf.server.mapper.data.MetaMapper; -import com.lf.server.service.all.BaseQueryService; -import com.lf.server.service.sys.MetaDownService; -import net.lingala.zip4j.ZipFile; -import net.lingala.zip4j.model.FileHeader; -import net.lingala.zip4j.model.ZipParameters; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileInputStream; -import java.util.*; - -/** - * 鍏冩暟鎹� - * @author WWW - */ -@Service -public class MetaService implements MetaMapper { - @Autowired - PathHelper pathHelper; - - @Autowired - MetaMapper metaMapper; - - @Autowired - MetaDownService metaDownService; - - @Autowired - DownloadService downloadService; - - private final static Log log = LogFactory.getLog(MetaService.class); - - @Override - public Integer selectCount(String depcode, String dircode, Integer verid, String name) { - depcode = StringHelper.getRightLike(depcode); - dircode = StringHelper.getRightLike(dircode); - name = StringHelper.getLikeUpperStr(name); - - return metaMapper.selectCount(depcode, dircode, verid, name); - } - - @Override - public List<MetaEntity> selectByPage(String depcode, String dircode, Integer verid, String name, Integer limit, Integer offset) { - depcode = StringHelper.getRightLike(depcode); - dircode = StringHelper.getRightLike(dircode); - name = StringHelper.getLikeUpperStr(name); - - return metaMapper.selectByPage(depcode, dircode, verid, name, limit, offset); - } - - @Override - public Integer selectMetasForCount(String depcode, String dirs, String name) { - depcode = StringHelper.getRightLike(depcode); - name = StringHelper.getLikeUpperStr(name); - - return metaMapper.selectMetasForCount(depcode, dirs, name); - } - - @Override - public List<MetaEntity> selectMetasForPage(String depcode, String dirs, String name, Integer limit, Integer offset) { - depcode = StringHelper.getRightLike(depcode); - name = StringHelper.getLikeUpperStr(name); - - return metaMapper.selectMetasForPage(depcode, dirs, name, limit, offset); - } - - @Override - public Integer selectCountForUpload(String name, Integer createUser, String types) { - name = StringHelper.getLikeUpperStr(name); - - return metaMapper.selectCountForUpload(name, createUser, types); - } - - @Override - public List<MetaEntity> selectByPageForUpload(String name, Integer createUser, String types, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return metaMapper.selectByPageForUpload(name, createUser, types, limit, offset); - } - - @Override - public Integer selectCountByPid(Integer metaid, String name) { - name = StringHelper.getLikeUpperStr(name); - - return metaMapper.selectCountByPid(metaid, name); - } - - @Override - public List<MetaEntity> selectPageByPid(Integer metaid, String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return metaMapper.selectPageByPid(metaid, name, limit, offset); - } - - @Override - public MetaEntity selectById(int id) { - return metaMapper.selectById(id); - } - - @Override - public MetaEntity selectByGuid(String guid, String dircode, String tab) { - return metaMapper.selectByGuid(guid, dircode, tab); - } - - @Override - public List<MetaEntity> selectByIdsForTab(String ids) { - return metaMapper.selectByIdsForTab(ids); - } - - @Override - public List<MetaEntity> selectMetaFiles(List<Integer> ids) { - return metaMapper.selectMetaFiles(ids); - } - - @Override - public List<MetaEntity> selectXlsAnnex(Integer[] ids, String tabs) { - return metaMapper.selectXlsAnnex(ids, tabs); - } - - @Override - public List<MetaEntity> selectMetasByDirCode(String dircode) { - dircode = StringHelper.getRightLike(dircode); - - return metaMapper.selectMetasByDirCode(dircode); - } - - @Override - public List<String> selectMetaOverflowDep(String ids, String depcode) { - depcode = StringHelper.getRightLike(depcode); - - return metaMapper.selectMetaOverflowDep(ids, depcode); - } - - @Override - public Integer insert(MetaEntity entity) { - return metaMapper.insert(entity); - } - - @Override - public Integer inserts(List<MetaEntity> list) { - return metaMapper.inserts(list); - } - - @Override - public Integer deletes(String sql, String ids) { - return metaMapper.deletes(sql, ids); - } - - @Override - public Integer update(MetaEntity entity) { - return metaMapper.update(entity); - } - - @Override - public Integer updates(List<MetaEntity> list) { - return metaMapper.updates(list); - } - - /** - * 鍒犻櫎鍏冩暟鎹� - */ - public Integer deletes(List<Integer> list) { - String ids = StringHelper.join(list, ","); - - String sql = null; - List<MetaEntity> metas = selectByIdsForTab(ids); - if (null != metas && metas.size() > 0) { - sql = getDelTabsSql(metas); - } - - return deletes(sql, ids); - } - - /** - * 鑾峰彇鍒犻櫎琛ㄨ褰昐QL - */ - public String getDelTabsSql(List<MetaEntity> metas) { - List<String> list = getTabDeletes(metas, metas.get(0).getTab()); - addCascadDeletes(list); - addAttachDeletes(list); - Collections.reverse(list); - - return StringHelper.join(list, ";"); - } - - /** - * 鑾峰彇鍒犻櫎琛ㄨ褰昐QL - */ - private List<String> getTabDeletes(List<MetaEntity> metas, String tab) { - List<String> list = new ArrayList<>(); - - List<String> pids = new ArrayList<>(); - for (MetaEntity me : metas) { - if (tab.equals(me.getTab())) { - pids.add("'" + me.getEventid() + "'"); - } else { - list.add(String.format("delete from %s where parentid in (%s)", tab, StringHelper.join(pids, ","))); - - pids.clear(); - tab = me.getTab(); - pids.add("'" + me.getEventid() + "'"); - } - } - if (pids.size() > 0) { - list.add(String.format("delete from %s where parentid in (%s)", tab, StringHelper.join(pids, ","))); - } - - return list; - } - - /** - * 娣诲姞绾ц仈鍒犻櫎 - */ - private void addCascadDeletes(List<String> list) { - int i = 0, c = list.size(); - while (i < c) { - String str = list.get(i); - if (str.contains("bs.m_pipelinepoint ")) { - list.add(str.replace("bs.m_pipelinepoint ", "bs.m_pipesegment ")); - list.add(str.replace("bs.m_pipelinepoint ", "bs.m_pipeline ")); - } - if (str.contains("bs.s_explorationpoint ")) { - list.add(str.replace("bs.s_explorationpoint ", "bs.s_surveyworksite ")); - } - - i++; - } - } - - /** - * 娣诲姞闄勪欢鍒犻櫎 - */ - private void addAttachDeletes(List<String> list) { - int i = 0, c = list.size(); - while (i < c) { - String str = list.get(i); - String tab = str.substring("delete from ".length(), str.indexOf(" where ")); - String select = str.replace("delete ", "select eventid "); - - list.add(String.format("delete from lf.sys_attach where tab='%s' and tab_guid in (%s)", tab, select)); - - i++; - } - } - - /** - * 鏌ョ湅鏂囦欢 - */ - public void downloadForView(String guid, boolean inline, HttpServletResponse res) { - try { - if (StringHelper.isEmpty(guid)) { - WebHelper.writeStr2Page(res, StaticData.NO_FILE); - return; - } - - MetaEntity me = selectByGuid(guid, null, null); - if (me == null) { - WebHelper.writeStr2Page(res, StaticData.NO_FILE); - return; - } - - String filePath = pathHelper.getConfig().getUploadPath() + File.separator + me.getPath(); - File file = new File(filePath); - if (!file.exists() || file.isDirectory()) { - WebHelper.writeJson2Page(res, "鏂囦欢涓嶅瓨鍦�"); - } - - WebHelper.download(filePath, me.getName(), inline, res); - } catch (Exception ex) { - WebHelper.writeJson2Page(res, "鏂囦欢涓嬭浇鍑洪敊"); - log.error(ex.getMessage(), ex); - } - } - - /** - * 鏌ヨ鍏冩暟鎹腑婧㈠嚭鐨勫崟浣岻D - */ - public List<String> selectMetaOverflowDep(UserEntity ue, DownloadReqEntity dr) { - String ids = StringHelper.join(dr.getIds(), ","); - - return selectMetaOverflowDep(ids, ue.getDepcode()); - } - - /** - * 璇锋眰鍏冩暟鎹笅杞� - * - * @param ue 鐢ㄦ埛瀹炰綋 - * @param dr 璇锋眰涓嬭浇瀹炰綋 - * @return 涓嬭浇鏂囦欢GUID - * @throws Exception 寮傚父 - */ - public String downloadMeteReq(UserEntity ue, DownloadReqEntity dr) throws Exception { - List<MetaEntity> list = selectMetaFiles(dr.getIds()); - if (null == list || list.isEmpty()) { - return null; - } - - Map<String, List<String>> tabs = getTabs(list); - rmRepeatMetas(list); - - Map<String, List<?>> dataMap = new HashMap<>(2); - Map<String, List<AttachEntity>> annexMap = new HashMap<>(2); - queryData(tabs, dataMap, annexMap); - - String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); - String tempPath = pathHelper.getTempPath(tempName); - String gdbPath = tempPath + File.separator + "tabs.gdb"; - - File gdbFile = new File(gdbPath); - if (gdbFile.exists() && gdbFile.isDirectory()) { - FileHelper.deleteDir(gdbPath); - } - if (dataMap.size() > 0) { - GdbHelper.createGdb(gdbPath, dataMap); - } - - String zipFile = pathHelper.getDownloadFullPath() + File.separator + tempName + ".zip"; - ZipFile zip = Zip4jHelper.createZipFile(zipFile, dr.getPwd()); - ZipParameters params = Zip4jHelper.getZipParams(true); - addMetaFiles(zip, params, list); - if (dataMap.size() > 0) { - zip.addFolder(new File(gdbPath), params); - addAnnex(zip, params, annexMap); - } - - String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd())); - DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd); - int rows = downloadService.insert(de); - if (de.getId() > 0) { - insertMetaDown(ue, list, de); - } - - return rows > 0 ? de.getGuid() : null; - } - - /** - * 鑾峰彇鏁版嵁琛� - */ - private Map<String, List<String>> getTabs(List<MetaEntity> list) { - Map<String, List<String>> tabs = new HashMap<>(2); - for (MetaEntity meta : list) { - if (StringHelper.isEmpty(meta.getTab()) || meta.getRows() == 0 || StringHelper.isEmpty(meta.getEventid())) { - continue; - } - - if (!tabs.containsKey(meta.getTab())) { - tabs.put(meta.getTab(), new ArrayList<>()); - } - - List<String> ids = tabs.get(meta.getTab()); - if (!ids.contains(meta.getEventid())) { - ids.add(meta.getEventid()); - } - } - - return tabs; - } - - /** - * 绉婚櫎閲嶅鐨勫厓鏁版嵁鏂囦欢 - */ - private void rmRepeatMetas(List<MetaEntity> list) { - List<String> guidList = new ArrayList<>(); - - int i = 0; - while (i < list.size()) { - MetaEntity entity = list.get(i); - if (guidList.contains(entity.getGuid())) { - list.remove(i); - continue; - } - - guidList.add(entity.getGuid()); - i++; - } - } - - /** - * 鏌ヨ鏁版嵁 - */ - private void queryData(Map<String, List<String>> tabs, Map<String, List<?>> dataMap, Map<String, List<AttachEntity>> annexMap) { - for (String tab : tabs.keySet()) { - try { - String entity = tab.toLowerCase().replace("_", "").split("\\.")[1]; - BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); - if (null == baseMapper) { - continue; - } - - QueryWrapper wrapper = createQueryWrapper(baseMapper, tabs.get(tab)); - addData(entity, baseMapper, wrapper, dataMap, annexMap); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } - - /** - * 娣诲姞鏁版嵁 - */ - public void addData(String entity, BasicMapper baseMapper, QueryWrapper wrapper, Map<String, List<?>> dataMap, Map<String, List<AttachEntity>> annexMap) { - List list = baseMapper.selectList(wrapper); - if (null == list || list.size() == 0) { - return; - } - - if (!dataMap.containsKey(entity)) { - dataMap.put(entity, list); - } else { - dataMap.get(entity).addAll(list); - } - if (wrapper.isEmptyOfWhere()) { - wrapper.apply("1 = 1"); - } - if (StaticData.BBOREHOLE.equals(entity)) { - wrapper.last("limit 100"); - } - - String tab = BaseQueryService.getTabName(baseMapper); - List<AttachEntity> annex = baseMapper.selectAnnex(tab, wrapper); - if (null == annex || annex.isEmpty()) { - return; - } - - if (!annexMap.containsKey(entity)) { - annexMap.put(tab.replace(StaticData.POINT, "_"), annex); - } else { - annexMap.get(tab.replace(StaticData.POINT, "_")).addAll(annex); - } - } - - /** - * 鍒涘缓鏌ヨ鍖呰鍣� - */ - private <T> QueryWrapper<T> createQueryWrapper(BasicMapper baseMapper, List<String> ids) { - for (int i = 0, c = ids.size(); i < c; i++) { - ids.set(i, "'" + ids.get(i) + "'"); - } - String filter = String.format("parentid in (%s)", StringHelper.join(ids, ",")); - - QueryWrapper<T> wrapper = new QueryWrapper<T>(); - if (baseMapper instanceof GeomBaseMapper) { - wrapper.select("ST_AsText(geom) as geom, *"); - } - wrapper.apply(filter); - - return wrapper; - } - - /** - * 娣诲姞闄勪欢 - */ - public void addAnnex(ZipFile zip, ZipParameters params, Map<String, List<AttachEntity>> annexMap) { - List<String> files = new ArrayList<>(); - String uploadPath = pathHelper.getConfig().getUploadPath(); - for (String key : annexMap.keySet()) { - for (AttachEntity ae : annexMap.get(key)) { - try { - File srcFile = new File(uploadPath + File.separator + ae.getPath()); - if (!srcFile.exists() || srcFile.isDirectory()) { - continue; - } - if (files.contains(srcFile.getPath())) { - continue; - } - - files.add(srcFile.getPath()); - params.setFileNameInZip("annex" + File.separator + key + File.separator + ae.getName()); - zip.addStream(new FileInputStream(srcFile), params); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } - } - - /** - * 娣诲姞鍏冩暟鎹枃浠惰嚦Zip鍖� - */ - private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaEntity> list) { - List<String> names = new ArrayList<>(); - String uploadPath = pathHelper.getConfig().getUploadPath(); - for (MetaEntity mf : list) { - if (names.contains(mf.getName())) { - mf.setName(mf.getId() + "_" + mf.getName()); - } else { - names.add(mf.getName()); - } - - try { - switch ("." + mf.getType()) { - case StaticData.MPT: - addMultiFile(uploadPath, mf, zip, params, StaticData.MPT_EXT); - break; - case StaticData.JPG: - addMultiFile(uploadPath, mf, zip, params, StaticData.JPG_EXT); - case StaticData.IMG: - addMultiFile(uploadPath, mf, zip, params, StaticData.IMG_EXT); - break; - case StaticData.TIF: - addMultiFile(uploadPath, mf, zip, params, StaticData.TIF_EXT); - break; - case StaticData.TIFF: - addMultiFile(uploadPath, mf, zip, params, StaticData.TIFF_EXT); - break; - case StaticData.SHP: - addMultiFile(uploadPath, mf, zip, params, StaticData.SHP_EXT); - break; - case StaticData.GDB: - addFolderFile(uploadPath, mf, zip, params); - break; - default: - addSingleFile(uploadPath, mf, zip, params); - break; - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } - - /** - * 娣诲姞鐩綍鏂囦欢 - */ - private void addFolderFile(String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params) throws Exception { - File file = new File(uploadPath + File.separator + mf.getPath()); - if (!file.exists() || !file.isDirectory()) { - return; - } - zip.addFolder(file, params); - - String fileName = FileHelper.getFileName(file.getPath()); - FileHeader header = zip.getFileHeader(fileName); - if (null != header) { - zip.renameFile(header, mf.getName()); - } - } - - /** - * 娣诲姞澶氭枃浠� - */ - private void addMultiFile(String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params, List<String> extList) throws Exception { - addSingleFile(uploadPath, mf, zip, params); - - for (String ext : extList) { - File file = new File(uploadPath + File.separator + mf.getPath().replace("." + mf.getType(), ext)); - if (!file.exists() || file.isDirectory()) { - continue; - } - zip.addFile(file, params); - - String fileName = FileHelper.getFileName(file.getPath()); - FileHeader header = zip.getFileHeader(fileName); - if (null != header) { - zip.renameFile(header, mf.getName().replace("." + mf.getType(), ext)); - } - } - } - - /** - * 娣诲姞鍗曟枃浠� - */ - private void addSingleFile(String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params) throws Exception { - File file = new File(uploadPath + File.separator + mf.getPath()); - if (!file.exists() || file.isDirectory()) { - return; - } - zip.addFile(file, params); - - String fileName = FileHelper.getFileName(file.getPath()); - FileHeader header = zip.getFileHeader(fileName); - if (null != header) { - zip.renameFile(header, mf.getName()); - } - } - - /** - * 鑾峰彇涓嬭浇瀹炰綋绫� - */ - private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { - DownloadEntity de = new DownloadEntity(); - de.setName(FileHelper.getFileName(file)); - // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 - de.setType(3); - de.setSizes(FileHelper.sizeToMb(new File(file).length())); - de.setDepid(ue.getDepid()); - de.setDcount(0); - de.setPwd(pwd); - de.setUrl(FileHelper.getRelativePath(file)); - de.setDescr("鍏冩暟鎹枃浠�"); - de.setGuid(FileHelper.getFileMd5(file)); - de.setCreateUser(ue.getId()); - // de.setGeom(null) - - return de; - } - - /** - * 鎻掑叆鍏冩暟鎹�-涓嬭浇琛� - */ - private void insertMetaDown(UserEntity ue, List<MetaEntity> metas, DownloadEntity de) { - List<MetaDownEntity> list = new ArrayList<>(); - for (MetaEntity me : metas) { - MetaDownEntity md = new MetaDownEntity(); - md.setMetaid(me.getId()); - md.setDownid(de.getId()); - md.setCreateUser(ue.getId()); - - list.add(md); - } - - metaDownService.inserts(list); - } -} diff --git a/src/main/java/com/lf/server/service/data/PublishService.java b/src/main/java/com/lf/server/service/data/PublishService.java deleted file mode 100644 index 24d04b9..0000000 --- a/src/main/java/com/lf/server/service/data/PublishService.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.lf.server.service.data; - -import com.alibaba.fastjson.JSON; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.PubEntity; -import com.lf.server.entity.ctrl.RegisterEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.data.PublishEntity; -import com.lf.server.helper.RestHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.data.PublishMapper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 鏁版嵁鍙戝竷 - * @author WWW - */ -@Service -public class PublishService implements PublishMapper { - @Value("${sys.exportServer}") - private String exportServer; - - @Value("${sys.iisHost}") - private String iisHost; - - @Autowired - PublishMapper publishMapper; - - @Autowired - FmeService fmeService; - - private final static Log log = LogFactory.getLog(PublishService.class); - - @Override - public Integer selectCount(String name) { - name = StringHelper.getLikeUpperStr(name); - - return publishMapper.selectCount(name); - } - - @Override - public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return publishMapper.selectByPage(name, limit, offset); - } - - @Override - public List<PublishEntity> selectAll() { - return publishMapper.selectAll(); - } - - @Override - public PublishEntity selectById(int id) { - return publishMapper.selectById(id); - } - - @Override - public List<PublishEntity> selectByIds(String ids) { - return publishMapper.selectByIds(ids); - } - - @Override - public Integer insert(PublishEntity entity) { - return publishMapper.insert(entity); - } - - @Override - public Integer inserts(List<PublishEntity> list) { - return publishMapper.inserts(list); - } - - @Override - public Integer insertPubDown(Integer pubid, Integer downid, Integer createUser) { - return publishMapper.insertPubDown(pubid, downid, createUser); - } - - @Override - public Integer delete(int id) { - return publishMapper.delete(id); - } - - @Override - public Integer deletes(String ids) { - return publishMapper.deletes(ids); - } - - @Override - public Integer update(PublishEntity entity) { - return publishMapper.update(entity); - } - - @Override - public Integer updates(List<PublishEntity> list) { - return publishMapper.updates(list); - } - - @Override - public Integer selectMetasByCount(String depcode, String dircode, Integer verid, String types, String name) { - depcode = StringHelper.getRightLike(depcode); - dircode = StringHelper.getRightLike(dircode); - name = StringHelper.getLikeUpperStr(name); - - return publishMapper.selectMetasByCount(depcode, dircode, verid, types, name); - } - - @Override - public List<MetaEntity> selectMetasByPage(String depcode, String dircode, Integer verid, String types, String name, Integer limit, Integer offset) { - depcode = StringHelper.getRightLike(depcode); - dircode = StringHelper.getRightLike(dircode); - name = StringHelper.getLikeUpperStr(name); - - return publishMapper.selectMetasByPage(depcode, dircode, verid, types, name, limit, offset); - } - - /** - * 鍙戦�佸彂甯冭姹� - */ - public long postForPub(PubEntity entity, String method, HttpServletRequest req) { - Map<String, Object> map = getMapData(entity); - - String str = RestHelper.postForRest(exportServer + method, map); - if (StringHelper.isEmpty(str)) { - return 0; - } - - ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class); - if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) { - return 0; - } - - if (msg.getCount() > 0) { - serverRegister(msg.getResult(), req); - } - - return msg.getCount(); - } - - /** - * 鑾峰彇Map鏁版嵁 - */ - private Map<String, Object> getMapData(PubEntity entity) { - Map<String, Object> map = new HashMap<>(3); - - Field[] fields = entity.getClass().getDeclaredFields(); - for (Field field : fields) { - try { - if ("serialVersionUID".equals(field.getName())) { - continue; - } - - field.setAccessible(true); - Object obj = field.get(entity); - - map.put(field.getName(), obj); - } catch (Exception ex) { - // - } - } - - return map; - } - - /** - * 鏈嶅姟娉ㄥ唽 - */ - private void serverRegister(String ids, HttpServletRequest req) { - List<PublishEntity> list = selectByIds(ids); - if (null == list || list.isEmpty()) { - return; - } - - for (PublishEntity entity : list) { - String url = entity.getUrl().replace("{host}", iisHost); - String type = getServerType(entity); - - RegisterEntity reg = fmeService.serverRegister(entity.getName(), url, type, req); - if (null == reg || StringHelper.isEmpty(reg.getSerialnum())) { - continue; - } - - fmeService.serverApply(reg.getSerialnum(), entity.getId(), req); - - entity.setRegid(reg.getHashid()); - update(entity); - } - } - - /** - * 鑾峰彇鏈嶅姟绫诲瀷 - */ - private String getServerType(PublishEntity entity) { - switch (entity.getType()) { - case "DOM": - return "TMS鏈嶅姟"; - case "DEM": - return "涓夌淮鍦板舰鏈嶅姟"; - case "mpt": - return "涓夌淮鍦烘櫙鏈嶅姟"; - default: - return "涓夌淮妯″瀷鏈嶅姟"; - } - } - - /** - * 鍒犻櫎澶氭潯 - */ - public Integer deletes(List<Integer> idList, HttpServletRequest req) { - String ids = StringHelper.join(idList, ","); - - deleteRes(ids, req); - - return deletes(ids); - } - - /** - * 鍒犻櫎璧勬簮 - */ - private void deleteRes(String ids, HttpServletRequest req) { - List<PublishEntity> list = selectByIds(ids); - if (null == list || list.isEmpty()) { - return; - } - - for (PublishEntity entity : list) { - if (StringHelper.isEmpty(entity.getRegid())) { - continue; - } - - try { - fmeService.deleteRes(entity.getRegid(), req); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } -} diff --git a/src/main/java/com/lf/server/service/data/StyleService.java b/src/main/java/com/lf/server/service/data/StyleService.java deleted file mode 100644 index c512561..0000000 --- a/src/main/java/com/lf/server/service/data/StyleService.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.data.StyleEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.data.StyleMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鏍峰紡绠$悊 - * @author sws - * @date 2022-09-26 - */ -@Service -public class StyleService implements StyleMapper { - @Autowired - StyleMapper styleMapper; - - @Override - public Integer selectCount(String name) { - name = StringHelper.getLikeUpperStr(name); - - return styleMapper.selectCount(name); - } - - @Override - public List<StyleEntity> selectByPage(String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return styleMapper.selectByPage(name, limit, offset); - } - - @Override - public Integer insertStyle(StyleEntity styleEntity) { - return styleMapper.insertStyle(styleEntity); - } - - @Override - public Integer insertStyles(List<StyleEntity> styleEntity) { - return styleMapper.insertStyles(styleEntity); - } - - @Override - public Integer deleteStyle(int id) { - return styleMapper.deleteStyle(id); - } - - @Override - public Integer deleteStyles(List<Integer> ids) { - return styleMapper.deleteStyles(ids); - } - - @Override - public Integer updateStyle(StyleEntity styleEntity) { - return styleMapper.updateStyle(styleEntity); - } - - - @Override - public StyleEntity selectStyle(int id) { - return styleMapper.selectStyle(id); - } - - @Override - public List<StyleEntity> selectStyleAll() { - return styleMapper.selectStyleAll(); - } -} \ No newline at end of file diff --git a/src/main/java/com/lf/server/service/data/UploadService.java b/src/main/java/com/lf/server/service/data/UploadService.java deleted file mode 100644 index 5660dad..0000000 --- a/src/main/java/com/lf/server/service/data/UploadService.java +++ /dev/null @@ -1,576 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.all.BaseEntity; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.data.*; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.mapper.data.UploadMapper; -import com.lf.server.service.all.BaseQueryService; -import com.lf.server.service.all.BaseUploadService; -import com.lf.server.service.sys.DepService; -import org.apache.commons.io.FileUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import java.io.File; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.List; - -/** - * 鏁版嵁涓婁紶鏈嶅姟绫� - * - * @author WWW - */ -@Service -public class UploadService extends BaseUploadService implements UploadMapper { - @Autowired - UploadMapper uploadMapper; - - @Autowired - FmeService fmeService; - - @Autowired - MetaService metaService; - - @Autowired - DepService depService; - - @Autowired - DirService dirService; - - @Override - public List<CoordEntity> selectCoords(String zoning) { - return uploadMapper.selectCoords(zoning); - } - - @Override - public Integer selectCount4Coord(String epsgCode) { - return uploadMapper.selectCount4Coord(epsgCode); - } - - @Override - public List<DirEntity> selectProject() { - return uploadMapper.selectProject(); - } - - @Override - public List<FmeLogEntity> selectFmeLog(String parentid) { - return uploadMapper.selectFmeLog(parentid); - } - - /** - * 鎻掑叆鏂囦欢 - */ - public void insertFiles(UserEntity ue, List<MetaFileEntity> list, HttpServletRequest req) { - checkMetaFiles(ue, list); - List<MetaFileEntity> xlsList = getExcelFiles(list); - loadData(list); - copyFiles(list); - insertMetas(list); - if (xlsList.size() > 0) { - String guid = excelLoader(xlsList, req); - } - } - - /** - * 妫�鏌ュ厓鏁版嵁鏂囦欢 - */ - private void checkMetaFiles(UserEntity ue, List<MetaFileEntity> list) { - Timestamp createTime = WebHelper.getCurrentTimestamp(); - String tempPath = pathHelper.getConfig().getTempPath(); - - for (MetaFileEntity mf : list) { - mf.setCreateUser(ue.getId()); - mf.setCreateTime(createTime); - mf.setDepcode(ue.getDepcode()); - mf.setPath(tempPath + File.separator + mf.getPath()); - mf.setMsg(null); - - File f = new File(mf.getPath()); - if (!f.exists()) { - mf.setMsg("鏂囦欢涓㈠け"); - } - - MetaEntity old = metaService.selectByGuid(mf.getGuid(), getDirCode(mf), null); - if (null != old) { - mf.setMsg("宸插瓨鍦�"); - } - } - } - - /** - * 鑾峰彇鐩綍缂栫爜 - */ - private String getDirCode(MetaFileEntity mf) { - if (StringHelper.isEmpty(mf.getDircode())) { - return null; - } - - return StringHelper.getRightLike(mf.getDircode().substring(0, 2)); - } - - /** - * 鑾峰彇Excel鍏冩暟鎹枃浠� - */ - private List<MetaFileEntity> getExcelFiles(List<MetaFileEntity> list) { - List<MetaFileEntity> xlsList = new ArrayList<>(); - for (MetaFileEntity mf : list) { - if (null == mf.getMsg() && isExcel(mf)) { - xlsList.add(mf); - } - } - if (xlsList.isEmpty()) { - return xlsList; - } - - String xlsBasePath = getXlsPath(xlsList.get(0).getPath()); - for (int i = 0, c = xlsList.size(); i < c; i++) { - MetaFileEntity mf = xlsList.get(i); - String xlsPath = copyXlsFile(xlsBasePath, i, mf); - mf.setXlsPath(xlsPath); - } - - return xlsList; - } - - /** - * 鏄�/鍚︿负Excel - */ - private boolean isExcel(MetaFileEntity mf) { - return StaticData.XLS.equals(mf.getExtName()) || StaticData.XLSX.equals(mf.getExtName()); - } - - /** - * 鑾峰彇Xls鐩綍 - */ - private String getXlsPath(String filePath) { - String tempPath = pathHelper.getConfig().getTempPath() + File.separator; - String subPath = filePath.substring(tempPath.length()); - subPath = tempPath + subPath.substring(0, subPath.indexOf(File.separator)).replace("_zip", "") + "_xls"; - - File f = new File(subPath); - if (!f.exists() || !f.isDirectory()) { - f.mkdirs(); - } - - return subPath; - } - - /** - * 澶嶅埗Xls鏂囦欢 - */ - private String copyXlsFile(String xlsBasePath, int i, MetaFileEntity mf) { - try { - String xlsPath = xlsBasePath + File.separator + i; - - File file = new File(xlsPath); - if (!file.exists() || !file.isDirectory()) { - file.mkdirs(); - } - file = new File(mf.getPath()); - - File newFile = new File(xlsPath + File.separator + FileHelper.getFileName(file.getPath())); - FileUtils.copyFile(file, newFile); - - return newFile.getPath(); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return null; - } - } - - /** - * 鍔犺浇鏁版嵁 - */ - private void loadData(List<MetaFileEntity> list) { - for (MetaFileEntity mf : list) { - if (null != mf.getMsg() || StringHelper.isEmpty(mf.getEntity())) { - continue; - } - if (StaticData.SHP.equals(mf.getExtName()) || StaticData.GDB.equals(mf.getExtName())) { - loadSpatialData(mf); - } - } - } - - /** - * 鍔犺浇绌洪棿鏁版嵁 - */ - public void loadSpatialData(MetaFileEntity mf) { - BasicMapper basicMapper = ClassHelper.getBasicMapper(mf.getEntity()); - if (null == basicMapper) { - return; - } - - String tabName = BaseQueryService.getTabName(basicMapper); - String className = ClassHelper.getClassName(basicMapper); - Class clazz = ClassHelper.getEntityClass(className); - if (null == clazz || null == tabName) { - return; - } - - File file = new File(mf.getPath()); - if (!file.exists()) { - mf.setMsg("鏂囦欢涓㈠け"); - return; - } - - MetaEntity old = metaService.selectByGuid(mf.getGuid(), getDirCode(mf), tabName); - if (null != old) { - mf.setMsg("宸插瓨鍦�"); - return; - } - - List<?> list; - if (StaticData.SHP.equals(mf.getExtName())) { - list = ShpHelper.readData(clazz, mf.getPath()); - } else { - list = GdbHelper.readData(clazz, mf.getPath(), mf.getTab()); - } - if (null == list || list.isEmpty()) { - return; - } - setCreateInfo(list, mf); - - int rows = basicMapper.insertBatch(list); - if (rows > 0) { - mf.setEntity(mf.getTab()); - mf.setTab(tabName); - mf.setRows(rows); - } - } - - /** - * 璁剧疆鍒涘缓淇℃伅 - */ - private <T> void setCreateInfo(List<T> list, MetaFileEntity mf) { - try { - if (!(list.get(0) instanceof BaseEntity)) { - return; - } - - for (T t : list) { - BaseEntity be = (BaseEntity) t; - be.setEventid(StringHelper.getGuid()); - be.setParentid(mf.getEventid()); - be.setDirid(mf.getDircode()); - be.setDepid(mf.getDepcode()); - be.setVerid(mf.getVerid()); - be.setCreateuser(mf.getCreateUser()); - be.setCreatetime(mf.getCreateTime()); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 澶嶅埗鏂囦欢 - */ - private void copyFiles(List<MetaFileEntity> list) { - List<String> gdbList = new ArrayList<>(); - for (MetaFileEntity mf : list) { - if (null != mf.getMsg()) { - continue; - } - - switch (mf.getExtName()) { - case StaticData.MPT: - copyMultiFile(mf, StaticData.MPT_EXT); - break; - case StaticData.JPG: - copyMultiFile(mf, StaticData.JPG_EXT); - break; - case StaticData.IMG: - copyMultiFile(mf, StaticData.IMG_EXT); - break; - case StaticData.TIF: - copyMultiFile(mf, StaticData.TIF_EXT); - break; - case StaticData.TIFF: - copyMultiFile(mf, StaticData.TIFF_EXT); - break; - case StaticData.SHP: - copyMultiFile(mf, StaticData.SHP_EXT); - break; - case StaticData.GDB: - if (gdbList.contains(mf.getPath())) { - String path = findPathByGuid(list, mf); - if (null != path) { - mf.setPath(path); - continue; - } - } - - gdbList.add(mf.getPath()); - copyFolderFile(mf); - break; - default: - copySingleFile(mf); - break; - } - } - } - - /** - * 澶嶅埗鍗曚釜鏂囦欢 - */ - private int copySingleFile(MetaFileEntity mf) { - File file = new File(mf.getPath()); - if (!file.exists()) { - mf.setMsg("鏂囦欢涓㈠け"); - return -1; - } - - MetaEntity old = metaService.selectByGuid(mf.getGuid(), null, null); - if (null != old) { - // mf.setMsg("宸插瓨鍦�") - setOldMeta(mf, old); - file.delete(); - return 0; - } - - String uploadPath = pathHelper.getUploadFullPath(); - String targetPath = uploadPath + File.separator + mf.getGuid() + mf.getExtName(); - String subPath = FileHelper.getRelativePath(targetPath); - - File newFile = new File(targetPath); - if (newFile.exists()) { - mf.setPath(subPath); - file.delete(); - return 0; - } - - file.renameTo(newFile); - mf.setPath(subPath); - - return 1; - } - - /** - * 璁剧疆鏃у厓鏁版嵁淇℃伅 - */ - private void setOldMeta(MetaFileEntity mf, MetaEntity old) { - mf.setPath(old.getPath()); - mf.setTab(old.getTab()); - mf.setRows(old.getRows()); - mf.setEntity(old.getEventid()); - } - - /** - * 澶嶅埗澶氫釜鏂囦欢 - */ - private void copyMultiFile(MetaFileEntity mf, List<String> extList) { - String path = mf.getPath(); - int status = copySingleFile(mf); - if (status < 1) { - for (int i = 0, c = extList.size(); i < c; i++) { - String subPath = path.replace(mf.getExtName(), extList.get(i)); - File file = new File(subPath); - if (file.exists()) { - file.delete(); - } - } - return; - } - - String uploadPath = pathHelper.getConfig().getUploadPath(); - for (int i = 0, c = extList.size(); i < c; i++) { - String sourcePath = path.replace(mf.getExtName(), extList.get(i)); - File file = new File(sourcePath); - if (!file.exists()) { - continue; - } - - String targetPath = uploadPath + File.separator + mf.getPath().replace(mf.getExtName(), extList.get(i)); - File newFile = new File(targetPath); - if (newFile.exists()) { - continue; - } - - file.renameTo(newFile); - } - } - - /** - * 澶嶅埗鏂囦欢澶规枃浠� - */ - private void copyFolderFile(MetaFileEntity mf) { - File file = new File(mf.getPath()); - if (!file.exists()) { - mf.setMsg("鏂囦欢涓㈠け"); - return; - } - - MetaEntity old = metaService.selectByGuid(mf.getGuid(), null, null); - if (null != old) { - // mf.setMsg("宸插瓨鍦�") - setOldMeta(mf, old); - FileHelper.deleteFiles(file); - return; - } - - String uploadPath = pathHelper.getUploadFullPath(); - String targetPath = uploadPath + File.separator + mf.getGuid() + mf.getExtName(); - String subPath = FileHelper.getRelativePath(targetPath); - - File newFile = new File(targetPath); - if (newFile.exists() && newFile.isDirectory()) { - mf.setPath(subPath); - FileHelper.deleteFiles(file); - return; - } - - newFile.mkdirs(); - File[] files = file.listFiles(); - if (null == files || files.length == 0) { - return; - } - - for (File f : files) { - String subFile = targetPath + File.separator + FileHelper.getFileName(f.getPath()); - f.renameTo(new File(subFile)); - } - mf.setPath(subPath); - } - - /** - * 鏍规嵁GUID鏌ユ壘璺緞 - */ - private String findPathByGuid(List<MetaFileEntity> list, MetaFileEntity mf) { - for (MetaFileEntity meta : list) { - if (meta.getGuid().equals(mf.getGuid()) && !meta.getPath().equals(mf.getPath())) { - return meta.getPath(); - } - } - - return null; - } - - /** - * 鍒涘缓鏂囦欢閾炬帴 - */ - private void createFileLink(String source, String target) { - String cmd = String.format("cmd /c mklink \"%s\" \"%s\"", target, source); - WebHelper.exec(cmd); - } - - /** - * 鎻掑叆鍏冩暟鎹� - */ - private void insertMetas(List<MetaFileEntity> list) { - int metaId = insertParentMeta(list); - for (MetaFileEntity mf : list) { - if (null != mf.getMsg()) { - continue; - } - - MetaEntity me = createMeta(mf, metaId); - metaService.insert(me); - - mf.setMsg(me.getId() > 0 ? "鎴愬姛" : "澶辫触"); - } - } - - /** - * 鍒涘缓鍏冩暟鎹� - */ - private MetaEntity createMeta(MetaFileEntity mf, int metaId) { - MetaEntity me = new MetaEntity(); - me.setMetaid(metaId); - me.setEventid(mf.getEventid()); - me.setDircode(mf.getDircode()); - me.setDepcode(mf.getDepcode()); - me.setVerid(mf.getVerid()); - me.setName(mf.getName()); - me.setType(mf.getType()); - me.setGuid(mf.getGuid()); - me.setPath(mf.getPath()); - me.setSizes(mf.getSizes()); - if (mf.getRows() > 0) { - me.setTab(mf.getTab()); - } - if (!StringHelper.isEmpty(mf.getEntity())) { - me.setLayer(mf.getEntity()); - } - me.setRows(mf.getRows()); - me.setCreateUser(mf.getCreateUser()); - me.setCreateTime(mf.getCreateTime()); - - return me; - } - - /** - * 鎻掑叆鐖跺厓鏁版嵁 - */ - private int insertParentMeta(List<MetaFileEntity> list) { - for (MetaFileEntity mf : list) { - if (null != mf.getMsg() || !mf.getIsMeta()) { - continue; - } - - MetaEntity me = createMeta(mf, 0); - me.setIsmeta((short) 1); - metaService.insert(me); - mf.setMsg(me.getId() > 0 ? "鎴愬姛" : "澶辫触"); - - return me.getId(); - } - - return 0; - } - - /** - * Excel鍏ュ簱 - */ - private String excelLoader(List<MetaFileEntity> xlsList, HttpServletRequest req) { - try { - MetaFileEntity xlsMeta = getExcelMeta(xlsList); - if (null != xlsMeta) { - return fmeService.excelLoader(xlsMeta, req); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - - return null; - } - - /** - * 鑾峰彇Excel鐨勫厓鏁版嵁 - */ - private MetaFileEntity getExcelMeta(List<MetaFileEntity> xlsList) { - if (null == xlsList || xlsList.isEmpty()) { - return null; - } - - List<String> pathList = new ArrayList<>(); - List<String> dirList = new ArrayList<>(); - List<String> pidList = new ArrayList<>(); - - for (int i = 0, c = xlsList.size(); i < c; i++) { - MetaFileEntity mf = xlsList.get(i); - if ("鎴愬姛".equals(mf.getMsg()) && null != mf.getXlsPath()) { - pathList.add(mf.getXlsPath()); - dirList.add(mf.getDircode()); - pidList.add(mf.getEventid()); - } - } - - MetaFileEntity first = xlsList.get(0); - MetaFileEntity meta = new MetaFileEntity(); - meta.setPath(StringHelper.join(pathList, ",")); - meta.setEpsgCode(first.getEpsgCode()); - meta.setName(StringHelper.join(dirList, ";")); - meta.setDepcode(first.getDepcode()); - meta.setVerid(first.getVerid()); - meta.setCreateUser(first.getCreateUser()); - meta.setEventid(StringHelper.join(pidList, ";")); - - return meta; - } -} diff --git a/src/main/java/com/lf/server/service/data/VerService.java b/src/main/java/com/lf/server/service/data/VerService.java deleted file mode 100644 index ec6e982..0000000 --- a/src/main/java/com/lf/server/service/data/VerService.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.lf.server.service.data; - -import com.lf.server.entity.data.VerEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.data.VerMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鐗堟湰琛� - * @author sws - * @date 2022-09-29 - */ -@Service -public class VerService implements VerMapper { - @Autowired - VerMapper verMapper; - - @Override - public Integer selectCount(Integer dirid, String name) { - name = StringHelper.getLikeUpperStr(name); - - return verMapper.selectCount(dirid, name); - } - - @Override - public List<VerEntity> selectByPage(Integer dirid, String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return verMapper.selectByPage(dirid, name, limit, offset); - } - - @Override - public List<VerEntity> selectByDirid(Integer dirid) { - return verMapper.selectByDirid(dirid); - } - - @Override - public Integer insertVersion(VerEntity verEntity) { - return verMapper.insertVersion(verEntity); - } - - @Override - public Integer insertVersions(List<VerEntity> verEntity) { - return verMapper.insertVersions(verEntity); - } - - @Override - public Integer deleteVersion(int id) { - return verMapper.deleteVersion(id); - } - - @Override - public Integer deleteVersions(List<Integer> ids) { - return verMapper.deleteVersions(ids); - } - - @Override - public Integer updateVersion(VerEntity verEntity) { - return verMapper.updateVersion(verEntity); - } - - @Override - public VerEntity selectVersion(int id) { - return verMapper.selectVersion(id); - } - - @Override - public List<VerEntity> selectVersionAll() { - return verMapper.selectVersionAll(); - } -} diff --git a/src/main/java/com/lf/server/service/show/ApplyService.java b/src/main/java/com/lf/server/service/show/ApplyService.java deleted file mode 100644 index b3adb4a..0000000 --- a/src/main/java/com/lf/server/service/show/ApplyService.java +++ /dev/null @@ -1,276 +0,0 @@ -package com.lf.server.service.show; - -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.DownloadReqEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.show.ApplyEntity; -import com.lf.server.entity.show.FlowEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.AesHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.show.ApplyMapper; -import com.lf.server.service.data.MetaService; -import com.lf.server.service.sys.UserService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * 鏁版嵁鐢宠 - * @author WWW - */ -@Service -public class ApplyService implements ApplyMapper { - @Autowired - ApplyMapper applyMapper; - - @Autowired - FlowService flowService; - - @Autowired - UserService userService; - - @Autowired - MetaService metaService; - - @Autowired - DataLibService dataLibService; - - private final static Log log = LogFactory.getLog(ApplyService.class); - - @Override - public Integer selectCount(String uname, Integer status, Timestamp start, Timestamp end) { - uname = StringHelper.getLikeUpperStr(uname); - - return applyMapper.selectCount(uname, status, start, end); - } - - @Override - public List<ApplyEntity> selectByPage(Integer userid, String uname, Integer status, Timestamp start, Timestamp end, Integer limit, Integer offset) { - uname = StringHelper.getLikeUpperStr(uname); - - return applyMapper.selectByPage(userid, uname, status, start, end, limit, offset); - } - - @Override - public List<ApplyEntity> selectAll() { - return applyMapper.selectAll(); - } - - @Override - public ApplyEntity selectById(int id) { - return applyMapper.selectById(id); - } - - @Override - public UserEntity selectUserByDepcode(String depcode) { - return applyMapper.selectUserByDepcode(depcode); - } - - @Override - public Integer selectSubmits(Integer userid) { - return applyMapper.selectSubmits(userid); - } - - @Override - public List<FlowEntity> selectFlows(Integer applyid) { - return applyMapper.selectFlows(applyid); - } - - @Override - public Integer insert(ApplyEntity entity) { - return applyMapper.insert(entity); - } - - @Override - public Integer inserts(List<ApplyEntity> list) { - return applyMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return applyMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return applyMapper.deletes(ids); - } - - @Override - public Integer update(ApplyEntity entity) { - return applyMapper.update(entity); - } - - @Override - public Integer updates(List<ApplyEntity> list) { - return applyMapper.updates(list); - } - - @Override - public Integer updateForDiscard(Integer userid, Integer id) { - return applyMapper.updateForDiscard(userid, id); - } - - @Override - public Integer updateForResubmit(Integer userid, Integer id) { - return applyMapper.updateForResubmit(userid, id); - } - - @Override - public Integer updateForSubmit(Integer userid, Integer applyid, Integer flowId) { - return applyMapper.updateForSubmit(userid, applyid, flowId); - } - - @Override - public Integer updateForReject(Integer userid, Integer applyid, Integer flowId) { - return applyMapper.updateForReject(userid, applyid, flowId); - } - - /** - * 鎻掑叆鏁版嵁鐢宠 - */ - public Integer insertApply(UserEntity ue, DownloadReqEntity dr) throws Exception { - ApplyEntity apply = getApplyEntity(ue, dr); - int rows = applyMapper.insert(apply); - if (0 == rows) { - return 0; - } - - List<FlowEntity> list = getFlowEntities(apply.getId(), ue, dr); - if (list.isEmpty()) { - applyMapper.delete(apply.getId()); - throw new Exception("鎵句笉鍒板緟瀹℃牳浜�"); - } - - return flowService.inserts(list); - } - - /** - * 鑾峰彇鏁版嵁鐢宠瀹炰綋绫� - */ - private ApplyEntity getApplyEntity(UserEntity ue, DownloadReqEntity dr) throws Exception { - // String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd())) - String aesPwd = AesHelper.encrypt(dr.getPwd()); - String gids = null == dr.getIds() || dr.getIds().isEmpty() ? null : StringHelper.join(dr.getIds(), ","); - - ApplyEntity apply = new ApplyEntity(); - apply.setUserid(ue.getId()); - apply.setDepids(StringHelper.join(dr.getDepcodes(), ",")); - apply.setTabs(getTabs(dr)); - apply.setEntities(StringHelper.join(dr.getEntities(), ",")); - apply.setWkt(dr.getWkt()); - apply.setPwd(aesPwd); - apply.setStatus(0); - apply.setCount(dr.getDepcodes().size()); - apply.setDescr(dr.getDescr()); - apply.setCreateUser(ue.getId()); - apply.setDepcode(dr.getDepcode()); - apply.setDircodes(dr.getDirs()); - apply.setGids(gids); - apply.setFilters(dr.getFilter()); - - return apply; - } - - /** - * 鑾峰彇琛ㄥ悕 - */ - private String getTabs(DownloadReqEntity dr) { - if (!StaticData.SYS_META.equals(dr.getEntities().get(0))) { - return StringHelper.join(dr.getTabs(), ","); - } - - List<MetaEntity> list = metaService.selectMetaFiles(dr.getIds()); - if (null == list || list.isEmpty()) { - return "鍏冩暟鎹〃"; - } - - StringBuilder sb = new StringBuilder(); - for (MetaEntity me : list) { - sb.append(me.getName()).append(","); - if (sb.length() > StaticData.I1000) { - break; - } - } - if (sb.length() > 1) { - sb.deleteCharAt(sb.length() - 1); - } - - return sb.toString(); - } - - /** - * 鑾峰彇鐢宠娴佺▼瀹炰綋绫婚泦鍚� - */ - private List<FlowEntity> getFlowEntities(Integer applyId, UserEntity ue, DownloadReqEntity dr) { - List<FlowEntity> list = new ArrayList<>(); - for (String depcode : dr.getDepcodes()) { - UserEntity user = selectUserByDepcode(depcode); - if (null == user) { - user = userService.selectByUid(StaticData.ADMIN); - } - - FlowEntity flow = new FlowEntity(); - flow.setApplyid(applyId); - flow.setDepcode(depcode); - flow.setUserid(user.getId()); - flow.setStatus(0); - flow.setDescr(null); - flow.setCreateUser(ue.getId()); - - list.add(flow); - } - - return list; - } - - /** - * 鎵撳寘DB鏁版嵁 - */ - public void zipDbData(UserEntity ue, ApplyEntity entity) { - try { - List<String> entities = Arrays.asList(entity.getEntities().split(StaticData.COMMA)); - String pwd = AesHelper.decrypt(entity.getPwd()); - - DownloadReqEntity dr = new DownloadReqEntity(); - dr.setEntities(entities); - dr.setWkt(dr.getWkt()); - dr.setPwd(pwd); - dr.setDepcode(entity.getDepcode()); - dr.setDirs(entity.getDircodes()); - dr.setIds(getIds(entity.getGids())); - dr.setFilter(entity.getFilters()); - - String guid = StaticData.SYS_META.equals(entity.getEntities()) ? metaService.downloadMeteReq(ue, dr) : dataLibService.downloadDbReq(ue, dr); - if (!StringHelper.isEmpty(guid)) { - entity.setGuid(guid); - update(entity); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - - /** - * 鑾峰彇ID闆嗗悎 - */ - private List<Integer> getIds(String gids) { - if (StringHelper.isEmpty(gids)) { - return null; - } - - List<Integer> list = new ArrayList<>(); - for (String str : gids.split(StaticData.COMMA)) { - list.add(Integer.parseInt(str)); - } - - return list; - } -} diff --git a/src/main/java/com/lf/server/service/show/DataLibService.java b/src/main/java/com/lf/server/service/show/DataLibService.java deleted file mode 100644 index 8ef4765..0000000 --- a/src/main/java/com/lf/server/service/show/DataLibService.java +++ /dev/null @@ -1,346 +0,0 @@ -package com.lf.server.service.show; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.lf.server.entity.ctrl.DownloadReqEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.sys.AttachEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.mapper.all.GeomBaseMapper; -import com.lf.server.mapper.data.DownloadMapper; -import com.lf.server.service.all.BaseQueryService; -import com.lf.server.service.data.MetaService; -import net.lingala.zip4j.ZipFile; -import net.lingala.zip4j.model.ZipParameters; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.util.*; - -/** - * 璧勬枡棣� - * @author WWW - */ -@Service -public class DataLibService { - @Autowired - PathHelper pathHelper; - - @Autowired - MetaService metaService; - - @Autowired - DownloadMapper downloadMapper; - - @Autowired - BaseQueryService baseQueryService; - - private final static Log log = LogFactory.getLog(DataLibService.class); - - /** - * 鏌ヨDB涓孩鍑虹殑鍗曚綅缂栫爜 - */ - public List<String> selectDbOverflowDep(UserEntity ue, DownloadReqEntity dr) { - if (!StringHelper.isEmpty(dr.getWkt())) { - return selectDbOverflowDep4Wkt(ue, dr); - } - - return selectDbOverflowDep4Prop(ue, dr); - } - - /** - * 鏌ヨDB涓孩鍑虹殑鍗曚綅缂栫爜-绌洪棿鏌ヨ - */ - public List<String> selectDbOverflowDep4Wkt(UserEntity ue, DownloadReqEntity dr) { - List<String> rs = new ArrayList<>(); - for (String entity : dr.getEntities()) { - GeomBaseMapper<?> baseMapper = ClassHelper.getGeoBaseMapper(entity); - if (null == baseMapper) { - continue; - } - - QueryWrapper wrapper = getWrapper4DbOverflow(ue, dr); - Integer srid = baseQueryService.getSrid(baseMapper); - wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", dr.getWkt(), srid)); - - List<String> ids = baseMapper.selectObjs(wrapper); - addDepCodes(rs, ids); - } - - return rs; - } - - /** - * 鏌ヨDB涓孩鍑虹殑鍗曚綅缂栫爜-灞炴�ф煡璇� - */ - public List<String> selectDbOverflowDep4Prop(UserEntity ue, DownloadReqEntity dr) { - List<String> rs = new ArrayList<>(); - BasicMapper<?> baseMapper = ClassHelper.getBasicMapper(dr.getEntities().get(0)); - if (null == baseMapper) { - return rs; - } - - QueryWrapper wrapper = getWrapper4DbOverflow(ue, dr); - List<String> ids = baseMapper.selectObjs(wrapper); - addDepCodes(rs, ids); - - return rs; - } - - /** - * 鏌ヨDB涓孩鍑哄崟浣嶇紪鐮佺殑鏌ヨ鍖呰鍣� - */ - private <T> QueryWrapper<T> getWrapper4DbOverflow(UserEntity ue, DownloadReqEntity dr) { - QueryWrapper<T> wrapper = new QueryWrapper<T>(); - wrapper.select("depid"); - wrapper.groupBy("depid"); - wrapper.apply("depid is not null and depid not like '" + ue.getDepcode() + "%'"); - - if (null != dr.getIds() && dr.getIds().size() > 0) { - wrapper.apply(String.format("gid in (%s)", StringHelper.join(dr.getIds(), ","))); - } else { - baseQueryService.addFilterWrapper(wrapper, dr.getFilter()); - } - - String dirs = copeCodes(dr.getDirs(), "dirid"); - if (!StringHelper.isEmpty(dirs)) { - wrapper.apply(dirs); - } - if (!StringHelper.isEmpty(dr.getDepcode())) { - wrapper.likeRight("depid", dr.getDepcode()); - } - - return wrapper; - } - - /** - * 娣诲姞鍗曚綅缂栫爜 - */ - private void addDepCodes(List<String> rs, List<String> ids) { - if (null == ids || ids.isEmpty()) { - return; - } - - for (String id : ids) { - if (StringHelper.isEmpty(id)) { - continue; - } - if (!rs.contains(id)) { - rs.add(id); - } - } - } - - /** - * 璇锋眰DB鏁版嵁涓嬭浇 - */ - public String downloadDbReq(UserEntity ue, DownloadReqEntity dr) throws Exception { - Map<String, List<?>> dataMap = new HashMap<>(2); - Map<String, List<AttachEntity>> annexMap = new HashMap<>(2); - queryData(dr, dataMap, annexMap); - if (dataMap.size() == 0) { - return null; - } - - String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); - String tempPath = pathHelper.getTempPath(tempName); - String gdbPath = tempPath + File.separator + "tabs.gdb"; - - File gdbFile = new File(gdbPath); - if (gdbFile.exists() && gdbFile.isDirectory()) { - FileHelper.deleteDir(gdbPath); - } - GdbHelper.createGdb(gdbPath, dataMap); - - String zipFile = pathHelper.getDownloadFullPath() + File.separator + tempName + ".gdb.zip"; - ZipFile zip = Zip4jHelper.createZipFile(zipFile, dr.getPwd()); - ZipParameters params = Zip4jHelper.getZipParams(true); - zip.addFolder(new File(gdbPath), params); - // zip.addFolder(new File(annexPath), params) - metaService.addAnnex(zip, params, annexMap); - - String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd())); - DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd); - int rows = downloadMapper.insert(de); - - return rows > 0 ? de.getGuid() : null; - } - - /** - * 鏌ヨ鏁版嵁+闄勪欢 - */ - private void queryData(DownloadReqEntity dr, Map<String, List<?>> dataMap, Map<String, List<AttachEntity>> annexMap) { - for (String entity : dr.getEntities()) { - try { - BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); - if (null == baseMapper) { - continue; - } - - QueryWrapper wrapper = createQueryWrapper(baseMapper, dr); - metaService.addData(entity, baseMapper, wrapper, dataMap, annexMap); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } - - /** - * 鍒涘缓鏌ヨ鍖呰鍣� - */ - private <T> QueryWrapper<T> createQueryWrapper(BasicMapper baseMapper, DownloadReqEntity dr) { - QueryWrapper<T> wrapper = new QueryWrapper<T>(); - - String dirs = copeCodes(dr.getDirs(), "dirid"); - if (!StringHelper.isEmpty(dirs)) { - wrapper.apply(dirs); - } - if (!StringHelper.isEmpty(dr.getDepcode())) { - // wrapper.apply(String.format("depid like '%s'", StringHelper.getRightLike(dr.getDepcode()))) - wrapper.likeRight("depid", dr.getDepcode()); - } - if (baseMapper instanceof GeomBaseMapper) { - wrapper.select("ST_AsText(geom) as geom, *"); - if (!StringHelper.isEmpty(dr.getWkt())) { - Integer srid = baseQueryService.getSrid((GeomBaseMapper) baseMapper); - wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", dr.getWkt(), srid)); - } - } - if (null != dr.getIds() && dr.getIds().size() > 0) { - wrapper.apply(String.format("gid in (%s)", StringHelper.join(dr.getIds(), ","))); - } else { - baseQueryService.addFilterWrapper(wrapper, dr.getFilter()); - } - - return wrapper; - } - - /** - * 鍒涘缓闄勪欢 * - */ - private void createAnnex(String annexPath, Map<String, List<AttachEntity>> annexMap) { - if (annexMap.size() == 0) { - return; - } - - String uploadPath = pathHelper.getConfig().getUploadPath(); - for (String key : annexMap.keySet()) { - String targetPath = annexPath + File.separator + key; - File targetFile = new File(targetPath); - if (!targetFile.exists() || !targetFile.isDirectory()) { - targetFile.mkdirs(); - } - - for (AttachEntity ae : annexMap.get(key)) { - try { - File srcFile = new File(uploadPath + File.separator + ae.getPath()); - if (!srcFile.exists() || srcFile.isDirectory()) { - continue; - } - - File destFile = new File(targetPath + File.separator + ae.getName()); - if (destFile.exists() && !destFile.isDirectory()) { - continue; - } - - FileHelper.copyFile(srcFile, destFile); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } - } - - /** - * 鑾峰彇涓嬭浇瀹炰綋绫� - */ - private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { - DownloadEntity de = new DownloadEntity(); - de.setName(FileHelper.getFileName(file)); - // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 - de.setType(4); - de.setSizes(FileHelper.sizeToMb(new File(file).length())); - de.setDepid(ue.getDepid()); - de.setDcount(0); - de.setPwd(pwd); - de.setUrl(FileHelper.getRelativePath(file)); - de.setDescr("涓氬姟鏁版嵁鏂囦欢"); - de.setGuid(FileHelper.getFileMd5(file)); - de.setCreateUser(ue.getId()); - // de.setGeom(null) - - return de; - } - - /** - * 澶勭悊缂栫爜 - */ - public static String copeCodes(String codes, String field) { - if (StringHelper.isEmpty(codes) || StringHelper.isSqlInjection(codes)) { - return null; - } - - List<String> list = codesAsList(codes); - removeDuplicate(list); - setRightLike(list, field); - - return "(" + StringHelper.join(list, " or ") + ")"; - } - - /** - * 鍗曚綅缂栫爜杞泦鍚� - */ - private static List<String> codesAsList(String codes) { - List<String> list = Arrays.asList(codes.split(",")); - Set set = new HashSet(list); - - List<String> newList = new ArrayList<>(set); - Collections.sort(newList); - - return newList; - } - - /** - * 鍘婚櫎閲嶅 - */ - private static void removeDuplicate(List<String> list) { - int i = 0; - while (i < list.size()) { - int j = findStr(list, i); - if (j > -1) { - list.remove(j); - continue; - } - - i++; - } - } - - /** - * 鏌ユ壘瀛楃涓� - */ - private static int findStr(List<String> list, int i) { - String source = list.get(i); - for (int j = i + 1, c = list.size(); j < c; j++) { - if (list.get(j).startsWith(source)) { - return j; - } - } - - return -1; - } - - /** - * 璁剧疆 鍙砽ike - */ - private static void setRightLike(List<String> list, String field) { - for (int i = 0, c = list.size(); i < c; i++) { - String str = String.format("%s like '%s%%'", field, list.get(i)); - list.set(i, str); - } - } -} diff --git a/src/main/java/com/lf/server/service/show/ExportService.java b/src/main/java/com/lf/server/service/show/ExportService.java deleted file mode 100644 index 6de55a9..0000000 --- a/src/main/java/com/lf/server/service/show/ExportService.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.lf.server.service.show; - -import com.alibaba.fastjson.JSON; -import com.lf.server.entity.all.ResponseMsg; -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.show.ExportEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.FileHelper; -import com.lf.server.helper.PathHelper; -import com.lf.server.helper.RestHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.service.data.DownloadService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -/** - * 鍦ㄧ嚎鍒跺浘 - * @author WWW - */ -@Service -public class ExportService { - @Value("${sys.exportServer}") - private String exportServer; - - @Autowired - PathHelper pathHelper; - - @Autowired - DownloadService downloadService; - - /** - * POST璇锋眰鍑哄浘鏈嶅姟 - * - * @param ue 鐢ㄦ埛绫� - * @param entity 鍦ㄧ嚎鍒跺浘绫� - * @return 鎴愬姛 - * @throws Exception - */ - public String post(UserEntity ue, ExportEntity entity) throws Exception { - Map<String, Object> map = getMapData(entity); - String url = exportServer + "/Export/Start"; - - String str = RestHelper.postForRest(url, map); - if (StringHelper.isEmpty(str)) { - return null; - } - - ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class); - if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) { - return null; - } - - String file = pathHelper.getConfig().getDownloadPath() + File.separator + msg.getResult(); - File f = new File(file); - if (!f.exists() && !f.isDirectory()) { - return null; - } - - DownloadEntity de = getDownloadEntity(ue, entity, file); - int rows = downloadService.insert(de); - - return rows > 0 ? de.getGuid() : null; - } - - /** - * 鑾峰彇Map鏁版嵁 - */ - private Map<String, Object> getMapData(ExportEntity entity) { - Map<String, Object> map = new HashMap<String, Object>(3); - - Field[] fields = entity.getClass().getDeclaredFields(); - for (Field field : fields) { - try { - if ("serialVersionUID".equals(field.getName())) { - continue; - } - - field.setAccessible(true); - Object obj = field.get(entity); - - map.put(field.getName(), obj); - } catch (Exception ex) { - // - } - } - - return map; - } - - /** - * 鑾峰彇涓嬭浇瀹炰綋绫� - */ - private DownloadEntity getDownloadEntity(UserEntity ue, ExportEntity entity, String file) throws Exception { - DownloadEntity de = new DownloadEntity(); - de.setName(FileHelper.getFileName(file)); - // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 - de.setType(2); - de.setSizes(FileHelper.sizeToMb(new File(file).length())); - de.setDepid(ue.getDepid()); - de.setDcount(0); - // de.setPwd(null) - de.setUrl(FileHelper.getRelativePath(file)); - // de.setDescr("涓撻鍥炬枃浠�") - de.setDescr(StringHelper.isEmpty(entity.getTitle()) ? "涓撻鍥炬枃浠�" : entity.getTitle().trim()); - de.setGuid(FileHelper.getFileMd5(file)); - de.setCreateUser(ue.getId()); - // de.setGeom(null) - - return de; - } -} diff --git a/src/main/java/com/lf/server/service/show/FlowService.java b/src/main/java/com/lf/server/service/show/FlowService.java deleted file mode 100644 index 15454ee..0000000 --- a/src/main/java/com/lf/server/service/show/FlowService.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.lf.server.service.show; - -import com.lf.server.entity.show.FlowEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.show.FlowMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鐢宠娴佺▼ - * @author WWW - */ -@Service -public class FlowService implements FlowMapper { - @Autowired - FlowMapper flowMapper; - - @Override - public Integer selectCount(Integer userid) { - return flowMapper.selectCount(userid); - } - - @Override - public List<FlowEntity> selectByPage(Integer userid, Integer limit, Integer offset) { - return flowMapper.selectByPage(userid, limit, offset); - } - - @Override - public List<FlowEntity> selectAll() { - return flowMapper.selectAll(); - } - - @Override - public FlowEntity selectById(int id) { - return flowMapper.selectById(id); - } - - @Override - public Integer insert(FlowEntity entity) { - return flowMapper.insert(entity); - } - - @Override - public Integer inserts(List<FlowEntity> list) { - return flowMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return flowMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return flowMapper.deletes(ids); - } - - @Override - public Integer update(FlowEntity entity) { - return flowMapper.update(entity); - } - - @Override - public Integer updates(List<FlowEntity> list) { - return flowMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/show/InquiryService.java b/src/main/java/com/lf/server/service/show/InquiryService.java deleted file mode 100644 index c607988..0000000 --- a/src/main/java/com/lf/server/service/show/InquiryService.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.lf.server.service.show; - -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.DownloadTileEntity; -import com.lf.server.entity.ctrl.ShpRecordEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.data.MetaFileEntity; -import com.lf.server.entity.data.PublishEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.service.data.DownloadService; -import com.lf.server.service.data.PublishService; -import net.lingala.zip4j.ZipFile; -import net.lingala.zip4j.model.ZipParameters; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.io.File; -import java.io.FileInputStream; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * 鏌ヨ鏈嶅姟绫� - * @author WWW - */ -@Service -public class InquiryService { - @Resource - PathHelper pathHelper; - - @Resource - PublishService publishService; - - @Resource - DownloadService downloadService; - - private final static Log log = LogFactory.getLog(InquiryService.class); - - /** - * 璇诲彇Shp绗竴鏉¤褰曠殑WKT - */ - public ShpRecordEntity readShpFirstRecord(List<MetaFileEntity> list) { - String fileName = null; - for (MetaFileEntity mf : list) { - if (mf.getName().toLowerCase().contains(".shp")) { - fileName = mf.getPath(); - break; - } - } - if (StringHelper.isEmpty(fileName)) { - return null; - } - - ShpRecordEntity sr = ShpHelper.readShpFirstRecord(fileName); - FileHelper.deleteFiles(list); - - return sr; - } - - /** - * 鎵撳寘鐡︾墖 - */ - public String zipTiles(DownloadTileEntity dt, PublishEntity pub, UserEntity ue) { - if (!isTilePathExist(pub)) { - return null; - } - - List<File> list = findTiles(dt, pub); - if (list.isEmpty()) { - return null; - } - - String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); - String zipFile = pathHelper.getDownloadFullPath() + File.separator + tempName + ".zip"; - - ZipFile zip = Zip4jHelper.createZipFile(zipFile, dt.getPwd()); - ZipParameters params = Zip4jHelper.getZipParams(true); - addFiles(zip, params, list, pub.getPath() + File.separator); - - String dbPwd = Md5Helper.reverse(Md5Helper.generate(dt.getPwd())); - DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd); - int rows = downloadService.insert(de); - if (de.getId() > 0) { - insertPubDown(pub, de, ue); - } - - return rows > 0 ? de.getGuid() : null; - } - - /** - * 鐡︾墖璺緞鏄惁瀛樺湪 - */ - private boolean isTilePathExist(PublishEntity pub) { - String tilePath = pathHelper.getConfig().getTilePath().replace("2d\\tiles", "") + pub.getPath(); - - File f = new File(tilePath); - if (!f.exists() || !f.isDirectory()) { - return false; - } - - pub.setPath(tilePath); - - return true; - } - - /** - * 鏌ユ壘鐡︾墖 - */ - private List<File> findTiles(DownloadTileEntity dt, PublishEntity pub) { - List<File> list = new ArrayList<>(); - for (int i = 0; i < StaticData.I23; i++) { - List<File> files = findTilesByZoom(dt, pub, i); - if (files.size() > 0) { - list.addAll(files); - } - } - - return list; - } - - /** - * 鏍规嵁灞傛鏌ユ壘鐡︾墖 - */ - private List<File> findTilesByZoom(DownloadTileEntity dt, PublishEntity pub, int zoom) { - List<File> list = new ArrayList<>(); - File f = new File(pub.getPath() + File.separator + zoom); - if (!f.exists() || !f.isDirectory()) { - return list; - } - - int[] leftTop = deg2num(zoom, dt.getXmin(), dt.getYmax()); - int[] rightBottom = deg2num(zoom, dt.getXmax(), dt.getYmin()); - - for (int x = leftTop[0]; x <= rightBottom[0]; x++) { - for (int y = leftTop[1]; y <= rightBottom[1]; y++) { - String pngPath = String.format("%s\\%d\\%d\\%d.png", pub.getPath(), zoom, x, y); - - File pngFile = new File(pngPath); - if (pngFile.exists()) { - list.add(pngFile); - } - } - } - - return list; - } - - /** - * 瑙掑害杞暟鍊� - */ - private int[] deg2num(int zoom, double x, double y) { - double yRad = Math.toRadians(y); - double n = Math.pow(2.0, zoom); - - int xTile = (int) ((x + 180.0) / 360.0 * n); - int yTile = (int) ((1.0 - Math.log(Math.tan(yRad) + (1 / Math.cos(yRad))) / Math.PI) / 2.0 * n); - - return new int[]{xTile, yTile}; - } - - /** - * 娣诲姞鏂囦欢鑷冲帇缂╁寘 - */ - private void addFiles(ZipFile zip, ZipParameters params, List<File> list, String basePath) { - for (File f : list) { - try { - params.setFileNameInZip(f.getPath().replace(basePath, "")); - zip.addStream(new FileInputStream(f), params); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } - - /** - * 鑾峰彇涓嬭浇瀹炰綋绫� - */ - private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { - DownloadEntity de = new DownloadEntity(); - de.setName(FileHelper.getFileName(file)); - // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 - de.setType(8); - de.setSizes(FileHelper.sizeToMb(new File(file).length())); - de.setDepid(ue.getDepid()); - de.setDcount(0); - de.setPwd(pwd); - de.setUrl(FileHelper.getRelativePath(file)); - de.setDescr("鐡︾墖鏂囦欢"); - de.setGuid(FileHelper.getFileMd5(file)); - de.setCreateUser(ue.getId()); - // de.setGeom(null) - - return de; - } - - /** - * 鎻掑叆鏁版嵁鍙戝竷-涓嬭浇琛� - */ - private void insertPubDown(PublishEntity pub, DownloadEntity de, UserEntity ue) { - publishService.insertPubDown(pub.getId(), de.getId(), ue.getId()); - } -} diff --git a/src/main/java/com/lf/server/service/show/MarkService.java b/src/main/java/com/lf/server/service/show/MarkService.java deleted file mode 100644 index a5ab635..0000000 --- a/src/main/java/com/lf/server/service/show/MarkService.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.lf.server.service.show; - -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.MarkJsonEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.data.MetaEntity; -import com.lf.server.entity.data.MetaFileEntity; -import com.lf.server.entity.show.MarkEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.show.MarkMapper; -import com.lf.server.service.data.DownloadService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * 鏍囩粯 - * @author WWW - */ -@Service -public class MarkService implements MarkMapper { - @Autowired - MarkMapper markMapper; - - @Autowired - PathHelper pathHelper; - - @Autowired - DownloadService downloadService; - - @Override - public Integer selectCount(Integer uid) { - return markMapper.selectCount(uid); - } - - @Override - public List<MarkEntity> selectByPage(Integer uid, Integer limit, Integer offset) { - return markMapper.selectByPage(uid, limit, offset); - } - - @Override - public List<MarkEntity> selectAll() { - return markMapper.selectAll(); - } - - @Override - public MarkEntity selectById(int id) { - return markMapper.selectById(id); - } - - @Override - public Integer insert(MarkEntity entity) { - return markMapper.insert(entity); - } - - @Override - public Integer inserts(List<MarkEntity> list) { - return markMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return markMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return markMapper.deletes(ids); - } - - @Override - public Integer update(MarkEntity entity) { - return markMapper.update(entity); - } - - @Override - public Integer updates(List<MarkEntity> list) { - return markMapper.updates(list); - } - - /** - * 涓嬭浇ShapeFile鏂囦欢 - * - * @param ue 鐢ㄦ埛瀹炰綋 - * @param list 鏍囩粯JSON瀹炰綋绫婚泦鍚� - * @return GUID - * @throws Exception 寮傚父 - */ - public String downloadShp(UserEntity ue, List<MarkJsonEntity> list) throws Exception { - String path = pathHelper.getTempPath(); - createShapeFiles(ue, list, path); - - File[] files = new File(path).listFiles(); - if (files == null || files.length == 0) { - return null; - } - - String zip = getZipPath(); - ZipHelper.zip(zip, path); - FileHelper.deleteDir(path); - - String guid = FileHelper.getFileMd5(zip); - DownloadEntity entity = downloadService.selectByGuid(guid); - if (entity != null) { - return entity.getGuid(); - } - - DownloadEntity de = getDownloadEntity(ue, zip); - int rows = downloadService.insert(de); - - return rows > 0 ? de.getGuid() : null; - } - - /** - * 鍒涘缓shp鏂囦欢 - */ - private String createShapeFiles(UserEntity ue, List<MarkJsonEntity> list, String path) { - List<MarkJsonEntity> points = getMarkByType(list, "POINT"); - if (points.size() > 0) { - ShpHelper.createShp(points, path, "POINT"); - } - List<MarkJsonEntity> lines = getMarkByType(list, "LINESTRING"); - if (lines.size() > 0) { - ShpHelper.createShp(lines, path, "LINESTRING"); - } - List<MarkJsonEntity> polygons = getMarkByType(list, "POLYGON"); - if (polygons.size() > 0) { - ShpHelper.createShp(polygons, path, "POLYGON"); - } - - return path; - } - - /** - * 鑾峰彇shp鐩綍 - */ - private String getShpDir(UserEntity ue, String parent) { - String path = parent + File.separator + StringHelper.YMDHMS2_FORMAT.format(new Date()); - - File file = new File(path); - if (!file.exists() && !file.isDirectory()) { - file.mkdirs(); - } - - return path; - } - - /** - * 鑾峰彇鏍囩粯绫诲瀷 - */ - private List<MarkJsonEntity> getMarkByType(List<MarkJsonEntity> list, String type) { - List<MarkJsonEntity> rs = new ArrayList<>(); - for (MarkJsonEntity mark : list) { - if (StringHelper.isEmpty(mark.getWkt())) { - continue; - } - if (mark.getWkt().contains(type)) { - rs.add(mark); - } - } - - return rs; - } - - /** - * 鑾峰彇zip璺緞 - */ - private String getZipPath() { - String path = pathHelper.getDownloadFullPath() + File.separator + StringHelper.YMDHMS2_FORMAT.format(new Date()) + ".zip"; - - File file = new File(path); - if (file.exists() && !file.isDirectory()) { - file.delete(); - } - - return path; - } - - /** - * 鑾峰彇涓嬭浇瀹炰綋绫� - */ - private DownloadEntity getDownloadEntity(UserEntity ue, String file) throws Exception { - DownloadEntity de = new DownloadEntity(); - de.setName(FileHelper.getFileName(file)); - // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 - de.setType(1); - de.setSizes(FileHelper.sizeToMb(new File(file).length())); - de.setDepid(ue.getDepid()); - de.setDcount(0); - // de.setPwd(null) - de.setUrl(FileHelper.getRelativePath(file)); - de.setDescr("Shp鏂囦欢"); - de.setGuid(FileHelper.getFileMd5(file)); - de.setCreateUser(ue.getId()); - // de.setGeom(null) - - return de; - } - - /** - * 鑾峰彇涓嬭浇鏂囦欢璺緞 - */ - public String getDownloadFilePath(DownloadEntity de) { - return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); - } - - /** - * 璇诲彇ShapeFile鏂囦欢鑾峰彇Mark瀹炰綋绫� - */ - public List<MarkJsonEntity> readShpForMarks(List<MetaFileEntity> list) { - String fileName = null; - for (MetaFileEntity mf : list) { - if (mf.getName().toLowerCase().contains(StaticData.SHP)) { - fileName = mf.getPath(); - break; - } - } - if (StringHelper.isEmpty(fileName)) { - return null; - } - - List<MarkJsonEntity> mjeList = ShpHelper.readShpForMarks(fileName); - FileHelper.deleteFiles(list); - - return mjeList; - } -} diff --git a/src/main/java/com/lf/server/service/show/ModelService.java b/src/main/java/com/lf/server/service/show/ModelService.java deleted file mode 100644 index 574cb6b..0000000 --- a/src/main/java/com/lf/server/service/show/ModelService.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.lf.server.service.show; - -import com.lf.server.entity.show.ModelEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.show.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 妯″瀷 - * @author WWW - */ -@Service -public class ModelService implements ModelMapper { - @Autowired - ModelMapper modelMapper; - - @Override - public Integer selectCount(Integer layerid) { - return modelMapper.selectCount(layerid); - } - - @Override - public List<ModelEntity> selectByPage(Integer layerid, Integer limit, Integer offset) { - return modelMapper.selectByPage(layerid, limit, offset); - } - - @Override - public List<ModelEntity> selectAll() { - return modelMapper.selectAll(); - } - - @Override - public ModelEntity selectById(int id) { - return modelMapper.selectById(id); - } - - @Override - public ModelEntity selectModelByGuid(int layerid, String modelid) { - return modelMapper.selectModelByGuid(layerid, modelid); - } - - @Override - public Integer insert(ModelEntity entity) { - return modelMapper.insert(entity); - } - - @Override - public Integer inserts(List<ModelEntity> list) { - return modelMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return modelMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return modelMapper.deletes(ids); - } - - @Override - public Integer update(ModelEntity entity) { - return modelMapper.update(entity); - } - - @Override - public Integer updates(List<ModelEntity> list) { - return modelMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/show/OneMapService.java b/src/main/java/com/lf/server/service/show/OneMapService.java deleted file mode 100644 index 3857b43..0000000 --- a/src/main/java/com/lf/server/service/show/OneMapService.java +++ /dev/null @@ -1,360 +0,0 @@ -package com.lf.server.service.show; - -import com.lf.server.entity.show.OneMapEntity; -import com.lf.server.mapper.show.OneMapMapper; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - -/** - * 绠$綉涓�寮犲浘Service - * - * @author 閭㈤敠鍙� - */ -@Service -public class OneMapService implements OneMapMapper { - @Resource - OneMapMapper aMapOfPipelineMapper; - - /** - * 娴嬬粯 - */ - private static final String MEASUREMENT = "娴嬬粯锛圗SV锛�"; - /** - * 璋冩煡 - */ - private static final String TOINVESTIGATE = "鍕樺療锛圗GE锛�"; - /** - * 鍦扮伨 - */ - private static final String DISASTER = "鍦扮伨锛圗GD锛�"; - /** - * 鍦颁笅缁撴瀯娲炲簱 - */ - private static final String UNDERGROUNDSTRUCTURE = "娲炲簱锛圗GD锛�"; - - /** - * 椤圭洰绫诲埆conut - */ - @Override - public List<String> projectCategoryCount() { - return aMapOfPipelineMapper.projectCategoryCount(); - } - - /** - * 椤圭洰浣嶇疆conut - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> projectLocationCount() { - return aMapOfPipelineMapper.projectLocationCount(); - } - - /** - * 鍥藉缁村害conut - */ - @Override - public List<String> countryDimensionCount() { - return aMapOfPipelineMapper.countryDimensionCount(); - } - - /** - * 鐪佺淮conut - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> provinceDimensionCount() { - return aMapOfPipelineMapper.provinceDimensionCount(); - } - - /** - * 鍏ㄥ浗缁村害-鎸夌収椤硅嚜绫诲瀷缁熻涓嶅悓椤圭洰涓暟 - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countProjectTypeNumber() { - return aMapOfPipelineMapper.countProjectTypeNumber(); - } - - /** - * 鏁版嵁瀛樺偍conut - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> dataStorageCount() { - return aMapOfPipelineMapper.dataStorageCount(); - } - - /** - * 缁熻鏁版嵁绫诲埆 - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> statisticalDataCategories() { - return aMapOfPipelineMapper.statisticalDataCategories(); - } - - /** - * 缁熻鏁版嵁鏈嶅姟绫诲瀷 - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> statisticalDataServiceType() { - return aMapOfPipelineMapper.statisticalDataServiceType(); - } - - /** - * 鐧诲綍浜烘暟缁熻 - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> loginNumberStatistics() { - return aMapOfPipelineMapper.loginNumberStatistics(); - } - - /** - * 鏂囦欢鏍煎紡conut - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> fileFormatCount() { - return aMapOfPipelineMapper.fileFormatCount(); - } - - /** - * 鏁版嵁鐢宠conut - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> dataApplyCount() { - return aMapOfPipelineMapper.dataApplyCount(); - } - - /** - * 鏁版嵁璁块棶鏁� - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> dataVisitCount() { - return aMapOfPipelineMapper.dataVisitCount(); - } - - /** - * 涓嬭浇鏁扮粺璁� - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countDownloads() { - return aMapOfPipelineMapper.countDownloads(); - } - - /** - * 缁熻椤圭洰鏄剧ず - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countProjectDisplay() { - return aMapOfPipelineMapper.countProjectDisplay(); - } - - /** - * 閫夋嫨椤圭洰鍙傝鍒楄〃 - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> selectProjectTour() { - return aMapOfPipelineMapper.selectProjectTour(); - } - - /** - * 閫夋嫨椤圭洰绫诲瀷 - * - * @return {@link List}<{@link OneMapEntity}> - */ - @Override - public List<OneMapEntity> selectProjectType1() { - List<OneMapEntity> resList = new ArrayList<>(); - List<OneMapEntity> resInfo = aMapOfPipelineMapper.selectProjectType1(); - for (OneMapEntity oneMapEntity : resInfo) { - if (MEASUREMENT.equals(oneMapEntity.getValue())) { - resList.addAll(queryDirectory(oneMapEntity)); - } else if (TOINVESTIGATE.equals(oneMapEntity.getValue())) { - resList.addAll(queryDirectory(oneMapEntity)); - } else if (DISASTER.equals(oneMapEntity.getValue())) { - resList.addAll(queryDirectory(oneMapEntity)); - } else if (UNDERGROUNDSTRUCTURE.equals(oneMapEntity.getValue())) { - resList.addAll(queryDirectory(oneMapEntity)); - } - } - return resList; - } - - /** - * 鏌ヨ鐩綍 - * - * @return {@link List}<{@link OneMapEntity}> - */ - public List<OneMapEntity> queryDirectory(OneMapEntity oneMapEntity) { - String valueStr = oneMapEntity.getKey(); - System.out.println(oneMapEntity.getValue() + " == value == " + valueStr); - String endSql = null; - String sqlQur; - if (valueStr.length() > 0) { - String[] arrStr = valueStr.split(","); - StringBuilder one = new StringBuilder(); - if (arrStr.length > 0) { - System.out.println("arrStr = " + arrStr.length); - } - for (String s : arrStr) { - sqlQur = "'" + s + "%' " + "or dircode like"; - one.append(sqlQur); - } - endSql = " where dircode like " + one.substring(0, one.toString().length() - 15); - System.out.println("endSql = " + endSql); - } - return aMapOfPipelineMapper.selectProjectTypeOne(endSql); - } - - /** - * 閫夋嫨椤圭洰绫诲瀷涓� - * - * @param sqlQur sql - * @return {@link List}<{@link OneMapEntity}> - */ - @Override - public List<OneMapEntity> selectProjectTypeOne(String sqlQur) { - return null; - } - - - /** - * 鏌ヨ琛ㄤ俊鎭� - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> queryTableInfo(String tableName) { - return aMapOfPipelineMapper.queryTableInfo(tableName); - } - - /** - * 璁$畻鍏ㄧ悆绠¢亾鍥� - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countGlobalPipeMap() { - return aMapOfPipelineMapper.countGlobalPipeMap(); - } - - /** - * 璁$畻鍏ㄥ浗绠¢亾鍥� - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countNationalPipeMap() { - return aMapOfPipelineMapper.countNationalPipeMap(); - } - - /** - * 鍏ㄥ浗绠$綉鍥捐緭閫佷粙璐ㄩ暱搴� - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countZhPipeMapLenByMed() { - return aMapOfPipelineMapper.countZhPipeMapLenByMed(); - } - - /** - * 鍏ㄥ浗绔欏満搴ф暟銆侀榾瀹ゃ�佺閬撴暟绛� - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countZhPipeStations() { - return aMapOfPipelineMapper.countZhPipeStations(); - } - - /** - * 鎸夐」鐩粺璁¢」鐩瓨鍌ㄩ噺 - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countStorageByProject() { - return aMapOfPipelineMapper.countStorageByProject(); - } - - /** - * 閫夋嫨椤圭洰淇℃伅 - * 鏌ヨ椤圭洰淇℃伅 - * - * @param projectCode 椤圭洰缂栫爜 - * @return {@link List}<{@link String}> - */ - @Override - public List<String> selectProjectInfo(String projectCode) { - return aMapOfPipelineMapper.selectProjectInfo(projectCode); - } - - /** - * 閫夋嫨椤圭洰鏂囦欢鍒楄〃 - * - * @return {@link List}<{@link String}> - */ - @Override - public List<String> selectProjectFileList() { - return aMapOfPipelineMapper.selectProjectFileList(); - } - - /** - * 璁$畻瀛樺偍椤圭洰 - * - * @param projectCode 椤圭洰浠g爜 - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countProjectStorage(String projectCode) { - return aMapOfPipelineMapper.countProjectStorage(projectCode); - } - - /** - * 鍗曚釜椤圭洰鏂囦欢鏁伴噺 - * - * @param projectCode 椤圭洰浠g爜 - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countProjectType(String projectCode) { - return aMapOfPipelineMapper.countProjectType(projectCode); - } - - /** - * 缁熻椤圭洰涓� - * - * @param projectCode 椤圭洰浠g爜 - * @return {@link List}<{@link String}> - */ - @Override - public List<String> countProjectDown(String projectCode) { - return aMapOfPipelineMapper.countProjectDown(projectCode); - } - -} diff --git a/src/main/java/com/lf/server/service/show/PipelineService.java b/src/main/java/com/lf/server/service/show/PipelineService.java deleted file mode 100644 index 68caf48..0000000 --- a/src/main/java/com/lf/server/service/show/PipelineService.java +++ /dev/null @@ -1,231 +0,0 @@ -package com.lf.server.service.show; - -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.show.PipelineEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.data.DownloadMapper; -import com.lf.server.mapper.show.PipelineMapper; -import net.lingala.zip4j.ZipFile; -import net.lingala.zip4j.model.ZipParameters; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.gdal.ogr.*; -import org.gdal.osr.SpatialReference; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -/** - * 绠¢亾鍒嗘瀽鏈嶅姟绫� - * @author WWW - */ -@Service -public class PipelineService implements PipelineMapper { - @Autowired - PathHelper pathHelper; - - @Autowired - DownloadMapper downloadMapper; - - @Autowired - PipelineMapper pipelineMapper; - - private final static Log log = LogFactory.getLog(PipelineService.class); - - @Override - public List<PipelineEntity> selectPipelines(String name) { - name = StringHelper.getLikeUpperStr(name); - - return pipelineMapper.selectPipelines(name); - } - - @Override - public List<PipelineEntity> selectSegNames() { - return pipelineMapper.selectSegNames(); - } - - @Override - public List<PipelineEntity> selectPipeAnalysis(String tab, Integer gid) { - return pipelineMapper.selectPipeAnalysis(tab, gid); - } - - /** - * 鍒涘缓Zip鍖� - * - * @param ue 鐢ㄦ埛瀹炰綋 - * @param map 绠¢亾鍒嗘瀽鏁版嵁闆嗗悎 - * @param pwd 瀵嗙爜 - * @return 涓嬭浇鏂囦欢GUID - */ - public String createZipFile(UserEntity ue, Map<String, List<PipelineEntity>> map, String pwd) throws Exception { - String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); - String tempPath = pathHelper.getTempPath(tempName); - String filePath = tempPath + File.separator + tempName + ".gdb"; - - File file = new File(filePath); - if (file.exists() && file.isDirectory()) { - FileHelper.deleteDir(filePath); - } - createGdb(filePath, map); - - String zipName = tempName + ".gdb.zip"; - String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName; - - ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd); - ZipParameters params = Zip4jHelper.getZipParams(true); - addZipFiles(zip, params, file.listFiles()); - - String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); - DownloadEntity downloadEntity = getDownloadEntity(ue, zipFile, dbPwd); - int rows = downloadMapper.insert(downloadEntity); - - return rows > 0 ? downloadEntity.getGuid() : null; - } - - /** - * 鍒涘缓GDB - */ - public static void createGdb(String filePath, Map<String, List<PipelineEntity>> map) throws Exception { - Driver driver = null; - DataSource dataSource = null; - try { - driver = ogr.GetDriverByName("FileGDB"); - if (null == driver) { - log.error("PipelineService.createGdb.driver(FileGDB) is null."); - return; - } - dataSource = driver.CreateDataSource(filePath, null); - if (null == dataSource) { - log.error("PipelineService.createGdb.dataSource is null. " + filePath); - return; - } - - for (String key : map.keySet()) { - Layer layer = null; - try { - List<PipelineEntity> list = map.get(key); - layer = createLayer(dataSource, key.replace(".", "_"), list.get(0)); - - List<Field> fields = new ArrayList<>(); - getFields(PipelineEntity.class, fields); - - GdbHelper.addLayerField(layer, fields); - setLayerData(layer, fields, list); - } finally { - if (null != layer) { - layer.delete(); - } - } - } - - dataSource.SyncToDisk(); - dataSource.FlushCache(); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - throw ex; - } finally { - GdbHelper.delete(dataSource, driver); - } - } - - /** - * 鍒涘缓鍥惧眰 - */ - private static Layer createLayer(DataSource dataSource, String tab, PipelineEntity pe) { - int geomType = pe.getWkt().contains("POINT") ? ogr.wkbMultiPoint : ogr.wkbMultiLineString; - - SpatialReference sr = new SpatialReference(); - sr.ImportFromEPSG(4490); - - return dataSource.CreateLayer(tab, sr, geomType, null); - } - - /** - * 鑾峰彇瀛楁 - */ - private static void getFields(Class clazz, List<Field> list) { - try { - Field[] fields = clazz.getDeclaredFields(); - for (Field f : fields) { - if (StaticData.PIPE_EXCLUDE_FIELDS.contains(f.getName())) { - continue; - } - - f.setAccessible(true); - list.add(f); - } - - if (!StaticData.OBJECT.equals(clazz.getSuperclass().getName())) { - getFields(clazz.getSuperclass(), list); - } - } catch (Exception ex) { - // - } - } - - /** - * 璁剧疆鍥惧眰鏁版嵁 - */ - private static void setLayerData(Layer layer, List<Field> fields, List<PipelineEntity> list) throws Exception { - for (PipelineEntity t : list) { - Feature f = new Feature(layer.GetLayerDefn()); - - String wkt = t.getWkt(); - if (!wkt.contains("MULTI")) { - wkt = wkt.replace("POINT", "MULTIPOINT").replace("LINESTRING", "MULTILINESTRING(") + (wkt.contains("LINESTRING") ? ")" : ""); - } - - Geometry geom = Geometry.CreateFromWkt(wkt); - f.SetGeometry(geom); - - GdbHelper.setFeatureData(f, fields, t); - layer.CreateFeature(f); - } - } - - /** - * 娣诲姞Zip鏂囦欢 - */ - private void addZipFiles(ZipFile zip, ZipParameters params, File[] files) { - if (null == files || files.length == 0) { - return; - } - - for (File f : files) { - try { - zip.addFile(f, params); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - } - } - - /** - * 鑾峰彇涓嬭浇瀹炰綋绫� - */ - private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) throws Exception { - DownloadEntity de = new DownloadEntity(); - de.setName(FileHelper.getFileName(file)); - // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 - de.setType(5); - de.setSizes(FileHelper.sizeToMb(new File(file).length())); - de.setDepid(ue.getDepid()); - de.setDcount(0); - de.setPwd(pwd); - de.setUrl(FileHelper.getRelativePath(file)); - de.setDescr("绠¢亾鍒嗘瀽鏂囦欢"); - de.setGuid(FileHelper.getFileMd5(file)); - de.setCreateUser(ue.getId()); - // de.setGeom(null) - - return de; - } -} diff --git a/src/main/java/com/lf/server/service/sys/ArgsService.java b/src/main/java/com/lf/server/service/sys/ArgsService.java deleted file mode 100644 index 2fc0c19..0000000 --- a/src/main/java/com/lf/server/service/sys/ArgsService.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.all.SettingData; -import com.lf.server.entity.sys.ArgsEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.ArgsMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.lang.reflect.Field; -import java.util.List; - -/** - * 鍙傛暟璁剧疆 - * @author WWW - */ -@Service -public class ArgsService implements ArgsMapper { - @Autowired - ArgsMapper argsMapper; - - @Override - public Integer selectCount(String name) { - name = StringHelper.getLikeUpperStr(name); - - return argsMapper.selectCount(name); - } - - @Override - public List<ArgsEntity> selectByPage(String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return argsMapper.selectByPage(name, limit, offset); - } - - @Override - public List<ArgsEntity> selectAll() { - return argsMapper.selectAll(); - } - - @Override - public ArgsEntity selectById(int id) { - return argsMapper.selectById(id); - } - - @Override - public Integer insert(ArgsEntity entity) { - return argsMapper.insert(entity); - } - - @Override - public Integer inserts(List<ArgsEntity> list) { - return argsMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return argsMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return argsMapper.deletes(ids); - } - - @Override - public Integer update(ArgsEntity entity) { - return argsMapper.update(entity); - } - - @Override - public Integer updateForValue(ArgsEntity entity) { - return argsMapper.updateForValue(entity); - } - - @Override - public Integer updates(List<ArgsEntity> list) { - return argsMapper.updates(list); - } - - /** - * 鍒濆鍖栬缃�� - */ - public void initSettingData() throws Exception { - List<ArgsEntity> list = selectAll(); - if (list == null || list.isEmpty()) { - return; - } - - for (ArgsEntity entity : list) { - updateSettingData(entity); - } - } - - /** - * 鏇存柊璁剧疆鍊� - */ - public void updateSettingData(ArgsEntity entity) throws Exception { - Field field = SettingData.class.getField(entity.getMark()); - // field.setAccessible(true) - field.set(null, entity.getCvalue() * entity.getTimes()); - } -} diff --git a/src/main/java/com/lf/server/service/sys/AttachService.java b/src/main/java/com/lf/server/service/sys/AttachService.java deleted file mode 100644 index 290b489..0000000 --- a/src/main/java/com/lf/server/service/sys/AttachService.java +++ /dev/null @@ -1,196 +0,0 @@ -package com.lf.server.service.sys; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.lf.server.entity.all.BaseEntity; -import com.lf.server.entity.data.FmeLogEntity; -import com.lf.server.entity.sys.AttachEntity; -import com.lf.server.helper.ClassHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.all.BasicMapper; -import com.lf.server.mapper.sys.AttachMapper; -import com.lf.server.service.all.UploadAttachService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.lang.reflect.Field; -import java.util.List; - -/** - * 闄勪欢 - * @author WWW - */ -@Service -public class AttachService implements AttachMapper { - @Autowired - AttachMapper attachMapper; - - private static String tabs; - - @Override - public Integer selectCount(String name) { - name = StringHelper.getLikeUpperStr(name); - - return attachMapper.selectCount(name); - } - - @Override - public List<AttachEntity> selectByPage(String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return attachMapper.selectByPage(name, limit, offset); - } - - @Override - public List<AttachEntity> selectAll() { - return attachMapper.selectAll(); - } - - @Override - public AttachEntity selectById(int id) { - return attachMapper.selectById(id); - } - - @Override - public AttachEntity selectByGuid(String guid) { - return attachMapper.selectByGuid(guid); - } - - @Override - public List<AttachEntity> selectByGuids(List<String> guids) { - return attachMapper.selectByGuids(guids); - } - - @Override - public AttachEntity selectByTabAndGuid(String tab, String tabGuid, String guid) { - return attachMapper.selectByTabAndGuid(tab, tabGuid, guid); - } - - @Override - public List<AttachEntity> selectByTabGuids(String tab, List<String> guids) { - return attachMapper.selectByTabGuids(tab, guids); - } - - @Override - public List<AttachEntity> selectByTab(String tab, String guid) { - return attachMapper.selectByTab(tab, guid); - } - - @Override - public Integer insert(AttachEntity entity) { - return attachMapper.insert(entity); - } - - @Override - public Integer inserts(List<AttachEntity> list) { - return attachMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return attachMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return attachMapper.deletes(ids); - } - - @Override - public Integer update(AttachEntity entity) { - return attachMapper.update(entity); - } - - @Override - public Integer updates(List<AttachEntity> list) { - return attachMapper.updates(list); - } - - @Override - public List<FmeLogEntity> selectFmeLogs(String tabs) { - return attachMapper.selectFmeLogs(tabs); - } - - /** - * 鏌ヨFME鏃ュ織 - */ - public List<FmeLogEntity> selectFmeLogs() { - if (StringHelper.isEmpty(tabs)) { - tabs = UploadAttachService.getTabs().replace("'", ""); - } - - return attachMapper.selectFmeLogs(tabs); - } - - @Override - public Integer updateFmeLog(Integer id) { - return attachMapper.updateFmeLog(id); - } - - @Override - public Integer insertAttachByMeta(String tab, String tabGuid, String metaName, String dirid) { - return attachMapper.insertAttachByMeta(tab, tabGuid, metaName, dirid); - } - - /** - * 鍚屾闄勪欢 - */ - public void syncAttaches(FmeLogEntity entity) { - String tab = entity.getPgNs() + "." + entity.getTcdm(); - String fieldName = UploadAttachService.ATTACH_TABS.get(tab); - - List<?> list = selectRowsByParentid(entity.getTcdm().replace("_", ""), entity.getParentid(), fieldName); - if (null == list || list.isEmpty()) { - return; - } - - Field field = UploadAttachService.getAnnexField(list.get(0), tab); - if (null == field) { - return; - } - - for (Object obj : list) { - String[] names = UploadAttachService.getNames(UploadAttachService.getAnnexName(obj, field)); - if (null == names || names.length == 0) { - continue; - } - - BaseEntity be = (BaseEntity) obj; - String dirid = getDirid(be); - for (String name : names) { - if (StringHelper.isEmpty(name)) { - continue; - } - insertAttachByMeta(tab, be.getEventid(), name.trim(), dirid); - } - } - } - - /** - * 鑾峰彇鐩綍缂栫爜 - */ - private String getDirid(BaseEntity be) { - if (StringHelper.isEmpty(be.getDirid())) { - return null; - } - - String dirid = be.getDirid().substring(0, 2); - - return StringHelper.getRightLike(dirid); - } - - /** - * 鏍规嵁鐖禝D鏌ヨ璁板綍 - */ - private List<?> selectRowsByParentid(String entity, String parentid, String field) { - BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); - if (null == baseMapper) { - return null; - } - - QueryWrapper wrapper = new QueryWrapper(); - wrapper.eq("parentid", parentid); - wrapper.apply(field + " is not null"); - - return baseMapper.selectList(wrapper); - } -} diff --git a/src/main/java/com/lf/server/service/sys/AuthService.java b/src/main/java/com/lf/server/service/sys/AuthService.java deleted file mode 100644 index d78c227..0000000 --- a/src/main/java/com/lf/server/service/sys/AuthService.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.AuthEntity; -import com.lf.server.mapper.sys.AuthMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鏉冮檺琛� - * @author sws - * @date 2022-09-28 - */ -@Service -public class AuthService implements AuthMapper { - @Autowired - AuthMapper authMapper; - - @Override - public Integer selectCount(String name) { - return authMapper.selectCount(name); - } - - @Override - public List<AuthEntity> selectByPage(String name, Integer limit, Integer offset) { - return authMapper.selectByPage(name, limit, offset); - } - - @Override - public Integer selectCountForMenu(Integer menuid) { - return authMapper.selectCountForMenu(menuid); - } - - @Override - public List<AuthEntity> selectByPageForMenu(Integer menuid, Integer limit, Integer offset) { - return authMapper.selectByPageForMenu(menuid, limit, offset); - } - - @Override - public Integer insertAuth(AuthEntity authEntity) { - return authMapper.insertAuth(authEntity); - } - - @Override - public Integer insertAuths(List<AuthEntity> authEntity) { - return authMapper.insertAuths(authEntity); - } - - @Override - public Integer deleteAuth(int id) { - return authMapper.deleteAuth(id); - } - - @Override - public Integer deleteAuths(List<Integer> ids) { - return authMapper.deleteAuths(ids); - } - - @Override - public Integer updateAuth(AuthEntity authEntity) { - return authMapper.updateAuth(authEntity); - } - - @Override - public AuthEntity selectAuth(int id) { - return authMapper.selectAuth(id); - } - - @Override - public List<AuthEntity> selectAuthAll() { - return authMapper.selectAuthAll(); - } -} diff --git a/src/main/java/com/lf/server/service/sys/BlacklistService.java b/src/main/java/com/lf/server/service/sys/BlacklistService.java deleted file mode 100644 index 8beb0f2..0000000 --- a/src/main/java/com/lf/server/service/sys/BlacklistService.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.all.RedisCacheKey; -import com.lf.server.entity.all.SettingData; -import com.lf.server.entity.sys.BlacklistEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.BlacklistMapper; -import com.lf.server.service.all.RedisService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * 榛戝悕鍗� - * @author WWW - */ -@Service -public class BlacklistService implements BlacklistMapper { - @Autowired - BlacklistMapper blacklistMapper; - - @Autowired - RedisService redisService; - - private final static int TWO = 2; - - @Override - public Integer selectCount(String ip, Integer type) { - ip = StringHelper.getLikeUpperStr(ip); - - return blacklistMapper.selectCount(ip, type); - } - - @Override - public List<BlacklistEntity> selectByPage(String ip, Integer type, Integer limit, Integer offset) { - ip = StringHelper.getLikeUpperStr(ip); - - return blacklistMapper.selectByPage(ip, type, limit, offset); - } - - @Override - public List<BlacklistEntity> selectAll() { - return blacklistMapper.selectAll(); - } - - @Override - public BlacklistEntity selectById(int id) { - return blacklistMapper.selectById(id); - } - - @Override - public List<String> selectIpList(Integer type) { - if (type == null || type < 1 || type > TWO) { - return null; - } - - String key = RedisCacheKey.blacklistKey(type.toString()); - Object obj = redisService.get(key); - if (obj instanceof List<?>) { - return (List<String>) obj; - } - - List<String> list = blacklistMapper.selectIpList(type); - if (list != null && list.size() > 0) { - redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); - } - - return list; - } - - /** - * 娓呯┖缂撳瓨 - */ - public void clearCache() { - redisService.clearKeys(RedisCacheKey.blacklistKey("")); - } - - @Override - public Integer insert(BlacklistEntity entity) { - return blacklistMapper.insert(entity); - } - - @Override - public Integer inserts(List<BlacklistEntity> list) { - return blacklistMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return blacklistMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return blacklistMapper.deletes(ids); - } - - @Override - public Integer update(BlacklistEntity entity) { - return blacklistMapper.update(entity); - } - - @Override - public Integer updates(List<BlacklistEntity> list) { - return blacklistMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/sys/DepService.java b/src/main/java/com/lf/server/service/sys/DepService.java deleted file mode 100644 index fc5e03e..0000000 --- a/src/main/java/com/lf/server/service/sys/DepService.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.ctrl.IdNameEntity; -import com.lf.server.entity.sys.DepEntity; -import com.lf.server.mapper.sys.DepMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 缁勭粐鏈烘瀯 - * @author sws - * @date 2022-09-23 - */ -@Service -public class DepService implements DepMapper { - @Autowired - DepMapper depMapper; - - @Override - public Integer insertDep(DepEntity depEntity) { - return depMapper.insertDep(depEntity); - } - - @Override - public Integer insertDeps(List<DepEntity> depEntity) { - return depMapper.insertDeps(depEntity); - } - - @Override - public Integer deleteDep(int id) { - return depMapper.deleteDep(id); - } - - @Override - public Integer deleteDeps(List<Integer> ids) { - return depMapper.deleteDeps(ids); - } - - @Override - public Integer updateDep(DepEntity depEntity) { - return depMapper.updateDep(depEntity); - } - - - @Override - public DepEntity selectDep(int id) { - return depMapper.selectDep(id); - } - - @Override - public List<IdNameEntity> selectDepsByCodes(String[] codes) { - return depMapper.selectDepsByCodes(codes); - } - - @Override - public List<DepEntity> selectDepAll() { - return depMapper.selectDepAll(); - } - - @Override - public Integer updateDeps(List<DepEntity> list) { - return depMapper.updateDeps(list); - } - - @Override - public List<DepEntity> selectDepRecursive(String name) { - return depMapper.selectDepRecursive(name); - } -} \ No newline at end of file diff --git a/src/main/java/com/lf/server/service/sys/DownlogService.java b/src/main/java/com/lf/server/service/sys/DownlogService.java deleted file mode 100644 index 2814ee8..0000000 --- a/src/main/java/com/lf/server/service/sys/DownlogService.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.sys.DownlogEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.mapper.sys.DownlogMapper; -import com.lf.server.service.data.DownloadService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import java.sql.Timestamp; -import java.util.List; - -/** - * 涓嬭浇鏃ュ織 - * @author WWW - */ -@Service -public class DownlogService implements DownlogMapper { - @Autowired - DownlogMapper downlogMapper; - - @Autowired - DownloadService downloadService; - - @Override - public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) { - uname = StringHelper.getLikeUpperStr(uname); - - return downlogMapper.selectCount(uname, type, start, end); - } - - @Override - public List<DownlogEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { - uname = StringHelper.getLikeUpperStr(uname); - - return downlogMapper.selectByPage(uname, type, start, end, limit, offset); - } - - @Override - public List<DownlogEntity> selectAll() { - return downlogMapper.selectAll(); - } - - @Override - public DownlogEntity selectById(int id) { - return downlogMapper.selectById(id); - } - - @Override - public Integer insert(DownlogEntity entity) { - return downlogMapper.insert(entity); - } - - @Override - public Integer inserts(List<DownlogEntity> list) { - return downlogMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return downlogMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return downlogMapper.deletes(ids); - } - - @Override - public Integer update(DownlogEntity entity) { - return downlogMapper.update(entity); - } - - @Override - public Integer updates(List<DownlogEntity> list) { - return downlogMapper.updates(list); - } - - /** - * 鏇存柊涓嬭浇淇℃伅 - */ - public void updateInfos(UserEntity ue, DownloadEntity de, HttpServletRequest req) { - de.setDcount(de.getDcount() + 1); - de.setDownloadUser(ue.getId()); - int rows = downloadService.update(de); - - DownlogEntity entity = new DownlogEntity(); - entity.setDownid(de.getId()); - entity.setCreateUser(ue.getId()); - entity.setIp(WebHelper.getIpAddress(req)); - - rows = downlogMapper.insert(entity); - } -} diff --git a/src/main/java/com/lf/server/service/sys/LoginService.java b/src/main/java/com/lf/server/service/sys/LoginService.java deleted file mode 100644 index 5e9653a..0000000 --- a/src/main/java/com/lf/server/service/sys/LoginService.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.LoginEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.mapper.sys.LoginMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import java.sql.Timestamp; -import java.util.List; - -/** - *鐧诲綍鏃ュ織 - * @author sws - * @date 2022-09-28 - */ -@Service -public class LoginService implements LoginMapper { - @Autowired - LoginMapper loginMapper; - - @Override - public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) { - uname = StringHelper.getLikeUpperStr(uname); - - return loginMapper.selectCount(uname, type, start, end); - } - - @Override - public List<LoginEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { - uname = StringHelper.getLikeUpperStr(uname); - - return loginMapper.selectByPage(uname, type, start, end, limit, offset); - } - - @Override - public Integer insertLogin(LoginEntity loginEntity) { - return loginMapper.insertLogin(loginEntity); - } - - @Override - public Integer insertLogins(List<LoginEntity> loginEntity) { - return loginMapper.insertLogins(loginEntity); - } - - @Override - public Integer deleteLogin(int id) { - return loginMapper.deleteLogin(id); - } - - @Override - public Integer deleteLogins(List<Integer> ids) { - return loginMapper.deleteLogins(ids); - } - - @Override - public Integer updateLogin(LoginEntity loginEntity) { - return loginMapper.updateLogin(loginEntity); - } - - @Override - public LoginEntity selectLogin(int id) { - return loginMapper.selectLogin(id); - } - - @Override - public List<LoginEntity> selectLoginAll() { - return loginMapper.selectLoginAll(); - } - - /** - * 鑾峰彇鏂扮殑鐧诲綍瀹炰綋绫� - */ - public LoginEntity getNewLogin(int userid, int appId, int type, int status, HttpServletRequest req) { - LoginEntity le = new LoginEntity(); - le.setUserid(userid); - le.setAppid(appId); - le.setIp(WebHelper.getIpAddress(req)); - le.setType(type); - le.setStatus(status); - le.setOptime(WebHelper.getCurrentTimestamp()); - - return le; - } - - /** - * 鐢ㄦ埛鐧诲綍鐘舵�� - * @return - */ - @Override - public List<LoginEntity> selectLoginCounts(){ - return loginMapper.selectLoginCounts(); - } -} diff --git a/src/main/java/com/lf/server/service/sys/MenuAuthService.java b/src/main/java/com/lf/server/service/sys/MenuAuthService.java deleted file mode 100644 index 3f41954..0000000 --- a/src/main/java/com/lf/server/service/sys/MenuAuthService.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.MenuAuthEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.MenuAuthMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鑿滃崟-鏉冮檺 - * @author WWW - */ -@Service -public class MenuAuthService implements MenuAuthMapper { - @Autowired - MenuAuthMapper menuAuthMapper; - - @Override - public Integer selectCount(Integer menuid) { - return menuAuthMapper.selectCount(menuid); - } - - @Override - public List<MenuAuthEntity> selectByPage(Integer menuid, Integer limit, Integer offset) { - return menuAuthMapper.selectByPage(menuid, limit, offset); - } - - @Override - public Integer selectCountForRole(Integer roleid, Integer menuid) { - return menuAuthMapper.selectCountForRole(roleid, menuid); - } - - @Override - public List<MenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset) { - return menuAuthMapper.selectByPageForRole(roleid, menuid, limit, offset); - } - - @Override - public List<MenuAuthEntity> selectAll() { - return menuAuthMapper.selectAll(); - } - - @Override - public MenuAuthEntity selectById(int id) { - return menuAuthMapper.selectById(id); - } - - @Override - public Integer insert(MenuAuthEntity entity) { - return menuAuthMapper.insert(entity); - } - - @Override - public Integer inserts(List<MenuAuthEntity> list) { - return menuAuthMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return menuAuthMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return menuAuthMapper.deletes(ids); - } - - @Override - public Integer update(MenuAuthEntity entity) { - return menuAuthMapper.update(entity); - } - - @Override - public Integer updates(List<MenuAuthEntity> list) { - return menuAuthMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/sys/MenuService.java b/src/main/java/com/lf/server/service/sys/MenuService.java deleted file mode 100644 index 5457a53..0000000 --- a/src/main/java/com/lf/server/service/sys/MenuService.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.MenuEntity; -import com.lf.server.mapper.sys.MenuMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鑿滃崟 - * @author sws - * @date 2022-09-24 - */ -@Service -public class MenuService implements MenuMapper { - @Autowired - MenuMapper menuMapper; - - @Override - public Integer insertMenu(MenuEntity menuEntity) { - return menuMapper.insertMenu(menuEntity); - } - - @Override - public Integer insertMenus(List<MenuEntity> menuEntity) { - return menuMapper.insertMenus(menuEntity); - } - - @Override - public Integer deleteMenu(int id) { - return menuMapper.deleteMenu(id); - } - - @Override - public Integer deleteMenus(List<Integer> ids) { - return menuMapper.deleteMenus(ids); - } - - @Override - public Integer updateMenu(MenuEntity menuEntity) { - return menuMapper.updateMenu(menuEntity); - } - - @Override - public Integer updateMenus(List<MenuEntity> menuEntity) { - return menuMapper.updateMenus(menuEntity); - } - - @Override - public MenuEntity selectMenu(int id) { - return menuMapper.selectMenu(id); - } - - @Override - public List<MenuEntity> selectMenuAll() { - return menuMapper.selectMenuAll(); - } - - @Override - public List<MenuEntity> selectMenuRecursive(String name) { - return menuMapper.selectMenuRecursive(name); - } -} \ No newline at end of file diff --git a/src/main/java/com/lf/server/service/sys/MetaDownService.java b/src/main/java/com/lf/server/service/sys/MetaDownService.java deleted file mode 100644 index 1205b4c..0000000 --- a/src/main/java/com/lf/server/service/sys/MetaDownService.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.MetaDownEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.MetaDownMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鍏冩暟鎹�-涓嬭浇 - * @author WWW - */ -@Service -public class MetaDownService implements MetaDownMapper { - @Autowired - MetaDownMapper metaDownMapper; - - @Override - public Integer selectCount(Integer metaid) { - return metaDownMapper.selectCount(metaid); - } - - @Override - public List<MetaDownEntity> selectByPage(Integer metaid, Integer limit, Integer offset) { - return metaDownMapper.selectByPage(metaid, limit, offset); - } - - @Override - public List<MetaDownEntity> selectAll() { - return metaDownMapper.selectAll(); - } - - @Override - public MetaDownEntity selectById(int id) { - return metaDownMapper.selectById(id); - } - - @Override - public Integer insert(MetaDownEntity entity) { - return metaDownMapper.insert(entity); - } - - @Override - public Integer inserts(List<MetaDownEntity> list) { - return metaDownMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return metaDownMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return metaDownMapper.deletes(ids); - } - - @Override - public Integer update(MetaDownEntity entity) { - return metaDownMapper.update(entity); - } - - @Override - public Integer updates(List<MetaDownEntity> list) { - return metaDownMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/sys/OperateService.java b/src/main/java/com/lf/server/service/sys/OperateService.java deleted file mode 100644 index aa833b4..0000000 --- a/src/main/java/com/lf/server/service/sys/OperateService.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.OperateEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.OperateMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.sql.Timestamp; -import java.util.List; - -/** - * 鎿嶄綔鏃ュ織 - * @author sws - * @date 2022-09-28 - */ -@Service -public class OperateService implements OperateMapper { - @Autowired - OperateMapper operateMapper; - - @Override - public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) { - uname = StringHelper.getLikeUpperStr(uname); - - return operateMapper.selectCount(uname, type, start, end); - } - - @Override - public List<OperateEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { - uname = StringHelper.getLikeUpperStr(uname); - - return operateMapper.selectByPage(uname, type, start, end, limit, offset); - } - - @Override - public Integer insertOperate(OperateEntity operateEntity) { - return operateMapper.insertOperate(operateEntity); - } - - @Override - public Integer insertOperates(List<OperateEntity> operateEntity) { - return operateMapper.insertOperates(operateEntity); - } - - @Override - public Integer deleteOperate(int id) { - return operateMapper.deleteOperate(id); - } - - @Override - public Integer deleteOperates(List<Integer> ids) { - return operateMapper.deleteOperates(ids); - } - - @Override - public Integer updateOperate(OperateEntity operateEntity) { - return operateMapper.updateOperate(operateEntity); - } - - @Override - public OperateEntity selectOperate(int id) { - return operateMapper.selectOperate(id); - } - - @Override - public List<OperateEntity> selectOperateAll() { - return operateMapper.selectOperateAll(); - } - - @Override - public List<OperateEntity> operateCount() { - return operateMapper.operateCount(); - } -} diff --git a/src/main/java/com/lf/server/service/sys/ReportService.java b/src/main/java/com/lf/server/service/sys/ReportService.java deleted file mode 100644 index 2f662dd..0000000 --- a/src/main/java/com/lf/server/service/sys/ReportService.java +++ /dev/null @@ -1,310 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.all.StaticData; -import com.lf.server.entity.ctrl.CountEntity; -import com.lf.server.entity.data.DownloadEntity; -import com.lf.server.entity.sys.AttachEntity; -import com.lf.server.entity.sys.ReportEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.*; -import com.lf.server.mapper.sys.ReportMapper; -import com.lf.server.service.data.DownloadService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.util.*; - -/** - * 鎶ュ憡妯℃澘 - * @author WWW - */ -@Service -public class ReportService implements ReportMapper { - @Autowired - ReportMapper reportMapper; - - @Autowired - AttachService attachService; - - @Autowired - PathHelper pathHelper; - - @Autowired - DownloadService downloadService; - - @Override - public Integer selectCount(String name, String code) { - name = StringHelper.getLikeUpperStr(name); - - return reportMapper.selectCount(name, code); - } - - @Override - public List<ReportEntity> selectByPage(String name, String code, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return reportMapper.selectByPage(name, code, limit, offset); - } - - @Override - public List<ReportEntity> selectAll() { - return reportMapper.selectAll(); - } - - @Override - public ReportEntity selectById(int id) { - return reportMapper.selectById(id); - } - - @Override - public Integer insert(ReportEntity entity) { - return reportMapper.insert(entity); - } - - @Override - public Integer inserts(List<ReportEntity> list) { - return reportMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return reportMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return reportMapper.deletes(ids); - } - - @Override - public Integer update(ReportEntity entity) { - return reportMapper.update(entity); - } - - @Override - public Integer updates(List<ReportEntity> list) { - return reportMapper.updates(list); - } - - @Override - public List<CountEntity> countSizes() { - return reportMapper.countSizes(); - } - - @Override - public List<CountEntity> countServices() { - return reportMapper.countServices(); - } - - @Override - public List<CountEntity> countOperates() { - return reportMapper.countOperates(); - } - - /** - * 鍒涘缓鎶ュ憡 - */ - public void createReport(UserEntity ue, ReportEntity re, HttpServletResponse res) throws Exception { - AttachEntity ae = attachService.selectByGuid(re.getGuid()); - if (null == ae) { - return; - } - - String source = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); - String targetName = StringHelper.YMDHMS2_FORMAT.format(new Date()) + FileHelper.getExtension(ae.getName()); - String target = pathHelper.getDownloadFullPath() + File.separator + targetName; - - File sourceFile = new File(source); - if (!sourceFile.exists() || sourceFile.isDirectory()) { - return; - } - generateReport(source, target, re); - - File targetFile = new File(target); - if (!targetFile.exists() || sourceFile.isDirectory()) { - return; - } - - DownloadEntity de = getDownloadEntity(ue, target); - int rows = downloadService.insert(de); - if (rows > 0) { - WebHelper.download(target, targetName, res); - } - } - - /** - * 鐢熸垚鎶ュ憡 - */ - private void generateReport(String source, String target, ReportEntity re) { - if (StaticData.S1.equals(re.getType())) { - switch (re.getCode()) { - case "countOperates": - createCountOperatesWord(source, target); - break; - case "countSizes": - createCountSizesWord(source, target); - break; - case "countServices": - createCountServicesWord(source, target); - break; - default: - break; - } - } else { - switch (re.getCode()) { - case "countOperates": - createCountOperatesExcel(source, target); - break; - case "countSizes": - createCountSizesExcel(source, target); - break; - case "countServices": - createCountServicesExcel(source, target); - break; - default: - break; - } - } - } - - /** - * 鍒涘缓 鐢ㄦ埛娴侀噺缁熻 Word - */ - public void createCountOperatesWord(String source, String target) { - List<CountEntity> list = countOperates(); - if (null == list || list.isEmpty()) { - return; - } - - int rows = 1; - ArrayList<String[]> addList = new ArrayList<>(); - for (CountEntity ce : list) { - String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getM2(), ce.getCount().toString()}; - addList.add(strs); - } - - WordHelper.generateWord(source, target, null, addList); - } - - /** - * 鍒涘缓 鏈嶅姟璋冪敤閲忕粺璁� Word - */ - public void createCountServicesWord(String source, String target) { - List<CountEntity> list = countServices(); - if (null == list || list.isEmpty()) { - return; - } - - int rows = 1; - ArrayList<String[]> addList = new ArrayList<>(); - for (CountEntity ce : list) { - String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getCount().toString()}; - addList.add(strs); - } - - WordHelper.generateWord(source, target, null, addList); - } - - /** - * 鍒涘缓 鏁版嵁閲忕粺璁� Word - */ - public void createCountSizesWord(String source, String target) { - List<CountEntity> list = countSizes(); - if (null == list || list.isEmpty()) { - return; - } - - int rows = 1; - ArrayList<String[]> addList = new ArrayList<>(); - for (CountEntity ce : list) { - String[] strs = new String[]{"" + rows++, ce.getM1(), FileHelper.getSizes(ce.getSizes())}; - addList.add(strs); - } - - WordHelper.generateWord(source, target, null, addList); - } - - /** - * 鍒涘缓 鐢ㄦ埛娴侀噺缁熻 Excel - */ - public void createCountOperatesExcel(String source, String target) { - List<CountEntity> list = countOperates(); - if (null == list || list.isEmpty()) { - return; - } - - int rows = 1; - for (CountEntity ce : list) { - ce.setNo(rows++); - } - - Map<String, List<CountEntity>> map = new HashMap<>(1); - map.put("data", list); - - ExcelHelper.writeToTemplate(source, target, map); - } - - /** - * 鍒涘缓 鏈嶅姟璋冪敤閲忕粺璁� Excel - */ - public void createCountServicesExcel(String source, String target) { - List<CountEntity> list = countServices(); - if (null == list || list.isEmpty()) { - return; - } - - int rows = 1; - for (CountEntity ce : list) { - ce.setNo(rows++); - } - - Map<String, List<CountEntity>> map = new HashMap<>(1); - map.put("data", list); - - ExcelHelper.writeToTemplate(source, target, map); - } - - /** - * 鍒涘缓 鏁版嵁閲忕粺璁� Excel - */ - public void createCountSizesExcel(String source, String target) { - List<CountEntity> list = countSizes(); - if (null == list || list.isEmpty()) { - return; - } - - int rows = 1; - for (CountEntity ce : list) { - ce.setNo(rows++); - ce.setM2(FileHelper.getSizes(ce.getSizes())); - } - - Map<String, List<CountEntity>> map = new HashMap<>(1); - map.put("data", list); - - ExcelHelper.writeToTemplate(source, target, map); - } - - /** - * 鑾峰彇涓嬭浇瀹炰綋绫� - */ - private DownloadEntity getDownloadEntity(UserEntity ue, String file) { - DownloadEntity de = new DownloadEntity(); - de.setName(FileHelper.getFileName(file)); - // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 - de.setType(6); - de.setSizes(FileHelper.sizeToMb(new File(file).length())); - de.setDepid(ue.getDepid()); - de.setDcount(1); - de.setPwd(null); - de.setUrl(FileHelper.getRelativePath(file)); - de.setDescr("缁熻鎶ュ憡"); - de.setGuid(FileHelper.getFileMd5(file)); - de.setCreateUser(ue.getId()); - // de.setGeom(null) - - return de; - } -} diff --git a/src/main/java/com/lf/server/service/sys/ResOpService.java b/src/main/java/com/lf/server/service/sys/ResOpService.java deleted file mode 100644 index 733ceb9..0000000 --- a/src/main/java/com/lf/server/service/sys/ResOpService.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.ResOpEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.ResOpMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.sql.Timestamp; -import java.util.List; - -/** - * 璧勬簮鎿嶄綔琛� - * @author sws - * @date 2022-09-28 - */ -@Service -public class ResOpService implements ResOpMapper { - @Autowired - ResOpMapper resOpMapper; - - @Override - public Integer selectCount(String name, Integer type, Timestamp start, Timestamp end) { - name = StringHelper.getLikeUpperStr(name); - - return resOpMapper.selectCount(name, type, start, end); - } - - @Override - public List<ResOpEntity> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return resOpMapper.selectByPage(name, type, start, end, limit, offset); - } - - @Override - public Integer insertResOp(ResOpEntity resOpEntity) { - return resOpMapper.insertResOp(resOpEntity); - } - - @Override - public Integer insertResOps(List<ResOpEntity> resOpEntity) { - return resOpMapper.insertResOps(resOpEntity); - } - - @Override - public Integer deleteResOp(int id) { - return resOpMapper.deleteResOp(id); - } - - @Override - public Integer deleteResOps(List<Integer> ids) { - return resOpMapper.deleteResOps(ids); - } - - @Override - public Integer updateResOp(ResOpEntity resOpEntity) { - return resOpMapper.updateResOp(resOpEntity); - } - - @Override - public ResOpEntity selectResOp(int id) { - return resOpMapper.selectResOp(id); - } - - @Override - public List<ResOpEntity> selectResOpAll() { - return resOpMapper.selectResOpAll(); - } -} diff --git a/src/main/java/com/lf/server/service/sys/ResService.java b/src/main/java/com/lf/server/service/sys/ResService.java deleted file mode 100644 index d31c0ea..0000000 --- a/src/main/java/com/lf/server/service/sys/ResService.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.ResEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.ResMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 浠ょ墝琛� - * @author sws - * @date 2022-09-28 - */ -@Service -public class ResService implements ResMapper { - @Autowired - ResMapper resMapper; - - @Override - public Integer selectCount(String name) { - name = StringHelper.getLikeUpperStr(name); - - return resMapper.selectCount(name); - } - - @Override - public List<ResEntity> selectByPage(String name, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return resMapper.selectByPage(name, limit, offset); - } - - @Override - public Integer selectCountForRole(Integer roleid) { - return resMapper.selectCountForRole(roleid); - } - - @Override - public List<ResEntity> selectByPageForRole(Integer roleid, Integer limit, Integer offset) { - return resMapper.selectByPageForRole(roleid, limit, offset); - } - - @Override - public Integer insertRes(ResEntity resEntity) { - return resMapper.insertRes(resEntity); - } - - @Override - public Integer insertRess(List<ResEntity> resEntity) { - return resMapper.insertRess(resEntity); - } - - @Override - public Integer deleteRes(int id) { - return resMapper.deleteRes(id); - } - - @Override - public Integer deleteRess(List<Integer> ids) { - return resMapper.deleteRess(ids); - } - - @Override - public Integer updateRes(ResEntity resEntity) { - return resMapper.updateRes(resEntity); - } - - @Override - public ResEntity selectRes(int id) { - return resMapper.selectRes(id); - } - - @Override - public List<ResEntity> selectResAll() { - return resMapper.selectResAll(); - } - -} diff --git a/src/main/java/com/lf/server/service/sys/RoleMenuAuthService.java b/src/main/java/com/lf/server/service/sys/RoleMenuAuthService.java deleted file mode 100644 index e0cbd9d..0000000 --- a/src/main/java/com/lf/server/service/sys/RoleMenuAuthService.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.RoleMenuAuthEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.RoleMenuAuthMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 瑙掕壊-鑿滃崟 - * @author WWW - */ -@Service -public class RoleMenuAuthService implements RoleMenuAuthMapper { - @Autowired - RoleMenuAuthMapper roleMenuAuthMapper; - - @Override - public Integer selectCount(Integer roleid) { - return roleMenuAuthMapper.selectCount(roleid); - } - - @Override - public List<RoleMenuAuthEntity> selectByPage(Integer roleid, Integer limit, Integer offset) { - return roleMenuAuthMapper.selectByPage(roleid, limit, offset); - } - - @Override - public Integer selectCountForRole(Integer roleid, Integer menuid) { - return roleMenuAuthMapper.selectCountForRole(roleid, menuid); - } - - @Override - public List<RoleMenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset) { - return roleMenuAuthMapper.selectByPageForRole(roleid, menuid, limit, offset); - } - - @Override - public List<RoleMenuAuthEntity> selectAll() { - return roleMenuAuthMapper.selectAll(); - } - - @Override - public RoleMenuAuthEntity selectById(int id) { - return roleMenuAuthMapper.selectById(id); - } - - @Override - public Integer insert(RoleMenuAuthEntity entity) { - return roleMenuAuthMapper.insert(entity); - } - - @Override - public Integer inserts(List<RoleMenuAuthEntity> list) { - return roleMenuAuthMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return roleMenuAuthMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return roleMenuAuthMapper.deletes(ids); - } - - @Override - public Integer update(RoleMenuAuthEntity entity) { - return roleMenuAuthMapper.update(entity); - } - - @Override - public Integer updates(List<RoleMenuAuthEntity> list) { - return roleMenuAuthMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/sys/RoleResService.java b/src/main/java/com/lf/server/service/sys/RoleResService.java deleted file mode 100644 index ee43456..0000000 --- a/src/main/java/com/lf/server/service/sys/RoleResService.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.RoleResEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.RoleResMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 瑙掕壊-璧勬簮 - * @author WWW - */ -@Service -public class RoleResService implements RoleResMapper { - @Autowired - RoleResMapper roleResMapper; - - @Override - public Integer selectCount(Integer roleid) { - return roleResMapper.selectCount(roleid); - } - - @Override - public List<RoleResEntity> selectByPage(Integer roleid, Integer limit, Integer offset) { - return roleResMapper.selectByPage(roleid, limit, offset); - } - - @Override - public List<RoleResEntity> selectAll() { - return roleResMapper.selectAll(); - } - - @Override - public RoleResEntity selectById(int id) { - return roleResMapper.selectById(id); - } - - @Override - public Integer insert(RoleResEntity entity) { - return roleResMapper.insert(entity); - } - - @Override - public Integer inserts(List<RoleResEntity> list) { - return roleResMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return roleResMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return roleResMapper.deletes(ids); - } - - @Override - public Integer update(RoleResEntity entity) { - return roleResMapper.update(entity); - } - - @Override - public Integer updates(List<RoleResEntity> list) { - return roleResMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/sys/RoleService.java b/src/main/java/com/lf/server/service/sys/RoleService.java deleted file mode 100644 index 680c2de..0000000 --- a/src/main/java/com/lf/server/service/sys/RoleService.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.RoleEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.RoleMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 瑙掕壊琛� - * @author sws - * @date 2022-09-29 - */ -@Service -public class RoleService implements RoleMapper { - @Autowired - RoleMapper roleMapper; - - @Override - public Integer selectCount(String name, Integer depid) { - name = StringHelper.getLikeUpperStr(name); - - return roleMapper.selectCount(name, depid); - } - - @Override - public List<RoleEntity> selectByPage(String name, Integer depid, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return roleMapper.selectByPage(name, depid, limit, offset); - } - - @Override - public Integer insertRole(RoleEntity roleEntity) { - return roleMapper.insertRole(roleEntity); - } - - @Override - public Integer insertRoles(List<RoleEntity> roleEntity) { - return roleMapper.insertRoles(roleEntity); - } - - @Override - public Integer deleteRole(int id) { - return roleMapper.deleteRole(id); - } - - @Override - public Integer deleteRoles(List<Integer> ids) { - return roleMapper.deleteRoles(ids); - } - - @Override - public Integer updateRole(RoleEntity roleEntity) { - return roleMapper.updateRole(roleEntity); - } - - @Override - public RoleEntity selectRole(int id) { - return roleMapper.selectRole(id); - } - - @Override - public List<RoleEntity> selectRoleAll() { - return roleMapper.selectRoleAll(); - } -} diff --git a/src/main/java/com/lf/server/service/sys/RoleUserService.java b/src/main/java/com/lf/server/service/sys/RoleUserService.java deleted file mode 100644 index 34ee277..0000000 --- a/src/main/java/com/lf/server/service/sys/RoleUserService.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.RoleUserEntity; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.RoleUserMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 瑙掕壊-鐢ㄦ埛 - * @author WWW - */ -@Service -public class RoleUserService implements RoleUserMapper { - @Autowired - RoleUserMapper roleUserMapper; - - @Override - public Integer selectCount(Integer roleid) { - return roleUserMapper.selectCount(roleid); - } - - @Override - public List<RoleUserEntity> selectByPage(Integer roleid, Integer limit, Integer offset) { - return roleUserMapper.selectByPage(roleid, limit, offset); - } - - @Override - public List<RoleUserEntity> selectAll() { - return roleUserMapper.selectAll(); - } - - @Override - public RoleUserEntity selectById(int id) { - return roleUserMapper.selectById(id); - } - - @Override - public Integer insert(RoleUserEntity entity) { - return roleUserMapper.insert(entity); - } - - @Override - public Integer inserts(List<RoleUserEntity> list) { - return roleUserMapper.inserts(list); - } - - @Override - public Integer delete(int id) { - return roleUserMapper.delete(id); - } - - @Override - public Integer deletes(List<Integer> ids) { - return roleUserMapper.deletes(ids); - } - - @Override - public Integer update(RoleUserEntity entity) { - return roleUserMapper.update(entity); - } - - @Override - public Integer updates(List<RoleUserEntity> list) { - return roleUserMapper.updates(list); - } -} diff --git a/src/main/java/com/lf/server/service/sys/TokenService.java b/src/main/java/com/lf/server/service/sys/TokenService.java deleted file mode 100644 index 5203629..0000000 --- a/src/main/java/com/lf/server/service/sys/TokenService.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.all.SettingData; -import com.lf.server.entity.sys.LoginEntity; -import com.lf.server.entity.sys.TokenEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.entity.all.RedisCacheKey; -import com.lf.server.helper.StringHelper; -import com.lf.server.helper.WebHelper; -import com.lf.server.mapper.sys.TokenMapper; -import com.lf.server.service.all.RedisService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Date; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * 浠ょ墝琛� - * @author sws - * @date 2022-09-28 - */ - -@Service -public class TokenService implements TokenMapper { - @Autowired - TokenMapper tokenMapper; - - @Autowired - UserService usersService; - - @Autowired - LoginService loginService; - - @Autowired - RedisService redisService; - - @Override - public Integer selectCount(String name, Integer type) { - name = StringHelper.getLikeUpperStr(name); - - return tokenMapper.selectCount(name, type); - } - - @Override - public List<TokenEntity> selectByPage(String name, Integer type, Integer limit, Integer offset) { - name = StringHelper.getLikeUpperStr(name); - - return tokenMapper.selectByPage(name, type, limit, offset); - } - - @Override - public TokenEntity selectToken(int id) { - return tokenMapper.selectToken(id); - } - - @Override - public TokenEntity selectOneByToken(String token) { - return tokenMapper.selectOneByToken(token); - } - - @Override - public List<TokenEntity> selectTokenAll() { - return tokenMapper.selectTokenAll(); - } - - @Override - public Integer insertToken(TokenEntity tokenEntity) { - return tokenMapper.insertToken(tokenEntity); - } - - @Override - public Integer insertTokens(List<TokenEntity> tokenEntity) { - return tokenMapper.insertTokens(tokenEntity); - } - - @Override - public Integer deleteToken(int id) { - return tokenMapper.deleteToken(id); - } - - @Override - public Integer deleteTokens(List<Integer> ids) { - return tokenMapper.deleteTokens(ids); - } - - @Override - public Integer updateToken(TokenEntity tokenEntity) { - return tokenMapper.updateToken(tokenEntity); - } - - @Override - public Integer updateTokenExpire(TokenEntity tokenEntity) { - return tokenMapper.updateTokenExpire(tokenEntity); - } - - /** - * 鑾峰彇鏂扮殑浠ょ墝瀹炰綋绫� - */ - public TokenEntity getNewToken(UserEntity ue, HttpServletRequest req) { - TokenEntity te = new TokenEntity(); - te.setToken(WebHelper.getGuid()); - te.setDuration(SettingData.TOKEN_EXPIRE); - te.setExpire(WebHelper.getTimestamp(SettingData.TOKEN_EXPIRE)); - te.setType(0); - te.setIp(WebHelper.getIpAddress(req)); - te.setCreateUser(ue.getId()); - te.setUname(ue.getUname()); - - return te; - } - - /** - * 鏄�/鍚︾櫥褰� - */ - public Boolean isLogin(HttpServletRequest req, HttpServletResponse res) { - String token = WebHelper.getToken(req); - if (StringHelper.isNull(token)) { - return false; - } - - // redis - String tokenKey = RedisCacheKey.signTokenKey(token); - if (redisService.hasKey(tokenKey)) { - return true; - } - - // db - TokenEntity te = selectOneByToken(token); - if (te != null) { - redisService.put(tokenKey, te, te.getDuration(), TimeUnit.MINUTES); - return true; - } - - return false; - } - - /** - * 鐧诲嚭 - */ - public Boolean logout(String token, HttpServletRequest req, HttpServletResponse res) { - TokenEntity te = getEntityByToken(token); - if (te == null) { - return false; - } - - // 娓呴櫎Cookie - WebHelper.deleteCookies(req, res); - - // 鑾峰彇褰撳墠鐢ㄦ埛 - UserEntity ue = getCurrentUser(req); - if (ue == null) { - return false; - } - - // 娓呴櫎缂撳瓨 - String tokenKey = RedisCacheKey.signTokenKey(token); - if (redisService.hasKey(tokenKey)) { - redisService.delete(tokenKey); - } - String userKey = RedisCacheKey.signUserKey(te.getToken()); - if (redisService.hasKey(userKey)) { - redisService.delete(userKey); - } - - // db锛岃缃护鐗岃繃鏈� - te.setUpdateUser(ue.getId()); - Integer rows = updateTokenExpire(te); - if (rows == 0) { - return false; - } - - // 鍐欐棩蹇� - LoginEntity le = loginService.getNewLogin(ue.getId(), 1, 3, 1, req); - rows = loginService.insertLogin(le); - - return rows > 0; - } - - /** - * 鏍规嵁浠ょ墝鑾峰彇瀹炰綋 - */ - public TokenEntity getEntityByToken(String token) { - if (StringHelper.isNull(token)) { - return null; - } - - String tokenKey = RedisCacheKey.signTokenKey(token); - - // redis - Object obj = redisService.get(tokenKey); - if (obj instanceof TokenEntity) { - return (TokenEntity) obj; - } - - // db - TokenEntity te = selectOneByToken(token); - if (te != null) { - redisService.put(tokenKey, te, te.getDuration(), TimeUnit.MINUTES); - } - - return te; - } - - /** - * 淇濆瓨token - */ - public void saveToken(UserEntity ue, TokenEntity te, HttpServletRequest req, HttpServletResponse res) { - // 淇濆瓨鑷矯ookie - WebHelper.saveToken2Cookie(te.getToken(), req, res); - - // 浠ょ墝淇濆瓨鑷砇edis - String tokenKey = RedisCacheKey.signTokenKey(te.getToken()); - redisService.put(tokenKey, te, te.getDuration(), TimeUnit.MINUTES); - - String userKey = RedisCacheKey.signUserKey(te.getToken()); - ue.setBak(StringHelper.YMDHMS_FORMAT.format(new Date())); - redisService.put(userKey, ue, te.getDuration(), TimeUnit.MINUTES); - } - - /** - * 鑾峰彇褰撳墠鐢ㄦ埛 - */ - public UserEntity getCurrentUser(HttpServletRequest req) { - String token = WebHelper.getToken(req); - if (StringHelper.isNull(token)) { - return null; - } - - String userKey = RedisCacheKey.signUserKey(token); - - // redis - Object obj = redisService.get(userKey); - if (obj instanceof UserEntity) { - return (UserEntity) obj; - } - - // db - UserEntity ue = usersService.selectByToken(token); - if (ue != null) { - TokenEntity te = getEntityByToken(token); - if (te != null) { - redisService.put(userKey, ue, te.getDuration(), TimeUnit.MINUTES); - } - } - - return ue; - } - - /** - * 璁剧疆瀵嗙爜閿欒缂撳瓨 - */ - public void setPwdErrCache(UserEntity ue) { - String key = RedisCacheKey.signPwdError(ue.getUid()); - Object objCount = redisService.get(key); - - int count = objCount == null ? 1 : (int) objCount + 1; - redisService.put(key, count, SettingData.PWD_ERR_TIME, TimeUnit.MINUTES); - - // 璁板綍鏃ュ織 - HttpServletRequest req = WebHelper.getRequest(); - LoginEntity le = loginService.getNewLogin(ue.getId(), 1, 1, 0, req); - le.setDescr("瀵嗙爜涓嶆纭�"); - loginService.insertLogin(le); - - if (count >= SettingData.PWD_ERR_COUNT) { - String token = WebHelper.getToken(req); - HttpServletResponse res = WebHelper.getResponse(); - logout(token, req, res); - } - } - - /** - * 鐢ㄦ埛ID鏄�/鍚︾鐢� - */ - public boolean isUidDisable(UserEntity ue) { - String key = RedisCacheKey.signPwdError(ue.getUid()); - Object objCount = redisService.get(key); - - return objCount != null && (int) objCount >= SettingData.PWD_ERR_COUNT; - } -} diff --git a/src/main/java/com/lf/server/service/sys/UserService.java b/src/main/java/com/lf/server/service/sys/UserService.java deleted file mode 100644 index 2301bee..0000000 --- a/src/main/java/com/lf/server/service/sys/UserService.java +++ /dev/null @@ -1,303 +0,0 @@ -package com.lf.server.service.sys; - -import com.lf.server.entity.sys.RoleEntity; -import com.lf.server.entity.sys.UserEntity; -import com.lf.server.helper.Md5Helper; -import com.lf.server.helper.RsaHelper; -import com.lf.server.helper.StringHelper; -import com.lf.server.mapper.sys.UserMapper; -import com.lf.server.service.all.RedisService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 鐢ㄦ埛琛� - * @author sws - * @date 2022-09-27 - */ - -@Service -public class UserService implements UserMapper { - @Autowired - UserMapper userMapper; - - @Autowired - RedisService redisService; - - @Autowired - LoginService loginService; - - @Autowired - TokenService tokenService; - - private final static Log log = LogFactory.getLog(UserService.class); - - @Override - public Integer selectCount(String uname, String depcode) { - uname = StringHelper.getLikeUpperStr(uname); - depcode = StringHelper.getRightLike(depcode); - - return userMapper.selectCount(uname, depcode); - } - - @Override - public UserEntity selectUser(int id) { - return userMapper.selectUser(id); - } - - @Override - public UserEntity selectByUid(String uid) { - return userMapper.selectByUid(uid); - } - - @Override - public List<UserEntity> selectUserAll() { - return userMapper.selectUserAll(); - } - - @Override - public List<UserEntity> selectByPage(String uname, String depcode, Integer limit, Integer offset) { - uname = StringHelper.getLikeUpperStr(uname); - depcode = StringHelper.getRightLike(depcode); - - return userMapper.selectByPage(uname, depcode, limit, offset); - } - - @Override - public UserEntity selectByToken(String token) { - return userMapper.selectByToken(token); - } - - @Override - public Integer selectForIsAdmin(Integer id) { - return userMapper.selectForIsAdmin(id); - } - - @Override - public List<UserEntity> selectAdminUsers(Integer type) { - return userMapper.selectAdminUsers(type); - } - - @Override - public List<RoleEntity> selectRoleByUserId(Integer id) { - return userMapper.selectRoleByUserId(id); - } - - @Override - public List<UserEntity> selectUserByRoleId(Integer roleId) { - return userMapper.selectUserByRoleId(roleId); - } - - @Override - public Integer insertUser(UserEntity userEntity) { - return userMapper.insertUser(userEntity); - } - - @Override - public Integer insertUsers(List<UserEntity> userEntity) { - return userMapper.insertUsers(userEntity); - } - - @Override - public Integer deleteUser(int id) { - return userMapper.deleteUser(id); - } - - @Override - public Integer deleteUsers(List<Integer> ids) { - return userMapper.deleteUsers(ids); - } - - @Override - public Integer updateUser(UserEntity userEntity) { - return userMapper.updateUser(userEntity); - } - - @Override - public Integer selectCountForRole(String uname, Integer roleid, String depcode) { - uname = StringHelper.getLikeUpperStr(uname); - depcode = StringHelper.getRightLike(depcode); - - return userMapper.selectCountForRole(uname, roleid, depcode); - } - - @Override - public List<UserEntity> selectByPageForRole(String uname, Integer roleid, String depcode, Integer limit, Integer offset) { - uname = StringHelper.getLikeUpperStr(uname); - depcode = StringHelper.getRightLike(depcode); - - return userMapper.selectByPageForRole(uname, roleid, depcode, limit, offset); - } - - @Override - public Integer updateUsersPwd(Integer updateUser, String pwd, List<Integer> ids) { - return userMapper.updateUsersPwd(updateUser, pwd, ids); - } - - /** - * 楠岃瘉鐢ㄦ埛瀹炰綋绫� - */ - public String validateUserEntity(UserEntity entity) { - if (entity == null) { - return "娌℃湁鎵惧埌鐢ㄦ埛"; - } - if (StringHelper.isEmpty(entity.getUid())) { - return "鐢ㄦ埛ID涓嶈兘涓虹┖"; - } - if (StringHelper.isEmpty(entity.getPwd())) { - return "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖"; - } - - return null; - } - - /** - * 楠岃瘉鐧诲綍鐢ㄦ埛瀵嗙爜 - */ - public String validateLoginPwd(UserEntity entity) { - try { - String str = validateUserEntity(entity); - if (str != null) { - return str; - } - - // 瑙e瘑 - String uid = RsaHelper.decrypt(entity.getUid()); - String pwd = RsaHelper.decrypt(entity.getPwd()); - - entity.setUid(uid); - entity.setPwd(pwd); - - if (tokenService.isUidDisable(entity)) { - return "鐢ㄦ埛ID宸茬鐢�"; - } - - return null; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return "瑙e瘑澶辫触"; - } - } - - /** - * 楠岃瘉鏂扮敤鎴峰瘑鐮� - */ - @SuppressWarnings("AlibabaRemoveCommentedCode") - public String validateNewPwd(UserEntity entity) { - try { - String str = validateUserEntity(entity); - if (str != null) { - return str; - } - - // 瑙e瘑 - String uid = RsaHelper.decrypt(entity.getUid()); - /*String pwd = RsaHelper.decrypt(entity.getPwd()); - if (!StringHelper.isPwdValid(pwd)) { - return "瀵嗙爜涓嶇鍚堣姹�"; - } - - String newPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); - entity.setPwd(newPwd);*/ - entity.setUid(uid); - - return null; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return "瑙e瘑澶辫触"; - } - } - - /** - * 楠岃瘉鑰佺敤鎴峰瘑鐮� - */ - public String validateOldPwd(UserEntity entity) { - try { - String str = validateUserEntity(entity); - if (str != null) { - return str; - } - if (StringHelper.isEmpty(entity.getSalt())) { - return "鏂板瘑鐮佷笉鑳戒负绌�"; - } - - String uid = RsaHelper.decrypt(entity.getUid()); - String pwd = RsaHelper.decrypt(entity.getPwd()); - String salt = RsaHelper.decrypt(entity.getSalt()); - - UserEntity ue = selectByUid(uid); - if (ue == null) { - return "娌℃湁鎵惧埌鐢ㄦ埛"; - } - if (!Md5Helper.validatePassword(pwd, ue.getPwd())) { - tokenService.setPwdErrCache(ue); - return "鏃у瘑鐮佷笉姝g‘"; - } - if (StringHelper.isPwdInvalid(salt)) { - return "瀵嗙爜涓嶇鍚堣姹�"; - } - - String newPwd = Md5Helper.reverse(Md5Helper.generate(salt)); - entity.setPwd(newPwd); - entity.setSalt(null); - entity.setUid(uid); - - return null; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return "瑙e瘑澶辫触"; - } - } - - /** - * 楠岃瘉绠$悊鍛樺瘑鐮� - */ - public String validateAdminPwd(UserEntity ue, String adminPwd) { - if (ue == null) { - return "娌℃湁鐧诲綍鎴栬秴鏃�"; - } - if (StringHelper.isEmpty(adminPwd)) { - return "绠$悊鍛樺瘑鐮佷笉鑳戒负绌�"; - } - - try { - String pwd = RsaHelper.decrypt(adminPwd); - if (!Md5Helper.validatePassword(pwd, ue.getPwd())) { - tokenService.setPwdErrCache(ue); - return "绠$悊鍛樺瘑鐮佷笉姝g‘"; - } - - return null; - } catch (Exception ex) { - return "瑙e瘑澶辫触"; - } - } - - /** - * 楠岃瘉鏂板瘑鐮� - */ - public String validateNewPwd(UserEntity ue, String newPwd) { - if (StringHelper.isEmpty(newPwd)) { - return "鏂板瘑鐮佷笉鑳戒负绌�"; - } - - try { - String pwd = RsaHelper.decrypt(newPwd); - if (StringHelper.isPwdInvalid(pwd)) { - return "瀵嗙爜涓嶇鍚堣姹�"; - } - - String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); - ue.setSalt(dbPwd); - - return null; - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - return "瑙e瘑澶辫触"; - } - } -} diff --git a/src/main/java/com/moon/server/LfApplication.java b/src/main/java/com/moon/server/LfApplication.java new file mode 100644 index 0000000..9fa8e8e --- /dev/null +++ b/src/main/java/com/moon/server/LfApplication.java @@ -0,0 +1,27 @@ +package com.moon.server; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Land搴旂敤绋嬪簭 + * @author WWW + * 鎺掗櫎Security锛�, exclude = {SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class} + * + * jar -> war锛氱户鎵� SpringBootServletInitializer锛屽疄鐜� configure 鍑芥暟 + */ +@EnableSwagger2 +@SpringBootApplication(scanBasePackages = {"com.moon.server.*"}) +public class LfApplication extends SpringBootServletInitializer { + public static void main(String[] args) { + SpringApplication.run(LfApplication.class, args); + } + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder springApplicationBuilder) { + return springApplicationBuilder.sources(LfApplication.class); + } +} diff --git a/src/main/java/com/moon/server/annotation/ExcelHead.java b/src/main/java/com/moon/server/annotation/ExcelHead.java new file mode 100644 index 0000000..fcce53b --- /dev/null +++ b/src/main/java/com/moon/server/annotation/ExcelHead.java @@ -0,0 +1,25 @@ +package com.moon.server.annotation; + +import java.lang.annotation.*; + +/** + * Excel澶存敞瑙g被 + * @author WWW + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface ExcelHead { + /** + * Excel澶磋鏁� + * + * @return 澶磋鏁� + */ + int headRows() default 1; + + /** + * 鎺掗櫎鐨凷heet鍚嶇О锛堝涓敤閫楀彿闅斿紑锛� + * + * @return + */ + String excludeSheets() default ""; +} diff --git a/src/main/java/com/moon/server/annotation/SysLog.java b/src/main/java/com/moon/server/annotation/SysLog.java new file mode 100644 index 0000000..6bfb869 --- /dev/null +++ b/src/main/java/com/moon/server/annotation/SysLog.java @@ -0,0 +1,14 @@ +package com.moon.server.annotation; + +import java.lang.annotation.*; + +/** + * 绯荤粺鏃ュ織娉ㄨВ绫� + * @author WWW + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface SysLog { + String value() default ""; +} diff --git a/src/main/java/com/moon/server/aspect/LogAspect.java b/src/main/java/com/moon/server/aspect/LogAspect.java new file mode 100644 index 0000000..6eff335 --- /dev/null +++ b/src/main/java/com/moon/server/aspect/LogAspect.java @@ -0,0 +1,153 @@ +package com.moon.server.aspect; + +import com.moon.server.annotation.SysLog; +import com.moon.server.entity.sys.OperateEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.sys.OperateService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; + +/** + * 鏃ュ織鍒囬潰绫� + * @author WWW + */ +@Aspect +@Component +public class LogAspect { + @Autowired + private TokenService tokenService; + + @Autowired + private OperateService operateService; + + private final static String SELECT = "select"; + + private final static String INSERT = "insert"; + + private final static String UPDATE = "update"; + + private final static String DELETE = "delete"; + + private final static String UPLOAD = "upload"; + + private final static String DOWNLOAD = "download"; + + private final static String COUNT = "count"; + + private final static String SPLIT = "\\\\"; + + private static final Log log = LogFactory.getLog(LogAspect.class); + + @Pointcut("@annotation(com.moon.server.annotation.SysLog)") + public void logPointCut() { + // + } + + /** + * 鐜粫閫氱煡 @Around锛屼篃鍙互浣跨敤 @Before (鍓嶇疆閫氱煡) 鎴� @After (鍚庣疆閫氱煡) + */ + @Around("logPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + long beginTime = System.currentTimeMillis(); + + // 鎵ц鏂规硶 + Object result = point.proceed(); + + // 鎵ц鏃堕暱(姣) + long time = System.currentTimeMillis() - beginTime; + + // 淇濆瓨鏃ュ織 + saveLog(point, time); + + return result; + } + + /** + * 淇濆瓨鏃ュ織 + */ + private void saveLog(ProceedingJoinPoint joinPoint, long time) { + try { + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Class<?> clazz = joinPoint.getTarget().getClass(); + Method method = signature.getMethod(); + + HttpServletRequest req = WebHelper.getRequest(); + String url = req.getServletPath(); + + OperateEntity oe = new OperateEntity(); + oe.setIp(WebHelper.getIpAddress(req)); + oe.setUrl(url); + oe.setExec(time); + + // 璁剧疆妯″潡 + Api api = clazz.getAnnotation(Api.class); + if (api != null) { + String[] strs = api.tags()[0].split(SPLIT); + oe.setModular1(strs[0]); + oe.setModular2(strs[1]); + } + + // 璁剧疆绫诲悕\鏂规硶鍚嶃�佺被鍒� + oe.setClazz(clazz.getName() + "." + method.getName()); + oe.setType(getType(method.getName())); + + // 璁剧疆澶囨敞 + SysLog sysLog = method.getAnnotation(SysLog.class); + if (sysLog != null) { + oe.setBak(sysLog.value()); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + oe.setUserid(ue.getId()); + } + + operateService.insertOperate(oe); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 鑾峰彇鎿嶄綔绫诲瀷 + */ + private static int getType(String methodName) { + if (methodName.contains(SELECT)) { + return 1; + } + if (methodName.contains(INSERT)) { + return 2; + } + if (methodName.contains(UPDATE)) { + return 3; + } + if (methodName.contains(DELETE)) { + return 4; + } + if (methodName.contains(UPLOAD)) { + return 5; + } + if (methodName.contains(DOWNLOAD)) { + return 6; + } + // methodName.indexOf(COUNT) > -1 + if (methodName.contains(COUNT)) { + return 7; + } + + return 0; + } +} diff --git a/src/main/java/com/moon/server/config/InitConfig.java b/src/main/java/com/moon/server/config/InitConfig.java new file mode 100644 index 0000000..47224f6 --- /dev/null +++ b/src/main/java/com/moon/server/config/InitConfig.java @@ -0,0 +1,51 @@ +package com.moon.server.config; + +import com.moon.server.service.all.UploadAttachService; +import com.moon.server.service.sys.ArgsService; +import com.moon.server.helper.GdalHelper; +import com.moon.server.helper.PathHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +/** + * 鍒濆鍖栧畬鎴愰厤缃被 + * @author WWW + */ +@Component +public class InitConfig implements ApplicationRunner { + private final static Log log = LogFactory.getLog(InitConfig.class); + + @Autowired + PathHelper pathHelper; + + @Autowired + ArgsService argsService; + + @Autowired + Environment env; + + //@Autowired + //TestService testService; + + @Override + public void run(ApplicationArguments args) { + // noinspection AlibabaRemoveCommentedCode + try { + GdalHelper.init(env.getProperty("sys.gdal_path")); + UploadAttachService.init(env.getProperty("sys.attachTabs")); + + //testService.testRegister(); + pathHelper.init(); + argsService.initSettingData(); + + log.info("***************** 绯荤粺鍚姩瀹屾瘯 *****************" + "\n"); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } +} diff --git a/src/main/java/com/moon/server/config/MultipartFileUploadConfig.java b/src/main/java/com/moon/server/config/MultipartFileUploadConfig.java new file mode 100644 index 0000000..712a85e --- /dev/null +++ b/src/main/java/com/moon/server/config/MultipartFileUploadConfig.java @@ -0,0 +1,18 @@ +package com.moon.server.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; + +/** + * 澶氭枃浠朵笂浼犻厤缃� + * @author WWW + */ +@Configuration +public class MultipartFileUploadConfig { + @Bean + public MultipartResolver multipartResolver() { + return new StandardServletMultipartResolver(); + } +} diff --git a/src/main/java/com/moon/server/config/MybatisPlusConfig.java b/src/main/java/com/moon/server/config/MybatisPlusConfig.java new file mode 100644 index 0000000..fc75a31 --- /dev/null +++ b/src/main/java/com/moon/server/config/MybatisPlusConfig.java @@ -0,0 +1,52 @@ +package com.moon.server.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer; +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import com.moon.server.extend.CustomizedSqlInjector; +import org.apache.ibatis.type.JdbcType; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * Mybatis-Plus鍒嗛〉閰嶇疆 + * @author WWW + */ +@EnableTransactionManagement +@Configuration +@MapperScan("com.lf.server.mapper") +public class MybatisPlusConfig { + /** + * 鏂扮殑鍒嗛〉鎻掍欢,涓�缂撳拰浜岀紦閬靛惊mybatis鐨勮鍒�,闇�瑕佽缃� + * MybatisConfiguration#useDeprecatedExecutor = false + * 閬垮厤缂撳瓨鍑虹幇闂(璇ュ睘鎬т細鍦ㄦ棫鎻掍欢绉婚櫎鍚庝竴鍚岀Щ闄�) + */ + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL)); + return interceptor; + } + + @Bean + public ConfigurationCustomizer configurationCustomizer() { + return new ConfigurationCustomizer() { + @Override + public void customize(MybatisConfiguration configuration) { + configuration.setCacheEnabled(true); + configuration.setMapUnderscoreToCamelCase(true); + configuration.setCallSettersOnNulls(true); + configuration.setJdbcTypeForNull(JdbcType.NULL); + } + }; + } + + @Bean + public CustomizedSqlInjector customizedSqlInjector() { + return new CustomizedSqlInjector(); + } +} diff --git a/src/main/java/com/moon/server/config/PropertiesConfig.java b/src/main/java/com/moon/server/config/PropertiesConfig.java new file mode 100644 index 0000000..c43e9c0 --- /dev/null +++ b/src/main/java/com/moon/server/config/PropertiesConfig.java @@ -0,0 +1,54 @@ +package com.moon.server.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +/** + * 灞炴�ч厤缃被 + * @author WWW + */ +@Configuration +@SuppressWarnings("AlibabaCommentsMustBeJavadocFormat") +public class PropertiesConfig { + @Value("${sys.path.download}") + private String downloadPath; + + @Value("${sys.path.upload}") + private String uploadPath; + + @Value("${sys.path.temp}") + private String tempPath; + + // @Value("${spring.datasource.druid.stat-view-servlet.login-username}") + private String druidUser; + + // @Value("${spring.datasource.druid.stat-view-servlet.login-password}") + private String druidPwd; + + @Value("${sys.tile_path}") + private String tilePath; + + public String getDownloadPath() { + return downloadPath; + } + + public String getUploadPath() { + return uploadPath; + } + + public String getTempPath() { + return tempPath; + } + + public String getDruidUser() { + return druidUser; + } + + public String getDruidPwd() { + return druidPwd; + } + + public String getTilePath() { + return tilePath; + } +} diff --git a/src/main/java/com/moon/server/config/RedisConfig.java b/src/main/java/com/moon/server/config/RedisConfig.java new file mode 100644 index 0000000..afe1e4c --- /dev/null +++ b/src/main/java/com/moon/server/config/RedisConfig.java @@ -0,0 +1,94 @@ +package com.moon.server.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.cache.Cache; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.interceptor.CacheErrorHandler; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import java.util.HashMap; +import java.util.Map; + +/** + * Redis閰嶇疆绫� + * @author WWW + */ +@Configuration +@AutoConfigureAfter(RedisAutoConfiguration.class) +public class RedisConfig extends CachingConfigurerSupport { + /** + * 閰嶇疆鑷畾涔塺edisTemplate + */ + @SuppressWarnings("deprecation") + @Bean + public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { + RedisTemplate<String, Object> template = new RedisTemplate<>(); + template.setConnectionFactory(redisConnectionFactory); + + // 浣跨敤Jackson2JsonRedisSerializer鏉ュ簭鍒楀寲鍜屽弽搴忓垪鍖杛edis鐨剉alue鍊� + Jackson2JsonRedisSerializer<Object> serializer = new Jackson2JsonRedisSerializer<Object>(Object.class); + + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); + serializer.setObjectMapper(mapper); + + template.setValueSerializer(serializer); + + //浣跨敤StringRedisSerializer鏉ュ簭鍒楀寲鍜屽弽搴忓垪鍖杛edis鐨刱ey鍊� + template.setKeySerializer(new StringRedisSerializer()); + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(serializer); + template.afterPropertiesSet(); + + return template; + } + + @Bean + @Override + public CacheErrorHandler errorHandler() { + // 寮傚父澶勭悊锛屽綋Redis鍙戠敓寮傚父鏃讹紝鎵撳嵃鏃ュ織锛屼絾鏄▼搴忔甯歌蛋 + return new CacheErrorHandler() { + @Override + public void handleCacheGetError(RuntimeException e, Cache cache, Object key) { + Map<String, Object> error = new HashMap<String, Object>(3); + error.put("e", e); + error.put("cache", cache); + error.put("key", key); + } + + @Override + public void handleCachePutError(RuntimeException e, Cache cache, Object key, Object value) { + Map<String, Object> error = new HashMap<String, Object>(4); + error.put("e", e); + error.put("cache", cache); + error.put("key", key); + error.put("value", value); + } + + @Override + public void handleCacheEvictError(RuntimeException e, Cache cache, Object key) { + Map<String, Object> error = new HashMap<String, Object>(3); + error.put("e", e); + error.put("cache", cache); + error.put("key", key); + } + + @Override + public void handleCacheClearError(RuntimeException e, Cache cache) { + Map<String, Object> error = new HashMap<String, Object>(2); + error.put("e", e); + error.put("cache", cache); + } + }; + } +} diff --git a/src/main/java/com/moon/server/config/RestTemplateConfig.java b/src/main/java/com/moon/server/config/RestTemplateConfig.java new file mode 100644 index 0000000..bafce30 --- /dev/null +++ b/src/main/java/com/moon/server/config/RestTemplateConfig.java @@ -0,0 +1,100 @@ +package com.moon.server.config; + +import org.apache.http.client.HttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.web.client.RestTemplate; + +import java.nio.charset.StandardCharsets; +import java.util.List; + +/** + * Rest妯℃澘閰嶇疆绫� + * @author WWW + */ +@Configuration +@ConditionalOnClass(value = {RestTemplate.class, HttpClient.class}) +public class RestTemplateConfig { + /** + * 杩炴帴姹犵殑鏈�澶ц繛鎺ユ暟榛樿涓�0 + */ + @Value("${remote.maxTotalConnect:0}") + private int maxTotalConnect; + + /** + * 鍗曚釜涓绘満鐨勬渶澶ц繛鎺ユ暟 + */ + @Value("${remote.maxConnectPerRoute:1000}") + private int maxConnectPerRoute; + + /** + * 杩炴帴瓒呮椂榛樿5s + */ + @Value("${remote.connectTimeout:5000}") + private int connectTimeout; + + /** + * 璇诲彇瓒呮椂榛樿30s + */ + @Value("${remote.readTimeout:30000}") + private int readTimeout; + + /** + * 鍒涘缓HTTP瀹㈡埛绔伐鍘� + * + * @return 瀹㈡埛绔伐鍘� + */ + private ClientHttpRequestFactory createFactory() { + if (this.maxTotalConnect <= 0) { + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setConnectTimeout(this.connectTimeout); + factory.setReadTimeout(this.readTimeout); + return factory; + } + + HttpClient httpClient = HttpClientBuilder.create().setMaxConnTotal(this.maxTotalConnect).setMaxConnPerRoute(this.maxConnectPerRoute).build(); + + HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient); + factory.setConnectTimeout(this.connectTimeout); + factory.setReadTimeout(this.readTimeout); + + return factory; + } + + /** + * 鍒濆鍖朢estTemplate,骞跺姞鍏pring鐨凚ean宸ュ巶锛岀敱spring缁熶竴绠$悊 + * 蹇呴』鍔犳敞瑙LoadBalanced + * + * @return + */ + @Bean + @ConditionalOnMissingBean(RestTemplate.class) + public RestTemplate getRestTemplate() { + RestTemplate restTemplate = new RestTemplate(this.createFactory()); + List<HttpMessageConverter<?>> converterList = restTemplate.getMessageConverters(); + + // 閲嶆柊璁剧疆StringHttpMessageConverter瀛楃闆嗕负UTF-8锛岃В鍐充腑鏂囦贡鐮侀棶棰� + HttpMessageConverter<?> converterTarget = null; + for (HttpMessageConverter<?> item : converterList) { + if (StringHttpMessageConverter.class == item.getClass()) { + converterTarget = item; + break; + } + } + if (null != converterTarget) { + converterList.remove(converterTarget); + } + converterList.add(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); + + return restTemplate; + } +} diff --git a/src/main/java/com/moon/server/config/ScheduleConfig.java b/src/main/java/com/moon/server/config/ScheduleConfig.java new file mode 100644 index 0000000..4b67724 --- /dev/null +++ b/src/main/java/com/moon/server/config/ScheduleConfig.java @@ -0,0 +1,117 @@ +package com.moon.server.config; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.moon.server.entity.data.FmeLogEntity; +import com.moon.server.service.all.ScheduleService; +import com.moon.server.service.all.WebSocketService; +import com.moon.server.service.sys.AttachService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 鏃ョ▼閰嶇疆绫� + * @author WWW + */ +@Component +@EnableScheduling +public class ScheduleConfig { + @Autowired + AttachService attachService; + + @Autowired + ScheduleService scheduleService; + + private static boolean isBusy = false; + + private static final Log log = LogFactory.getLog(ScheduleConfig.class); + + @Scheduled(fixedRate = 15 * 1000) + public void pushMonitorInfo() { + try { + JSONObject jsonObject = new JSONObject(); + + // 鏌ヨCpu淇℃伅 + jsonObject.put("cpuInfo", scheduleService.selectCpuInfo()); + // 鏌ヨ鍐呭瓨淇℃伅 + jsonObject.put("memInfo", scheduleService.selectMemInfo()); + // 鏌ヨ鍦ㄧ嚎鐢ㄦ埛 + jsonObject.put("userInfo", scheduleService.selectOnlineUsers()); + + String json = JSONObject.toJSONStringWithDateFormat(jsonObject, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue); + + WebSocketService.broadCastInfo(json); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + @Scheduled(fixedRate = 30 * 1000) + public void checkSystemStatus() { + try { + JSONObject jsonObject = new JSONObject(); + + // 鏌ヨ鏈嶅姟璧勬簮鐘舵�� + jsonObject.put("resInfo", scheduleService.selectResStatus()); + + String json = JSONObject.toJSONStringWithDateFormat(jsonObject, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue); + + WebSocketService.broadCastInfo(json); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + @Scheduled(fixedRate = 30 * 1000) + public void countSystemStatus() { + // noinspection AlibabaRemoveCommentedCode + try { + JSONObject jsonObject = new JSONObject(); + + // 鏈嶅姟璧勬簮鐘舵�� sys_res + jsonObject.put("resUseCount", scheduleService.countResStatus()); + + // 鐢ㄦ埛鐧诲綍鐘舵�� sys_login + jsonObject.put("userLoginCount", scheduleService.userLoginCount()); + + // 璧勬簮鎿嶄綔鐘舵�� sys_operate + jsonObject.put("operateCount", scheduleService.operateCount()); + + // 璧勬簮璋冪敤鐘舵�� + String json = JSONObject.toJSONStringWithDateFormat(jsonObject, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue); + + WebSocketService.broadCastInfo(json); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 鍚屾闄勪欢 + */ + @Scheduled(fixedRate = 30 * 1000) + public void syncAttaches() { + try { + List<FmeLogEntity> list = attachService.selectFmeLogs(); + if (isBusy || null == list || list.isEmpty()) { + return; + } + + isBusy = true; + for (FmeLogEntity entity : list) { + attachService.syncAttaches(entity); + attachService.updateFmeLog(entity.getId()); + } + isBusy = false; + } catch (Exception ex) { + isBusy = false; + log.error(ex.getMessage(), ex); + } + } +} diff --git a/src/main/java/com/moon/server/config/SwaggerConfig.java b/src/main/java/com/moon/server/config/SwaggerConfig.java new file mode 100644 index 0000000..cf1889c --- /dev/null +++ b/src/main/java/com/moon/server/config/SwaggerConfig.java @@ -0,0 +1,66 @@ +package com.moon.server.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.*; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +/** + * Swagger閰嶇疆绫� + * @author www + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig { + private List<ApiKey> securitySchemes() { + List<ApiKey> apiKeys = new ArrayList<ApiKey>(); + apiKeys.add(new ApiKey("Authorization", "token", "header")); + + return apiKeys; + } + + private List<SecurityContext> securityContexts() { + List<SecurityContext> securityContexts = new ArrayList<>(); + securityContexts.add(SecurityContext.builder() + .securityReferences(defaultAuth()) + .forPaths(PathSelectors.regex("^(?!auth).*$")).build()); + + return securityContexts; + } + + private List<SecurityReference> defaultAuth() { + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + List<SecurityReference> securityReferences = new ArrayList<>(); + securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); + + return securityReferences; + } + + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()).select() + .apis(RequestHandlerSelectors.basePackage("com.lf.server.controller")) + //.securitySchemes(securitySchemes()) + //.securityContexts(securityContexts()) + .paths(PathSelectors.any()).build(); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("Spring Boot鎺ュ彛API") + .description("Spring Boot鎺ュ彛API鏌ョ湅") + .version("1.0").build(); + } +} diff --git a/src/main/java/com/moon/server/config/WebConfig.java b/src/main/java/com/moon/server/config/WebConfig.java new file mode 100644 index 0000000..fd4f0b3 --- /dev/null +++ b/src/main/java/com/moon/server/config/WebConfig.java @@ -0,0 +1,110 @@ +package com.moon.server.config; + +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.alibaba.fastjson.support.config.FastJsonConfig; +import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; +import com.moon.server.interceptor.AuthInterceptor; +import com.moon.server.service.all.SysService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.util.AntPathMatcher; +import org.springframework.web.servlet.config.annotation.*; + +import java.nio.charset.Charset; +import java.util.List; + +/** + * Web閰嶇疆绫� + * @author WWW + */ +@Configuration +public class WebConfig extends WebMvcConfigurationSupport { + @Autowired + private SysService sysService; + + @Override + public void addViewControllers(ViewControllerRegistry registry) { + // 璁剧疆璁块棶璺緞涓� 鈥�/鈥� 璺宠浆鍒版寚瀹氶〉闈� + registry.addViewController("/").setViewName("redirect:/sign/toIndex"); + // 璁剧疆涓烘渶楂樹紭鍏堢骇 + registry.setOrder(Ordered.HIGHEST_PRECEDENCE); + } + + /** + * 鑾峰彇鎷︽埅鍣ㄥ璞� + * + * @return + */ + public AuthInterceptor getAuthBean() { + return new AuthInterceptor(sysService); + } + + /** + * swagger鎺у埗 + */ + @Override + protected void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/**").addResourceLocations("classpath:/static/"); + super.addResourceHandlers(registry); + } + + /** + * 蹇界暐url鍦板潃澶у皬鍐� + */ + @Override + protected void configurePathMatch(PathMatchConfigurer configurer) { + AntPathMatcher matcher = new AntPathMatcher(); + matcher.setCaseSensitive(false); + + configurer.setPathMatcher(matcher); + } + + /** + * 璺ㄥ煙璇锋眰 + */ + @Override + protected void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowCredentials(true) + .allowedOrigins("*") + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") + .allowedHeaders("*") + .maxAge(3600); + } + + /** + * 娣诲姞缁熶竴鐨勬嫤鎴櫒 + */ + @Override + protected void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(getAuthBean()) + // .excludePathPatterns("/swagger", "/webjars/**", "/v2/**", "/sign/**") + .addPathPatterns("/**"); + super.addInterceptors(registry); + } + + /** + * 澶勭悊json鏍煎紡锛屽�糿ull鐨勮浆鎹负"" + */ + @Override + public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { + FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); + FastJsonConfig config = new FastJsonConfig(); + config.setSerializerFeatures( + SerializerFeature.WriteNullListAsEmpty, + SerializerFeature.WriteMapNullValue, + //SerializerFeature.WriteNullStringAsEmpty, + SerializerFeature.WriteNullNumberAsZero, + SerializerFeature.WriteNullBooleanAsFalse); + // 缁撴灉鏄惁鏍煎紡鍖�,榛樿涓篺alse + //SerializerFeature.PrettyFormat); + + converter.setFastJsonConfig(config); + converter.setDefaultCharset(Charset.forName("UTF-8")); + converters.add(converter); + } +} diff --git a/src/main/java/com/moon/server/config/WebSocketConfig.java b/src/main/java/com/moon/server/config/WebSocketConfig.java new file mode 100644 index 0000000..bd71a95 --- /dev/null +++ b/src/main/java/com/moon/server/config/WebSocketConfig.java @@ -0,0 +1,21 @@ +package com.moon.server.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; +import org.springframework.web.socket.server.standard.ServerEndpointExporter; + +/** + * WebSocket閰嶇疆绫� + * @author WWW + */ +@Component +public class WebSocketConfig { + /** + * 鑷姩娉ㄥ唽浣跨敤@ServerEndpoint + */ + @Bean + public ServerEndpointExporter serverEndpointExporter() { + return new ServerEndpointExporter(); + } +} diff --git a/src/main/java/com/moon/server/controller/all/BaseController.java b/src/main/java/com/moon/server/controller/all/BaseController.java new file mode 100644 index 0000000..5d1c9a0 --- /dev/null +++ b/src/main/java/com/moon/server/controller/all/BaseController.java @@ -0,0 +1,44 @@ +package com.moon.server.controller.all; + +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Controller鍩虹被 + * @author WWW + */ +public class BaseController { + public Log log = LogFactory.getLog(getClass()); + + public <T> ResponseMsg<T> success(T result) { + return new ResponseMsg<T>(HttpStatus.OK, result); + } + + public <T> ResponseMsg<T> success(String msg, T result) { + return new ResponseMsg<T>(HttpStatus.OK, msg, result); + } + + public <T> ResponseMsg<T> success(long count, T result) { + return new ResponseMsg<T>(HttpStatus.OK, count, result); + } + + public <T> ResponseMsg<T> success(String msg, long count, T result) { + return new ResponseMsg<T>(HttpStatus.OK, msg, count, result); + } + + public <T> ResponseMsg<T> fail(T result) { + return new ResponseMsg<T>(HttpStatus.ERROR, result); + } + + public <T> ResponseMsg<T> fail(String msg, T result) { + return new ResponseMsg<T>(HttpStatus.ERROR, msg, result); + } + + public <T> ResponseMsg<T> fail(Exception ex, T result) { + log.error(ex.getMessage(), ex); + + return new ResponseMsg<T>(HttpStatus.ERROR, ex.getMessage(), result); + } +} diff --git a/src/main/java/com/moon/server/controller/all/BaseQueryController.java b/src/main/java/com/moon/server/controller/all/BaseQueryController.java new file mode 100644 index 0000000..31f4206 --- /dev/null +++ b/src/main/java/com/moon/server/controller/all/BaseQueryController.java @@ -0,0 +1,776 @@ +package com.moon.server.controller.all; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.moon.server.annotation.SysLog; +import com.moon.server.entity.all.BaseGeoEntity; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.DownloadReqEntity; +import com.moon.server.entity.ctrl.IdNameEntity; +import com.moon.server.entity.ctrl.KeyValueEntity; +import com.moon.server.entity.ctrl.TabEntity; +import com.moon.server.entity.data.*; +import com.moon.server.entity.sys.AttachEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.AesHelper; +import com.moon.server.helper.ClassHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.mapper.all.GeomBaseMapper; +import com.moon.server.service.all.BaseQueryService; +import com.moon.server.service.data.DictService; +import com.moon.server.service.data.DirService; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.data.MetaService; +import com.moon.server.service.show.DataLibService; +import com.moon.server.service.sys.AttachService; +import com.moon.server.service.sys.DepService; +import com.moon.server.service.sys.DownlogService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + +/** + * 鐖舵煡璇㈡帶鍒跺櫒 + * @author WWW + */ +public class BaseQueryController extends BaseController { + @Autowired + AttachService attachService; + + @Autowired + TokenService tokenService; + + @Autowired + DepService depService; + + @Autowired + DirService dirService; + + @Autowired + MetaService metaService; + + @Autowired + DataLibService dataLibService; + + @Autowired + public DownlogService downlogService; + + @Autowired + public DownloadService downloadService; + + @Autowired + BaseQueryService baseQueryService; + + @Autowired + DictService dictService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), + @ApiImplicitParam(name = "filter", value = "杩囨护鏉′欢", dataType = "String", paramType = "query", example = "gid >= 50 and name like '鍘�' and objectid < 5000.0"), + @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = "gAPpDbZ53XfoQfvT8dj/uhBWX5os8kBJQ1LrNvH3VX7byFQdUJMPiEr8Fkj0q2i1pw+L8KFrvR0MLXq2xaO21nlQQXmEPofJxpDQZwEWUIFZsToXo1kLRD3t6WQezxWB8YTzXHM20Ba73x/ZuuezVhOFOq1U8HKf1dXQdv7gBzEB6fWMmFDc3FuH8GDDHv3LfT86Gio9VgMO6ohlrUdf3ZKtTHeLSuzGF4t0RZuX97YBNo25IIzpeTfRTXBxfdxA") + }) + @GetMapping(value = "/selectCount") + @PostMapping(value = "/selectCount") + public ResponseMsg<Long> selectCount(String name, String filter, String wkt) { + try { + BasicMapper baseMapper = ClassHelper.getBasicMapper(name); + if (baseMapper == null) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); + } + + QueryWrapper wrapper = new QueryWrapper(); + baseQueryService.addFilterWrapper(wrapper, filter); + baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt); + + long count = baseMapper.selectCount(wrapper); + + return success(count); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), + @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), + @ApiImplicitParam(name = "dirs", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00,01"), + @ApiImplicitParam(name = "filter", value = "杩囨护鏉′欢", dataType = "String", paramType = "query", example = "gid >= 50 and name like '鍘�' and objectid < 5000.0"), + @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = ""), + //@ApiImplicitParam(name = "srid", value = "绌洪棿寮曠敤鏍囪瘑绗�", dataType = "Integer", paramType = "query", example = "4326"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "hasGeom", value = "鏄�/鍚﹀寘鍚┖闂翠俊鎭�", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + @PostMapping(value = "/selectByPage") + public ResponseMsg<List<Object>> selectByPage(String name, String depcode, String dirs, String filter, String wkt, Integer pageIndex, Integer pageSize, Integer hasGeom) { + try { + BasicMapper baseMapper = ClassHelper.getBasicMapper(name); + if (null == baseMapper) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); + } + + QueryWrapper wrapper = new QueryWrapper(); + baseQueryService.addFilterWrapper(wrapper, filter); + baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt); + if (!StringHelper.isEmpty(depcode)) { + wrapper.likeRight("depid", depcode); + } + + dirs = DataLibService.copeCodes(dirs, "dirid"); + if (!StringHelper.isEmpty(dirs)) { + wrapper.apply(dirs); + } + + boolean hasWkt = null != hasGeom && hasGeom > 0 && baseMapper instanceof GeomBaseMapper; + if (hasWkt) { + wrapper.select("ST_AsText(geom) as geom, *"); + } + + Page<Object> page = new Page<>(pageIndex, pageSize); + page.addOrder(OrderItem.desc("gid")); + IPage<Object> paged = baseMapper.selectPage(page, wrapper); + if (hasWkt && null != paged.getRecords()) { + copeWkt(paged.getRecords()); + } + + return success(paged.getTotal(), paged.getRecords()); + } catch (Exception ex) { + return fail(ex, null); + } + } + + /** + * 澶勭悊WKT + */ + private void copeWkt(List<?> list) { + for (int i = 0, c = list.size(); i < c; i++) { + Object obj = list.get(i); + setWktEncrypt(obj); + } + } + + /** + * 璁剧疆WKT鍔犲瘑 + */ + private void setWktEncrypt(Object obj) { + if (obj instanceof BaseGeoEntity) { + BaseGeoEntity entity = (BaseGeoEntity) obj; + if (StringHelper.isEmpty(entity.getGeom())) { + return; + } + + try { + String wkt = AesHelper.encrypt(entity.getGeom()); + entity.setGeom(wkt); + } catch (Exception ex) { + entity.setGeom(null); + log.error(ex.getMessage(), ex); + } + } + } + + @SysLog() + @ApiOperation(value = "缂撳啿鍖烘煡璇�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), + @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "buffer", value = "缂撳啿鍖哄ぇ灏�", dataType = "Double", paramType = "query", example = "10"), + @ApiImplicitParam(name = "limit", value = "闄愬埗鏉℃暟", dataType = "Integer", paramType = "query", example = "20") + }) + @GetMapping(value = "/selectByBuffer") + public ResponseMsg<List<?>> selectByBuffer(String name, String wkt, Double buffer, Integer limit) { + try { + if (StringHelper.isEmpty(wkt)) { + return fail("WKT涓嶈兘涓虹┖", null); + } + if (null == limit || limit < 1 || limit > StaticData.ONE_HUNDRED) { + limit = 20; + } + if (null == buffer || buffer < 0 || buffer > StaticData.ONE_HUNDRED_THOUSAND) { + buffer = 10.0; + } + + GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(name); + if (baseMapper == null) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); + } + + QueryWrapper wrapper = new QueryWrapper(); + wrapper.select("ST_AsText(geom) as geom, *"); + baseQueryService.addBufferWrapper(baseMapper, wrapper, wkt, buffer); + wrapper.last("limit " + limit); + + List<?> list = baseMapper.selectList(wrapper); + + return success(null == list ? 0 : list.size(), list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐖禝D鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "metaid", value = "鐖禝D", dataType = "String", paramType = "query", example = "0"), + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectPageAndCountByPid") + public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + if (null == metaid || metaid < 1) { + return fail("鐖禝D涓嶈兘涓虹┖涓斿ぇ浜�1", null); + } + + int count = metaService.selectCountByPid(metaid, name); + if (count == 0) { + return success(0, null); + } + + List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨWKT") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), + @ApiImplicitParam(name = "gid", value = "GID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectWktById") + public ResponseMsg<String> selectWktById(String name, Integer gid) { + try { + GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(name); + if (null == baseMapper) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦ㄦ垨涓嶆槸绌洪棿琛�", null); + } + + String tab = BaseQueryService.getTabName(baseMapper); + if (StringHelper.isNull(tab)) { + return fail("鏌ヨ瀵硅薄鐨勮〃鍚嶄笉瀛樺湪", null); + } + + String wkt = baseMapper.selectWktById(tab, gid); + if (!StringHelper.isEmpty(wkt)) { + wkt = AesHelper.encrypt(wkt); + } + + return success(wkt); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁GID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), + @ApiImplicitParam(name = "gid", value = "GID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByGid") + public ResponseMsg<Object> selectByGid(String name, int gid) { + try { + BasicMapper baseMapper = ClassHelper.getBasicMapper(name); + if (null == baseMapper) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); + } + + QueryWrapper wrapper = new QueryWrapper(); + if (baseMapper instanceof GeomBaseMapper) { + wrapper.select("ST_AsText(geom) as geom, *"); + } + wrapper.eq("gid", gid); + + Object obj = baseMapper.selectOne(wrapper); + setWktEncrypt(obj); + + return success(null == obj ? 0 : 1, obj); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁瀹炰綋鍚嶆煡璇㈣〃鍚�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp") + }) + @GetMapping(value = "/selectTabByEntity") + public ResponseMsg<Object> selectTabByEntity(String name) { + try { + BasicMapper baseMapper = ClassHelper.getBasicMapper(name); + if (baseMapper == null) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); + } + + String tab = BaseQueryService.getTabName(baseMapper); + + return success(tab); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "妯$硦鎼滅储瀛楁") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"), + @ApiImplicitParam(name = "field", value = "瀛楁", dataType = "String", paramType = "query", example = "name"), + @ApiImplicitParam(name = "value", value = "鍊�", dataType = "String", paramType = "query", example = "'鍘�'") + }) + @GetMapping(value = "/selectFieldFuzzy") + public ResponseMsg<List<String>> selectFieldFuzzy(String name, String field, String value) { + try { + BasicMapper baseMapper = ClassHelper.getBasicMapper(name); + if (baseMapper == null) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); + } + + String tab = BaseQueryService.getTabName(baseMapper); + if (StringHelper.isNull(tab)) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); + } + if (StringHelper.isEmpty(field) || StringHelper.isSqlInjection(field)) { + return fail("鏌ヨ瀛楁涓嶆纭�", null); + } + + value = StringHelper.isEmpty(value) ? "%" : StringHelper.getLikeUpperStr(value); + List<String> rs = baseMapper.selectFieldFuzzy(tab, field, value); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "妯$硦鎼滅储鐢ㄦ埛") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "瀹�") + }) + @GetMapping(value = "/selectUserFuzzy") + public ResponseMsg<List<IdNameEntity>> selectUserFuzzy(String name) { + try { + List<IdNameEntity> rs = baseQueryService.selectUserFuzzy(name); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "妯$硦鎼滅储鍗曚綅") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍗曚綅鍚�", dataType = "String", paramType = "query", example = "鍙�") + }) + @GetMapping(value = "/selectDepFuzzy") + public ResponseMsg<List<IdNameEntity>> selectDepFuzzy(String name) { + try { + List<IdNameEntity> rs = baseQueryService.selectDepFuzzy(name); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈夎〃") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鐐�"), + @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false") + }) + @GetMapping(value = "/selectTabs") + public ResponseMsg<List<TabEntity>> selectTabs(String name, Boolean hasGeom) { + try { + List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom"); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁琛ㄥ悕鍒嗛〉鏌ヨ琛�") + @GetMapping(value = "/selectTabsByPage") + @ApiImplicitParams({ + @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), + @ApiImplicitParam(name = "dirs", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00,01"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_"), + @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + public ResponseMsg<Object> selectTabsByPage(String depcode, String dirs, String tab, Boolean hasGeom, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + if (StringHelper.isSqlInjection(depcode)) { + return fail("鍗曚綅浠g爜鍚湁闈炴硶瀛楃", null); + } + + String filters = "1=1"; + if (!StringHelper.isEmpty(depcode)) { + filters += String.format(" and depid like '%s%%'", depcode); + } + dirs = DataLibService.copeCodes(dirs, "dirid"); + if (dirs != null) { + filters += String.format(" and %s", dirs); + } + + String field = null == hasGeom || !hasGeom ? "gid" : "geom"; + int count = baseQueryService.selectTabsForCount(tab, field); + if (count == 0) { + return success(0, null); + } + + List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, field, filters, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ瀛楁淇℃伅") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlg25wAanp") + }) + @GetMapping(value = "/selectFields") + public ResponseMsg<List<DictEntity>> selectFields(String name) { + try { + BasicMapper baseMapper = ClassHelper.getBasicMapper(name); + if (baseMapper == null) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); + } + + String tabName = BaseQueryService.getTabName(baseMapper); + if (tabName == null) { + return null; + } + + String[] strs = tabName.split("\\."); + List<DictEntity> list = baseQueryService.selectFields(strs[0], strs[1]); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ瀛楁淇℃伅") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg25wAanp") + }) + @GetMapping(value = "/selectTabFields") + public ResponseMsg<List<DictEntity>> selectTabFields(String ns, String tab) { + try { + if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(tab)) { + return fail("鍚嶇О绌洪棿鍜岃〃鍚嶄笉鑳戒负绌�", null); + } + + List<DictEntity> list = baseQueryService.selectFields(ns, tab); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍊煎煙淇℃伅") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlg25wAanp") + }) + @GetMapping(value = "/selectDomains") + public ResponseMsg<List<DomainEntity>> selectDomains(String name) { + try { + BasicMapper baseMapper = ClassHelper.getBasicMapper(name); + if (baseMapper == null) { + return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null); + } + + String tabName = BaseQueryService.getTabName(baseMapper); + if (tabName == null) { + return null; + } + + String[] strs = tabName.split("\\."); + List<DomainEntity> list = baseQueryService.selectDomains(strs[0], strs[1]); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tabName", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "lf.sys_style"), + @ApiImplicitParam(name = "eventid", value = "涓婚敭", dataType = "String", paramType = "query", example = "fa25979a5ef8b43ba82a0be35b3fb0d4") + }) + @GetMapping(value = "/selectFiles") + public ResponseMsg<List<AttachEntity>> selectFiles(String tabName, String eventid) { + try { + if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) { + return fail("鍙傛暟涓嶈兘涓虹┖", null); + } + + List<AttachEntity> list = attachService.selectByTab(tabName, eventid); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deleteFiles(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int rows = attachService.deletes(ids); + + return success(rows); + } catch (Exception ex) { + return fail(ex, 0); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍏冩暟鎹腑婧㈠嚭鐨勫崟浣岻D") + @ApiImplicitParams({ + @ApiImplicitParam(name = "reqEntity", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/selectMetaOverflowDep") + public ResponseMsg<Object> selectMetaOverflowDep(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dr || null == dr.getIds() || dr.getIds().isEmpty()) { + return fail("璇烽�夋嫨瑕佷笅杞界殑鏂囦欢ID"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (StaticData.ADMIN.equals(ue.getUid())) { + return success(new ArrayList<String>()); + } + + List<String> list = metaService.selectMetaOverflowDep(ue, dr); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨDB涓孩鍑虹殑鍗曚綅ID") + @ApiImplicitParams({ + @ApiImplicitParam(name = "reqEntity", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/selectDbOverflowDep") + public ResponseMsg<Object> selectDbOverflowDep(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dr || null == dr.getEntities() || dr.getEntities().isEmpty()) { + return fail("璇烽�夋嫨瑕佷笅杞界殑瀹炰綋鍚�"); + } + if (!StringHelper.isEmpty(dr.getWkt())) { + dr.setWkt(AesHelper.decrypt(dr.getWkt())); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (StaticData.ADMIN.equals(ue.getUid())) { + return success(new ArrayList<String>()); + } + + List<String> list = dataLibService.selectDbOverflowDep(ue, dr); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鍗曚綅缂栫爜鏁扮粍鏌ヨ鍗曚綅") + @ApiImplicitParams({ + @ApiImplicitParam(name = "codes", value = "鍗曚綅缂栫爜鏁扮粍", dataType = "String", paramType = "query", allowMultiple = true, example = "00,0001") + }) + @GetMapping(value = "/selectDepsByCodes") + public ResponseMsg<Object> selectDepsByCodes(String[] codes) { + try { + if (null == codes || codes.length == 0) { + return fail("鍗曚綅ID闆嗗悎涓虹┖"); + } + + List<IdNameEntity> list = depService.selectDepsByCodes(codes); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇DB鏁版嵁") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dr", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/downloadDbData") + public ResponseMsg<Object> downloadDbData(@RequestBody DownloadReqEntity dr, HttpServletRequest req) { + try { + if (null == dr || null == dr.getEntities() || dr.getEntities().isEmpty()) { + return fail("璇烽�夋嫨瑕佷笅杞界殑瀹炰綋鍚�"); + } + if (StringHelper.isEmpty(dr.getPwd())) { + return fail("瀵嗙爜涓嶈兘涓虹┖"); + } + if (!DownloadService.decryptPwd(dr)) { + return fail("瀵嗙爜瑙e瘑澶辫触", null); + } + if (StringHelper.isPwdInvalid(dr.getPwd())) { + return fail("瀵嗙爜涓嶇鍚堣姹�"); + } + if (!StringHelper.isEmpty(dr.getWkt())) { + dr.setWkt(AesHelper.decrypt(dr.getWkt())); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String guid = dataLibService.downloadDbReq(ue, dr); + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ョ湅鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") + }) + @GetMapping(value = "/downloadForView") + public void downloadForView(String guid, HttpServletResponse res) { + metaService.downloadForView(guid, true, res); + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectPageCountForDownload") + public ResponseMsg<List<DownloadEntity>> selectPageCountForDownload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + int count = downloadService.selectCountForUser(ue.getId(), "3,4", name); + if (count == 0) { + return success(0, null); + } + List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), "3,4", name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鐩綍绫诲埆") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "D") + }) + @GetMapping(value = "/selectDirTypes") + public ResponseMsg<Object> selectDirTypes(String name) { + try { + List<KeyValueEntity> list = baseQueryService.selectDirTypes(name); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ椤圭洰鍚嶇О") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "瑗�") + }) + @GetMapping(value = "/selectProject") + public ResponseMsg<Object> selectProject(String name) { + try { + List<DirEntity> list = dirService.selectProject(name); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鍏冩暟鎹甀D鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectMetaById") + public ResponseMsg<MetaEntity> selectMetaById(int id) { + try { + MetaEntity entity = metaService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/moon/server/controller/all/CrdsController.java b/src/main/java/com/moon/server/controller/all/CrdsController.java new file mode 100644 index 0000000..3715bf9 --- /dev/null +++ b/src/main/java/com/moon/server/controller/all/CrdsController.java @@ -0,0 +1,164 @@ +package com.moon.server.controller.all; + +import com.moon.server.annotation.SysLog; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.data.DirEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.helper.HttpHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.data.DirService; +import com.moon.server.service.data.FmeService; +import com.moon.server.service.data.MetaService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * CRDS绯荤粺鎺ュ彛 + * @author WWW + */ +@Api(tags = "绯荤粺瀵规帴\\CRDS") +@RestController +@RequestMapping("/crds") +public class CrdsController extends BaseController { + @Autowired + DirService dirService; + + @Autowired + FmeService fmeService; + + @Autowired + MetaService metaService; + + @SysLog() + @ApiOperation(value = "鏌ヨ椤圭洰") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "瑗�") + }) + @GetMapping(value = "/selectProject") + public ResponseMsg<List<DirEntity>> selectProject(String name) { + try { + List<DirEntity> list = dirService.selectProject(name); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ椤圭洰鐩綍鏍�") + @GetMapping(value = "/selectDirsForPrj") + public ResponseMsg<List<DirEntity>> selectDirsForPrj() { + try { + List<DirEntity> list = dirService.selectDirsForPrj(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ浠诲姟鐘舵��") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") + }) + @GetMapping(value = "/selectTaskStatus") + public Object selectTaskStatus(String id, HttpServletRequest req) { + try { + if (StringHelper.isEmpty(id)) { + return fail("id涓嶈兘涓虹┖"); + } + + return fmeService.getTaskStatus(id, req); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "璇锋眰鎵撳寘") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dirCode", value = "鐩綍缂栫爜", dataType = "String", paramType = "01"), + @ApiImplicitParam(name = "major", value = "涓撲笟", dataType = "String", paramType = "绌胯法瓒�"), + @ApiImplicitParam(name = "isCut", value = "鏄惁瑁佸壀", dataType = "String", paramType = "NO") + }) + @GetMapping(value = "/uploadReqPackaging") + public ResponseMsg<Object> uploadReqPackaging(String dirCode, String major, String isCut, HttpServletRequest req) { + try { + boolean isMajor = StaticData.CROSSING.equals(major) || StaticData.ROUTE.equals(major); + if (!isMajor) { + return fail("涓撲笟鍙兘鏄�滅┛璺ㄨ秺鈥濇垨鈥滅嚎璺��"); + } + + boolean bCut = StaticData.YES.equals(isCut) || StaticData.NO.equals(isCut); + if (!bCut) { + return fail("鏄惁瑁佸壀鍙兘鏄�淵ES鈥濇垨鈥淣O鈥�"); + } + + if (StringHelper.isEmpty(dirCode)) { + return fail("鐩綍缂栫爜涓嶈兘涓虹┖"); + } + DirEntity dir = dirService.selectByCode(dirCode); + if (null == dir) { + return fail("鐩綍缂栫爜涓�" + dirCode + "鐨勭洰褰曚笉瀛樺湪"); + } + + String id = fmeService.crdsPackaging(dirCode, major, isCut, req); + + return success(id); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") + }) + @GetMapping(value = "/downloadFile") + public void downloadResult(String id, HttpServletRequest req, HttpServletResponse res) { + try { + if (!StringHelper.isEmpty(id)) { + String url = fmeService.getDownloadUrl(id, req); + + HttpHelper httpHelper = new HttpHelper(); + httpHelper.service(req, res, url, null); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐩綍缂栫爜鏌ヨ鍏冩暟鎹枃浠�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dircode", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "01") + }) + @GetMapping(value = "/selectMetasByDirCode") + public ResponseMsg<Object> selectMetasByDirCode(String dircode) { + try { + if (StringHelper.isEmpty(dircode)) { + return fail("鐩綍缂栫爜涓嶈兘涓虹┖"); + } + + List<MetaEntity> list = metaService.selectMetasByDirCode(dircode); + + return success(null == list ? 0 : list.size(), list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/all/FloatServerController.java b/src/main/java/com/moon/server/controller/all/FloatServerController.java new file mode 100644 index 0000000..b8475a7 --- /dev/null +++ b/src/main/java/com/moon/server/controller/all/FloatServerController.java @@ -0,0 +1,130 @@ +package com.moon.server.controller.all; + +import com.alibaba.fastjson.JSON; +import com.moon.server.entity.ctrl.SdkDecryptEntity; +import com.moon.server.entity.ctrl.SdkSecretEntity; +import com.moon.server.entity.other.FloatServerResponse; +import com.moon.server.entity.other.ReqParamFloatServer; +import com.moon.server.helper.HttpHelper; +import com.moon.server.helper.LicHelper; +import com.moon.server.helper.WebHelper; +import org.apache.http.HttpEntity; +import org.apache.http.entity.InputStreamEntity; +import org.apache.http.util.EntityUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * FloatServer + * @author WWW + */ +@RestController +@RequestMapping("/floatserver") +public class FloatServerController extends BaseController { + private static LicHelper licHelper; + + private final static boolean IS_REDIRECT = false; + + @PostMapping({"/checkout/license"}) + public void license(HttpServletRequest req, HttpServletResponse res) { + try { + if (IS_REDIRECT) { + HttpHelper httpHelper = new HttpHelper(); + httpHelper.service(req, res, "http://192.168.20.43:38080/floatserver/checkout/license", null); + return; + } + + HttpEntity entity = new InputStreamEntity(req.getInputStream(), getContentLength(req)); + String str = EntityUtils.toString(entity, "UTF-8"); + + LicHelper helper = getHelper(); + String reqJson = helper.b(str); + + ReqParamFloatServer rfs = JSON.parseObject(reqJson, ReqParamFloatServer.class); + FloatServerResponse fsr = new FloatServerResponse(rfs); + + String resJson = JSON.toJSONString(fsr); + String strRes = helper.a(resJson); + + res.getWriter().write(strRes); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + private Integer getContentLength(HttpServletRequest request) { + String contentLengthHeader = request.getHeader("Content-Length"); + if (contentLengthHeader != null) { + return Integer.parseInt(contentLengthHeader); + } + + return -1; + } + + private static LicHelper getHelper() { + if (licHelper == null) { + licHelper = new LicHelper(); + licHelper.d("&kdaow$IEW.##%5-"); + licHelper.c("*y91z72a;pclfleoqc20161v$DSP&%3+"); + } + + return licHelper; + } + + @SuppressWarnings("AlibabaUndefineMagicConstant") + private static String getClientIpAddr(HttpServletRequest req) { + String ip; + if ((ip = req.getHeader("x-forwarded-for")) == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = req.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = req.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = req.getRemoteAddr(); + } + + return ip; + } + + public static void test() { + try { + ReqParamFloatServer reqParam = new ReqParamFloatServer("192.168.20.106", "12316"); + String json = JSON.toJSONString(reqParam); + + String licCode = "78a82f0920de0f557f8177bec1e48601c4dc25e4054a00728e4314b56528d3a1632de5298edee38a65412277977a174fea5d91c452b19ef138dbc2ba089ba632"; + + LicHelper helper = getHelper(); + String str = helper.a(json); + System.out.println("ReqParamFloatServer: " + str); + + String data = "8dfb75298185cbcc4b2d485fdb4f25627f7aeb4dd41329076b5015586e4d56cfe2c56f12cd9852c447904210117b41fe2672b24d7e82fd581ad5a0983b501b5bcbe97d65dbbe770dbdc4a98e80d2966a71ecd0041a5282283bff853d70caf7aed671bc9c9d4bedf6d1d0294394861af40f195d68a965d957d53c78aa50ada3afc65d1a526c54648e6e081e8f7f7ab1c31b9f75916170e638b0b9216d30204864afe3a7a1bc8a6563bf44daf6a29e27c19f798c4f82dbb904ea4aa4fcc87a82226d9bf3e891ecb97b94263064fec025e3aa7c440d7c0e8ed559b84ae2438ec0fc438444a03c992883170ecdde20e08552efcf9d584de469930b27c81f946548d5c6e63e815671182b03b5e6e622ddb10a3f6a35ad3f44ec247a3b2dee0e936020d48efb7abc2d2abfb555f61d54c85eca"; + String rs = helper.b(data); + System.out.println("Lic: " + rs); + } catch (Exception ex) { + System.out.println(Arrays.toString(ex.getStackTrace())); + } + } + + @GetMapping({"/licenseEncryption/getLicenseSecret"}) + @PostMapping({"/licenseEncryption/getLicenseSecret"}) + public void getLicenseSecret(HttpServletResponse res) { + // http://127.0.0.1:12316/server/floatserver/licenseEncryption/getLicenseSecret + String json = JSON.toJSONString(new SdkSecretEntity()); + WebHelper.writeStr2Page(res, json); + } + + @GetMapping({"/licenseEncryption/getLicenseDecrypt"}) + @PostMapping({"/licenseEncryption/getLicenseDecrypt"}) + public void getLicenseDecrypt(HttpServletResponse res) { + // http://127.0.0.1:12316/server/floatserver/licenseEncryption/getLicenseDecrypt + String json = JSON.toJSONString(new SdkDecryptEntity()); + WebHelper.writeStr2Page(res, json); + } +} diff --git a/src/main/java/com/moon/server/controller/all/FmeItController.java b/src/main/java/com/moon/server/controller/all/FmeItController.java new file mode 100644 index 0000000..e0aaff7 --- /dev/null +++ b/src/main/java/com/moon/server/controller/all/FmeItController.java @@ -0,0 +1,290 @@ +package com.moon.server.controller.all; + +import com.moon.server.annotation.SysLog; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.data.DirEntity; +import com.moon.server.entity.sys.RoleEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.data.DirService; +import com.moon.server.service.sys.RoleService; +import com.moon.server.service.sys.TokenService; +import com.moon.server.service.sys.UserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * FME鎺ュ彛鎺у埗鍣� + * @author WWW + */ +@Api(tags = "绯荤粺瀵规帴\\FME") +@RestController +@RequestMapping("/fmeIt") +public class FmeItController extends BaseController { + @Autowired + UserService userService; + + @Autowired + RoleService roleService; + + @Autowired + TokenService tokenService; + + @Autowired + DirService dirService; + + @SysLog() + @ApiOperation(value = "鏌ヨ鏄�/鍚︿负绠$悊鍛�") + @GetMapping(value = "/selectForIsAdmin") + public ResponseMsg<Boolean> selectForIsAdmin(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", false); + } + + Integer rows = userService.selectForIsAdmin(ue.getId()); + + return success("鎴愬姛", rows > 0); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectUser") + public ResponseMsg<UserEntity> selectUser(int id) { + try { + UserEntity userEntity = userService.selectUser(id); + + return success(userEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐢ㄦ埛ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uid", value = "鐢ㄦ埛ID", dataType = "String", paramType = "query", example = "admin") + }) + @GetMapping(value = "/selectByUid") + public ResponseMsg<UserEntity> selectByUid(String uid) { + try { + if (StringHelper.isEmpty(uid)) { + fail("鐢ㄦ埛ID涓嶈兘涓虹┖", null); + } + + UserEntity userEntity = userService.selectByUid(uid); + + return success(userEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ鐢ㄦ埛骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "瀹�"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageForUser") + public ResponseMsg<List<UserEntity>> selectByPageForUser(String uname, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = userService.selectCount(uname, null); + if (count == 0) { + return success(0, null); + } + List<UserEntity> rs = userService.selectByPage(uname, null, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏄�/鍚︿负绠$悊鍛�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鐢ㄦ埛ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectIsAdmin") + public ResponseMsg<Boolean> selectIsAdmin(Integer id) { + try { + UserEntity ue = userService.selectUser(id); + if (ue == null) { + return fail("鐢ㄦ埛涓嶅瓨鍦�", false); + } + + Integer rows = userService.selectForIsAdmin(ue.getId()); + + return success("鎴愬姛", rows > 0); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ绠$悊鍛樼敤鎴�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "type", value = "绠$悊鍛樼被鍒�", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectAdminUsers") + public ResponseMsg<Object> selectAdminUsers(Integer type) { + try { + if (null == type || type < 1) { + return fail("绠$悊鍛樼被鍒笉鑳戒负绌烘垨灏忎簬1", false); + } + + List<UserEntity> rs = userService.selectAdminUsers(type); + + return success(rs); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鐢ㄦ埛ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectRoleByUserId") + public ResponseMsg<Object> selectRoleByUserId(Integer id) { + try { + if (null == id || id < 1) { + return fail("鐢ㄦ埛ID涓嶈兘涓虹┖鎴栧皬浜�1", false); + } + + List<RoleEntity> rs = userService.selectRoleByUserId(id); + + return success(rs); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁瑙掕壊鏌ヨ鐢ㄦ埛") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectUserByRoleId") + public ResponseMsg<Object> selectUserByRoleId(Integer id) { + try { + if (null == id || id < 1) { + return fail("鐢ㄦ埛ID涓嶈兘涓虹┖鎴栧皬浜�1", false); + } + + List<UserEntity> rs = userService.selectUserByRoleId(id); + + return success(rs); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectRole") + public ResponseMsg<RoleEntity> selectRole(int id) { + try { + RoleEntity roleEntity = roleService.selectRole(id); + + return success(roleEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ瑙掕壊骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "Admin"), + @ApiImplicitParam(name = "depid", value = "鍗曚綅ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageForRole") + public ResponseMsg<List<RoleEntity>> selectByPageForRole(String name, Integer depid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = roleService.selectCount(name, depid); + if (count == 0) { + return success(0, null); + } + + List<RoleEntity> rs = roleService.selectByPage(name, depid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏍圭洰褰�") + @GetMapping(value = "/selectDirRoot") + public ResponseMsg<List<DirEntity>> selectDirRoot() { + try { + List<DirEntity> list = dirService.selectDirRoot(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ椤圭洰") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "瑗�") + }) + @GetMapping(value = "/selectProject") + public ResponseMsg<List<DirEntity>> selectProject(String name) { + try { + List<DirEntity> list = dirService.selectProject(name); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ椤圭洰鐩綍鏍�") + @GetMapping(value = "/selectDirsForPrj") + public ResponseMsg<List<DirEntity>> selectDirsForPrj() { + try { + List<DirEntity> list = dirService.selectDirsForPrj(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/all/PermsController.java b/src/main/java/com/moon/server/controller/all/PermsController.java new file mode 100644 index 0000000..f4b7d4b --- /dev/null +++ b/src/main/java/com/moon/server/controller/all/PermsController.java @@ -0,0 +1,188 @@ +package com.moon.server.controller.all; + +import com.moon.server.annotation.SysLog; +import com.moon.server.entity.data.LayerEntity; +import com.moon.server.entity.sys.MenuEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.PermsService; +import com.moon.server.service.data.LayerService; +import com.moon.server.service.sys.MenuService; +import com.moon.server.service.sys.TokenService; +import com.moon.server.entity.all.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鎺堟潈鎺у埗鍣� + * @author WWW + */ +@Api(tags = "杩愮淮绠$悊\\鎺堟潈绠$悊") +@RestController +@RequestMapping("/perms") +public class PermsController extends BaseController { + @Autowired + PermsService permsService; + + @Autowired + TokenService tokenService; + + @Autowired + MenuService menuService; + + @Autowired + LayerService layerService; + + @SysLog() + @ApiOperation(value = "鏌ヨ褰撳墠鐢ㄦ埛鐨勮祫婧愭巿鏉�") + @GetMapping(value = "/selectRes") + public ResponseMsg<List<ResAuthEntity>> selectRes(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); + List<ResAuthEntity> rs = permsService.selectRes(uid); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ褰撳墠鐢ㄦ埛鐨勮彍鍗曟巿鏉�") + @GetMapping(value = "/selectMenus") + public ResponseMsg<List<MenusAuthEntity>> selectMenus(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); + List<MenusAuthEntity> rs = permsService.selectMenus(uid); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ褰撳墠鐢ㄦ埛鐨勬潈闄愭巿鏉�") + @GetMapping(value = "/selectPerms") + public ResponseMsg<List<String>> selectPerms(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); + List<String> rs = permsService.selectPerms(uid); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ褰撳墠鐢ㄦ埛鐨勬潈闄愭巿鏉冨疄浣撻泦鍚�") + @GetMapping(value = "/selectPermsEntity") + public ResponseMsg<List<PermsAuthEntity>> selectPermsEntity(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); + List<PermsAuthEntity> rs = permsService.selectPermsEntity(uid); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "娓呯┖鎵�鏈夋巿鏉冪紦瀛�") + @GetMapping(value = "/deleteAllCache") + public ResponseMsg<Boolean> deleteAllCache() { + try { + permsService.clearAllCache(); + + return success(true); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鐢ㄦ埛瑙掕壊") + @GetMapping("/selectRoles") + public ResponseMsg<Object> selectRoles(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + List<Integer> list = permsService.selectRoles(ue.getUid()); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "閫掑綊鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = "14") + }) + @GetMapping(value = "/selectMenuRecursive") + public ResponseMsg<Object> selectMenuRecursive(int id, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); + List<MenuEntity> list = permsService.selectMenuRecursive(id, uid); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈夊浘灞�") + @GetMapping(value = "/selectLayers") + public ResponseMsg<Object> selectLayers(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + List<LayerEntity> list = layerService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/all/SignController.java b/src/main/java/com/moon/server/controller/all/SignController.java new file mode 100644 index 0000000..9f4e9b5 --- /dev/null +++ b/src/main/java/com/moon/server/controller/all/SignController.java @@ -0,0 +1,265 @@ +package com.moon.server.controller.all; + +import com.moon.server.annotation.SysLog; +import com.moon.server.config.PropertiesConfig; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.SettingData; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.sys.LoginEntity; +import com.moon.server.entity.sys.OperateEntity; +import com.moon.server.entity.sys.TokenEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.ScheduleService; +import com.moon.server.service.sys.LoginService; +import com.moon.server.service.sys.OperateService; +import com.moon.server.service.sys.TokenService; +import com.moon.server.service.sys.UserService; +import com.moon.server.service.all.SignService; +import com.moon.server.helper.Md5Helper; +import com.moon.server.helper.RsaHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * 绛惧悕鎺у埗鍣� + * @author WWW + * @date 2022-09-21 + */ +@Api(tags = "杩愮淮绠$悊\\绛惧悕绠$悊") +@RestController +@RequestMapping("/sign") +public class SignController extends BaseController { + @Autowired + UserService userService; + + @Autowired + LoginService loginService; + + @Autowired + TokenService tokenService; + + @Autowired + SignService signService; + + @Autowired + private OperateService operateService; + + @Autowired + PropertiesConfig propertiesConfig; + + @Autowired + private ScheduleService scheduleService; + + @SysLog() + @ApiOperation(value = "璺宠浆棣栭〉") + @GetMapping({"/", "/toIndex"}) + public ModelAndView toIndex(ModelAndView mv, HttpServletRequest req) { + mv.setViewName("index"); + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + mv.addObject("msg", "Hello " + ue.getUname() + " !"); + } + + return mv; + } + + @SysLog() + @ApiOperation(value = "璺宠浆鐧诲綍椤�") + @GetMapping("/toLogin") + public ModelAndView toLogin(ModelAndView mv) { + mv.setViewName("login"); + + return mv; + } + + @SysLog() + @ApiOperation(value = "鏁版嵁搴撶洃鎺�") + @GetMapping(value = "/toDruid") + public ModelAndView toDruid(HttpServletRequest req, HttpServletResponse res) { + ModelAndView mv = new ModelAndView(); + mv.setViewName("druid"); + + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + String sessionId = WebHelper.getCookieByKey(StaticData.DRUID_COOKIE_KEY, req); + if (StringHelper.isNull(sessionId)) { + signService.loginDruid(req, res); + } + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + + return mv; + } + + @SysLog() + @ApiOperation(value = "璧勬簮鐩戞帶") + @GetMapping(value = "/toMonitor") + public ModelAndView toMonitor(ModelAndView mv, HttpServletRequest req, HttpServletResponse res) { + try { + mv.setViewName("redirect:/toLogin"); + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + mv.setViewName("monitor"); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + + return mv; + } + + @SysLog() + @ApiOperation(value = "鐧诲綍") + @ApiImplicitParams({ + @ApiImplicitParam(name = "user", value = "鐢ㄦ埗鍚�", dataType = "UsersEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/login", produces = "application/json; charset=UTF-8") + public ResponseMsg<TokenEntity> login(@RequestBody UserEntity user, HttpServletRequest req, HttpServletResponse res) { + try { + String str = userService.validateLoginPwd(user); + if (str != null) { + return fail(str, null); + } + + UserEntity ue = userService.selectByUid(user.getUid()); + if (ue == null) { + return fail("鐢ㄦ埛鍚嶄笉瀛樺湪", null); + } + + if (!Md5Helper.validatePassword(user.getPwd(), ue.getPwd())) { + tokenService.setPwdErrCache(ue); + return fail("瀵嗙爜涓嶆纭�", null); + } + + LoginEntity le = loginService.getNewLogin(ue.getId(), 1, 1, 1, req); + Integer rows = loginService.insertLogin(le); + if (rows == 0) { + return fail("鍒涘缓鐧诲綍鏃ュ織澶辫触", null); + } + + TokenEntity te = tokenService.getNewToken(ue, req); + rows = tokenService.insertToken(te); + if (rows == 0) { + return fail("鍒涘缓浠ょ墝澶辫触", null); + } + + te.setAutoLogOut(SettingData.AUTO_LOGOUT); + tokenService.saveToken(ue, te, req, res); + + int onlineUser = scheduleService.countOnlineUsers(); + String msg = onlineUser >= SettingData.MAX_USER_LOGIN ? "璀﹀憡锛氱郴缁熷凡缁忓埌杈剧敤鎴疯闂噺鐨勪笂闄愶紒" : ""; + + return success(msg, te); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鐧诲嚭") + @GetMapping(value = "/logout") + public ResponseMsg<Boolean> logout(HttpServletRequest req, HttpServletResponse res) { + try { + String token = WebHelper.getToken(req); + if (StringHelper.isEmpty(token)) { + return fail("娌℃湁妫�娴嬪埌浠ょ墝", false); + } + + Boolean flag = tokenService.logout(token, req, res); + + return success(flag ? "鐧诲嚭鎴愬姛" : "鐧诲嚭澶辫触", flag); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "妫�鏌ユ槸/鍚︾櫥褰�") + @GetMapping("/check") + public ResponseMsg<Boolean> check(HttpServletRequest req, HttpServletResponse res) { + try { + Boolean flag = tokenService.isLogin(req, res); + if (flag) { + // 鍐欐棩蹇� + UserEntity ue = tokenService.getCurrentUser(req); + LoginEntity le = loginService.getNewLogin(ue.getId(), 1, 2, 1, req); + Integer rows = loginService.insertLogin(le); + } + + return success(flag ? "鐢ㄦ埛宸茬櫥褰�" : "鐢ㄦ埛鏈櫥褰�", flag); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鑾峰彇褰撳墠鐢ㄦ埛") + @GetMapping("/getCurrentUser") + public ResponseMsg<UserEntity> getCurrentUser(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("娌℃湁鎵惧埌", null); + } + + return success(ue); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鑾峰彇RSA鍔犲瘑鍏挜") + @GetMapping("/getPublicKey") + public ResponseMsg<String> getPublicKey() { + try { + String key = RsaHelper.getPublicKey(); + + return success(key); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @ApiOperation(value = "鎻掑叆鎿嶄綔鏃ュ織") + @GetMapping("/insertOpLog") + public ResponseMsg<Object> insertOpLog(String m1, String m2, HttpServletRequest req) { + try { + if (StringHelper.isEmpty(m1)) { + return fail("涓�绾фā鍧楀繀濉�", 0); + } + + OperateEntity oe = new OperateEntity(); + oe.setIp(WebHelper.getIpAddress(req)); + oe.setModular1(m1); + oe.setModular2(m2); + oe.setType(0); + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + oe.setUserid(ue.getId()); + } + + int rows = operateService.insertOperate(oe); + + return success(rows); + } catch (Exception ex) { + return fail(ex, 0); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/DataCountController.java b/src/main/java/com/moon/server/controller/data/DataCountController.java new file mode 100644 index 0000000..220a787 --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/DataCountController.java @@ -0,0 +1,132 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.ctrl.CountEntity; +import com.moon.server.entity.sys.ReportEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.all.UploadAttachService; +import com.moon.server.service.sys.ReportService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 鏁版嵁缁熻 + * @author WWW + */ +@Api(tags = "鏁版嵁绠$悊\\鏁版嵁缁熻") +@RestController +@RequestMapping("/dataCount") +public class DataCountController extends BaseController { + @Autowired + ReportService reportService; + + @Autowired + TokenService tokenService; + + @Autowired + UploadAttachService uploadAttachService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "code", value = "缂栫爜", dataType = "String", paramType = "query", example = "countOperates"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<ReportEntity>> selectByPageAndCount(String name, String code, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = reportService.selectCount(name, code); + if (count == 0) { + return success(0, null); + } + + List<ReportEntity> rs = reportService.selectByPage(name, code, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏁版嵁閲忕粺璁�") + @GetMapping(value = "/selectCountSizes") + public ResponseMsg<Object> selectCountSizes() { + try { + List<CountEntity> list = reportService.countSizes(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏈嶅姟璋冪敤閲忕粺璁�") + @GetMapping(value = "/selectCountServices") + public ResponseMsg<Object> selectCountServices() { + try { + List<CountEntity> list = reportService.countServices(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鐢ㄦ埛娴侀噺缁熻") + @GetMapping(value = "/selectCountOperates") + public ResponseMsg<Object> selectCountOperates() { + try { + List<CountEntity> list = reportService.countOperates(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鎶ュ憡") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鎶ュ憡ID", dataType = "Integer", paramType = "7") + }) + @GetMapping(value = "/downloadReport") + public void downloadReport(Integer id, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == id || id < 1) { + return; + } + + ReportEntity re = reportService.selectById(id); + if (null == re || StringHelper.isEmpty(re.getGuid()) || StringHelper.isEmpty(re.getType()) || StringHelper.isEmpty(re.getCode())) { + return; + } + + UserEntity ue = tokenService.getCurrentUser(req); + + reportService.createReport(ue, re, res); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/DataQueryController.java b/src/main/java/com/moon/server/controller/data/DataQueryController.java new file mode 100644 index 0000000..7db52cc --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/DataQueryController.java @@ -0,0 +1,59 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseQueryController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.data.DataQueryService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; + +/** + * 鏁版嵁妫�绱� + * @author WWW + */ +@Api(tags = "鏁版嵁绠$悊\\鏁版嵁鏌ヨ") +@RestController +@RequestMapping("/dataQuery") +public class DataQueryController extends BaseQueryController { + @Autowired + TokenService tokenService; + + @Autowired + DataQueryService dataQueryService; + + @SysLog() + @ApiOperation(value = "涓婁紶鏂囦欢") + @ResponseBody + @ApiImplicitParams({ + @ApiImplicitParam(name = "tabName", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "lf.sys_style"), + @ApiImplicitParam(name = "eventid", value = "涓婚敭", dataType = "String", paramType = "query", example = "fa25979a5ef8b43ba82a0be35b3fb0d4") + }) + @PostMapping(value = "/uploadFiles") + public ResponseMsg<Integer> uploadFiles(String tabName, String eventid, @RequestParam("file") MultipartFile[] files, HttpServletRequest req) { + try { + if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) { + return fail("鍙傛暟涓嶈兘涓虹┖", null); + } + if (null == files || files.length == 0) { + return fail("鏂囦欢涓婁紶涓虹┖", 0); + } + + UserEntity ue = tokenService.getCurrentUser(req); + Integer count = dataQueryService.uploadFiles(ue, tabName, eventid, files, req); + + return success(count); + } catch (Exception ex) { + return fail(ex, 0); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/DictController.java b/src/main/java/com/moon/server/controller/data/DictController.java new file mode 100644 index 0000000..c15271d --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/DictController.java @@ -0,0 +1,261 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.ctrl.TabEntity; +import com.moon.server.entity.data.DictEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.data.DictService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 瀛楀吀绠$悊 + * @author WWW + */ +@Api(tags = "鏁版嵁绠$悊\\瀛楀吀绠$悊") +@RestController +@RequestMapping("/dict") +public class DictController extends BaseController { + @Autowired + DictService dictService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "琛ㄧ┖闂�", dataType = "String", paramType = "query", required = false, example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_hyda") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String ns, String tab) { + try { + int count = dictService.selectCount(ns, tab); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "琛ㄧ┖闂�", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_hyda"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<DictEntity>> selectByPage(String ns, String tab, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<DictEntity> rs = dictService.selectByPage(ns, tab, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "琛ㄧ┖闂�", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_hyda"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<DictEntity>> selectByPageAndCount(String ns, String tab, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = dictService.selectCount(ns, tab); + if (count == 0) { + return success(0, null); + } + + List<DictEntity> rs = dictService.selectByPage(ns, tab, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<DictEntity> selectById(int id) { + try { + DictEntity entity = dictService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ瀛楀吀琛ㄧ粨鏋�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鐐�"), + @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false") + }) + @GetMapping(value = "/selectDictTab") + public ResponseMsg<List<TabEntity>> selectDictTab(String name, Boolean hasGeom) { + try { + List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom"); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DictEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody DictEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = dictService.insert(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DictEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<DictEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (DictEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = dictService.inserts(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = dictService.delete(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = dictService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DictEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody DictEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = dictService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DictEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<DictEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (DictEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = dictService.updates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/DirController.java b/src/main/java/com/moon/server/controller/data/DirController.java new file mode 100644 index 0000000..5e8051c --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/DirController.java @@ -0,0 +1,212 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.data.DirEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.data.DirService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 鐩綍绠$悊 + * @author sws + * @date 2022-09-22 + */ +@Api(tags = "鏁版嵁绠$悊\\鐩綍绠$悊") +@RestController +@RequestMapping("/dir") +public class DirController extends BaseController { + @Autowired + DirService dirService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.data.DirEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertDir", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertDir(@RequestBody DirEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + dirService.insert(entity); + + return success(entity.getId()); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "com.lf.server.entity.data.DirEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertDirs", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertDirs(@RequestBody List<DirEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + for (DirEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + + int count = dirService.inserts(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteDir") + public ResponseMsg<Integer> deleteDir(int id) { + try { + int count = dirService.deleteDir(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "com.lf.server.entity.data.DirEntity", paramType = "body", example = "") + }) + @GetMapping(value = "/deleteDirs") + public ResponseMsg<Integer> deleteDirs(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = dirService.deleteDirs(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DictEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateDir", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateDir(@RequestBody DirEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = dirService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DirEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateDirs", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateDirs(@RequestBody List<DirEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (DirEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = dirService.updates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ鏁版嵁") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectDir") + public ResponseMsg<DirEntity> selectDir(int id) { + try { + DirEntity dirEntity = dirService.selectDir(id); + + return success(dirEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") + @GetMapping(value = "/selectDirAll") + public ResponseMsg<List<DirEntity>> selectDirAll() { + try { + List<DirEntity> list = dirService.selectDirAll(); + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鐩綍缁撴瀯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鐩綍ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/downloadDir") + public void downloadDir(int id, HttpServletResponse res) { + try { + DirEntity entity = dirService.selectDir(id); + if (null == entity || entity.getPid() > 0) { + return; + } + + String zipFile = dirService.createDirs(id); + if (null == zipFile) { + return; + } + + WebHelper.download(zipFile, entity.getName() + ".zip", res); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/DomainController.java b/src/main/java/com/moon/server/controller/data/DomainController.java new file mode 100644 index 0000000..6b2720e --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/DomainController.java @@ -0,0 +1,307 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.ctrl.TabEntity; +import com.moon.server.entity.data.DomainEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.all.BaseQueryService; +import com.moon.server.service.data.DictService; +import com.moon.server.service.data.DomainService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鍊煎煙 + * @author WWW + */ +@Api(tags = "鏁版嵁绠$悊\\鍊煎煙") +@RestController +@RequestMapping("/domain") +public class DomainController extends BaseController { + @Autowired + DomainService domainService; + + @Autowired + TokenService tokenService; + + @Autowired + BaseQueryService baseQueryService; + + @Autowired + DictService dictService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_aanp"), + @ApiImplicitParam(name = "code", value = "缂栫爜", dataType = "String", paramType = "query", example = "210") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String ns, String tab, String code) { + try { + int count = domainService.selectCount(ns, tab, code); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_25w_aanp"), + @ApiImplicitParam(name = "code", value = "缂栫爜", dataType = "String", paramType = "query", example = "210"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<DomainEntity>> selectByPage(String ns, String tab, String code, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<DomainEntity> rs = domainService.selectByPage(ns, tab, code, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "b_hy20w_s23"), + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "绛夌骇"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<DomainEntity>> selectByPageAndCount(String ns, String tab, String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = domainService.selectCount(ns, tab, name); + if (count == 0) { + return success(0, null); + } + + List<DomainEntity> rs = domainService.selectByPage(ns, tab, name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAll") + public ResponseMsg<List<DomainEntity>> selectAll() { + try { + List<DomainEntity> list = domainService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍊煎煙琛ㄩ泦鍚�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "b_"), + @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false") + }) + @GetMapping(value = "/selectDomainTabs") + public ResponseMsg<List<TabEntity>> selectDomainTabs(String name, Boolean hasGeom) { + try { + List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom"); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁琛ㄥ悕鏌ヨ鍊煎煙鍚嶇О") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "b_hy20w_s23") + }) + @GetMapping(value = "/selectDomainNames") + public ResponseMsg<List<String>> selectDomainNames(String ns, String tab) { + try { + if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(tab)) { + return fail("鍚嶇О绌洪棿鍜岃〃鍚嶄笉鑳戒负绌�", null); + } + + List<String> list = domainService.selectDomainNames(ns, tab); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<DomainEntity> selectById(int id) { + try { + DomainEntity entity = domainService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DomainEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody DomainEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = domainService.insert(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DomainEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<DomainEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (DomainEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = domainService.inserts(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = domainService.delete(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = domainService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DomainEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody DomainEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = domainService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DomainEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<DomainEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (DomainEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = domainService.updates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/LayerController.java b/src/main/java/com/moon/server/controller/data/LayerController.java new file mode 100644 index 0000000..a1869d2 --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/LayerController.java @@ -0,0 +1,253 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.data.LayerEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.data.LayerService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鍥惧眰绠$悊 + * @author WWW + */ +@Api(tags = "鏁版嵁绠$悊\\鍥惧眰绠$悊") +@RestController +@RequestMapping("/layer") +public class LayerController extends BaseController { + @Autowired + LayerService layerService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "cnName", value = "涓枃鍚嶇О", dataType = "String", paramType = "query", required = false, example = "") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String cnName) { + try { + int count = layerService.selectCount(cnName); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "cnName", value = "涓枃鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<LayerEntity>> selectByPage(String cnName, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<LayerEntity> rs = layerService.selectByPage(cnName, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "cnName", value = "涓枃鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<LayerEntity>> selectByPageAndCount(String cnName, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = layerService.selectCount(cnName); + if (count == 0) { + return success(0, null); + } + + List<LayerEntity> rs = layerService.selectByPage(cnName, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAll") + public ResponseMsg<List<LayerEntity>> selectAll() { + try { + List<LayerEntity> list = layerService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<LayerEntity> selectById(int id) { + try { + LayerEntity entity = layerService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "LayerEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody LayerEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = layerService.insert(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "LayerEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<LayerEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (LayerEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = layerService.inserts(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = layerService.delete(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = layerService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "LayerEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody LayerEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = layerService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "LayerEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<LayerEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (LayerEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = layerService.updates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/MetaController.java b/src/main/java/com/moon/server/controller/data/MetaController.java new file mode 100644 index 0000000..a3bfa9a --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/MetaController.java @@ -0,0 +1,539 @@ +package com.moon.server.controller.data; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.DownloadReqEntity; +import com.moon.server.entity.ctrl.IdNameEntity; +import com.moon.server.entity.data.DictEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.data.VerEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.ClassHelper; +import com.moon.server.helper.Md5Helper; +import com.moon.server.helper.WebHelper; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.service.all.BaseQueryService; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.data.MetaService; +import com.moon.server.service.data.VerService; +import com.moon.server.service.sys.DepService; +import com.moon.server.service.sys.DownlogService; +import com.moon.server.service.sys.TokenService; +import com.moon.server.helper.StringHelper; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * 鍏冩暟鎹� + * @author WWW + */ +@Api(tags = "鏁版嵁绠$悊\\淇℃伅绠$悊") +@RestController +@RequestMapping("/meta") +public class MetaController extends BaseController { + @Autowired + MetaService metaService; + + @Autowired + TokenService tokenService; + + @Autowired + BaseQueryService baseQueryService; + + @Autowired + DownlogService downlogService; + + @Autowired + DownloadService downloadService; + + @Autowired + VerService verService; + + @Autowired + DepService depService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), + @ApiImplicitParam(name = "dircode", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00"), + @ApiImplicitParam(name = "verid", value = "鐗堟湰ID", dataType = "Integer", paramType = "query", example = "0"), + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<MetaEntity>> selectByPageAndCount(String depcode, String dircode, Integer verid, String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = metaService.selectCount(depcode, dircode, verid, name); + if (count == 0) { + return success(0, null); + } + + List<MetaEntity> rs = metaService.selectByPage(depcode, dircode, verid, name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐖禝D鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "metaid", value = "鐖禝D", dataType = "String", paramType = "query", example = "0"), + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectPageAndCountByPid") + public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + if (null == metaid || metaid < 1) { + return fail("鐖禝D涓嶈兘涓虹┖涓斿ぇ浜�1", null); + } + + int count = metaService.selectCountByPid(metaid, name); + if (count == 0) { + return success(0, null); + } + + List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐩綍ID鏌ヨ鐗堟湰鍒楄〃") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query") + }) + @GetMapping(value = "/selectVerByDirid") + public ResponseMsg<List<VerEntity>> selectVerByDirid(Integer dirid) { + try { + if (null == dirid || dirid < 0) { + dirid = 0; + } + + List<VerEntity> list = verService.selectByDirid(dirid); + if (null == list || list.isEmpty()) { + list = verService.selectByDirid(0); + } + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<MetaEntity> selectById(int id) { + try { + MetaEntity entity = metaService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ琛ㄤ腑鏁版嵁") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鍏冩暟鎹甀D", dataType = "Integer", paramType = "query", example = "115"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10") + }) + @GetMapping(value = "/selectDbData") + public ResponseMsg<Object> selectDbData(Integer id, Integer pageIndex, Integer pageSize) { + // noinspection AlibabaRemoveCommentedCode + try { + if (null == id || id < 0) { + return fail("鍏冩暟鎹甀D涓嶈兘涓虹┖鎴栧皬浜�0", null); + } + + MetaEntity meta = metaService.selectById(id); + if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { + return fail("鎵句笉鍒板厓鏁版嵁淇℃伅", null); + } + + String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); + BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); + if (null == baseMapper) { + return null; + } + + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("parentid", meta.getEventid()); + + Page<Object> page = new Page<>(pageIndex, pageSize); + page.addOrder(OrderItem.desc("gid")); + IPage<Object> paged = baseMapper.selectPage(page, wrapper); + + return success(paged.getTotal(), paged.getRecords()); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ瀛楁淇℃伅") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg25wAanp") + }) + @GetMapping(value = "/selectTabFields") + public ResponseMsg<List<DictEntity>> selectTabFields(String ns, String tab) { + try { + if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(tab)) { + return fail("鍚嶇О绌洪棿鍜岃〃鍚嶄笉鑳戒负绌�", null); + } + + List<DictEntity> list = baseQueryService.selectFields(ns, tab); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MetaEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody MetaEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + entity.setCreateTime(WebHelper.getCurrentTimestamp()); + int count = metaService.insert(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MetaEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<MetaEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (MetaEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = metaService.inserts(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = metaService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MetaEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody MetaEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = metaService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MetaEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<MetaEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (MetaEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = metaService.updates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectPageCountForDownload") + public ResponseMsg<List<DownloadEntity>> selectPageCountForDownload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + int count = downloadService.selectCountForUser(ue.getId(), "3,4", name); + if (count == 0) { + return success(0, null); + } + List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), "3,4", name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍏冩暟鎹腑婧㈠嚭鐨勫崟浣岻D") + @ApiImplicitParams({ + @ApiImplicitParam(name = "reqEntity", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/selectMetaOverflowDep") + public ResponseMsg<Object> selectMetaOverflowDep(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dr || null == dr.getIds() || dr.getIds().isEmpty()) { + return fail("璇烽�夋嫨瑕佷笅杞界殑鏂囦欢ID"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (StaticData.ADMIN.equals(ue.getUid())) { + return success(new ArrayList<String>()); + } + + List<String> list = metaService.selectMetaOverflowDep(ue, dr); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鍗曚綅缂栫爜鏁扮粍鏌ヨ鍗曚綅") + @ApiImplicitParams({ + @ApiImplicitParam(name = "codes", value = "鍗曚綅缂栫爜鏁扮粍", dataType = "String", paramType = "query", allowMultiple = true, example = "00,0001") + }) + @GetMapping(value = "/selectDepsByCodes") + public ResponseMsg<Object> selectDepsByCodes(String[] codes) { + try { + if (null == codes || codes.length == 0) { + return fail("鍗曚綅ID闆嗗悎涓虹┖"); + } + + List<IdNameEntity> list = depService.selectDepsByCodes(codes); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "璇锋眰鍏冩暟鎹笅杞�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dr", value = "璇锋眰涓嬭浇瀹炰綋绫�", dataType = "DownloadReqEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/downloadReq") + public ResponseMsg<Object> downloadReq(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dr || StringHelper.isEmpty(dr.getPwd())) { + return fail("瀵嗙爜涓嶈兘涓虹┖"); + } + if (null == dr.getIds() || dr.getIds().isEmpty()) { + return fail("璇烽�夋嫨瑕佷笅杞界殑鏂囦欢ID"); + } + if (!DownloadService.decryptPwd(dr)) { + return fail("瀵嗙爜瑙e瘑澶辫触", null); + } + if (StringHelper.isPwdInvalid(dr.getPwd())) { + return fail("瀵嗙爜涓嶇鍚堣姹�"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String guid = metaService.downloadMeteReq(ue, dr); + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") + }) + @GetMapping(value = "/selectDownloadFile") + public ResponseMsg<Boolean> selectDownloadFile(String guid, String pwd) { + try { + if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { + return fail("鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", null); + } + if (!pwd.endsWith(StaticData.EQ)) { + pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); + } + + String password = DownloadService.decryptPwd(pwd); + if (null == password) { + return fail("瀵嗙爜瑙e瘑澶辫触", null); + } + + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + return fail("鏂囦欢涓嶅瓨鍦�", null); + } + if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { + return fail("瀵嗙爜涓嶆纭�", null); + } + + String filePath = downloadService.getDownloadFilePath(de); + File file = new File(filePath); + + return success(file.exists()); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") + }) + @ResponseBody + @GetMapping(value = "/downloadFile") + public void downloadFile(String guid, String pwd, HttpServletRequest req, HttpServletResponse res) { + try { + if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { + WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", res); + } + if (!pwd.endsWith(StaticData.EQ)) { + pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); + } + + String password = DownloadService.decryptPwd(pwd); + if (null == password) { + WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "瀵嗙爜瑙e瘑澶辫触", res); + } + + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); + return; + } + if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { + WebHelper.writeInfo(HttpStatus.UNAUTHORIZED, "瀵嗙爜涓嶆纭�", res); + } + + UserEntity ue = tokenService.getCurrentUser(req); + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); + } + } + + @SysLog() + @ApiOperation(value = "鏌ョ湅鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") + }) + @GetMapping(value = "/downloadForView") + public void downloadForView(String guid, HttpServletResponse res) { + metaService.downloadForView(guid, true, res); + } +} diff --git a/src/main/java/com/moon/server/controller/data/PublishController.java b/src/main/java/com/moon/server/controller/data/PublishController.java new file mode 100644 index 0000000..0027314 --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/PublishController.java @@ -0,0 +1,226 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.ctrl.PubEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.data.PublishEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.data.PublishService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鏁版嵁鍙戝竷 + * @author WWW + */ +@Api(tags = "鏁版嵁绠$悊\\鍙戝竷绠$悊") +@RestController +@RequestMapping("/publish") +public class PublishController extends BaseController { + @Autowired + PublishService publishService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ鍏冩暟鎹�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), + @ApiImplicitParam(name = "dircode", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "01"), + @ApiImplicitParam(name = "verid", value = "鐗堟湰ID", dataType = "Integer", paramType = "query", example = "0"), + @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "String", paramType = "query", example = "DOM"), + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectMetasByPage") + public ResponseMsg<Object> selectMetasByPage(String depcode, String dircode, Integer verid, String type, String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + if (StringHelper.isEmpty(type)) { + return fail("鏁版嵁绫诲埆涓虹┖", null); + } + + String types = getType(type); + int count = publishService.selectMetasByCount(depcode, dircode, verid, types, name); + if (count == 0) { + return success(0, null); + } + + List<MetaEntity> rs = publishService.selectMetasByPage(depcode, dircode, verid, types, name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + /** + * 鑾峰彇绫诲瀷 + */ + private String getType(String type) throws Exception { + switch (type) { + case "DOM": + return "type in ('tif', 'tiff', 'img')"; + case "DEM": + return "type in ('tif', 'tiff')"; + case "MPT": + return "type = 'mpt'"; + case "3DML": + return "type = '3dml'"; + case "BIM": + return "type in ('ifc', 'fbx', 'rvt')"; + default: + throw new Exception("鏁版嵁绫诲瀷涓嶅尮閰�"); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = publishService.selectCount(name); + if (count == 0) { + return success(0, null); + } + + List<PublishEntity> rs = publishService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<PublishEntity> selectById(int id) { + try { + PublishEntity entity = publishService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆鍙戝竷鏁版嵁") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PubEntity", paramType = "body") + }) + @PostMapping(value = "/insertForPub", produces = "application/json; charset=UTF-8") + public ResponseMsg<Object> insertForPub(@RequestBody PubEntity entity, HttpServletRequest req) { + try { + if (null == entity || null == entity.getIds() || entity.getIds().isEmpty()) { + return fail("瀹炰綋绫讳负绌烘垨鎵句笉鍒板厓鏁版嵁ID", 0); + } + if (StringHelper.isEmpty(entity.getType())) { + return fail("鏁版嵁绫诲埆涓虹┖", null); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUserId(ue.getId()); + entity.setToken(WebHelper.getToken(req)); + } + + String method = getConvertMethod(entity.getType()); + long count = publishService.postForPub(entity, method, req); + + return success(count); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); + } + } + + /** + * 鑾峰彇杞崲鏂规硶 + */ + private String getConvertMethod(String type) throws Exception { + switch (type) { + case "DOM": + return "/Convert/ToTiles"; + case "DEM": + return "/Convert/ToTerra"; + case "MPT": + case "3DML": + return "/Convert/ToSG"; + case "BIM": + return "/Convert/ToTileset"; + default: + throw new Exception("鏁版嵁绫诲瀷涓嶅尮閰�"); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids, HttpServletRequest req) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = publishService.deletes(ids, req); + + return success(count); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PublishEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody PublishEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = publishService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/StyleController.java b/src/main/java/com/moon/server/controller/data/StyleController.java new file mode 100644 index 0000000..0679aa4 --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/StyleController.java @@ -0,0 +1,321 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.ctrl.DownloadReqEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.data.StyleEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.all.UploadAttachService; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.data.StyleService; +import com.moon.server.service.sys.DownlogService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 鏍峰紡绠$悊 + * @author sws + * @date 2022-09.26 + */ +@Api(tags = "鏁版嵁绠$悊\\鏍峰紡绠$悊") +@RestController +@RequestMapping("/style") +public class StyleController extends BaseController { + @Autowired + StyleService styleService; + + @Autowired + TokenService tokenService; + + @Autowired + DownloadService downloadService; + + @Autowired + DownlogService downlogService; + + @Autowired + UploadAttachService uploadAttachService; + + private final static String TAB_NAME = "lf.sys_style"; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "a") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String name) { + try { + int count = styleService.selectCount(name); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "a"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<StyleEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 0) { + return fail("鍒嗛〉鏁板皬浜�1鎴栧垎椤电储寮曞皬浜�0", null); + } + + List<StyleEntity> rs = styleService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "a"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<StyleEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 0) { + return fail("鍒嗛〉鏁板皬浜�1鎴栧垎椤电储寮曞皬浜�0", null); + } + + int count = styleService.selectCount(name); + if (count == 0) { + return success(0, null); + } + + List<StyleEntity> rs = styleService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.data.StyleEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertStyle", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertStyle(@RequestBody StyleEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = styleService.insertStyle(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "com.lf.server.entity.data.StyleEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertStyles", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertStyles(@RequestBody List<StyleEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (StyleEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = styleService.insertStyles(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteStyle") + public ResponseMsg<Integer> deleteStyle(int id) { + try { + int count = styleService.deleteStyle(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteStyles") + public ResponseMsg<Integer> deleteStyles(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = styleService.deleteStyles(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "StyleEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateStyle", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateStyle(@RequestBody StyleEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = styleService.updateStyle(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectStyle") + public ResponseMsg<StyleEntity> selectStyle(int id) { + try { + StyleEntity styleEntity = styleService.selectStyle(id); + + return success(styleEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectStyleAll") + public ResponseMsg<List<StyleEntity>> selectStyleAll() { + + try { + List<StyleEntity> list = styleService.selectStyleAll(); + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓婁紶鏂囦欢") + @ResponseBody + @PostMapping(value = "/upload") + public ResponseMsg<String> upload(@RequestParam("file") MultipartFile file, HttpServletRequest req) { + UserEntity ue = tokenService.getCurrentUser(req); + + return uploadAttachService.upload(ue, TAB_NAME, file, this); + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") + }) + @GetMapping(value = "/download") + public void download(String guid, HttpServletResponse res) { + uploadAttachService.download(guid, res); + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") + }) + @RequestMapping(value = "/downloadFile", method = RequestMethod.GET) + public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, "鐢ㄦ埛鏈櫥褰�")); + } + + DownloadEntity de = downloadService.selectByGuid(guid); + if (de == null) { + WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�")); + } + + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, ex.getMessage())); + log.error(ex.getMessage(), ex); + } + } + + @SysLog() + @ApiOperation(value = "璇锋眰涓嬭浇") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guids", value = "闄勪欢Guid鏁扮粍", dataType = "String", paramType = "body", allowMultiple = true, example = "e5b6ae0889b88111f13a4b6e048348db,fa4f299e901a0c46e634f8fcc8185c0c") + }) + @ResponseBody + @PostMapping(value = "/downloadReqForGuids") + public ResponseMsg<Object> downloadReqForGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dre || null == dre.getGuids() || dre.getGuids().isEmpty()) { + return fail("Guid鏁扮粍涓虹┖"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String guid = uploadAttachService.downloadReqForGuids(ue, dre.getGuids()); + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/VerController.java b/src/main/java/com/moon/server/controller/data/VerController.java new file mode 100644 index 0000000..f018827 --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/VerController.java @@ -0,0 +1,190 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.data.VerEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.data.VerService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鐗堟湰琛� + * @author SWS + * @date 2022-09.29 + */ +@Api(tags = "鏁版嵁绠$悊\\鐗堟湰绠$悊") +@RestController +@RequestMapping("/ver") +public class VerController extends BaseController { + @Autowired + VerService versionService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<VerEntity>> selectByPageAndCount(Integer dirid, String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = versionService.selectCount(dirid, name); + if (count == 0) { + return success(0, null); + } + + List<VerEntity> rs = versionService.selectByPage(dirid, name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.data.VersionEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertVersion", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertVersion(@RequestBody VerEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = versionService.insertVersion(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<VersionEntity>", paramType = "body", example = "") + }) + @PostMapping(value = "/insertVersions", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertVersions(@RequestParam List<VerEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (VerEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = versionService.insertVersions(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteVersion") + public ResponseMsg<Integer> deleteVersion(int id) { + try { + int count = versionService.deleteVersion(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteVersions") + public ResponseMsg<Integer> deleteVersions(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + int count = versionService.deleteVersions(ids); + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "VersionEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateVersion", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateVersion(@RequestBody VerEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = versionService.updateVersion(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectVersion") + public ResponseMsg<VerEntity> selectVersion(int id) { + try { + VerEntity verEntity = versionService.selectVersion(id); + + return success(verEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectVersionAll") + public ResponseMsg<List<VerEntity>> selectVersionAll() { + try { + List<VerEntity> list = versionService.selectVersionAll(); + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/WmtsController.java b/src/main/java/com/moon/server/controller/data/WmtsController.java new file mode 100644 index 0000000..9a4e975 --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/WmtsController.java @@ -0,0 +1,190 @@ +package com.moon.server.controller.data; + +import com.moon.server.annotation.SysLog; +import com.moon.server.config.PropertiesConfig; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.server.ServerHttpRequest; +import org.springframework.http.server.ServerHttpResponse; +import org.springframework.http.server.ServletServerHttpRequest; +import org.springframework.http.server.ServletServerHttpResponse; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Date; +import java.util.List; + +/** + * WMTS鏈嶅姟 + * @author WWW + */ +@Api(tags = "鏁版嵁绠$悊\\WMTS鏈嶅姟") +@RestController +@RequestMapping("/wmts") +public class WmtsController { + @Autowired + PropertiesConfig config; + + private final static Log log = LogFactory.getLog(WmtsController.class); + + @SysLog() + @ApiOperation(value = "鑾峰彇WMTS鍏冩暟鎹�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "浠ょ墝", required = true, dataType = "String", defaultValue = "token", paramType = "path") + }) + @GetMapping("select/{token}/WMTSCapabilities.xml") + public void selectWmtsCapabilities(@PathVariable(name = "token") String token, HttpServletRequest req, HttpServletResponse res) { + try { + ClassPathResource resource = new ClassPathResource("wmts/web.xml"); + if (!resource.exists()) { + return; + } + + InputStream stream = resource.getInputStream(); + byte[] data = new byte[stream.available()]; + stream.read(data); + stream.close(); + + String url = req.getRequestURL().toString().replace("WMTSCapabilities.xml", "tile?"); + + String result = new String(data, StandardCharsets.UTF_8); + result = result.replace("{url}", url); + byte[] bytes = result.getBytes(StandardCharsets.UTF_8); + + res.setHeader("Content-Type", "application/xml;charset=UTF-8"); + ServletOutputStream os = res.getOutputStream(); + os.write(bytes); + os.flush(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + @ApiOperation(value = "鑾峰彇WMTS鐡︾墖") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "浠ょ墝", required = true, dataType = "String", defaultValue = "token", paramType = "path"), + @ApiImplicitParam(name = "layer", value = "鍥惧眰绫诲瀷", required = true, dataType = "String", defaultValue = "img"), + @ApiImplicitParam(name = "tilematrix", value = "灞傜骇", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "tilerow", value = "琛屽彿", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "tilecol", value = "鍒楀彿", required = true, dataType = "Integer") + }) + @GetMapping("select/{token}/tile") + public void selectWmtsTile(@PathVariable(name = "token") String token, HttpServletRequest req, HttpServletResponse res) { + try { + String layer = WebHelper.getReqParamVal(req, "layer"); + String matrix = WebHelper.getReqParamVal(req, "tilematrix"); + String row = WebHelper.getReqParamVal(req, "tilerow"); + String col = WebHelper.getReqParamVal(req, "tilecol"); + if (StringHelper.isEmpty(layer) || StringHelper.isEmpty(matrix) || StringHelper.isEmpty(layer) || StringHelper.isEmpty(row) || StringHelper.isEmpty(col)) { + return; + } + + int z = Integer.parseInt(matrix); + int x = Integer.parseInt(row); + int y = Integer.parseInt(col); + + getWmtsTile(layer, z, x, y, req, res); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 鑾峰彇WMTS鐡︾墖 + */ + private void getWmtsTile(String layer, int z, int x, int y, HttpServletRequest req, HttpServletResponse res) throws Exception { + ServletServerHttpRequest ssReq = new ServletServerHttpRequest(req); + ServletServerHttpResponse ssRes = new ServletServerHttpResponse(res); + + // 妫�鏌ョ紦瀛樻槸鍚﹁繃鏈� + if (checkIfNotModify(ssReq, ssRes)) { + // 璁剧疆缂撳瓨澶� + setBrowerCache(ssRes); + return; + } + + // 璁剧疆缂撳瓨鍙傛暟 + setBrowerCache(ssRes); + //res.setContentType("image/png") + + // 閫氳繃response瀵硅薄锛岃幏鍙栧埌杈撳嚭娴� + ServletOutputStream outputStream = res.getOutputStream(); + // 瀹氫箟杈撳叆娴侊紝閫氳繃杈撳叆娴佽鍙栨枃浠跺唴瀹� + FileInputStream fileInputStream; + + // y = (int) Math.pow(2, z) - y - 1; + String path = config.getTilePath() + File.separator + layer + File.separator + z + File.separator + y + File.separator + x + ".png"; + System.out.println(path); + + File file = new File(path); + if (!file.exists() || file.isDirectory()) { + ClassPathResource resource = new ClassPathResource("wmts/nofound.png"); + fileInputStream = new FileInputStream(resource.getFile()); + } else { + System.out.println(path); + fileInputStream = new FileInputStream(file); + } + + int len = 0; + byte[] bytes = new byte[1024]; + while ((len = fileInputStream.read(bytes)) != -1) { + outputStream.write(bytes, 0, len); + outputStream.flush(); + } + //outputStream.close() + fileInputStream.close(); + + // 璁剧疆杩斿洖鍥剧墖绫诲瀷 + ssRes.getHeaders().set("Content-Type", "image/png"); + + OutputStream os = ssRes.getBody(); + os.write(bytes); + os.flush(); + } + + /** + * 璁剧疆娴忚鍣ㄧ紦瀛樺弬鏁� + */ + private void setBrowerCache(ServerHttpResponse res) { + HttpHeaders headers = res.getHeaders(); + headers.setCacheControl("public, must-revalidate"); + + headers.setExpires(System.currentTimeMillis() + 24 * 60 * 60 * 1000); + headers.setAccessControlMaxAge(Duration.ofHours(24)); + headers.setETag("\"" + new Date().toString() + "\""); + // must-revalidate + // response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); + } + + /** + * 楠岃瘉缂撳瓨鍙傛暟 + */ + boolean checkIfNotModify(ServerHttpRequest req, ServerHttpResponse res) { + List<String> etags = req.getHeaders().getIfNoneMatch(); + if (0 == etags.size() || StringHelper.isEmpty(etags.get(0))) { + return false; + } + + res.setStatusCode(HttpStatus.NOT_MODIFIED); + + return true; + } +} diff --git a/src/main/java/com/moon/server/controller/data/upload/CheckController.java b/src/main/java/com/moon/server/controller/data/upload/CheckController.java new file mode 100644 index 0000000..4813937 --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/upload/CheckController.java @@ -0,0 +1,523 @@ +package com.moon.server.controller.data.upload; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.FmeReqEntity; +import com.moon.server.entity.ctrl.RegisterEntity; +import com.moon.server.helper.HttpHelper; +import com.moon.server.helper.PathHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.data.FmeService; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +/** + * 妫�鏌ユ帶鍒跺櫒 + * @author WWW + */ +public class CheckController extends BaseController { + @Autowired + protected PathHelper pathHelper; + + @Autowired + protected FmeService fmeService; + + @SysLog() + @ApiOperation(value = "鏌ヨ浠诲姟鐘舵��") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") + }) + @GetMapping(value = "/selectTaskStatus") + public Object selectTaskStatus(String id, HttpServletRequest req) { + try { + if (StringHelper.isEmpty(id)) { + return fail("id涓嶈兘涓虹┖"); + } + + return fmeService.getTaskStatus(id, req); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇璐ㄦ缁撴灉") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") + }) + @GetMapping(value = "/downloadResult") + public void downloadResult(String id, HttpServletRequest req, HttpServletResponse res) { + try { + if (!StringHelper.isEmpty(id)) { + String url = fmeService.getDownloadUrl(id, req); + + HttpHelper httpHelper = new HttpHelper(); + // res.sendRedirect(url) + httpHelper.service(req, res, url, null); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + @SysLog() + @ApiOperation(value = "鎻愪氦鏁版嵁璐ㄦ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "FME璇锋眰瀹炰綋绫�", dataType = "FmeReqEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/uploadChecks") + public ResponseMsg<Object> uploadChecks(@RequestBody FmeReqEntity entity, HttpServletRequest req) { + try { + if (StringHelper.isEmpty(entity.names)) { + return fail("浠诲姟鍚嶇О涓嶈兘涓虹┖"); + } + if (StringHelper.isEmpty(entity.zipPath)) { + return fail("璇烽�夋嫨寰呰川妫�鐨剒ip鏂囦欢"); + } + + entity.zipPath = getFullPath(entity.zipPath); + if (!isZipFile(entity.zipPath)) { + return fail("寰呰川妫�鐨剒ip鏂囦欢涓嶅瓨鍦�"); + } + if (entity.names.contains(StaticData.CHECK_MAIN)) { + entity.wbsPath = getFullPath(entity.wbsPath); + if (!isXlsFile(entity.wbsPath)) { + return fail("寰呰川妫�鐨刉BS鏂囦欢涓嶅瓨鍦�"); + } + } + + List<String> list = new ArrayList<>(); + for (String name : entity.names.split(StaticData.COMMA)) { + String guid = invoke(name, entity, req); + list.add(guid); + } + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + /** + * 鑾峰彇鏂囦欢璺緞 + */ + private String getFullPath(String filePath) { + return null == filePath ? null : pathHelper.getConfig().getTempPath() + File.separator + filePath; + } + + /** + * 鏄�/鍚︿负Zip鏂囦欢 + */ + private boolean isZipFile(String filePath) { + if (null == filePath || !filePath.toLowerCase().endsWith(StaticData.ZIP)) { + return false; + } + + File zipFile = new File(filePath); + + return zipFile.exists() && !zipFile.isDirectory(); + } + + /** + * 鏄�/鍚︿负Excel鏂囦欢 + */ + private boolean isXlsFile(String filePath) { + if (null == filePath) { + return false; + } + if (!(filePath.toLowerCase().endsWith(StaticData.XLS) || filePath.toLowerCase().endsWith(StaticData.XLSX))) { + return false; + } + + File zipFile = new File(filePath); + + return zipFile.exists() && !zipFile.isDirectory(); + } + + /** + * 鏂规硶璋冪敤 + */ + private String invoke(String name, FmeReqEntity entity, HttpServletRequest req) throws Exception { + Method method; + try { + method = FmeService.class.getDeclaredMethod(name, FmeReqEntity.class, HttpServletRequest.class); + } catch (Exception ex) { + throw new Exception(name + "锛岃妫�鏌ユ柟娉曚笉瀛樺湪"); + } + + Object obj = method.invoke(fmeService, entity, req); + + return null == obj ? null : obj.toString(); + } + + /*@SysLog() + @ApiOperation(value = "鏌ヨOSGB妫�鏌�") + @GetMapping(value = "/selectCheckOsgb") + public ResponseMsg<Object> selectCheckOsgb(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\OSGB妫�鏌�.zip"; + fme.imgResolution = 0.2; + + String rs = fmeService.checkOsgb(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ琛ㄦ牸鏁版嵁妫�鏌�") + @GetMapping(value = "/selectCheckXls") + public ResponseMsg<Object> selectCheckXls(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.sjzy = "娴嬮噺涓撲笟"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\琛ㄦ牸鏁版嵁妫�鏌�.zip"; + + String rs = fmeService.checkXls(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鐐逛簯妫�鏌�") + @GetMapping(value = "/selectCheckLaz") + public ResponseMsg<Object> selectCheckLaz(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鐐逛簯妫�鏌�.zip"; + fme.lazDensity = 1; + + String rs = fmeService.checkLaz(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ楂樼▼妫�鏌�") + @GetMapping(value = "/selectCheckDem") + public ResponseMsg<Object> selectCheckDem(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\楂樼▼妫�鏌�.zip"; + fme.demTolerance = 5; + fme.demChangeRate = 200; + + String rs = fmeService.checkDem(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ灞炴�ф鏌�") + @GetMapping(value = "/selectCheckAttrs") + public ResponseMsg<Object> selectCheckAttrs(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.sjzy = "娴嬮噺涓撲笟"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\灞炴�ф鏌�.zip"; + + String rs = fmeService.checkAttrs(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎷撴墤妫�鏌�") + @GetMapping(value = "/selectCheckTopology") + public ResponseMsg<Object> selectCheckTopology(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鎷撴墤妫�鏌�.zip"; + fme.polyTolerance = 0.001; + fme.lineTolerance = 0.001; + fme.pointTolerance = 0.001; + fme.gcdOffset = 20; + fme.kzdOffset = 100; + fme.rangeOffset = 200; + fme.xgMax = 0.005; + + String rs = fmeService.checkTopology(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍥鹃潰鏁撮グ妫�鏌�") + @GetMapping(value = "/selectCheckDecorate") + public ResponseMsg<Object> selectCheckDecorate(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鍥鹃潰鏁撮グ妫�鏌�.zip"; + fme.xlsList = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鏂囦欢娓呭崟.xlsx"; + + String rs = fmeService.checkDecorate(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍘熺偣妫�鏌�") + @GetMapping(value = "/selectCheckOrigin") + public ResponseMsg<Object> selectCheckOrigin(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鍘熺偣妫�鏌�.zip"; + + String rs = fmeService.checkOrigin(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏍呮牸妫�鏌�") + @GetMapping(value = "/selectCheckDom") + public ResponseMsg<Object> selectCheckDom(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.sjzy = "娴嬮噺涓撲笟"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鏍呮牸妫�鏌�.zip"; + fme.coordinateSystem = "CGCS2000/GK3d-93E_FME"; + fme.imgResolution = 0.2; + + String rs = fmeService.checkDom(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏁板鍩虹妫�鏌�") + @GetMapping(value = "/selectCheckMath") + public ResponseMsg<Object> selectCheckMath(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.sjzy = "娴嬮噺涓撲笟"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鏁板鍩虹妫�鏌�.zip"; + + String rs = fmeService.checkMath(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍏冩暟鎹鏌�") + @GetMapping(value = "/selectCheckMeta") + public ResponseMsg<Object> selectCheckMeta(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.sjzy = "娴嬮噺涓撲笟"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\鍏冩暟鎹鏌�.zip"; + + String rs = fmeService.checkMeta(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎬昏川妫�") + @GetMapping(value = "/selectCheckMain") + public ResponseMsg<Object> selectCheckMain(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.sjzy = "娴嬮噺涓撲笟"; + fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�.7z"; + fme.wbsPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\椤圭洰WBS瀵煎嚭.xlsx"; + fme.isDiZai = "NO"; + fme.diZaiType = "NO"; + + String rs = fmeService.checkMain(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "閫昏緫涓�鑷存�ф鏌�") + @GetMapping(value = "/checkLogical") + public ResponseMsg<Object> checkLogical(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.sjzy = "娴嬮噺涓撲笟"; + fme.zipPath = "D:\\LF\\temp\\20230411\\鏁板瓧鍖栨垚鏋�.zip"; + + String rs = fmeService.checkLogical(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍗曢」鎴愭灉瀹屾暣鎬ф鏌�") + @GetMapping(value = "/checkSingleIntegrity") + public ResponseMsg<Object> checkSingleIntegrity(HttpServletRequest req) { + try { + FmeReqEntity fme = new FmeReqEntity(); + fme.xmmc = "瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116BT02锛�"; + fme.sjzy = "娴嬮噺涓撲笟"; + fme.sjfl = "鏁板瓧鍖栨垚鏋�"; + fme.zipPath = "D:\\LF\\temp\\20230411\\鏁板瓧鍖栨垚鏋�.zip"; + + String rs = fmeService.checkSingleIntegrity(fme, req); + if (StringHelper.isEmpty(rs)) { + return fail("妫�鏌ュけ璐�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + }*/ + + @SysLog() + @ApiOperation(value = "鏈嶅姟娉ㄥ唽") + @GetMapping(value = "/selectServerRegister") + public ResponseMsg<Object> selectServerRegister(HttpServletRequest req) { + try { + RegisterEntity rs = fmeService.serverRegister("瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116DT02锛�", "http://127.0.0.1/LFData/2d/tiles/01/{z}/{x}/{y}.png", "DOM", req); + if (null == rs || StringHelper.isEmpty(rs.getSerialnum())) { + return fail("澶辫触"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏈嶅姟鐢宠") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鏈嶅姟ID", dataType = "String", paramType = "query", example = "195f77eb-19dd-4e34-afc1-fcff8f758f7b"), + @ApiImplicitParam(name = "pubid", value = "鍙戝竷ID", dataType = "Integer", paramType = "query", example = "1"), + }) + @GetMapping(value = "/selectServerApply") + public ResponseMsg<Object> selectServerApply(String id, Integer pubid, HttpServletRequest req) { + try { + fmeService.serverApply(id, pubid, req); + + return success("OK"); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎璧勬簮") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鏈嶅姟ID", dataType = "String", paramType = "query", example = "6f4b6783-4b98-4d46-a0d9-43cdb5f339dc") + }) + @GetMapping(value = "/selectDeleteRes") + public ResponseMsg<Object> selectDeleteRes(String id, HttpServletRequest req) { + try { + fmeService.deleteRes(id, req); + + return success("OK"); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/upload/QueryController.java b/src/main/java/com/moon/server/controller/data/upload/QueryController.java new file mode 100644 index 0000000..32e71c3 --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/upload/QueryController.java @@ -0,0 +1,289 @@ +package com.moon.server.controller.data.upload; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.moon.server.annotation.SysLog; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.TabEntity; +import com.moon.server.entity.sys.DepEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.ClassHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.service.all.BaseQueryService; +import com.moon.server.service.data.*; +import com.moon.server.service.sys.DepService; +import com.moon.server.service.sys.TokenService; +import com.moon.server.entity.data.*; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鏌ヨ鎺у埗鍣� + * @author WWW + */ +public class QueryController extends CheckController { + @Autowired + protected DepService depService; + + @Autowired + protected DirService dirService; + + @Autowired + protected VerService verService; + + @Autowired + protected MetaService metaService; + + @Autowired + protected TokenService tokenService; + + @Autowired + protected UploadService uploadService; + + @Autowired + protected BaseQueryService baseQueryService; + + @Autowired + DictService dictService; + + @SysLog() + @ApiOperation(value = "鏍规嵁鐖禝D鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "metaid", value = "鐖禝D", dataType = "String", paramType = "query", example = "0"), + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectPageAndCountByPid") + public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + if (null == metaid || metaid < 1) { + return fail("鐖禝D涓嶈兘涓虹┖涓斿ぇ浜�1", null); + } + + int count = metaService.selectCountByPid(metaid, name); + if (count == 0) { + return success(0, null); + } + + List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈夊崟浣�") + @GetMapping(value = "/selectDepAll") + public ResponseMsg<List<DepEntity>> selectDepAll() { + try { + List<DepEntity> list = depService.selectDepAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈夌洰褰�") + @GetMapping(value = "/selectDirAll") + public ResponseMsg<List<DirEntity>> selectDirAll() { + try { + List<DirEntity> list = dirService.selectDirAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐩綍ID鏌ヨ鐗堟湰鍒楄〃") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query") + }) + @GetMapping(value = "/selectVerByDirid") + public ResponseMsg<List<VerEntity>> selectVerByDirid(Integer dirid) { + try { + if (null == dirid || dirid < 0) { + dirid = 0; + } + + List<VerEntity> list = verService.selectByDirid(dirid); + if (null == list || list.isEmpty()) { + list = verService.selectByDirid(0); + } + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍧愭爣绯�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "zoning", value = "甯﹀彿", dataType = "String", paramType = "query", example = "6搴︽湁甯﹀彿") + }) + @GetMapping(value = "/selectCoords") + public ResponseMsg<Object> selectCoords(String zoning) { + try { + List<CoordEntity> list = uploadService.selectCoords(zoning); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ椤圭洰鍚嶇О") + @GetMapping(value = "/selectProject") + public ResponseMsg<Object> selectProject() { + try { + List<DirEntity> list = uploadService.selectProject(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈夎〃") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鐐�"), + @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false") + }) + @GetMapping(value = "/selectTabs") + public ResponseMsg<List<TabEntity>> selectTabs(String name, Boolean hasGeom) { + try { + List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom"); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ瀛楁淇℃伅") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ns", value = "鍚嶇О绌洪棿", dataType = "String", paramType = "query", example = "bd"), + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg25wAanp") + }) + @GetMapping(value = "/selectFields") + public ResponseMsg<List<DictEntity>> selectFields(String ns, String tab) { + try { + if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(tab)) { + return fail("鍚嶇О绌洪棿鍜岃〃鍚嶄笉鑳戒负绌�", null); + } + + List<DictEntity> list = baseQueryService.selectFields(ns, tab); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ琛ㄤ腑鏁版嵁") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鍏冩暟鎹甀D", dataType = "Integer", paramType = "query", example = "115"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10") + }) + @GetMapping(value = "/selectDbData") + public ResponseMsg<Object> selectDbData(Integer id, Integer pageIndex, Integer pageSize) { + // noinspection AlibabaRemoveCommentedCode + try { + if (null == id || id < 0) { + return fail("鍏冩暟鎹甀D涓嶈兘涓虹┖鎴栧皬浜�0", null); + } + + MetaEntity meta = metaService.selectById(id); + if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { + return fail("鎵句笉鍒板厓鏁版嵁淇℃伅", null); + } + + String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); + BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); + if (null == baseMapper) { + return null; + } + + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("parentid", meta.getEventid()); + + Page<Object> page = new Page<>(pageIndex, pageSize); + page.addOrder(OrderItem.desc("gid")); + IPage<Object> paged = baseMapper.selectPage(page, wrapper); + + return success(paged.getTotal(), paged.getRecords()); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ涓婁紶鏁版嵁骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageForUpload") + public ResponseMsg<Object> selectByPageForUpload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + UserEntity ue = tokenService.getCurrentUser(req); + + int count = metaService.selectCountForUpload(name, ue.getId(), null); + if (count == 0) { + return success(0, null); + } + + List<MetaEntity> list = metaService.selectByPageForUpload(name, ue.getId(), null, pageSize, pageSize * (pageIndex - 1)); + + return success(count, list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鍏冩暟鎹甀D鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectMetaById") + public ResponseMsg<MetaEntity> selectMetaById(int id) { + try { + MetaEntity entity = metaService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/data/upload/UploadController.java b/src/main/java/com/moon/server/controller/data/upload/UploadController.java new file mode 100644 index 0000000..2bc670c --- /dev/null +++ b/src/main/java/com/moon/server/controller/data/upload/UploadController.java @@ -0,0 +1,240 @@ +package com.moon.server.controller.data.upload; + +import com.moon.server.annotation.SysLog; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.ctrl.KeyValueEntity; +import com.moon.server.entity.data.DirEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.data.MetaFileEntity; +import com.moon.server.entity.data.VerEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.all.UploadAttachService; +import com.moon.server.service.data.UploadService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 鏁版嵁鍏ュ簱 + * @author WWW + */ +@Api(tags = "鏁版嵁绠$悊\\鏁版嵁涓婁紶") +@RestController +@RequestMapping("/dataUpload") +public class UploadController extends QueryController { + @Autowired + UploadService uploadService; + + @Autowired + UploadAttachService uploadAttachService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璺緞") + @GetMapping(value = "/selectPath") + public ResponseMsg<String> selectPath() { + try { + String pathName = uploadService.selectPath(); + + return success(pathName); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓婁紶鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "path", value = "璺緞", dataType = "String", paramType = "query") + }) + @ResponseBody + @PostMapping(value = "/uploadFiles") + public ResponseMsg<Object> uploadFiles(String path, HttpServletRequest req, HttpServletResponse res) { + try { + List<MetaFileEntity> list = uploadService.uploadData(null, path, false, req, res); + if (null == list || list.isEmpty()) { + return fail("娌℃湁鎵惧埌涓婁紶鏂囦欢", null); + } + + uploadService.copePath(list); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + /** + * 鎺ユ敹鏁扮粍1锛欯RequestParam(value = "ids")List<Integer> ids + * &ids=1209&ids=1180&ids=1387 + * 鎺ユ敹鏁版嵁2锛欼nteger[] ids + * formData.append("ids", 1209); formData.append("ids", 1180); formData.append("ids", 1387); + */ + @SysLog() + @ApiOperation(value = "涓婁紶Excel闄勪欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "path", value = "璺緞", dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "ids", value = "鍏冩暟鎹泦鍚�", dataType = "Integer", allowMultiple = true, paramType = "query") + }) + @ResponseBody + @PostMapping(value = "/uploadXlsAnnex") + public ResponseMsg<Object> uploadXlsAnnex(String path, Integer[] ids, HttpServletRequest req, HttpServletResponse res) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + if (null == ids || ids.length == 0) { + return fail("鎵句笉鍒板厓鏁版嵁鐨処D闆嗗悎"); + } + + List<MetaEntity> ms = metaService.selectXlsAnnex(ids, UploadAttachService.getTabs()); + if (null == ms || ms.isEmpty()) { + return fail("鎵句笉鍒拌涓婁紶闄勪欢鐨勫厓鏁版嵁"); + } + + List<MetaFileEntity> list = uploadService.uploadData(null, path, false, req, res); + if (null == list || list.isEmpty()) { + return fail("娌℃湁鎵惧埌涓婁紶鏂囦欢", null); + } + + List<KeyValueEntity> rs = uploadAttachService.uploadXlsAnnex(ue, ms, list, path); + if (null == rs || rs.size() == 0) { + return fail("娌℃湁瑕佹洿鏂扮殑鍏冩暟鎹�"); + } + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "path", value = "璺緞", dataType = "String", paramType = "query") + }) + @GetMapping(value = "/selectFiles") + public ResponseMsg<List<MetaFileEntity>> selectFiles(String path) { + try { + List<MetaFileEntity> list = uploadService.selectFiles(path); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MetaEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/deleteFiles") + public ResponseMsg<Object> deleteFiles(@RequestBody List<MetaFileEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + if (null == list || list.isEmpty()) { + return fail("娌℃湁鎵惧埌鏂囦欢", null); + } + + int rows = uploadService.deleteFiles(list); + + return success("鎴愬姛", rows); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏄犲皠") + @ApiImplicitParams({ + @ApiImplicitParam(name = "path", value = "璺緞", dataType = "String", paramType = "query", example = "20230110010101"), + @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query", example = "163"), + @ApiImplicitParam(name = "verid", value = "鐗堟湰ID", dataType = "Integer", paramType = "query", example = "0"), + @ApiImplicitParam(name = "epsgCode", value = "鍧愭爣缂栫爜", dataType = "String", paramType = "query", example = "EPSG:4490") + }) + @GetMapping(value = "/selectMappers") + public ResponseMsg<Object> selectMappers(String path, Integer dirid, Integer verid, String epsgCode, HttpServletRequest req) { + try { + if (StringHelper.isEmpty(path) || StringHelper.isEmpty(epsgCode) || null == dirid || null == verid) { + return fail("璺緞銆佺洰褰旾D銆佺増鏈琁D鍜屽潗鏍囩紪鐮佷笉鑳戒负绌�"); + } + if (1 > uploadService.selectCount4Coord(epsgCode)) { + return fail("鍧愭爣缂栫爜" + epsgCode + "涓嶅瓨鍦�"); + } + DirEntity dir = dirService.selectDir(dirid); + if (null == dir) { + return fail("鐩綍ID=" + dirid + "涓嶅瓨鍦�"); + } + VerEntity ver = verService.selectVersion(verid); + if (null == ver) { + return fail("鐗堟湰ID=" + verid + "涓嶅瓨鍦�"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + List<MetaFileEntity> list = uploadService.selectMappers(ue, path, dir, ver, epsgCode); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "鍏冩暟鎹枃浠堕泦鍚�", dataType = "MetaFileEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/insertFiles") + public ResponseMsg<Object> insertFiles(@RequestBody List<MetaFileEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (null == ue) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + if (null == list || list.isEmpty()) { + return fail("鍏冩暟鎹枃浠堕泦鍚堜负绌�", null); + } + + uploadService.insertFiles(ue, list, req); + + return success("鎴愬姛", list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎鍏冩暟鎹�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1") + }) + @GetMapping(value = "/deleteMetas") + public ResponseMsg<Integer> deleteMetas(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = metaService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/show/ApplyController.java b/src/main/java/com/moon/server/controller/show/ApplyController.java new file mode 100644 index 0000000..5526bc3 --- /dev/null +++ b/src/main/java/com/moon/server/controller/show/ApplyController.java @@ -0,0 +1,305 @@ +package com.moon.server.controller.show; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.DownloadReqEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.show.ApplyEntity; +import com.moon.server.entity.show.FlowEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.AesHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.show.ApplyService; +import com.moon.server.service.show.FlowService; +import com.moon.server.service.sys.DownlogService; +import com.moon.server.service.sys.TokenService; +import com.moon.server.service.sys.UserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.sql.Timestamp; +import java.util.List; + +/** + * 鏁版嵁鐢宠 + * @author WWW + */ +@Api(tags = "缁煎悎灞曠ず\\鏁版嵁鐢宠") +@RestController +@RequestMapping("/apply") +public class ApplyController extends BaseController { + @Autowired + ApplyService applyService; + + @Autowired + FlowService flowService; + + @Autowired + TokenService tokenService; + + @Autowired + UserService userService; + + @Autowired + DownlogService downlogService; + + @Autowired + DownloadService downloadService; + + @SysLog() + @ApiOperation(value = "鎻掑叆鏁版嵁鐢宠") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dr", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/insertApply") + public ResponseMsg<Object> insertApply(@RequestBody DownloadReqEntity dr, HttpServletRequest req) { + try { + if (null == dr || null == dr.getEntities() || dr.getEntities().isEmpty()) { + return fail("璇烽�夋嫨瑕佷笅杞界殑瀹炰綋鍚�"); + } + if (StringHelper.isEmpty(dr.getPwd())) { + return fail("瀵嗙爜涓嶈兘涓虹┖"); + } + dr.setPwd(AesHelper.decrypt(dr.getPwd())); + if (StringHelper.isPwdInvalid(dr.getPwd())) { + return fail("瀵嗙爜涓嶇鍚堣姹�"); + } + if (!StringHelper.isEmpty(dr.getWkt())) { + dr.setWkt(AesHelper.decrypt(dr.getWkt())); + } + if (null == dr.getTabs() || dr.getTabs().isEmpty()) { + return fail("璇烽�夋嫨瑕佷笅杞界殑琛ㄥ悕"); + } + if (null == dr.getDepcodes() || dr.getDepcodes().isEmpty()) { + return fail("璇烽�夋嫨寰呯敵璇风殑鍗曚綅缂栫爜(澶氫釜浠ラ�楀彿闅斿紑)"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + int rows = applyService.insertApply(ue, dr); + + return success(rows); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ鐢宠") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "鍛�"), + @ApiImplicitParam(name = "status", value = "鐘舵��", dataType = "Integer", paramType = "query", example = "0"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-12-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-12-31 23:00:00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<Object> selectByPage(String uname, Integer status, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex, HttpServletRequest req) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = applyService.selectCount(uname, status, start, end); + if (count == 0) { + return success(0, null); + } + + UserEntity ue = tokenService.getCurrentUser(req); + List<ApplyEntity> rs = applyService.selectByPage(ue.getId(), uname, status, start, end, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ寰呭鏍告暟") + @GetMapping(value = "/selectSubmits") + public ResponseMsg<Object> selectSubmits(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + int rows = applyService.selectSubmits(ue.getId()); + + return success(rows); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ娴佺▼") + @ApiImplicitParams({ + @ApiImplicitParam(name = "applyid", value = "鏁版嵁鐢宠ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectFlows") + public ResponseMsg<Object> selectFlows(Integer applyid) { + try { + List<FlowEntity> rs = applyService.selectFlows(applyid); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "搴熷純鐢宠") + @ApiImplicitParams({ + @ApiImplicitParam(name = "applyid", value = "鏁版嵁鐢宠ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/updateForDiscard") + public ResponseMsg<Object> updateForDiscard(Integer applyid, HttpServletRequest req) { + try { + ApplyEntity applyEntity = applyService.selectById(applyid); + if (null == applyEntity) { + return fail("鎵句笉鍒版暟鎹敵璇�"); + } + if (!(applyEntity.getStatus() >= -1 && applyEntity.getStatus() <= StaticData.NINE)) { + return fail("璇ユ暟鎹敵璇锋棤娉曞簾寮�"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + int rows = applyService.updateForDiscard(ue.getId(), applyid); + + return success(rows); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "閲嶆柊鎻愪氦") + @ApiImplicitParams({ + @ApiImplicitParam(name = "applyid", value = "鏁版嵁鐢宠ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/updateForResubmit") + public ResponseMsg<Object> updateForResubmit(Integer applyid, HttpServletRequest req) { + try { + ApplyEntity applyEntity = applyService.selectById(applyid); + if (null == applyEntity) { + return fail("鎵句笉鍒版暟鎹敵璇�"); + } + if (-1 != applyEntity.getStatus()) { + return fail("璇ユ暟鎹敵璇锋棤闇�閲嶆柊鎻愪氦"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + int rows = applyService.updateForResubmit(ue.getId(), applyid); + + return success(rows); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻愪氦娴佺▼") + @ApiImplicitParams({ + @ApiImplicitParam(name = "flowId", value = "鐢宠娴佺▼ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/updateForSubmit") + public ResponseMsg<Object> updateForSubmit(Integer flowId, HttpServletRequest req) { + try { + FlowEntity flowEntity = flowService.selectById(flowId); + if (null == flowEntity) { + return fail("鎵句笉鍒扮敵璇锋祦绋�"); + } + if (flowEntity.getStatus() != 0) { + return fail("璇ョ敵璇锋祦绋嬫棤闇�鎻愪氦"); + } + + ApplyEntity applyEntity = applyService.selectById(flowEntity.getApplyid()); + if (null == applyEntity) { + return fail("鎵句笉鍒版暟鎹敵璇�"); + } + if (!(applyEntity.getStatus() >= 0 && applyEntity.getStatus() <= StaticData.NINE)) { + return fail("璇ユ暟鎹敵璇锋棤闇�鎵撳洖"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + int rows = applyService.updateForSubmit(ue.getId(), applyEntity.getId(), flowEntity.getId()); + + applyEntity = applyService.selectById(applyEntity.getId()); + if (StaticData.TEN == applyEntity.getStatus()) { + UserEntity user = userService.selectUser(applyEntity.getUserid()); + applyService.zipDbData(user, applyEntity); + } + + return success(rows); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎵撳洖娴佺▼") + @ApiImplicitParams({ + @ApiImplicitParam(name = "flowId", value = "鐢宠娴佺▼ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/updateForReject") + public ResponseMsg<Object> updateForReject(Integer flowId, HttpServletRequest req) { + try { + FlowEntity flowEntity = flowService.selectById(flowId); + if (null == flowEntity) { + return fail("鎵句笉鍒扮敵璇锋祦绋�"); + } + if (flowEntity.getStatus() != 0) { + return fail("璇ョ敵璇锋祦绋嬫棤闇�鎵撳洖"); + } + + ApplyEntity applyEntity = applyService.selectById(flowEntity.getApplyid()); + if (null == applyEntity) { + return fail("鎵句笉鍒版暟鎹敵璇�"); + } + if (!(applyEntity.getStatus() >= 0 && applyEntity.getStatus() <= StaticData.NINE)) { + return fail("璇ユ暟鎹敵璇锋棤闇�鎵撳洖"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + Integer rows = applyService.updateForReject(ue.getId(), applyEntity.getId(), flowEntity.getId()); + + return success(rows); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") + }) + @ResponseBody + @GetMapping(value = "/downloadFile") + public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { + try { + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); + return; + } + + UserEntity ue = tokenService.getCurrentUser(req); + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); + } + } +} diff --git a/src/main/java/com/moon/server/controller/show/ComprehensiveController.java b/src/main/java/com/moon/server/controller/show/ComprehensiveController.java new file mode 100644 index 0000000..eb91ed1 --- /dev/null +++ b/src/main/java/com/moon/server/controller/show/ComprehensiveController.java @@ -0,0 +1,336 @@ +package com.moon.server.controller.show; + +import com.moon.server.annotation.SysLog; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.DownloadReqEntity; +import com.moon.server.entity.ctrl.MarkJsonEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.data.MetaFileEntity; +import com.moon.server.entity.data.PublishEntity; +import com.moon.server.entity.show.PipelineEntity; +import com.moon.server.entity.sys.AttachEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.all.BaseQueryService; +import com.moon.server.service.all.BaseUploadService; +import com.moon.server.service.all.UploadAttachService; +import com.moon.server.service.data.DataQueryService; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.data.PublishService; +import com.moon.server.service.show.MarkService; +import com.moon.server.service.show.PipelineService; +import com.moon.server.service.sys.AttachService; +import com.moon.server.service.sys.DownlogService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 缁煎悎灞曠ず + * @author WWW + */ +@Api(tags = "缁煎悎灞曠ず\\棣栭〉") +@RestController +@RequestMapping("/comprehensive") +public class ComprehensiveController extends ModelController { + @Autowired + BaseQueryService baseQueryService; + + @Autowired + MarkService markService; + + @Autowired + TokenService tokenService; + + @Autowired + AttachService attachService; + + @Autowired + DownlogService downlogService; + + @Autowired + PublishService publishService; + + @Autowired + DownloadService downloadService; + + @Autowired + PipelineService pipelineService; + + @Autowired + DataQueryService dataQueryService; + + @Autowired + BaseUploadService baseUploadService; + + @Autowired + UploadAttachService uploadAttachService; + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ鍙戝竷娓呭崟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectPubById") + public ResponseMsg<PublishEntity> selectPubById(int id) { + try { + PublishEntity entity = publishService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ绠$嚎") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "瑗挎皵涓滆緭"), + }) + @GetMapping(value = "/selectPipelines") + public ResponseMsg<Object> selectPipelines(String name) { + try { + List<PipelineEntity> rs = pipelineService.selectPipelines(name); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ璺綉") + @ApiImplicitParams({ + @ApiImplicitParam(name = "x1", value = "X1", dataType = "Double", paramType = "query", example = "116.78999"), + @ApiImplicitParam(name = "y1", value = "Y1", dataType = "Double", paramType = "query", example = "39.9468"), + @ApiImplicitParam(name = "x2", value = "X2", dataType = "Double", paramType = "query", example = "116.80458"), + @ApiImplicitParam(name = "y2", value = "Y2", dataType = "Double", paramType = "query", example = "39.94758") + }) + @GetMapping(value = "/selectRoute") + public ResponseMsg<Object> selectRoute(double x1, double y1, double x2, double y2) { + try { + String route = baseQueryService.selectRoute(x1, y1, x2, y2); + + return success(route); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓婁紶ShapeFile鏂囦欢") + @ResponseBody + @PostMapping(value = "/uploadShp", produces = "application/json; charset=UTF-8") + public ResponseMsg<Object> uploadShp(HttpServletRequest req, HttpServletResponse res) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + List<MetaFileEntity> meList = baseUploadService.uploadData(null, null, false, req, res); + if (meList == null || meList.size() < StaticData.FOUR) { + return fail("娌℃湁鎵惧埌宸蹭笂浼犵殑鏁版嵁鎴栦笉瀹屾暣", null); + } + + List<MarkJsonEntity> list = markService.readShpForMarks(meList); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇ShapeFile鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "鏍囩粯JSON瀹炰綋绫婚泦鍚�", dataType = "MarkJsonEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/downloadShp", produces = "application/json; charset=UTF-8") + public ResponseMsg<String> downloadShp(@RequestBody List<MarkJsonEntity> list, HttpServletRequest req, HttpServletResponse res) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + if (list == null || list.isEmpty()) { + return fail("鎵句笉鍒版爣缁樻暟鎹�", null); + } + + String guid = markService.downloadShp(ue, list); + if (StringHelper.isNull(guid)) { + return fail("鐢熸垚ShapeFile鏂囦欢澶辫触", null); + } + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓婁紶鏂囦欢") + @ResponseBody + @ApiImplicitParams({ + @ApiImplicitParam(name = "tabName", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "lf.sys_style"), + @ApiImplicitParam(name = "eventid", value = "涓婚敭", dataType = "String", paramType = "query", example = "fa25979a5ef8b43ba82a0be35b3fb0d4") + }) + @PostMapping(value = "/uploadFiles") + public ResponseMsg<Integer> uploadFiles(String tabName, String eventid, @RequestParam("file") MultipartFile[] files, HttpServletRequest req) { + try { + if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) { + return fail("鍙傛暟涓嶈兘涓虹┖", null); + } + if (null == files || files.length == 0) { + return fail("鏂囦欢涓婁紶涓虹┖", 0); + } + + UserEntity ue = tokenService.getCurrentUser(req); + Integer count = dataQueryService.uploadFiles(ue, tabName, eventid, files, req); + + return success(count); + } catch (Exception ex) { + return fail(ex, 0); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") + }) + @RequestMapping(value = "/downloadFile", method = RequestMethod.GET) + public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, "鐢ㄦ埛鏈櫥褰�")); + } + + DownloadEntity de = downloadService.selectByGuid(guid); + if (de == null) { + WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�")); + } + + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, ex.getMessage())); + log.error(ex.getMessage(), ex); + } + } + + @SysLog() + @ApiOperation(value = "鏌ョ湅鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") + }) + @GetMapping(value = "/downloadForView") + public void downloadForView(String guid, HttpServletResponse res) { + uploadAttachService.download(guid, true, res); + } + + @SysLog() + @ApiOperation(value = "璇锋眰涓嬭浇") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guids", value = "闄勪欢Guid鏁扮粍", dataType = "String", paramType = "body", allowMultiple = true, example = "e5b6ae0889b88111f13a4b6e048348db,fa4f299e901a0c46e634f8fcc8185c0c") + }) + @ResponseBody + @PostMapping(value = "/downloadReqForGuids") + public ResponseMsg<Object> downloadReqForGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dre || null == dre.getGuids() || dre.getGuids().isEmpty()) { + return fail("Guid鏁扮粍涓虹┖"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String guid = uploadAttachService.downloadReqForGuids(ue, dre.getGuids()); + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "璇锋眰涓嬭浇") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "body", example = "bd.b_borehole"), + @ApiImplicitParam(name = "guids", value = "闄勪欢Guid鏁扮粍", dataType = "String", paramType = "body", allowMultiple = true, example = "08e5b4ad-93b8-46f6-adaa-46a6274af4ce,6f94f4f8-6e8d-44e7-8803-3d068d34983f") + }) + @ResponseBody + @PostMapping(value = "/downloadReqForTabGuids") + public ResponseMsg<Object> downloadReqForTabGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dre || StringHelper.isEmpty(dre.getTab())) { + return fail("琛ㄥ悕涓虹┖"); + } + if (null != dre.getGuids() && dre.getGuids().size() == 0) { + dre.setIds(null); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String guid = uploadAttachService.downloadReqForTabGuids(ue, dre.getTab(), dre.getGuids()); + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tabName", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "lf.sys_style"), + @ApiImplicitParam(name = "eventid", value = "涓婚敭", dataType = "String", paramType = "query", example = "fa25979a5ef8b43ba82a0be35b3fb0d4") + }) + @GetMapping(value = "/selectFiles") + public ResponseMsg<List<AttachEntity>> selectFiles(String tabName, String eventid) { + try { + if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) { + return fail("鍙傛暟涓嶈兘涓虹┖", null); + } + + List<AttachEntity> list = attachService.selectByTab(tabName, eventid); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deleteFiles(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int rows = attachService.deletes(ids); + + return success(rows); + } catch (Exception ex) { + return fail(ex, 0); + } + } +} diff --git a/src/main/java/com/moon/server/controller/show/DataLibController.java b/src/main/java/com/moon/server/controller/show/DataLibController.java new file mode 100644 index 0000000..51b62ea --- /dev/null +++ b/src/main/java/com/moon/server/controller/show/DataLibController.java @@ -0,0 +1,267 @@ +package com.moon.server.controller.show; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseQueryController; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.DownloadReqEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.data.VerEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.ClassHelper; +import com.moon.server.helper.Md5Helper; +import com.moon.server.helper.WebHelper; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.service.all.BaseQueryService; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.data.MetaService; +import com.moon.server.service.data.VerService; +import com.moon.server.service.show.DataLibService; +import com.moon.server.service.sys.TokenService; +import com.moon.server.helper.StringHelper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.*; + +/** + * 璧勬枡棣� + * @author WWW + */ +@Api(tags = "缁煎悎灞曠ず\\璧勬枡棣�") +@RestController +@RequestMapping("/dataLib") +public class DataLibController extends BaseQueryController { + @Autowired + MetaService metaService; + + @Autowired + TokenService tokenService; + + @Autowired + DataLibService dataLibService; + + @Autowired + BaseQueryService baseQueryService; + + @Autowired + VerService verService; + + @SysLog() + @ApiOperation(value = "鏍规嵁鐩綍ID鏌ヨ鐗堟湰鍒楄〃") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dirid", value = "鐩綍ID", dataType = "Integer", paramType = "query") + }) + @GetMapping(value = "/selectVerByDirid") + public ResponseMsg<List<VerEntity>> selectVerByDirid(Integer dirid) { + try { + if (null == dirid || dirid < 0) { + dirid = 0; + } + + List<VerEntity> list = verService.selectByDirid(dirid); + if (null == list || list.isEmpty()) { + list = verService.selectByDirid(0); + } + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ鍏冩暟鎹�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), + @ApiImplicitParam(name = "dirs", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00,01"), + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectMetasForPage") + public ResponseMsg<Object> selectMetasForPage(String depcode, String dirs, String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + dirs = DataLibService.copeCodes(dirs, "dircode"); + + int count = metaService.selectMetasForCount(depcode, dirs, name); + if (count == 0) { + return success(0, null); + } + + List<MetaEntity> rs = metaService.selectMetasForPage(depcode, dirs, name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ琛ㄤ腑鏁版嵁") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鍏冩暟鎹甀D", dataType = "Integer", paramType = "query", example = "115"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10") + }) + @GetMapping(value = "/selectDbData") + public ResponseMsg<Object> selectDbData(Integer id, Integer pageIndex, Integer pageSize) { + // noinspection AlibabaRemoveCommentedCode + try { + if (null == id || id < 0) { + return fail("鍏冩暟鎹甀D涓嶈兘涓虹┖鎴栧皬浜�0", null); + } + + MetaEntity meta = metaService.selectById(id); + if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { + return fail("鎵句笉鍒板厓鏁版嵁淇℃伅", null); + } + + String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); + BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); + if (null == baseMapper) { + return null; + } + + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("parentid", meta.getEventid()); + + Page<Object> page = new Page<>(pageIndex, pageSize); + page.addOrder(OrderItem.desc("gid")); + IPage<Object> paged = baseMapper.selectPage(page, wrapper); + + return success(paged.getTotal(), paged.getRecords()); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "璇锋眰鍏冩暟鎹笅杞�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dr", value = "璇锋眰涓嬭浇瀹炰綋", dataType = "DownloadReqEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/downloadReq") + public ResponseMsg<Object> downloadReq(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dr || StringHelper.isEmpty(dr.getPwd())) { + return fail("瀵嗙爜涓嶈兘涓虹┖"); + } + if (null == dr.getIds() || dr.getIds().isEmpty()) { + return fail("璇烽�夋嫨瑕佷笅杞界殑鏂囦欢ID"); + } + if (!DownloadService.decryptPwd(dr)) { + return fail("瀵嗙爜瑙e瘑澶辫触", null); + } + if (StringHelper.isPwdInvalid(dr.getPwd())) { + return fail("瀵嗙爜涓嶇鍚堣姹�"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String guid = metaService.downloadMeteReq(ue, dr); + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") + }) + @GetMapping(value = "/selectDownloadFile") + public ResponseMsg<Boolean> selectDownloadFile(String guid, String pwd) { + try { + if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { + return fail("鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", null); + } + if (!pwd.endsWith(StaticData.EQ)) { + pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); + } + + String password = DownloadService.decryptPwd(pwd); + if (null == password) { + return fail("瀵嗙爜瑙e瘑澶辫触", null); + } + + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + return fail("鏂囦欢涓嶅瓨鍦�", null); + } + if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { + return fail("瀵嗙爜涓嶆纭�", null); + } + + String filePath = downloadService.getDownloadFilePath(de); + File file = new File(filePath); + + return success(file.exists()); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") + }) + @ResponseBody + @GetMapping(value = "/downloadFile") + @SuppressWarnings("AlibabaRemoveCommentedCode") + public void downloadFile(String guid, String pwd, HttpServletRequest req, HttpServletResponse res) { + try { + /*if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { + WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", res); + } + if (!pwd.endsWith(StaticData.EQ)) { + pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); + } + + String password = DownloadService.decryptPwd(pwd); + if (null == password) { + WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "瀵嗙爜瑙e瘑澶辫触", res); + }*/ + + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); + return; + } + /*if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { + WebHelper.writeInfo(HttpStatus.UNAUTHORIZED, "瀵嗙爜涓嶆纭�", res); + }*/ + + UserEntity ue = tokenService.getCurrentUser(req); + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); + } + } +} diff --git a/src/main/java/com/moon/server/controller/show/ExportController.java b/src/main/java/com/moon/server/controller/show/ExportController.java new file mode 100644 index 0000000..5ce4fba --- /dev/null +++ b/src/main/java/com/moon/server/controller/show/ExportController.java @@ -0,0 +1,136 @@ +package com.moon.server.controller.show; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.show.ExportEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.show.ExportService; +import com.moon.server.service.sys.DownlogService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 鍦ㄧ嚎鍒跺浘 + * @author WWW + */ +@Api(tags = "缁煎悎灞曠ず\\鍦ㄧ嚎鍒跺浘") +@RestController +@RequestMapping("/export") +public class ExportController extends BaseController { + @Autowired + TokenService tokenService; + + @Autowired + ExportService exportService; + + @Autowired + DownlogService downlogService; + + @Autowired + DownloadService downloadService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<DownloadEntity>> selectPageCountForDownload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + int count = downloadService.selectCountForUser(ue.getId(), "2", name); + if (count == 0) { + return success(0, null); + } + List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), "2", name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏂板缓鍑哄浘") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "鍦ㄧ嚎鍒跺浘瀹炰綋绫�", dataType = "ExportEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/insertMap", produces = "application/json; charset=UTF-8") + public ResponseMsg<String> insertMap(@RequestBody ExportEntity entity, HttpServletRequest req) { + try { + boolean flag = entity.getXmin() == 0 && entity.getYmin() == 0 && entity.getXmax() == 0 && entity.getYmax() == 0; + if (StringHelper.isEmpty(entity.getLayers()) || StringHelper.isEmpty(entity.getToken()) || flag) { + return fail("鍙傛暟涓嶅畬鏁�"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�"); + } + + String str = exportService.post(ue, entity); + if (StringHelper.isNull(str)) { + return fail("鍑哄浘澶辫触"); + } + + return success("鍑哄浘鎴愬姛", str); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鍑哄浘") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") + }) + @RequestMapping(value = "/downloadFile", method = RequestMethod.GET) + public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { + try { + if (StringHelper.isEmpty(guid)) { + WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "鎵句笉鍒版枃浠禝D", res); + return; + } + + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); + return; + } + + UserEntity ue = tokenService.getCurrentUser(req); + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); + } + } +} diff --git a/src/main/java/com/moon/server/controller/show/InquiryController.java b/src/main/java/com/moon/server/controller/show/InquiryController.java new file mode 100644 index 0000000..67113bd --- /dev/null +++ b/src/main/java/com/moon/server/controller/show/InquiryController.java @@ -0,0 +1,142 @@ +package com.moon.server.controller.show; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseQueryController; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.DownloadTileEntity; +import com.moon.server.entity.ctrl.ShpRecordEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.data.MetaFileEntity; +import com.moon.server.entity.data.PublishEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.AesHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.all.BaseUploadService; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.data.PublishService; +import com.moon.server.service.show.InquiryService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 鏌ヨ + * @author WWW + */ +@Api(tags = "缁煎悎灞曠ず\\鏌ヨ") +@RestController +@RequestMapping("/inquiry") +public class InquiryController extends BaseQueryController { + @Autowired + TokenService tokenService; + + @Autowired + BaseUploadService baseUploadService; + + @Autowired + InquiryService inquiryService; + + @Resource + PublishService publishService; + + @SysLog() + @ApiOperation(value = "涓婁紶Shp鏂囦欢璇诲彇绗竴鏉¤褰曠殑WKT") + @ResponseBody + @PostMapping(value = "/uploadShp") + public ResponseMsg<ShpRecordEntity> uploadShp(HttpServletRequest req, HttpServletResponse res) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + List<MetaFileEntity> list = baseUploadService.uploadData(null, null, false, req, res); + if (list == null || list.size() < StaticData.FOUR) { + return fail("娌℃湁鎵惧埌宸蹭笂浼犵殑鏁版嵁鎴栦笉瀹屾暣", null); + } + + ShpRecordEntity sr = inquiryService.readShpFirstRecord(list); + if (sr != null && !StringHelper.isEmpty(sr.getWkt())) { + sr.setWkt(AesHelper.encrypt(sr.getWkt())); + } + + return success(sr); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鐡︾墖") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dt", value = "涓嬭浇鐡︾墖瀹炰綋绫�", dataType = "DownloadTileEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/downloadTiles") + public ResponseMsg<Object> downloadTiles(@RequestBody DownloadTileEntity dt, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dt || null == dt.getPubid() || StringHelper.isEmpty(dt.getPwd())) { + return fail("鍙戝竷ID鍜屽瘑鐮佷笉鑳戒负绌�"); + } + String err = dt.verifyCoords(); + if (null != err) { + return fail(err); + } + if (!DownloadService.decryptPwd(dt)) { + return fail("瀵嗙爜瑙e瘑澶辫触", null); + } + + PublishEntity pub = publishService.selectById(dt.getPubid()); + if (null == pub) { + return fail("鍙戝竷鏁版嵁涓嶅瓨鍦�"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String guid = inquiryService.zipTiles(dt, pub, ue); + if (null == guid) { + return fail("娌℃湁鐡︾墖闇�瑕佹墦鍖呬笅杞�"); + } + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") + }) + @ResponseBody + @GetMapping(value = "/downloadFile") + public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { + try { + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); + return; + } + + UserEntity ue = tokenService.getCurrentUser(req); + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); + } + } +} diff --git a/src/main/java/com/moon/server/controller/show/MarkController.java b/src/main/java/com/moon/server/controller/show/MarkController.java new file mode 100644 index 0000000..cbec4b1 --- /dev/null +++ b/src/main/java/com/moon/server/controller/show/MarkController.java @@ -0,0 +1,217 @@ +package com.moon.server.controller.show; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.show.MarkEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.BaseUploadService; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.show.MarkService; +import com.moon.server.service.sys.DownlogService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鏍囩粯 + * @author WWW + */ +@Api(tags = "缁煎悎灞曠ず\\鏍囩粯") +@RestController +@RequestMapping("/mark") +public class MarkController extends BaseController { + @Autowired + MarkService markService; + + @Autowired + TokenService tokenService; + + @Autowired + BaseUploadService baseUploadService; + + @Autowired + DownlogService downlogService; + + @Autowired + DownloadService downloadService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<MarkEntity>> selectByPageAndCount(Integer pageSize, Integer pageIndex, HttpServletRequest req) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + int count = markService.selectCount(ue.getId()); + if (count == 0) { + return success(0, null); + } + + List<MarkEntity> rs = markService.selectByPage(ue.getId(), pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<MarkEntity> selectById(int id) { + try { + MarkEntity entity = markService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MarkEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody MarkEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = markService.insert(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MarkEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<MarkEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (MarkEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = markService.inserts(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = markService.delete(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = markService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MarkEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody MarkEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = markService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MarkEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<MarkEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (MarkEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = markService.updates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/show/ModelController.java b/src/main/java/com/moon/server/controller/show/ModelController.java new file mode 100644 index 0000000..069be5b --- /dev/null +++ b/src/main/java/com/moon/server/controller/show/ModelController.java @@ -0,0 +1,220 @@ +package com.moon.server.controller.show; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.show.ModelEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.show.ModelService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 妯″瀷 + * @author WWW + */ +public class ModelController extends BaseController { + @Autowired + ModelService modelService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ妯″瀷骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "layerid", value = "鍥惧眰ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectModelByPageAndCount") + public ResponseMsg<List<ModelEntity>> selectModelByPageAndCount(Integer layerid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = modelService.selectCount(layerid); + if (count == 0) { + return success(0, null); + } + + List<ModelEntity> rs = modelService.selectByPage(layerid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ妯″瀷") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectModelById") + public ResponseMsg<ModelEntity> selectModelById(int id) { + try { + ModelEntity entity = modelService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁Guid鏌ヨ妯″瀷") + @ApiImplicitParams({ + @ApiImplicitParam(name = "layerid", value = "鍥惧眰ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "modelid", value = "妯″瀷ID", dataType = "String", paramType = "query", example = "") + }) + @GetMapping(value = "/selectModelByGuid") + public ResponseMsg<ModelEntity> selectModelByGuid(Integer layerid, String modelid) { + try { + if (null == layerid || StringHelper.isEmpty(modelid)) { + return fail("鍥惧眰ID鍜屾ā鍨婭D涓嶈兘涓虹┖", null); + } + + ModelEntity entity = modelService.selectModelByGuid(layerid, modelid); + + return success(entity); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�涓ā鍨�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ModelEntity", paramType = "body") + }) + @PostMapping(value = "/insertModel", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertModel(@RequestBody ModelEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = modelService.insert(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氫釜妯″瀷") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ModelEntity", paramType = "body") + }) + @PostMapping(value = "/insertModels", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertModels(@RequestBody List<ModelEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (ModelEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = modelService.inserts(list); + + return success(count); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�涓ā鍨�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteModel") + public ResponseMsg<Integer> deleteModel(int id) { + try { + int count = modelService.delete(id); + + return success(count); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氫釜妯″瀷") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteModels") + public ResponseMsg<Integer> deleteModels(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = modelService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�涓ā鍨�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ModelEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updateModel", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateModel(@RequestBody ModelEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = modelService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氫釜妯″瀷") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ModelEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updateModels", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateModels(@RequestBody List<ModelEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (ModelEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = modelService.updates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/show/OneMapController.java b/src/main/java/com/moon/server/controller/show/OneMapController.java new file mode 100644 index 0000000..511f591 --- /dev/null +++ b/src/main/java/com/moon/server/controller/show/OneMapController.java @@ -0,0 +1,389 @@ +package com.moon.server.controller.show; + + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.show.OneMapEntity; +import com.moon.server.service.show.OneMapService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 绠$綉涓�寮犲浘 + * aFigurePipelineNetwork + * + * @author xing + * @date 2023/02/13 + */ + +@Api(tags = "缁煎悎灞曠ず\\绠$綉涓�寮犲浘") +@RestController +@RequestMapping("/oneMap") +public class OneMapController extends BaseController { + + @Autowired + OneMapService aMapOfPipelineService; + + + //============[椤圭洰缁熻 project Statistics]================== + + /** + * 椤圭洰绫诲埆 + * Project category + */ + @SysLog() + @ApiOperation(value = "椤圭洰绫诲埆") + @GetMapping("/countProjectCategory") + public ResponseMsg<Object> projectCategoryCount() { + List<String> resList = aMapOfPipelineService.projectCategoryCount(); + return success(resList); + } + + /** + * 椤圭洰浣嶇疆鍒嗗竷鎺ュ彛 + * Project location + */ + @SysLog() + @ApiOperation(value = "椤圭洰浣嶇疆鍒嗗竷鎺ュ彛") + @GetMapping("/countProjectLocation") + public ResponseMsg<Object> projectLocationCount() { + List<String> resList = aMapOfPipelineService.projectLocationCount(); + return success(resList); + } + + + /** + * 鍥藉缁村害-鏁伴噺缁熻 + * Country dimension + */ + @SysLog() + @ApiOperation(value = "鍥藉缁村害-鏁伴噺缁熻") + @GetMapping("/countCountryDimension") + public ResponseMsg<Object> countryDimensionCount() { + List<String> resList = aMapOfPipelineService.countryDimensionCount(); + return success(resList); + } + + /** + * 鐪佺淮搴�-鏁伴噺缁熻 + * Province dimension - quantity + */ + @SysLog() + @ApiOperation(value = "鐪佺淮搴�-鏁伴噺缁熻") + @GetMapping("/countProvinceDimension") + public ResponseMsg<Object> provinceDimensionCount() { + List<String> resList = aMapOfPipelineService.provinceDimensionCount(); + return success(resList); + } + + /** + * 鍏ㄥ浗缁村害-鎸夌収椤硅嚜绫诲瀷缁熻涓嶅悓椤圭洰涓暟 + * Count the number of different items according to their type + */ + @SysLog() + @ApiOperation(value = "鍏ㄥ浗缁村害-鎸夌収椤硅嚜绫诲瀷缁熻涓嶅悓椤圭洰涓暟") + @GetMapping("/countProjectTypeNumber") + public ResponseMsg<Object> countProjectTypeNumber() { + List<String> resList = aMapOfPipelineService.countProjectTypeNumber(); + return success(resList); + } + + + //============[鏁版嵁缁熻 data Statistics]================== + + /** + * 鏁版嵁缁熻 + * 鏁版嵁瀛樺偍 + * data storage + */ + @SysLog() + @ApiOperation(value = "鏁版嵁瀛樺偍缁熻") + @GetMapping("/countDataStorage") + public ResponseMsg<Object> dataStorageCount() { + List<String> resList = aMapOfPipelineService.dataStorageCount(); + return success(resList); + } + + /** + * 鏁版嵁澶х被缁熻 + * Statistics of large categories of data + */ + @SysLog() + @ApiOperation(value = "鏁版嵁澶х被缁熻") + @GetMapping("/countLargeCategories") + public ResponseMsg<Object> statisticalDataCategories() { + List<String> resList = aMapOfPipelineService.statisticalDataCategories(); + return success(resList); + } + + /** + * 鏁版嵁鏈嶅姟绫诲瀷缁熻 + * Data service type statistics + */ + @SysLog() + @ApiOperation(value = "鏁版嵁鏈嶅姟绫诲瀷缁熻") + @GetMapping("/countDataServiceType") + public ResponseMsg<Object> statisticalDataServiceType() { + List<String> resList = aMapOfPipelineService.statisticalDataServiceType(); + return success(resList); + } + + /** + * 鐧诲綍娆℃暟缁熻 + * Number of logins + */ + @SysLog() + @ApiOperation(value = "鐧诲綍娆℃暟缁熻") + @GetMapping("/countLoginNumber") + public ResponseMsg<Object> loginNumberStatistics() { + List<String> resList = aMapOfPipelineService.loginNumberStatistics(); + return success(resList); + } + + + /** + * 鏁版嵁缁熻 + * 鏂囦欢鏍煎紡缁村害-鏂囦欢涓暟 + * File format dimension + */ + @SysLog() + @ApiOperation(value = "鏂囦欢鏍煎紡缁村害-鏂囦欢涓暟") + @GetMapping("/countFileFormat") + public ResponseMsg<Object> fileFormatCount() { + List<String> resList = aMapOfPipelineService.fileFormatCount(); + return success(resList); + } + + /** + * 鏁版嵁缁熻 + * 鏁版嵁鐢宠 + * Data application + */ + @SysLog() + @ApiOperation(value = "鏁版嵁鐢宠") + @GetMapping("/countDataApply") + public ResponseMsg<Object> dataApplyCount() { + List<String> resList = aMapOfPipelineService.dataApplyCount(); + return success(resList); + } + + /** + * 鏁版嵁缁熻 + * 璁块棶娆℃暟 + * Number of visits + */ + @SysLog() + @ApiOperation(value = "璁块棶娆℃暟") + @GetMapping("/countDataVisit") + public ResponseMsg<Object> dataVisitCount() { + List<String> resList = aMapOfPipelineService.dataVisitCount(); + return success(resList); + } + + /** + * 涓嬭浇閲忕粺璁� + * Download statistics + * <p>type绫诲瀷锛�1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡<p/> + */ + @SysLog() + @ApiOperation(value = "涓嬭浇閲忕粺璁�") + @GetMapping("/countDownloads") + public ResponseMsg<Object> countDownloads() { + List<String> resList = aMapOfPipelineService.countDownloads(); + return success(resList); + } + + + /** + * 椤圭洰宸ョ▼灞曠ず + * Project engineering display + */ + @SysLog() + @ApiOperation(value = "椤圭洰宸ョ▼灞曠ず") + @GetMapping("/countProjectDisplay") + public ResponseMsg<Object> countProjectDisplay() { + List<String> resList = aMapOfPipelineService.countProjectDisplay(); + return success(resList); + } + + /** + * 椤圭洰宸ョ▼宸¤鍒楄〃 + * Project inspection tour + */ + @SysLog() + @ApiOperation(value = "椤圭洰宸ョ▼宸¤鍒楄〃") + @GetMapping("/selectProjectTour") + public ResponseMsg<Object> selectProjectTour() { + List<String> resList = aMapOfPipelineService.selectProjectTour(); + return success(resList); + } + + + /** + * 宸ョ▼椤圭洰鐩綍 + * Project Catalog + */ + @SysLog() + @ApiOperation(value = "宸ョ▼椤圭洰鐩綍") + @GetMapping("/selectProjectType") + public ResponseMsg<Object> selectProjectType() { + List<OneMapEntity> resList = aMapOfPipelineService.selectProjectType1(); + return success(resList); + } + + /** + * 鏍规嵁琛ㄥ悕鏌ヨ琛ㄥ瓧娈典俊鎭� + * Query table field information according to table name + */ + @ApiOperation(value = "鏍规嵁琛ㄥ悕鏌ヨ琛ㄥ瓧娈典俊鎭�") + @GetMapping("/selectTableInfo") + public ResponseMsg<Object> selectTableInfo(@RequestParam("tableName") String tableName) { + List<String> resList = aMapOfPipelineService.queryTableInfo(tableName); + return success(resList); + } + + + //============[涓撻灞曠ず Thematic presentations]================== + + /** + * 鍏ㄧ悆绠$綉鍥� + * Global pipe network map + */ + @SysLog() + @ApiOperation(value = "鍏ㄧ悆绠$綉鍥�") + @GetMapping("/countGlobalPipeMap") + public ResponseMsg<Object> countGlobalPipeMap() { + List<String> resList = aMapOfPipelineService.countGlobalPipeMap(); + return success(resList); + } + + /** + * 鍏ㄥ浗绠$綉鍥� + * National pipe network map + */ + @SysLog() + @ApiOperation(value = "鍏ㄥ浗绠$綉鍥�") + @GetMapping("/countNationalPipeMap") + public ResponseMsg<Object> countNationalPipeMap() { + List<String> resList = aMapOfPipelineService.countNationalPipeMap(); + return success(resList); + } + + /** + * 鍏ㄥ浗绠$綉鍥捐緭閫佷粙璐ㄩ暱搴� + * National pipe network diagram conveying medium length + */ + @SysLog() + @ApiOperation(value = "鍏ㄥ浗绠$綉鍥捐緭閫佷粙璐ㄩ暱搴�") + @GetMapping("/countZhPipeMapLength") + public ResponseMsg<Object> countZhPipeMapLenByMed() { + List<String> resList = aMapOfPipelineService.countZhPipeMapLenByMed(); + return success(resList); + } + + /** + * 缁熻鍏ㄥ浗绔欏満搴ф暟 + * Number of station seats nationwide + */ + @SysLog() + @ApiOperation(value = "鍏ㄥ浗绔欏満搴ф暟銆侀榾瀹ゃ�佺閬撴暟绛�") + @GetMapping("/countZhPipeStations") + public ResponseMsg<Object> countZhPipeStations() { + List<String> resList = aMapOfPipelineService.countZhPipeStations(); + return success(resList); + } + + /** + * 鎸夐」鐩粺璁¢」鐩瓨鍌ㄩ噺 + * Count the amount of project storage by project + */ + @SysLog() + @ApiOperation(value = "鎸夐」鐩粺璁¢」鐩瓨鍌ㄩ噺") + @GetMapping("/countStorageByProject") + public ResponseMsg<Object> countStorageByProject() { + List<String> resList = aMapOfPipelineService.countStorageByProject(); + return success(resList); + } + + + //============[宸ョ▼灞曠ず Engineering Showcase]================== + + /** + * 椤圭洰淇℃伅鏌ヨ + * Project information query + */ + @SysLog() + @ApiOperation(value = "椤圭洰淇℃伅鏌ヨ") + @GetMapping("/selectProjectInfo") + public ResponseMsg<Object> selectProjectInfo(@RequestParam("projectCode") String projectCode) { + List<String> resList = aMapOfPipelineService.selectProjectInfo(projectCode); + return success(resList); + } + /** + * 椤圭洰鏂囦欢鍒楄〃鏌ヨ + * Project file list query + */ + @SysLog() + @ApiOperation(value = "椤圭洰鏂囦欢鍒楄〃鏌ヨ") + @GetMapping("/selectProjectFileList") + public ResponseMsg<Object> selectProjectFileList() { + List<String> resList = aMapOfPipelineService.selectProjectFileList(); + return success(resList); + } + + /** + * 鍗曚釜椤圭洰瀛樺偍閲� + * + * @param projectCode 椤圭洰浠g爜 + * @return {@link ResponseMsg}<{@link Object}> + */ + @SysLog() + @ApiOperation(value = "鍗曚釜椤圭洰瀛樺偍閲�") + @GetMapping("/countProjectStorage") + public ResponseMsg<Object> countProjectStorage(@RequestParam("projectCode") String projectCode) { + List<String> resList = aMapOfPipelineService.countProjectStorage(projectCode); + return success(resList); + } + + /** + * 鍗曚釜椤圭洰鏂囦欢鏁伴噺 + * The number of individual project files + * + * @param projectCode 椤圭洰浠g爜 + * @return {@link ResponseMsg}<{@link Object}> + */ + @SysLog() + @ApiOperation(value = "鍗曚釜椤圭洰鏂囦欢绫诲瀷鏁伴噺") + @GetMapping("/countProjectType") + public ResponseMsg<Object> countProjectType(@RequestParam("projectCode") String projectCode) { + List<String> resList = aMapOfPipelineService.countProjectType(projectCode); + return success(resList); + } + + + /** + * 缁熻椤圭洰涓� + * 鍗曚釜椤圭洰涓嬭浇閲� + * + * @param projectCode 椤圭洰浠g爜 + * @return {@link ResponseMsg}<{@link Object}> + */ + @SysLog() + @ApiOperation(value = "鍗曚釜椤圭洰涓嬭浇閲�") + @GetMapping("/countProjectDown") + public ResponseMsg<Object> countProjectDown(@RequestParam("projectCode") String projectCode) { + List<String> resList = aMapOfPipelineService.countProjectDown(projectCode); + return success(resList); + } + + + +} diff --git a/src/main/java/com/moon/server/controller/show/PipelineController.java b/src/main/java/com/moon/server/controller/show/PipelineController.java new file mode 100644 index 0000000..772e166 --- /dev/null +++ b/src/main/java/com/moon/server/controller/show/PipelineController.java @@ -0,0 +1,263 @@ +package com.moon.server.controller.show; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.show.PipelineEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.Md5Helper; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.show.PipelineService; +import com.moon.server.service.sys.DownlogService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.*; + +/** + * 绠¢亾鍒嗘瀽 + * @author WWW + */ +@Api(tags = "缁煎悎灞曠ず\\绠¢亾鍒嗘瀽") +@RestController +@RequestMapping("/pipeline") +public class PipelineController extends BaseController { + @Autowired + TokenService tokenService; + + @Autowired + DownlogService downlogService; + + @Autowired + DownloadService downloadService; + + @Autowired + PipelineService pipelineService; + + @SysLog() + @ApiOperation(value = "鏌ヨ绠℃") + @GetMapping(value = "/selectSegNames") + public ResponseMsg<Object> selectSegNames() { + try { + List<PipelineEntity> rs = pipelineService.selectSegNames(); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ绠$嚎鍒嗘瀽") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pe", value = "绠¢亾鍒嗘瀽瀹炰綋绫�", dataType = "PipelineEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/selectPipeAnalysis") + public ResponseMsg<Object> selectPipeAnalysis(@RequestBody PipelineEntity pe) { + try { + if (null == pe.getGid() || pe.getGid() < 1) { + return fail("璇疯緭鍏ョ娈礗D"); + } + if (null == pe.getTabs() || 0 == pe.getTabs().size()) { + return fail("璇疯緭鍏ヨ〃鍚�"); + } + if (!checkTabs(pe.getTabs())) { + return fail("瀛樺湪闈炴硶琛ㄥ悕"); + } + + Map<String, Object> map = new HashMap<>(4); + for (String tab : pe.getTabs()) { + List<PipelineEntity> rs = pipelineService.selectPipeAnalysis(tab, pe.getGid()); + map.put(tab, rs); + } + + return success(map); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "璇锋眰绠¢亾鍒嗘瀽缁撴灉涓嬭浇") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pe", value = "绠¢亾鍒嗘瀽瀹炰綋绫�", dataType = "PipelineEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/downloadReq") + public ResponseMsg<Object> downloadReq(@RequestBody PipelineEntity pe, HttpServletRequest req) { + try { + if (null == pe || StringHelper.isEmpty(pe.getPwd())) { + return fail("瀵嗙爜涓嶈兘涓虹┖"); + } + if (null == pe.getTabs() || 0 == pe.getTabs().size()) { + return fail("璇疯緭鍏ヨ〃鍚�"); + } + if (!checkTabs(pe.getTabs())) { + return fail("瀛樺湪闈炴硶琛ㄥ悕"); + } + if (!DownloadService.decryptPwd(pe)) { + return fail("瀵嗙爜瑙e瘑澶辫触", null); + } + if (StringHelper.isPwdInvalid(pe.getPwd())) { + return fail("瀵嗙爜涓嶇鍚堣姹�"); + } + + Map<String, List<PipelineEntity>> map = new HashMap<>(4); + for (String tab : pe.getTabs()) { + List<PipelineEntity> rs = pipelineService.selectPipeAnalysis(tab, pe.getGid()); + if (null != rs && rs.size() > 0) { + map.put(tab, rs); + } + } + if (map.size() == 0) { + return fail("鏌ユ棤鏁版嵁"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String guid = pipelineService.createZipFile(ue, map, pe.getPwd()); + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectPageCountForDownload") + public ResponseMsg<List<DownloadEntity>> selectPageCountForDownload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", null); + } + + int count = downloadService.selectCountForUser(ue.getId(), "5", name); + if (count == 0) { + return success(0, null); + } + List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), "5", name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") + }) + @GetMapping(value = "/selectDownloadFile") + public ResponseMsg<Boolean> selectDownloadFile(String guid, String pwd) { + try { + if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { + return fail("鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", null); + } + if (!pwd.endsWith(StaticData.EQ)) { + pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); + } + + String password = DownloadService.decryptPwd(pwd); + if (null == password) { + return fail("瀵嗙爜瑙e瘑澶辫触", null); + } + + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + return fail("鏂囦欢涓嶅瓨鍦�", null); + } + if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { + return fail("瀵嗙爜涓嶆纭�", null); + } + + String filePath = downloadService.getDownloadFilePath(de); + File file = new File(filePath); + + return success(file.exists()); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "pwd", value = "瀵嗙爜", dataType = "String", paramType = "query") + }) + @ResponseBody + @GetMapping(value = "/downloadFile") + public void downloadFile(String guid, String pwd, HttpServletRequest req, HttpServletResponse res) { + try { + if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) { + WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "鏂囦欢ID鍜屽瘑鐮佷笉鑳戒负绌�", res); + } + if (!pwd.endsWith(StaticData.EQ)) { + pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name()); + } + + String password = DownloadService.decryptPwd(pwd); + if (null == password) { + WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "瀵嗙爜瑙e瘑澶辫触", res); + } + + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); + return; + } + if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) { + WebHelper.writeInfo(HttpStatus.UNAUTHORIZED, "瀵嗙爜涓嶆纭�", res); + } + + UserEntity ue = tokenService.getCurrentUser(req); + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); + } + } + + /** + * 妫�鏌ヨ〃鍚� + */ + private boolean checkTabs(List<String> tabs) { + for (String tab : tabs) { + if (!StaticData.PIPE_ANALYSIS_TABS.contains(tab)) { + return false; + } + } + + return true; + } +} diff --git a/src/main/java/com/moon/server/controller/sys/ArgsController.java b/src/main/java/com/moon/server/controller/sys/ArgsController.java new file mode 100644 index 0000000..8b26d85 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/ArgsController.java @@ -0,0 +1,263 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.ArgsEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.sys.ArgsService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鍙傛暟璁剧疆 + * @author WWW + */ +@Api(tags = "杩愮淮绠$悊\\绯荤粺閰嶇疆") +@RestController +@RequestMapping("/args") +public class ArgsController extends BaseController { + @Autowired + ArgsService argsService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "鏈夋晥鏈�") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String name) { + try { + int count = argsService.selectCount(name); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鏈夋晥鏈�"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<ArgsEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<ArgsEntity> rs = argsService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鏈夋晥鏈�"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<ArgsEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = argsService.selectCount(name); + if (count == 0) { + return success(0, null); + } + List<ArgsEntity> rs = argsService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAll") + public ResponseMsg<List<ArgsEntity>> selectAll() { + try { + List<ArgsEntity> list = argsService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<ArgsEntity> selectById(int id) { + try { + ArgsEntity entity = argsService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + /*@SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ArgsEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody ArgsEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = argsService.insert(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ArgsEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<ArgsEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (ArgsEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = argsService.inserts(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = argsService.delete(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = argsService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + }*/ + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ArgsEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody ArgsEntity entity, HttpServletRequest req) { + try { + ArgsEntity ae = argsService.selectById(entity.getId()); + if (ae == null) { + return fail("鎵句笉鍒板緟鏇存柊鐨勫疄浣�", -1); + } + if (entity.getCvalue() > ae.getMaxValue() || entity.getCvalue() < ae.getMinValue()) { + return fail("寰呮洿鏂扮殑鍊间笉鍦ㄦ湁鏁堣寖鍥村唴", -1); + } + ae.setCvalue(entity.getCvalue()); + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + ae.setUpdateUser(ue.getId()); + } + + int count = argsService.updateForValue(ae); + if (count > 0) { + argsService.updateSettingData(ae); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + /*@SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ArgsEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<ArgsEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (ArgsEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = argsService.updates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + }*/ +} diff --git a/src/main/java/com/moon/server/controller/sys/AuthController.java b/src/main/java/com/moon/server/controller/sys/AuthController.java new file mode 100644 index 0000000..8f76ffd --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/AuthController.java @@ -0,0 +1,274 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.AuthEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.PermsService; +import com.moon.server.service.sys.AuthService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鏉冮檺琛� + * @author SWS + * @date 2022-09.28 + */ +@Api(tags = "杩愮淮绠$悊\\鏉冮檺绠$悊") +@RestController +@RequestMapping("/auth") +public class AuthController extends BaseController { + @Autowired + AuthService authService; + + @Autowired + TokenService tokenService; + + @Autowired + PermsService permsService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "sys_auth") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String name) { + try { + int count = authService.selectCount(name); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "sys_auth"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<AuthEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + List<AuthEntity> rs = authService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<AuthEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = authService.selectCount(name); + if (count == 0) { + return success(0, null); + } + + List<AuthEntity> rs = authService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鑿滃崟鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageForMenu") + public ResponseMsg<List<AuthEntity>> selectByPageForMenu(Integer menuid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = authService.selectCountForMenu(menuid); + if (count == 0) { + return success(0, null); + } + + List<AuthEntity> rs = authService.selectByPageForMenu(menuid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.AuthEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertAuth", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertAuth(@RequestBody AuthEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = authService.insertAuth(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<AuthEntity>", paramType = "body", example = "") + }) + @PostMapping(value = "/insertAuths", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertAuths(@RequestBody List<AuthEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (AuthEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = authService.insertAuths(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteAuth") + public ResponseMsg<Integer> deleteAuth(int id) { + try { + int count = authService.deleteAuth(id); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteAuths") + public ResponseMsg<Integer> deleteAuths(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = authService.deleteAuths(ids); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "LoginEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateAuth", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateAuth(@RequestBody AuthEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = authService.updateAuth(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectAuth") + public ResponseMsg<AuthEntity> selectAuth(int id) { + try { + AuthEntity authEntity = authService.selectAuth(id); + + return success(authEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAuthAll") + public ResponseMsg<List<AuthEntity>> selectAuthAll() { + try { + List<AuthEntity> list = authService.selectAuthAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/BlacklistController.java b/src/main/java/com/moon/server/controller/sys/BlacklistController.java new file mode 100644 index 0000000..dd8c6ac --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/BlacklistController.java @@ -0,0 +1,254 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.BlacklistEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.sys.BlacklistService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 榛戝悕鍗� + * @author WWW + */ +@Api(tags = "杩愮淮绠$悊\\榛戝悕鍗�") +@RestController +@RequestMapping("/blacklist") +public class BlacklistController extends BaseController { + @Autowired + BlacklistService blacklistService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ip", value = "IP鍦板潃", dataType = "String", paramType = "query", required = false, example = "192."), + @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String ip, Integer type) { + try { + int count = blacklistService.selectCount(ip, type); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ip", value = "IP鍦板潃", dataType = "String", paramType = "query", example = "192."), + @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<BlacklistEntity>> selectByPage(String ip, Integer type, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<BlacklistEntity> rs = blacklistService.selectByPage(ip, type, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ip", value = "IP鍦板潃", dataType = "String", paramType = "query", required = false, example = "192."), + @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<BlacklistEntity>> selectByPageAndCount(String ip, Integer type, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = blacklistService.selectCount(ip, type); + if (count == 0) { + return success(0, null); + } + List<BlacklistEntity> rs = blacklistService.selectByPage(ip, type, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAll") + public ResponseMsg<List<BlacklistEntity>> selectAll() { + try { + List<BlacklistEntity> list = blacklistService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<BlacklistEntity> selectById(int id) { + try { + BlacklistEntity entity = blacklistService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "BlacklistEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody BlacklistEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = blacklistService.insert(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "BlacklistEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<BlacklistEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (BlacklistEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = blacklistService.inserts(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = blacklistService.delete(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = blacklistService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "BlacklistEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody BlacklistEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = blacklistService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "BlacklistEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<BlacklistEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (BlacklistEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = blacklistService.updates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/CtrlController.java b/src/main/java/com/moon/server/controller/sys/CtrlController.java new file mode 100644 index 0000000..9277bcd --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/CtrlController.java @@ -0,0 +1,94 @@ +package com.moon.server.controller.sys; + +import com.alibaba.fastjson.JSONObject; +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.ResEntity; +import com.moon.server.service.all.ScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 鎺у埗鍙版帶鍒跺櫒 + * @author WWW + * @date 2022-09-21 + */ +@Api(tags = "杩愮淮绠$悊\\鎺у埗鍙�") +@RestController +@RequestMapping("/ctrl") +public class CtrlController extends BaseController { + @Autowired + private ScheduleService scheduleService; + + @SysLog() + @ApiOperation(value = "鏌ヨ鏈嶅姟鍣ㄧ姸鎬�") + @GetMapping(value = "/selectServerStatus") + public ResponseMsg<JSONObject> selectServerStatus() { + try { + JSONObject jsonObject = scheduleService.selectServerStatus(); + + return success(jsonObject); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨCpu淇℃伅") + @GetMapping(value = "/selectCpuInfo") + public ResponseMsg<JSONObject> selectCpuInfo() { + try { + JSONObject jsonObject = scheduleService.selectCpuInfo(); + + return success(jsonObject); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍐呭瓨淇℃伅") + @GetMapping(value = "/selectMemInfo") + public ResponseMsg<JSONObject> selectMemInfo() { + try { + JSONObject jsonObject = scheduleService.selectMemInfo(); + + return success(jsonObject); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鍦ㄧ嚎鐢ㄦ埛") + @GetMapping(value = "/selectOnlineUsers") + public ResponseMsg<List<JSONObject>> selectOnlineUsers() { + try { + List<JSONObject> list = scheduleService.selectOnlineUsers(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏈嶅姟璧勬簮鐘舵��") + @GetMapping(value = "/selectResStatus") + public ResponseMsg<List<ResEntity>> selectResStatus() { + try { + List<ResEntity> list = scheduleService.selectResStatus(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/DepController.java b/src/main/java/com/moon/server/controller/sys/DepController.java new file mode 100644 index 0000000..ec0cdcc --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/DepController.java @@ -0,0 +1,207 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.DepEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.sys.DepService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 缁勭粐鏈烘瀯 + * @author sws + * @date 2022-09-23 + */ +@Api(tags = "杩愮淮绠$悊\\鍗曚綅绠$悊") +@RestController +@RequestMapping("/dep") +public class DepController extends BaseController { + @Autowired + DepService depService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.DepEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertDep", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertDep(@RequestBody DepEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = depService.insertDep(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "com.lf.server.entity.sys.DepEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertDes", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertDes(@RequestBody List<DepEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (DepEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = depService.insertDeps(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteDep") + public ResponseMsg<Integer> deleteDep(int id) { + try { + int count = depService.deleteDep(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteDeps") + public ResponseMsg<Integer> deleteDeps(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = depService.deleteDeps(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "DepEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateDep", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateDep(@RequestBody DepEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = depService.updateDep(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "DepEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updateDeps", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateDeps(@RequestBody List<DepEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (DepEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = depService.updateDeps(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectDep") + public ResponseMsg<DepEntity> selectDep(int id) { + try { + DepEntity de = depService.selectDep(id); + return success(de); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") + @GetMapping(value = "/selectDepAll") + public ResponseMsg<List<DepEntity>> selectDepAll() { + try { + List<DepEntity> list = depService.selectDepAll(); + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "閫掑綊鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍗曚綅鍚嶇О", dataType = "String", paramType = "query", required = false, example = "涓浗xxx宸ョ▼鏈夐檺鍏徃") + }) + @GetMapping(value = "/selectDepRecursive") + public ResponseMsg<List<DepEntity>> selectDepRecursive(String name) { + try { + if (StringHelper.isEmpty(name)) { + name = "涓浗xxx宸ョ▼鏈夐檺鍏徃"; + } + List<DepEntity> list = depService.selectDepRecursive(name); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/DownlogController.java b/src/main/java/com/moon/server/controller/sys/DownlogController.java new file mode 100644 index 0000000..b4e0fab --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/DownlogController.java @@ -0,0 +1,62 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.DownlogEntity; +import com.moon.server.service.sys.DownlogService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 涓嬭浇鏃ュ織 + * @author WWW + */ +@Api(tags = "杩愮淮绠$悊\\涓嬭浇鏃ュ織") +@RestController +@RequestMapping("/downlog") +public class DownlogController extends BaseController { + @Autowired + DownlogService downlogService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "鍛�"), + @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "3"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-12-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-12-25 17:00:00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<Object> selectByPageAndCount(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = downlogService.selectCount(uname, type, start, end); + if (count == 0) { + return success(0, null); + } + + List<DownlogEntity> rs = downlogService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/LoginController.java b/src/main/java/com/moon/server/controller/sys/LoginController.java new file mode 100644 index 0000000..bfca664 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/LoginController.java @@ -0,0 +1,237 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.LoginEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.sys.LoginService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.sql.Timestamp; +import java.util.List; + +/** + * 鐧诲綍鏃ュ織 + * @author SWS + * @date 2022-09.28 + */ +@Api(tags = "杩愮淮绠$悊\\鐧诲綍鏃ュ織") +@RestController +@RequestMapping("/login") +public class LoginController extends BaseController { + @Autowired + LoginService loginService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), + @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String uname, Integer type, Timestamp start, Timestamp end) { + try { + int count = loginService.selectCount(uname, type, start, end); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), + @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<LoginEntity>> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + List<LoginEntity> rs = loginService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), + @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<LoginEntity>> selectByPageAndCount(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = loginService.selectCount(uname, type, start, end); + if (count == 0) { + return success(0, null); + } + + List<LoginEntity> rs = loginService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.LoginEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertLogin", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertLogin(@RequestBody LoginEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUserid(ue.getId()); + } + + int count = loginService.insertLogin(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<LoginEntity>", paramType = "body", example = "") + }) + @PostMapping(value = "/insertLogins", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertLogins(@RequestBody List<LoginEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (LoginEntity entity : list) { + entity.setUserid(ue.getId()); + } + } + + int count = loginService.insertLogins(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteLogin") + public ResponseMsg<Integer> deleteLogin(int id) { + try { + int count = loginService.deleteLogin(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteLogins") + public ResponseMsg<Integer> deleteLogins(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + int count = loginService.deleteLogins(ids); + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "LoginEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateLogin", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateLogin(@RequestBody LoginEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUserid(ue.getId()); + } + + int count = loginService.updateLogin(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectLogin") + public ResponseMsg<LoginEntity> selectLogin(int id) { + try { + LoginEntity loginEntity = loginService.selectLogin(id); + + return success(loginEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectLoginAll") + public ResponseMsg<List<LoginEntity>> selectLoginAll() { + try { + List<LoginEntity> list = loginService.selectLoginAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/MenuAuthController.java b/src/main/java/com/moon/server/controller/sys/MenuAuthController.java new file mode 100644 index 0000000..d7a9b25 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/MenuAuthController.java @@ -0,0 +1,301 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.MenuAuthEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.PermsService; +import com.moon.server.service.sys.MenuAuthService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鑿滃崟-鏉冮檺 + * @author WWW + */ +@Api(tags = "杩愮淮绠$悊\\鑿滃崟鏉冮檺") +@RestController +@RequestMapping("/menuAuth") +public class MenuAuthController extends BaseController { + @Autowired + MenuAuthService menuAuthService; + + @Autowired + TokenService tokenService; + + @Autowired + PermsService permsService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", required = false, example = "") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(Integer menuid) { + try { + int count = menuAuthService.selectCount(menuid); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<MenuAuthEntity>> selectByPage(Integer menuid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<MenuAuthEntity> rs = menuAuthService.selectByPage(menuid, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<MenuAuthEntity>> selectByPageAndCount(Integer menuid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = menuAuthService.selectCount(menuid); + if (count == 0) { + return success(0, null); + } + List<MenuAuthEntity> rs = menuAuthService.selectByPage(menuid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁瑙掕壊ID+鑿滃崟ID鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageForRole") + public ResponseMsg<List<MenuAuthEntity>> selectByPageForRole(Integer roleid, Integer menuid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = menuAuthService.selectCountForRole(roleid, menuid); + if (count == 0) { + return success(0, null); + } + + List<MenuAuthEntity> rs = menuAuthService.selectByPageForRole(roleid, menuid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAll") + public ResponseMsg<List<MenuAuthEntity>> selectAll() { + try { + List<MenuAuthEntity> list = menuAuthService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<MenuAuthEntity> selectById(int id) { + try { + MenuAuthEntity entity = menuAuthService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MenuAuthEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody MenuAuthEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = menuAuthService.insert(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MenuAuthEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<MenuAuthEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (MenuAuthEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = menuAuthService.inserts(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = menuAuthService.delete(id); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = menuAuthService.deletes(ids); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MenuAuthEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody MenuAuthEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = menuAuthService.update(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MenuAuthEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<MenuAuthEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (MenuAuthEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = menuAuthService.updates(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/MenuController.java b/src/main/java/com/moon/server/controller/sys/MenuController.java new file mode 100644 index 0000000..331129b --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/MenuController.java @@ -0,0 +1,231 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.MenuEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.all.PermsService; +import com.moon.server.service.sys.MenuService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鑿滃崟 + * @author sws + * @date 2022-09-23 + */ +@Api(tags= "杩愮淮绠$悊\\鑿滃崟绠$悊") +@RestController +@RequestMapping("/menu") +public class MenuController extends BaseController { + @Autowired + MenuService menuService; + + @Autowired + TokenService tokenService; + + @Autowired + PermsService permsService; + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.MenusEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertMenu", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertMenu(@RequestBody MenuEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = menuService.insertMenu(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "com.lf.server.entity.sys.MenusEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertMenus", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertMenus(@RequestBody List<MenuEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (MenuEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = menuService.insertMenus(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteMenu") + public ResponseMsg<Integer> deleteMenu(int id) { + try { + int count = menuService.deleteMenu(id); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteMenus") + public ResponseMsg<Integer> deleteMenus(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = menuService.deleteMenus(ids); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "MenusEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateMenu", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateMenu(@RequestBody MenuEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = menuService.updateMenu(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "MenusEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateMenus", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateMenus(@RequestBody List<MenuEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (MenuEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = menuService.updateMenus(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectMenu") + public ResponseMsg<MenuEntity> selectMenu(int id) { + try { + MenuEntity menuEntity = menuService.selectMenu(id); + + return success(menuEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectMenuAll") + public ResponseMsg<List<MenuEntity>> selectMenuAll() { + try { + List<MenuEntity> list = menuService.selectMenuAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "閫掑綊鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鑿滃崟鍚嶇О", dataType = "String", paramType = "query", required = false, example = "绠¢亾鍩虹澶ф暟鎹钩鍙�") + }) + @GetMapping(value = "/selectMenuRecursive") + public ResponseMsg<Object> selectMenuRecursive(String name) { + try { + if (StringHelper.isEmpty(name)) { + name = "绠¢亾鍩虹澶ф暟鎹钩鍙�"; + } + List<MenuEntity> list = menuService.selectMenuRecursive(name); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/OperateController.java b/src/main/java/com/moon/server/controller/sys/OperateController.java new file mode 100644 index 0000000..6180f10 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/OperateController.java @@ -0,0 +1,236 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.OperateEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.sys.OperateService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.sql.Timestamp; +import java.util.List; + +/** + * 鎿嶄綔鏃ュ織 + * @author SWS + * @date 2022-09.28 + */ +@Api(tags = "杩愮淮绠$悊\\鎿嶄綔鏃ュ織") +@RestController +@RequestMapping("/operate") +public class OperateController extends BaseController { + @Autowired + OperateService operateService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), + @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String uname, Integer type, Timestamp start, Timestamp end) { + try { + int count = operateService.selectCount(uname, type, start, end); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), + @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<OperateEntity>> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + List<OperateEntity> rs = operateService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "绠$悊鍛�"), + @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<OperateEntity>> selectByPageAndCount(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = operateService.selectCount(uname, type, start, end); + if (count == 0) { + return success(0, null); + } + + List<OperateEntity> rs = operateService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.OperateEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertOperate", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertOperate(@RequestBody OperateEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUserid(ue.getId()); + } + + int count = operateService.insertOperate(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<OperateEntity>", paramType = "body", example = "") + }) + @PostMapping(value = "/insertOperates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertOperates(@RequestBody List<OperateEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (OperateEntity entity : list) { + entity.setUserid(ue.getId()); + } + } + + int count = operateService.insertOperates(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteOperate") + public ResponseMsg<Integer> deleteOperate(int id) { + try { + int count = operateService.deleteOperate(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteOperates") + public ResponseMsg<Integer> deleteOperates(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + int count = operateService.deleteOperates(ids); + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "OperateEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateOperate", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateOperate(@RequestBody OperateEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUserid(ue.getId()); + } + + int count = operateService.updateOperate(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectOperate") + public ResponseMsg<OperateEntity> selectOperate(int id) { + try { + OperateEntity operateEntity = operateService.selectOperate(id); + + return success(operateEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectOperateAll") + public ResponseMsg<List<OperateEntity>> selectOperateAll() { + try { + List<OperateEntity> list = operateService.selectOperateAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/ReportController.java b/src/main/java/com/moon/server/controller/sys/ReportController.java new file mode 100644 index 0000000..c9a7577 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/ReportController.java @@ -0,0 +1,183 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.ReportEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.UploadAttachService; +import com.moon.server.service.sys.ReportService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 鎶ュ憡妯℃澘 + * @author WWW + */ +@Api(tags = "杩愮淮绠$悊\\妯℃澘绠$悊") +@RestController +@RequestMapping("/report") +public class ReportController extends BaseController { + @Autowired + ReportService reportService; + + @Autowired + TokenService tokenService; + + @Autowired + UploadAttachService uploadAttachService; + + private final static String TAB_NAME = "lf.sys_report"; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<ReportEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = reportService.selectCount(name, null); + if (count == 0) { + return success(0, null); + } + + List<ReportEntity> rs = reportService.selectByPage(name, null, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<ReportEntity> selectById(int id) { + try { + ReportEntity entity = reportService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ReportEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody ReportEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = reportService.insert(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = reportService.delete(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = reportService.deletes(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ReportEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody ReportEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = reportService.update(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "涓婁紶鏂囦欢") + @ResponseBody + @PostMapping(value = "/upload") + public ResponseMsg<String> upload(@RequestParam("file") MultipartFile file, HttpServletRequest req) { + UserEntity ue = tokenService.getCurrentUser(req); + + return uploadAttachService.upload(ue, TAB_NAME, file, this); + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") + }) + @GetMapping(value = "/download") + public void download(String guid, HttpServletResponse res) { + uploadAttachService.download(guid, res); + } +} diff --git a/src/main/java/com/moon/server/controller/sys/ResController.java b/src/main/java/com/moon/server/controller/sys/ResController.java new file mode 100644 index 0000000..879b3f7 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/ResController.java @@ -0,0 +1,316 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.ResEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.PermsService; +import com.moon.server.service.all.UploadAttachService; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.sys.ResService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 璧勬簮琛� + * @author SWS + * @date 2022-09.28 + */ +@Api(tags = "杩愮淮绠$悊\\璧勬簮绠$悊") +@RestController +@RequestMapping("/res") +public class ResController extends BaseController { + @Autowired + ResService resService; + + @Autowired + TokenService tokenService; + + @Autowired + PermsService permsService; + + @Autowired + DownloadService downloadService; + + @Autowired + UploadAttachService uploadAttachService; + + private final static String TAB_NAME = "lf.sys_res"; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "sys_res") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String name) { + try { + int count = resService.selectCount(name); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "sys_res"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<ResEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<ResEntity> rs = resService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "sys_res"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<ResEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = resService.selectCount(name); + if (count == 0) { + return success(0, null); + } + List<ResEntity> rs = resService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁瑙掕壊鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageForRole") + public ResponseMsg<List<ResEntity>> selectByPageForRole(Integer roleid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = resService.selectCountForRole(roleid); + if (count == 0) { + return success(0, null); + } + + List<ResEntity> rs = resService.selectByPageForRole(roleid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.ResEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertRes", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertRes(@RequestBody ResEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = resService.insertRes(entity); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<ResEntity>", paramType = "body", example = "") + }) + @PostMapping(value = "/insertRess", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertRess(@RequestBody List<ResEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (ResEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = resService.insertRess(list); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteRes") + public ResponseMsg<Integer> deleteRes(int id) { + try { + int count = resService.deleteRes(id); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteRess") + public ResponseMsg<Integer> deleteRess(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = resService.deleteRess(ids); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ResEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateRes", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateRes(@RequestBody ResEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = resService.updateRes(entity); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectRes") + public ResponseMsg<ResEntity> selectRes(int id) { + try { + ResEntity resEntity = resService.selectRes(id); + + return success(resEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectResAll") + public ResponseMsg<List<ResEntity>> selectResAll() { + try { + List<ResEntity> list = resService.selectResAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓婁紶鏂囦欢") + @ResponseBody + @PostMapping(value = "/upload") + public ResponseMsg<String> upload(@RequestParam("file") MultipartFile file, HttpServletRequest req) { + UserEntity ue = tokenService.getCurrentUser(req); + + return uploadAttachService.upload(ue, TAB_NAME, file, this); + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") + }) + @GetMapping(value = "/download") + public void download(String guid, HttpServletResponse res) { + uploadAttachService.download(guid, false, res); + } + + @SysLog() + @ApiOperation(value = "鏌ョ湅鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body") + }) + @GetMapping(value = "/downloadForView") + public void downloadForView(String guid, HttpServletResponse res) { + uploadAttachService.download(guid, true, res); + } +} diff --git a/src/main/java/com/moon/server/controller/sys/ResOpController.java b/src/main/java/com/moon/server/controller/sys/ResOpController.java new file mode 100644 index 0000000..a781469 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/ResOpController.java @@ -0,0 +1,236 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.ResOpEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.sys.ResOpService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.sql.Timestamp; +import java.util.List; + +/** + * 璧勬簮鎿嶄綔 + * @author SWS + * @date 2022-09.28 + */ +@Api(tags = "杩愮淮绠$悊\\璧勬簮鎿嶄綔") +@RestController +@RequestMapping("/resOp") +public class ResOpController extends BaseController { + @Autowired + ResOpService resOpService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "璧勬簮鍚嶇О", dataType = "String", paramType = "query", example = "澶╁湴鍥�"), + @ApiImplicitParam(name = "type", value = "鎿嶄綔绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"), + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String name, Integer type, Timestamp start, Timestamp end) { + try { + int count = resOpService.selectCount(name, type, start, end); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "璧勬簮鍚嶇О", dataType = "String", paramType = "query", example = "澶╁湴鍥�"), + @ApiImplicitParam(name = "type", value = "鎿嶄綔绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<ResOpEntity>> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + List<ResOpEntity> rs = resOpService.selectByPage(name, type, start, end, pageSize, pageSize * (pageIndex - 1)); + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "璧勬簮鍚嶇О", dataType = "String", paramType = "query", example = "澶╁湴鍥�"), + @ApiImplicitParam(name = "type", value = "鎿嶄綔绫诲瀷", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), + @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", dataType = "Timestamp", paramType = "query", example = "2022-10-10 18:00:00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<ResOpEntity>> selectByPageAndCount(String name, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = resOpService.selectCount(name, type, start, end); + if (count == 0) { + return success(0, null); + } + + List<ResOpEntity> rs = resOpService.selectByPage(name, type, start, end, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.ResOpEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertResOp", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertResOp(@RequestBody ResOpEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUserid(ue.getId()); + } + + int count = resOpService.insertResOp(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<ResOpEntity>", paramType = "body", example = "") + }) + @PostMapping(value = "/insertResOps", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertResOps(@RequestBody List<ResOpEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (ResOpEntity entity : list) { + entity.setUserid(ue.getId()); + } + } + + int count = resOpService.insertResOps(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteLogin") + public ResponseMsg<Integer> deleteResOp(int id) { + try { + int count = resOpService.deleteResOp(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteResOps") + public ResponseMsg<Integer> deleteResOps(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + int count = resOpService.deleteResOps(ids); + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "ID鏁扮粍", dataType = "LoginEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateResOp", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateResOp(@RequestBody ResOpEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUserid(ue.getId()); + } + + int count = resOpService.updateResOp(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectResOp") + public ResponseMsg<ResOpEntity> selectResOp(int id) { + try { + ResOpEntity resOpEntity = resOpService.selectResOp(id); + + return success(resOpEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectResOpAll") + public ResponseMsg<List<ResOpEntity>> selectResOpAll() { + try { + List<ResOpEntity> list = resOpService.selectResOpAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/RoleController.java b/src/main/java/com/moon/server/controller/sys/RoleController.java new file mode 100644 index 0000000..da44181 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/RoleController.java @@ -0,0 +1,252 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.RoleEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.PermsService; +import com.moon.server.service.sys.RoleService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *瑙掕壊琛� + * @author SWS + * @date 2022-09.28 + */ +@Api(tags = "杩愮淮绠$悊\\瑙掕壊绠$悊") +@RestController +@RequestMapping("/role") +public class RoleController extends BaseController { + @Autowired + RoleService roleService; + + @Autowired + TokenService tokenService; + + @Autowired + PermsService permsService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "Admin"), + @ApiImplicitParam(name = "depid", value = "鍗曚綅ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(String name, Integer depid) { + try { + int count = roleService.selectCount(name, depid); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "Admin"), + @ApiImplicitParam(name = "depid", value = "鍗曚綅ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<RoleEntity>> selectByPage(String name, Integer depid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<RoleEntity> rs = roleService.selectByPage(name, depid, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "Admin"), + @ApiImplicitParam(name = "depid", value = "鍗曚綅ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<RoleEntity>> selectByPageAndCount(String name, Integer depid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = roleService.selectCount(name, depid); + if (count == 0) { + return success(0, null); + } + + List<RoleEntity> rs = roleService.selectByPage(name, depid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.RoleEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertRole", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertRole(@RequestBody RoleEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = roleService.insertRole(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<RoleEntity>", paramType = "body", example = "") + }) + @PostMapping(value = "/insertRoles", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertRoles(@RequestBody List<RoleEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (RoleEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = roleService.insertRoles(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteRole") + public ResponseMsg<Integer> deleteRole(int id) { + try { + int count = roleService.deleteRole(id); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteAuths") + public ResponseMsg<Integer> deleteRoles(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = roleService.deleteRoles(ids); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateRole", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateRole(@RequestBody RoleEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = roleService.updateRole(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectRole") + public ResponseMsg<RoleEntity> selectRole(int id) { + try { + RoleEntity roleEntity = roleService.selectRole(id); + + return success(roleEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectRoleAll") + public ResponseMsg<List<RoleEntity>> selectRoleAll() { + try { + List<RoleEntity> list = roleService.selectRoleAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/RoleMenuAuthController.java b/src/main/java/com/moon/server/controller/sys/RoleMenuAuthController.java new file mode 100644 index 0000000..03e4275 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/RoleMenuAuthController.java @@ -0,0 +1,301 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.RoleMenuAuthEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.PermsService; +import com.moon.server.service.sys.RoleMenuAuthService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 瑙掕壊-鑿滃崟 + * @author WWW + */ +@Api(tags = "杩愮淮绠$悊\\瑙掕壊鑿滃崟") +@RestController +@RequestMapping("/roleMenuAuth") +public class RoleMenuAuthController extends BaseController { + @Autowired + RoleMenuAuthService roleMenuAuthService; + + @Autowired + TokenService tokenService; + + @Autowired + PermsService permsService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", required = false, example = "") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(Integer roleid) { + try { + int count = roleMenuAuthService.selectCount(roleid); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<RoleMenuAuthEntity>> selectByPage(Integer roleid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<RoleMenuAuthEntity> rs = roleMenuAuthService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<RoleMenuAuthEntity>> selectByPageAndCount(Integer roleid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = roleMenuAuthService.selectCount(roleid); + if (count == 0) { + return success(0, null); + } + List<RoleMenuAuthEntity> rs = roleMenuAuthService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁瑙掕壊ID+鑿滃崟ID鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "menuid", value = "鑿滃崟ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageForRole") + public ResponseMsg<List<RoleMenuAuthEntity>> selectByPageForRole(Integer roleid, Integer menuid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = roleMenuAuthService.selectCountForRole(roleid, menuid); + if (count == 0) { + return success(0, null); + } + + List<RoleMenuAuthEntity> rs = roleMenuAuthService.selectByPageForRole(roleid, menuid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAll") + public ResponseMsg<List<RoleMenuAuthEntity>> selectAll() { + try { + List<RoleMenuAuthEntity> list = roleMenuAuthService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<RoleMenuAuthEntity> selectById(int id) { + try { + RoleMenuAuthEntity entity = roleMenuAuthService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleMenuAuthEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody RoleMenuAuthEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = roleMenuAuthService.insert(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleMenuAuthEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<RoleMenuAuthEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (RoleMenuAuthEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = roleMenuAuthService.inserts(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = roleMenuAuthService.delete(id); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = roleMenuAuthService.deletes(ids); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleMenuAuthEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody RoleMenuAuthEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = roleMenuAuthService.update(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleMenuAuthEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<RoleMenuAuthEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (RoleMenuAuthEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = roleMenuAuthService.updates(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/RoleResController.java b/src/main/java/com/moon/server/controller/sys/RoleResController.java new file mode 100644 index 0000000..f46065e --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/RoleResController.java @@ -0,0 +1,273 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.RoleResEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.PermsService; +import com.moon.server.service.sys.RoleResService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 瑙掕壊-璧勬簮 + * @author WWW + */ +@Api(tags = "杩愮淮绠$悊\\瑙掕壊璧勬簮") +@RestController +@RequestMapping("/roleRes") +public class RoleResController extends BaseController { + @Autowired + RoleResService roleResService; + + @Autowired + TokenService tokenService; + + @Autowired + PermsService permsService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", required = false, example = "") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(Integer roleid) { + try { + int count = roleResService.selectCount(roleid); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<RoleResEntity>> selectByPage(Integer roleid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<RoleResEntity> rs = roleResService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<RoleResEntity>> selectByPageAndCount(Integer roleid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = roleResService.selectCount(roleid); + if (count == 0) { + return success(0, null); + } + List<RoleResEntity> rs = roleResService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAll") + public ResponseMsg<List<RoleResEntity>> selectAll() { + try { + List<RoleResEntity> list = roleResService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<RoleResEntity> selectById(int id) { + try { + RoleResEntity entity = roleResService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleResEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody RoleResEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = roleResService.insert(entity); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleResEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<RoleResEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (RoleResEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = roleResService.inserts(list); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = roleResService.delete(id); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = roleResService.deletes(ids); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleResEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody RoleResEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = roleResService.update(entity); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleResEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<RoleResEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (RoleResEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = roleResService.updates(list); + if (count > 0) { + permsService.clearResCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/RoleUserController.java b/src/main/java/com/moon/server/controller/sys/RoleUserController.java new file mode 100644 index 0000000..20a2301 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/RoleUserController.java @@ -0,0 +1,273 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.RoleUserEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.PermsService; +import com.moon.server.service.sys.RoleUserService; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 瑙掕壊-鐢ㄦ埛 + * @author WWW + */ +@Api(tags = "杩愮淮绠$悊\\鐢ㄦ埛瑙掕壊") +@RestController +@RequestMapping("/roleUser") +public class RoleUserController extends BaseController { + @Autowired + RoleUserService roleUserService; + + @Autowired + TokenService tokenService; + + @Autowired + PermsService permsService; + + @SysLog() + @ApiOperation(value = "鏌ヨ璁板綍鏁�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", required = false, example = "") + }) + @GetMapping({"/selectCount"}) + public ResponseMsg<Integer> selectCount(Integer roleid) { + try { + int count = roleUserService.selectCount(roleid); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPage") + public ResponseMsg<List<RoleUserEntity>> selectByPage(Integer roleid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + List<RoleUserEntity> rs = roleUserService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); + + return success(rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<RoleUserEntity>> selectByPageAndCount(Integer roleid, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = roleUserService.selectCount(roleid); + if (count == 0) { + return success(0, null); + } + List<RoleUserEntity> rs = roleUserService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectAll") + public ResponseMsg<List<RoleUserEntity>> selectAll() { + try { + List<RoleUserEntity> list = roleUserService.selectAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectById") + public ResponseMsg<RoleUserEntity> selectById(int id) { + try { + RoleUserEntity entity = roleUserService.selectById(id); + + return success(entity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleUserEntity", paramType = "body") + }) + @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insert(@RequestBody RoleUserEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = roleUserService.insert(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleUserEntity", paramType = "body") + }) + @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> inserts(@RequestBody List<RoleUserEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (RoleUserEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = roleUserService.inserts(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/delete") + public ResponseMsg<Integer> delete(int id) { + try { + int count = roleUserService.delete(id); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deletes") + public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = roleUserService.deletes(ids); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleUserEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> update(@RequestBody RoleUserEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = roleUserService.update(entity); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleUserEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updates(@RequestBody List<RoleUserEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (RoleUserEntity entity : list) { + entity.setUpdateUser(ue.getId()); + } + } + + int count = roleUserService.updates(list); + if (count > 0) { + permsService.clearPermsCache(); + } + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/TokenController.java b/src/main/java/com/moon/server/controller/sys/TokenController.java new file mode 100644 index 0000000..9b1373e --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/TokenController.java @@ -0,0 +1,172 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.TokenEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.sys.TokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 浠ょ墝琛� + * @author sws + * @date 2022-09-28 + */ + +@Api(tags = "杩愮淮绠$悊\\浠ょ墝绠$悊") +@RestController +@RequestMapping("/token") +public class TokenController extends BaseController { + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "浠ょ墝", dataType = "String", paramType = "query", example = "ec101de8-1403-4d8f-ad13-edab8358399b"), + @ApiImplicitParam(name = "type", value = "绫诲瀷", dataType = "Integer", paramType = "query", example = "0"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<TokenEntity>> selectByPageAndCount(String name, Integer type, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = tokenService.selectCount(name,type); + if (count == 0) { + return success(0, null); + } + List<TokenEntity> rs = tokenService.selectByPage(name,type, pageSize, pageSize * (pageIndex - 1)); + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.sys.TokenEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertToken", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertToken(@RequestBody TokenEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = tokenService.insertToken(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<TokenEntity>", paramType = "body", example = "") + }) + @PostMapping(value = "/insertTokens", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertTokens(@RequestBody List<TokenEntity> list, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + for (TokenEntity entity : list) { + entity.setCreateUser(ue.getId()); + } + } + + int count = tokenService.insertTokens(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteToken") + public ResponseMsg<Integer> deleteToken(int id) { + try { + int count = tokenService.deleteToken(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteTokens") + public ResponseMsg<Integer> deleteTokens(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + int count = tokenService.deleteTokens(ids); + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "TokenEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateToken", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> updateToken(@RequestBody TokenEntity entity, HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = tokenService.updateToken(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1658") + }) + @GetMapping(value = "/selectToken") + public ResponseMsg<TokenEntity> selectToken(int id) { + try { + TokenEntity tokenEntity = tokenService.selectToken(id); + + return success(tokenEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } +} diff --git a/src/main/java/com/moon/server/controller/sys/UserController.java b/src/main/java/com/moon/server/controller/sys/UserController.java new file mode 100644 index 0000000..ac84054 --- /dev/null +++ b/src/main/java/com/moon/server/controller/sys/UserController.java @@ -0,0 +1,400 @@ +package com.moon.server.controller.sys; + +import com.moon.server.annotation.SysLog; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.RoleEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.entity.ctrl.UserUpdateEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.sys.TokenService; +import com.moon.server.service.sys.UserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 鐢ㄦ埛琛� + * @author sws + * @date 2022-09-27 + */ +@Api(tags = "杩愮淮绠$悊\\鐢ㄦ埛绠$悊") +@RestController +@RequestMapping("/user") +public class UserController extends BaseController { + @Autowired + UserService userService; + + @Autowired + TokenService tokenService; + + @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "瀹�"), + @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<UserEntity>> selectByPageAndCount(String uname, String depcode, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + + int count = userService.selectCount(uname, depcode); + if (count == 0) { + return success(0, null); + } + + List<UserEntity> rs = userService.selectByPage(uname, depcode, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁瑙掕壊+鍗曚綅鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uname", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "瀹�"), + @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1"), + @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageForRole") + public ResponseMsg<List<UserEntity>> selectByPageForRole(String uname, Integer roleid, String depcode, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = userService.selectCountForRole(uname, roleid, depcode); + if (count == 0) { + return success(0, null); + } + + List<UserEntity> rs = userService.selectByPageForRole(uname, roleid, depcode, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectUser") + public ResponseMsg<UserEntity> selectUser(int id) { + try { + UserEntity userEntity = userService.selectUser(id); + + return success(userEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐢ㄦ埛ID鏌ヨ") + @ApiImplicitParams({ + @ApiImplicitParam(name = "uid", value = "鐢ㄦ埛ID", dataType = "String", paramType = "query", example = "admin") + }) + @GetMapping(value = "/selectByUid") + public ResponseMsg<UserEntity> selectByUid(String uid) { + try { + if (StringHelper.isEmpty(uid)) { + fail("鐢ㄦ埛ID涓嶈兘涓虹┖", null); + } + + UserEntity userEntity = userService.selectByUid(uid); + + return success(userEntity); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鎵�鏈�") + @GetMapping(value = "/selectUserAll") + public ResponseMsg<List<UserEntity>> selectUserAll() { + try { + List<UserEntity> list = userService.selectUserAll(); + + return success(list); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏄�/鍚︿负绠$悊鍛�") + @GetMapping(value = "/selectForIsAdmin") + public ResponseMsg<Boolean> selectForIsAdmin(HttpServletRequest req) { + try { + UserEntity ue = tokenService.getCurrentUser(req); + if (ue == null) { + return fail("鐢ㄦ埛鏈櫥褰�", false); + } + + Integer rows = userService.selectForIsAdmin(ue.getId()); + + return success("鎴愬姛", rows > 0); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ鏄�/鍚︿负绠$悊鍛�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鐢ㄦ埛ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectIsAdmin") + public ResponseMsg<Boolean> selectIsAdmin(Integer id) { + try { + UserEntity ue = userService.selectUser(id); + if (ue == null) { + return fail("鐢ㄦ埛涓嶅瓨鍦�", false); + } + + Integer rows = userService.selectForIsAdmin(ue.getId()); + + return success("鎴愬姛", rows > 0); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ绠$悊鍛樼敤鎴�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "type", value = "绠$悊鍛樼被鍒�", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectAdminUsers") + public ResponseMsg<Object> selectAdminUsers(Integer type) { + try { + if (null == type || type < 1) { + return fail("绠$悊鍛樼被鍒笉鑳戒负绌烘垨灏忎簬1", false); + } + + List<UserEntity> rs = userService.selectAdminUsers(type); + + return success(rs); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "鐢ㄦ埛ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectRoleByUserId") + public ResponseMsg<Object> selectRoleByUserId(Integer id) { + try { + if (null == id || id < 1) { + return fail("鐢ㄦ埛ID涓嶈兘涓虹┖鎴栧皬浜�1", false); + } + + List<RoleEntity> rs = userService.selectRoleByUserId(id); + + return success(rs); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁瑙掕壊鏌ヨ鐢ㄦ埛") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectUserByRoleId") + public ResponseMsg<Object> selectUserByRoleId(Integer id) { + try { + if (null == id || id < 1) { + return fail("鐢ㄦ埛ID涓嶈兘涓虹┖鎴栧皬浜�1", false); + } + + List<UserEntity> rs = userService.selectUserByRoleId(id); + + return success(rs); + } catch (Exception ex) { + return fail(ex, false); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "com.lf.server.entity.data.UserEntity", paramType = "body", example = "") + }) + @PostMapping(value = "/insertUser", produces = "application/json; charset=UTF-8") + public ResponseMsg<Integer> insertUser(@RequestBody UserEntity entity, HttpServletRequest req) { + try { + String str = userService.validateNewPwd(entity); + if (str != null) { + return fail(str, -1); + } + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + int count = userService.insertUser(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鎻掑叆澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "List<UserEntity>", paramType = "body", example = "") + }) + @PostMapping(value = "/insertUsers", produces = "application/json; charset=UTF-8") + @SuppressWarnings("AlibabaRemoveCommentedCode") + public ResponseMsg<Integer> insertUsers(@RequestBody List<UserEntity> list, HttpServletRequest req) { + try { + if (list == null || list.isEmpty()) { + return fail("瀹炰綋绫婚泦鍚堜负绌�", -1); + } + + UserEntity ue = tokenService.getCurrentUser(req); + for (UserEntity entity : list) { + /*String str = userService.validateNewPwd(entity); + if (str != null) { + return fail(str, -1); + }*/ + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + } + + int count = userService.insertUsers(list); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/deleteUser") + public ResponseMsg<Integer> deleteUser(int id) { + try { + int count = userService.deleteUser(id); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鍒犻櫎澶氭潯") + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "List<Integer>", paramType = "query", example = "1,2") + }) + @GetMapping(value = "/deleteUsers") + public ResponseMsg<Integer> deleteUsers(@RequestParam List<Integer> ids) { + try { + if (ids == null || ids.isEmpty()) { + return fail("id鏁扮粍涓嶈兘涓虹┖", -1); + } + + int count = userService.deleteUsers(ids); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊涓�鏉�") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "UserEntity", paramType = "body", example = "") + }) + @ResponseBody + @PostMapping(value = "/updateUser", produces = "application/json; charset=UTF-8") + @SuppressWarnings("AlibabaRemoveCommentedCode") + public ResponseMsg<Integer> updateUser(@RequestBody UserEntity entity, HttpServletRequest req) { + try { + /*String str = userService.validateOldPwd(entity); + if (str != null) { + return fail(str, -1); + }*/ + + UserEntity ue = tokenService.getCurrentUser(req); + if (ue != null) { + entity.setUpdateUser(ue.getId()); + } + + int count = userService.updateUser(entity); + + return success(count); + } catch (Exception ex) { + return fail(ex, -1); + } + } + + @SysLog() + @ApiOperation(value = "鏇存柊澶氫釜鐢ㄦ埛瀵嗙爜") + @ApiImplicitParams({ + @ApiImplicitParam(name = "adminPwd", value = "绠$悊鍛樺瘑鐮�", dataType = "String", paramType = "body", example = ""), + @ApiImplicitParam(name = "newPwd", value = "鏂板瘑鐮�", dataType = "String", paramType = "body", example = ""), + @ApiImplicitParam(name = "ids", value = "鐢ㄦ埛ID闆嗗悎", dataType = "List<Integer>", paramType = "body", example = "") + }) + @PostMapping(value = "/updateUsersPwd", produces = "application/json; charset=UTF-8") + public ResponseMsg<Boolean> updateUsersPwd(@RequestBody UserUpdateEntity uue, HttpServletRequest req) { + try { + if (uue == null || uue.getIds() == null || uue.getIds().isEmpty()) { + return fail("娌℃湁鎵惧埌鏁版嵁", false); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String str = userService.validateAdminPwd(ue, uue.getAdminPwd()); + if (str != null) { + return fail(str, false); + } + + Integer rows = userService.selectForIsAdmin(ue.getId()); + if (rows < 1) { + return fail("鍙厑璁哥鐞嗗憳鎿嶄綔", false); + } + + str = userService.validateNewPwd(ue, uue.getNewPwd()); + if (str != null) { + return fail(str, false); + } + + rows = userService.updateUsersPwd(ue.getId(), ue.getSalt(), uue.getIds()); + + return success(rows > 0 ? "鏇存柊鎴愬姛" : "鏇存柊澶辫触", rows > 0); + } catch (Exception ex) { + return fail(ex, false); + } + } +} diff --git a/src/main/java/com/moon/server/entity/all/AbstractPwdEntity.java b/src/main/java/com/moon/server/entity/all/AbstractPwdEntity.java new file mode 100644 index 0000000..cb40f9a --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/AbstractPwdEntity.java @@ -0,0 +1,17 @@ +package com.moon.server.entity.all; + +/** + * 瀵嗙爜鎶借薄绫� + * @author WWW + */ +public abstract class AbstractPwdEntity { + private String pwd; + + public String getPwd() { + return pwd; + } + + public void setPwd(String pwd) { + this.pwd = pwd; + } +} diff --git a/src/main/java/com/moon/server/entity/all/BaseEntity.java b/src/main/java/com/moon/server/entity/all/BaseEntity.java new file mode 100644 index 0000000..e50c0b2 --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/BaseEntity.java @@ -0,0 +1,174 @@ +package com.moon.server.entity.all; + +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鍩虹瀹炰綋绫� + * @author WWW + */ +public class BaseEntity implements Serializable { + @TableId(type = IdType.AUTO) + private Integer gid; + + private String eventid; + + private String parentid; + + private String dirid; + + private String depid; + + private Integer verid; + + private Timestamp createtime; + + private Integer createuser; + + private Integer updateuser; + + private Timestamp updatetime; + + @TableField(value = "fn_get_fullname(dirid, 2)", updateStrategy = FieldStrategy.NEVER) + private String dirName; + + @TableField(value = "fn_get_fullname(depid, 1)", updateStrategy = FieldStrategy.NEVER) + private String depName; + + @TableField(value = "fn_ver(verid)", updateStrategy = FieldStrategy.NEVER) + private String verName; + + @TableField(value = "fn_uname(createuser)", updateStrategy = FieldStrategy.NEVER) + private String createName; + + @TableField(value = "fn_uname(updateuser)", updateStrategy = FieldStrategy.NEVER) + private String updateName; + + public BaseEntity() { + } + + public Integer getGid() { + return gid; + } + + public void setGid(Integer gid) { + this.gid = gid; + } + + public String getEventid() { + return eventid; + } + + public void setEventid(String eventid) { + this.eventid = eventid; + } + + public String getParentid() { + return parentid; + } + + public void setParentid(String parentid) { + this.parentid = parentid; + } + + public String getDirid() { + return dirid; + } + + public void setDirid(String dirid) { + this.dirid = dirid; + } + + public String getDepid() { + return depid; + } + + public void setDepid(String depid) { + this.depid = depid; + } + + public Integer getVerid() { + return verid; + } + + public void setVerid(Integer verid) { + this.verid = verid; + } + + public Timestamp getCreatetime() { + return createtime; + } + + public void setCreatetime(Timestamp createtime) { + this.createtime = createtime; + } + + public Integer getCreateuser() { + return createuser; + } + + public void setCreateuser(Integer createuser) { + this.createuser = createuser; + } + + public Integer getUpdateuser() { + return updateuser; + } + + public void setUpdateuser(Integer updateuser) { + this.updateuser = updateuser; + } + + public Timestamp getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Timestamp updatetime) { + this.updatetime = updatetime; + } + + public String getDirName() { + return dirName; + } + + public void setDirName(String dirName) { + this.dirName = dirName; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public String getVerName() { + return verName; + } + + public void setVerName(String verName) { + this.verName = verName; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } +} diff --git a/src/main/java/com/moon/server/entity/all/BaseGeoEntity.java b/src/main/java/com/moon/server/entity/all/BaseGeoEntity.java new file mode 100644 index 0000000..f83a28b --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/BaseGeoEntity.java @@ -0,0 +1,20 @@ +package com.moon.server.entity.all; + +import com.baomidou.mybatisplus.annotation.TableField; + +/** + * 绌洪棿鍩虹瀹炰綋绫� + * @author WWW + */ +public class BaseGeoEntity extends BaseEntity { + @TableField(select = false) + private String geom; + + public String getGeom() { + return geom; + } + + public void setGeom(String geom) { + this.geom = geom; + } +} diff --git a/src/main/java/com/moon/server/entity/all/HttpStatus.java b/src/main/java/com/moon/server/entity/all/HttpStatus.java new file mode 100644 index 0000000..fc94c22 --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/HttpStatus.java @@ -0,0 +1,104 @@ +package com.moon.server.entity.all; + +/** + * Http鐘舵�佺爜绫� + * @author WWW + */ +public enum HttpStatus { + /** + * 璇锋眰鎴愬姛 + */ + OK(200,"璇锋眰鎴愬姛"), + + /** + * 璇锋眰鏃犳晥 + */ + BAD_REQUEST(400,"璇锋眰鏃犳晥"), + + /** + * 鏈粡鎺堟潈璁块棶 + */ + UNAUTHORIZED(401,"鏈粡鎺堟潈璁块棶"), + + /** + * 鏈嶅姟璇锋眰鏈壘鍒� + */ + NOT_FOUND(404,"鏈嶅姟璇锋眰鏈壘鍒�"), + + /** + * 绯荤粺閿欒 + */ + ERROR(500,"绯荤粺閿欒"), + + /** + * 瀛樺湪閲嶅鐨勬暟鎹� + */ + UNIQUE_ERROR(500100,"瀛樺湪閲嶅鐨勬暟鎹�"), + + /** + * 鍙傛暟鏍¢獙閿欒 + */ + VALIDATE_ERROR(500101,"鍙傛暟鏍¢獙閿欒"), + + /** + * token閿欒 + */ + TOKEN_ERROR(500102,"token閿欒"), + + /** + * 鐢ㄦ埛鏈櫥闄� + */ + NO_LOGIN_ERROR(500104,"鐢ㄦ埛鏈櫥闄�"), + + /** + * 鐧婚檰澶辫触 + */ + LOGIN_ERROR(500105,"鐧婚檰澶辫触"), + + /** + * 鏃犳潈闄愯闂� + */ + NO_AUTH_ERROR(500106,"鏃犳潈闄愯闂�"), + + /** + * 鐢ㄦ埛鍚嶉敊璇� + */ + LOGIN_USER_ERROR(500107,"鐢ㄦ埛鍚嶉敊璇�"), + + /** + * 瀵嗙爜閿欒 + */ + LOGIN_PWD_ERROR(500108,"瀵嗙爜閿欒"), + + /** + * 鐢ㄦ埛琚攣瀹� + */ + USER_LOCK_ERROR(500109,"鐢ㄦ埛琚攣瀹�"), + + /** + * 瀵嗙爜涓嶅悎瑙勮寖 + */ + PWD_NONSTANDARD(500111,"瀵嗙爜涓嶅悎瑙勮寖"), + + /** + * 瀵嗙爜杩囨湡 + */ + LOGIN_PWD_EXPIRE(500116,"瀵嗙爜杩囨湡"); + + private HttpStatus(int value, String msg) { + this.value = value; + this.msg = msg; + } + + private int value; + + private String msg; + + public int getValue() { + return value; + } + + public String getMsg() { + return msg; + } +} diff --git a/src/main/java/com/moon/server/entity/all/MenusAuthEntity.java b/src/main/java/com/moon/server/entity/all/MenusAuthEntity.java new file mode 100644 index 0000000..5884dbb --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/MenusAuthEntity.java @@ -0,0 +1,135 @@ +package com.moon.server.entity.all; + +import java.io.Serializable; + +/** + * 鑿滃崟鎺堟潈 + * @author WWW + */ +public class MenusAuthEntity implements Serializable { + private static final long serialVersionUID = -944664756113218L; + + private Integer id; + + private Integer pid; + + private String cnName; + + private String enName; + + private String url; + + private String perms; + + private Integer type; + + private String css; + + private String icon; + + private Integer level; + + private Integer orderNum; + + private Integer isShow; + + public MenusAuthEntity() { + + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getPid() { + return pid; + } + + public void setPid(Integer pid) { + this.pid = pid; + } + + public String getCnName() { + return cnName; + } + + public void setCnName(String cnName) { + this.cnName = cnName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getPerms() { + return perms; + } + + public void setPerms(String perms) { + this.perms = perms; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getCss() { + return css; + } + + public void setCss(String css) { + this.css = css; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public Integer getLevel() { + return level; + } + + public void setLevel(Integer level) { + this.level = level; + } + + public Integer getOrderNum() { + return orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + public Integer getIsShow() { + return isShow; + } + + public void setIsShow(Integer isShow) { + this.isShow = isShow; + } +} diff --git a/src/main/java/com/moon/server/entity/all/PermsAuthEntity.java b/src/main/java/com/moon/server/entity/all/PermsAuthEntity.java new file mode 100644 index 0000000..9a1c244 --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/PermsAuthEntity.java @@ -0,0 +1,95 @@ +package com.moon.server.entity.all; + +import java.io.Serializable; + +/** + * 鏉冮檺鎺堟潈 + * @author WWW + */ +public class PermsAuthEntity implements Serializable { + private static final long serialVersionUID = -8948994757253139554L; + + private Integer id; + + private Integer pid; + + private Integer orderNum; + + private String cnName; + + private String enName; + + private String name; + + private String perms; + + private String tag; + + public PermsAuthEntity() { + + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getPid() { + return pid; + } + + public void setPid(Integer pid) { + this.pid = pid; + } + + public Integer getOrderNum() { + return orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + public String getCnName() { + return cnName; + } + + public void setCnName(String cnName) { + this.cnName = cnName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPerms() { + return perms; + } + + public void setPerms(String perms) { + this.perms = perms; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } +} diff --git a/src/main/java/com/moon/server/entity/all/RedisCacheKey.java b/src/main/java/com/moon/server/entity/all/RedisCacheKey.java new file mode 100644 index 0000000..37b017b --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/RedisCacheKey.java @@ -0,0 +1,77 @@ +package com.moon.server.entity.all; + +/** + * Redis缂撳瓨閿� + * @author WWW + */ +public class RedisCacheKey { + /** + * 鐧诲綍浠ょ墝閿� + */ + public static String signTokenKey(String key) { + return "sign:token:" + key; + } + + /** + * 鐧诲綍鐢ㄦ埛閿� + */ + public static String signUserKey(String key) { + return "sign:user:" + key; + } + + /** + * 瀵嗙爜閿欒閿� + */ + public static String signPwdError(String key) { + return "sign:pwdError:" + key; + } + + /** + * 鎺堟潈鏍归敭 + */ + public static String permsRootKey() { + return "perms:"; + } + + /** + * 璧勬簮鎺堟潈閿� + */ + public static String permsResKey(String key) { + return "perms:res:" + key; + } + + /** + * 鑿滃崟鎺堟潈閿� + */ + public static String permsMenusKey(String key) { + return "perms:menus:" + key; + } + + /** + * 鏉冮檺鎺堟潈閿� + */ + public static String permsPermsKey(String key) { + return "perms:perms:" + key; + } + + /** + * 鏉冮檺鎺堟潈瀹炰綋閿� + */ + public static String permsPermsEntityKey(String key) { + return "perms:permsEntity:" + key; + } + + /** + * 榛�/鐧藉悕鍗曢敭 + */ + public static String blacklistKey(String key) { + return "blacklist:" + key; + } + + /** + * 鍑犱綍瀵硅薄鐨勭┖闂村弬鑰冮敭 + */ + public static String sridKey(String key) { + return "geom:srid:" + key; + } +} diff --git a/src/main/java/com/moon/server/entity/all/ResAuthEntity.java b/src/main/java/com/moon/server/entity/all/ResAuthEntity.java new file mode 100644 index 0000000..23d0bed --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/ResAuthEntity.java @@ -0,0 +1,45 @@ +package com.moon.server.entity.all; + +import java.io.Serializable; + +/** + * 璧勬簮鎺堟潈 + * @author WWW + */ +public class ResAuthEntity implements Serializable { + private static final long serialVersionUID = 7610553267313397837L; + + private Integer id; + + private String name; + + private String server; + + public ResAuthEntity() { + + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getServer() { + return server; + } + + public void setServer(String server) { + this.server = server; + } +} diff --git a/src/main/java/com/moon/server/entity/all/ResponseMsg.java b/src/main/java/com/moon/server/entity/all/ResponseMsg.java new file mode 100644 index 0000000..78d54a4 --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/ResponseMsg.java @@ -0,0 +1,107 @@ +package com.moon.server.entity.all; + +/** + * 鍝嶅簲娑堟伅绫� + * @author www + * @param <T> 娉涘瀷 + */ +public class ResponseMsg<T> { + public ResponseMsg() { + this.time = System.currentTimeMillis(); + } + + public ResponseMsg(HttpStatus code, T result) { + this.code = code.getValue(); + this.msg = this.code == 200 ? "鎴愬姛" : "澶辫触"; + this.result = result; + this.time = System.currentTimeMillis(); + } + + public ResponseMsg(HttpStatus code, String msg, T result) { + this.code = code.getValue(); + this.msg = msg; + this.result = result; + this.time = System.currentTimeMillis(); + } + + public ResponseMsg(int code, String msg, T result, long time) { + this.code = code; + this.msg = msg; + this.result = result; + this.time = time; + } + + public ResponseMsg(HttpStatus code, long count, T result) { + this.code = code.getValue(); + this.msg = this.code == 200 ? "鎴愬姛" : "澶辫触"; + this.count = count; + this.result = result; + this.time = System.currentTimeMillis(); + } + + public ResponseMsg(HttpStatus code, String msg, long count, T result) { + this.code = code.getValue(); + this.msg = msg; + this.count = count; + this.result = result; + this.time = System.currentTimeMillis(); + } + + public ResponseMsg(int code, String msg, long count, T result, long time) { + this.code = code; + this.msg = msg; + this.count = count; + this.result = result; + this.time = time; + } + + private int code; + + private String msg; + + private long count; + + private T result; + + private long time; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public long getCount() { + return count; + } + + public void setCount(long count) { + this.count = count; + } + + public T getResult() { + return result; + } + + public void setResult(T result) { + this.result = result; + } + + public long getTime() { + return time; + } + + public void setTime(long time) { + this.time = time; + } +} diff --git a/src/main/java/com/moon/server/entity/all/SettingData.java b/src/main/java/com/moon/server/entity/all/SettingData.java new file mode 100644 index 0000000..2e03a73 --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/SettingData.java @@ -0,0 +1,57 @@ +package com.moon.server.entity.all; + +/** + * 璁剧疆鏁版嵁绫� + * @author WWW + */ +public class SettingData { + /** + * 瀵嗙爜鍑洪敊娆℃暟 + */ + public static int PWD_ERR_COUNT = 5; + + /** + * 鍑洪敊绛夊緟鏃堕棿 + */ + public static int PWD_ERR_TIME = 5; + + /** + * 鑷姩鐧诲嚭鏃堕棿 + */ + public static int AUTO_LOGOUT = 15; + + /** + * 浠ょ墝鏈夋晥鏈� + */ + public static int TOKEN_EXPIRE = 240; + + /** + * 缂撳瓨鏈夋晥鏈� + */ + public static int CACHE_EXPIRE = 240; + + /** + * 鏈�澶ф枃浠舵暟锛�2000 + */ + public static int MAX_FILES = 2001; + + /** + * Cookie鏈夋晥鏈燂細s + */ + public static int COOKIE_MAX_AGE = 4 * 60 * 60; + + /** + * 闄勪欢澶у皬锛欱 + */ + public static long MAX_FILE_SIZE = 50 * 1024 * 1024; + + /** + * 鐢ㄦ埛璁块棶閲� + */ + public static int MAX_USER_LOGIN; + + /** + * 鏈嶅姟涓婇檺 + */ + public static int MAX_SERVERS; +} diff --git a/src/main/java/com/moon/server/entity/all/StaticData.java b/src/main/java/com/moon/server/entity/all/StaticData.java new file mode 100644 index 0000000..4f1d7c3 --- /dev/null +++ b/src/main/java/com/moon/server/entity/all/StaticData.java @@ -0,0 +1,273 @@ +package com.moon.server.entity.all; + +import com.alibaba.fastjson.JSON; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 闈欐�佹暟鎹被 + * @author WWW + */ +public class StaticData { + /** + * 鏉冮檺鎺掗櫎璺緞锛�/proxy锛岃姹傚叏閮ㄥ皬鍐� + */ + public static String[] EXCLUDE_PATH = new String[]{"/sign/", "/perms/", "/fmeit/", "/crds/", "/floatserver/", "/wmts/select", "/onemap/", "/swagger", "/error"}; + + public final static int TWO = 2; + + public final static int FOUR = 4; + + public final static int NINE = 9; + + public final static int TEN = 10; + + public final static int SIXTEEN = 16; + + public final static int ONE_HUNDRED = 100; + + public final static int TWO_HUNDRED = 200; + + public final static int ONE_HUNDRED_THOUSAND = 100000; + + public static final double D1024 = 1024.0; + + public static final double D1050 = 1050.0; + + public static final int I12 = 12; + + public static final int I23 = 23; + + public static final int I24 = 24; + + public static final int I31 = 31; + + public static final int I60 = 60; + + public static final int I90 = 90; + + public static final int I90_NEG = -90; + + public static final int I180 = 180; + + public static final int I180_NEG = -180; + + public static final int I1000 = 1000; + + public static final int I2050 = 2050; + + public static final int I4490 = 4490; + + /** + * 瀛楃1 + */ + public final static String S1 = "1"; + + /** + * 绛夊彿 + */ + public final static String EQ = "="; + + /** + * 瀛楃鐐� + */ + public final static String POINT = "."; + + /** + * 閫楀彿 + */ + public final static String COMMA = ","; + + /** + * 鍗曞紩鍙� + */ + public final static String SINGLE_QUOTES = "'"; + + public final static String BBOREHOLE = "bborehole"; + + /** + * 姝f枩鏉� + */ + public final static String SLASH = "/"; + + public final static String IN = "in"; + + public final static String ZIP = ".zip"; + + public final static String XLS = ".xls"; + + public final static String XLSX = ".xlsx"; + + public final static String MDB = ".mdb"; + + public final static String SHP = ".shp"; + + public final static String GDB = ".gdb"; + + public final static String JPG = ".jpg"; + + public final static String IMG = ".img"; + + public final static String MPT = ".mpt"; + + public final static String D3DML = ".3dml"; + + public final static String TIF = ".tif"; + + public final static String TIFF = ".tiff"; + + public final static String ADMIN = "admin"; + + public final static String SYS_META = "sysmeta"; + + /** + * 鐗堟湰鍙� + */ + public final static String VERSION = "1.0.0"; + + /** + * 浠ょ墝閿� + */ + public final static String TOKEN_KEY = "token"; + + /** + * Cookie涓护鐗岄敭 + */ + public final static String TOKEN_COOKIE_KEY = "token"; + + /** + * 鏂囨湰缂栫爜鏂瑰紡 + */ + public final static String TEXT_ENCODER = "UTF-8"; + + /** + * 鎬昏川妫� + */ + public final static String CHECK_MAIN = "checkMain"; + + /** + * Object瀵硅薄 + */ + public final static String OBJECT = "java.lang.Object"; + + /** + * Cookie涓璬ruid閿� + */ + public final static String DRUID_COOKIE_KEY = "JSESSIONID"; + + public final static String YES = "YES"; + + public final static String NO = "NO"; + + /** + * 绾胯矾 + */ + public final static String ROUTE = "绾胯矾"; + + /** + * 绌胯法瓒� + */ + public final static String CROSSING = "绌胯法瓒�"; + + public final static String LINESTRING = "LINESTRING"; + + public final static String MULTILINESTRING = "MULTILINESTRING"; + + public final static String POLYGON = "POLYGON"; + + public final static String MULTIPOLYGON = "MULTIPOLYGON"; + + public static final String NO_FILE = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NOT_FOUND, "鏂囦欢鎵句笉鍒�")); + + /** + * 16杩涘埗 + */ + public static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + + /** + * 瀵嗙爜姝e垯琛ㄨ揪寮� + */ + public final static String PWD_REG = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![a-z0-9]+$)(?![a-z\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![0-9\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)[a-zA-Z0-9\\W!@#$%^&*`~()\\-_+=,.?;<>]{12,20}$"; + + /** + * MPT鏂囦欢鎵╁睍鍚� + */ + public final static List<String> MPT_EXT = new ArrayList<>(Arrays.asList(".midx", ".strmi", ".ei.midx", ".ei.mpt", ".ei.strmi")); + + /** + * JPG鏂囦欢鎵╁睍鍚� + */ + public final static List<String> JPG_EXT = new ArrayList<>(Arrays.asList(".jgw", ".jpg.aux.xml", ".jpg.xml", ".prj")); + + /** + * IMG鏂囦欢鎵╁睍鍚� + */ + public final static List<String> IMG_EXT = new ArrayList<>(Arrays.asList(".rrd", ".img.aux.xml", ".hdr", ".img.enp", ".img.xml")); + + /** + * TIF鏂囦欢鎵╁睍鍚� + */ + public final static List<String> TIF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".tif.ovr", ".tif.aux.xml", ".tif.enp", ".tif.xml")); + + /** + * TIFF鏂囦欢鎵╁睍鍚� + */ + public final static List<String> TIFF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".tiff.ovr", ".tiff.aux.xml", ".tiff.enp", ".tiff.xml")); + + /** + * SHP鏂囦欢鎵╁睍鍚� + */ + public final static List<String> SHP_EXT = new ArrayList<>(Arrays.asList(".shx", ".dbf", ".prj", ".cpg")); + + /** + * Mapper鎺掗櫎鎵╁睍鍚� + */ + public final static List<String> MAPPER_EXCLUDE_EXT = new ArrayList<>(Arrays.asList(".img.aux.xml", ".img.xml", ".tif.aux.xml", ".tif.xml", ".tiff.aux.xml", ".tiff.xml", ".shp.xml")); + + /** + * 鎵�鏈夋枃浠舵墿灞曞悕 + */ + public final static List<String> ALL_EXTENSION = new ArrayList<>(Arrays.asList(".txt", ".xml", ".pdf", ".xls", ".xlsx", ".doc", ".docx", ".ppt", ".pptx", ".shp", ".gdb", ".mdb", ".dwg", ".las", ".laz", ".cpt", ".mpt", ".ei.mpt", ".fly", ".efb", ".g3d", ".fbx", ".obj", ".3dm", ".3dml", ".osgb", ".rvt", ".ifc", ".jpg", ".png", ".img", ".tif", ".tiff", ".dem", ".bmp", ".gif", ".rmvb", ".rm", ".mp3", ".mp4", ".avi", ".wma", ".wmv", ".7z", ".rar", ".zip")); + + /** + * 鎻掑叆鎺掗櫎瀛楁 + */ + public final static List<String> INSERT_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("gid", "objectid", "updateuser", "updatetime", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); + + /** + * 鏇存柊鎺掗櫎瀛楁 + */ + public final static List<String> UPDATE_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("objectid", "createuser", "createtime", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); + + /** + * 璇诲彇鎺掗櫎瀛楁 + */ + public final static List<String> READ_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("gid", "eventid", "parentid", "objectid", "dirid", "depid", "verid", "createtime", "createuser", "updateuser", "updatetime", "shape_leng", "shape_area", "serialversionuid", "dirname", "depname", "vername", "createname", "updatename")); + + /** + * MDB鎺掗櫎瀛楁 + */ + public final static List<String> MDB_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("Shape", "SHAPE_LENG", "Shape_Length", "Shape_Area", "OBJECTID_1")); + + /** + * 鏍囩粯Shp鎺掗櫎瀛楁 + */ + public final static List<String> MARK_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("wkt", "geom", "objectid", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); + + /** + * GDB鎺掗櫎瀛楁 + */ + public final static List<String> GDB_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("geom", "objectid", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); + + /** + * 绠$嚎鍒嗘瀽琛ㄥ悕闆嗗悎 + */ + public final static List<String> PIPE_ANALYSIS_TABS = new ArrayList<>(Arrays.asList("bd.dlg_25w_hydl", "bd.dlg_25w_lrdl", "bd.dlg_25w_lrrl", "bd.dlg_25w_hyda")); + + /** + * 绠$嚎鎺掗櫎瀛楁 + */ + public final static List<String> PIPE_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("serialVersionUID", "tabs", "pwd", "gid", "wkt")); +} diff --git a/src/main/java/com/moon/server/entity/ctrl/CountEntity.java b/src/main/java/com/moon/server/entity/ctrl/CountEntity.java new file mode 100644 index 0000000..f0d8988 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/CountEntity.java @@ -0,0 +1,70 @@ +package com.moon.server.entity.ctrl; + +/** + * 缁熻瀹炰綋绫� + * @author WWW + */ +public class CountEntity { + private Integer no; + + private String m1; + + private String m2; + + private String m3; + + private Long count; + + private Double sizes; + + public CountEntity() { + } + + public Integer getNo() { + return no; + } + + public void setNo(Integer no) { + this.no = no; + } + + public String getM1() { + return m1; + } + + public void setM1(String m1) { + this.m1 = m1; + } + + public String getM2() { + return m2; + } + + public void setM2(String m2) { + this.m2 = m2; + } + + public String getM3() { + return m3; + } + + public void setM3(String m3) { + this.m3 = m3; + } + + public Long getCount() { + return count; + } + + public void setCount(Long count) { + this.count = count; + } + + public Double getSizes() { + return sizes; + } + + public void setSizes(Double sizes) { + this.sizes = sizes; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/DownloadReqEntity.java b/src/main/java/com/moon/server/entity/ctrl/DownloadReqEntity.java new file mode 100644 index 0000000..8aa5b50 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/DownloadReqEntity.java @@ -0,0 +1,137 @@ +package com.moon.server.entity.ctrl; + +import com.moon.server.entity.all.AbstractPwdEntity; + +import java.io.Serializable; +import java.util.List; + +/** + * 璇锋眰涓嬭浇瀹炰綋绫� + * @author WWW + */ +public class DownloadReqEntity extends AbstractPwdEntity implements Serializable { + private static final long serialVersionUID = -8624235184539814997L; + + private String guid; + + private List<String> guids; + + private List<Integer> ids; + + private String wkt; + + private List<String> entities; + + private String tab; + + private List<String> tabs; + + private String descr; + + private String filter; + + private List<String> depcodes; + + private String depcode; + + private String dirs; + + public DownloadReqEntity() { + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public List<String> getGuids() { + return guids; + } + + public void setGuids(List<String> guids) { + this.guids = guids; + } + + public List<Integer> getIds() { + return ids; + } + + public void setIds(List<Integer> ids) { + this.ids = ids; + } + + public String getWkt() { + return wkt; + } + + public void setWkt(String wkt) { + this.wkt = wkt; + } + + public String getTab() { + return tab; + } + + public void setTab(String tab) { + this.tab = tab; + } + + public List<String> getTabs() { + return tabs; + } + + public void setTabs(List<String> tabs) { + this.tabs = tabs; + } + + public List<String> getEntities() { + return entities; + } + + public void setEntities(List<String> entities) { + this.entities = entities; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public String getFilter() { + return filter; + } + + public void setFilter(String filter) { + this.filter = filter; + } + + public List<String> getDepcodes() { + return depcodes; + } + + public void setDepcodes(List<String> depcodes) { + this.depcodes = depcodes; + } + + public String getDirs() { + return dirs; + } + + public void setDirs(String dirs) { + this.dirs = dirs; + } + + public String getDepcode() { + return depcode; + } + + public void setDepcode(String depcode) { + this.depcode = depcode; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/DownloadTileEntity.java b/src/main/java/com/moon/server/entity/ctrl/DownloadTileEntity.java new file mode 100644 index 0000000..25cf4ab --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/DownloadTileEntity.java @@ -0,0 +1,105 @@ +package com.moon.server.entity.ctrl; + +import com.moon.server.entity.all.AbstractPwdEntity; +import com.moon.server.entity.all.StaticData; + +import java.io.Serializable; + +/** + * 涓嬭浇鐡︾墖瀹炰綋绫� + * @author WWW + */ +public class DownloadTileEntity extends AbstractPwdEntity implements Serializable { + private static final long serialVersionUID = -229710198271495902L; + + private Double xmin; + + private Double ymin; + + private Double xmax; + + private Double ymax; + + private Integer pubid; + + private String title; + + public DownloadTileEntity() { + } + + /** + * 楠岃瘉鍧愭爣 + */ + public String verifyCoords() { + if (null == xmin || null == ymin || null == xmax || null == ymax) { + return "鍥涜嚦鍧愭爣鍊间笉鑳戒负绌�"; + } + if (xmin < StaticData.I180_NEG || xmin > StaticData.I180 || xmax < StaticData.I180_NEG || xmax > StaticData.I180) { + return "X鍧愭爣鍊间笉姝g‘"; + } + if (ymin < StaticData.I90_NEG || ymin > StaticData.I90 || ymax < StaticData.I90_NEG || ymax > StaticData.I90) { + return "Y鍧愭爣鍊间笉姝g‘"; + } + + if (xmin > xmax) { + double x = xmax; + xmin = xmax; + xmax = x; + } + if (ymin > ymax) { + double y = ymax; + ymin = ymax; + ymax = y; + } + + return null; + } + + public Double getXmin() { + return xmin; + } + + public void setXmin(Double xmin) { + this.xmin = xmin; + } + + public Double getYmin() { + return ymin; + } + + public void setYmin(Double ymin) { + this.ymin = ymin; + } + + public Double getXmax() { + return xmax; + } + + public void setXmax(Double xmax) { + this.xmax = xmax; + } + + public Double getYmax() { + return ymax; + } + + public void setYmax(Double ymax) { + this.ymax = ymax; + } + + public Integer getPubid() { + return pubid; + } + + public void setPubid(Integer pubid) { + this.pubid = pubid; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/FileInfoEntity.java b/src/main/java/com/moon/server/entity/ctrl/FileInfoEntity.java new file mode 100644 index 0000000..e0a95d3 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/FileInfoEntity.java @@ -0,0 +1,58 @@ +package com.moon.server.entity.ctrl; + +import java.io.Serializable; + +/** + * 鏂囦欢淇℃伅 + * @author WWW + */ +public class FileInfoEntity implements Serializable { + private static final long serialVersionUID = -674723262772248619L; + + private String fileName; + + private Long size; + + private String md5; + + private String path; + + public FileInfoEntity() { + } + + public FileInfoEntity(String fileName) { + this.fileName = fileName; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + + public String getMd5() { + return md5; + } + + public void setMd5(String md5) { + this.md5 = md5; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/FmeReqEntity.java b/src/main/java/com/moon/server/entity/ctrl/FmeReqEntity.java new file mode 100644 index 0000000..c6ca70b --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/FmeReqEntity.java @@ -0,0 +1,100 @@ +package com.moon.server.entity.ctrl; + +/** + * FME璇锋眰瀹炰綋绫� + * @author WWW + */ +public class FmeReqEntity { + public FmeReqEntity() { + } + + /** + * 浠诲姟鍚嶇О + */ + public String names; + + /** + * 椤圭洰鍚嶇О + */ + public String xmmc; + + /** + * 鏁版嵁涓撲笟锛氭祴閲忎笓涓� | 鍕樺療涓撲笟 | 鍦扮伨涓撲笟 | 娲炲簱涓撲笟 | 绾胯矾涓撲笟 + */ + public String sjzy; + + /** + * 鏁版嵁鍒嗙被锛氭暟瀛楀寲鎴愭灉 | 鏁版嵁搴撴垚鏋� | 鍕樺療淇℃伅琛� | 琛ㄦ牸鎴愭灉 + */ + public String sjfl; + + /** + * 寰呮鍘嬬缉鍖� + */ + public String zipPath; + + /** + * WBS琛ㄦ牸 + */ + public String wbsPath; + + /** + * 鏄�/鍚︿负鍦扮伨鏁版嵁锛歒ES | NO + */ + public String isDiZai; + + /** + * 鍦扮伨鏁版嵁绫诲瀷锛氾紙宕╁娌荤悊 | 涓嶇ǔ瀹氭枩鍧℃不鐞� | 鍦伴潰濉岄櫡娌荤悊 | 楂橀櫋杈瑰潯娌荤悊 | 娉ョ煶娴佹不鐞� | 姘存瘉娌荤悊 | 婊戝潯娌荤悊锛� | NO + */ + public String diZaiType; + + /** + * 鍧愭爣绯伙細EPSG:4326 + */ + public String coordinateSystem; + + /** + * 褰卞儚鍒嗚鲸鐜囷紙榛樿0.2m锛� + */ + public double imgResolution = 0.2; + + /** + * 闈�/绾�/鐐归噸鍙犲宸� + */ + public double tolerance = 0.001; + + /** + * 楂樼▼鐐归棿璺濅笂闄� + */ + public double gcdOffset = 20; + + /** + * 鎺у埗鐐归棿璺濅笂闄� + */ + public double kzdOffset = 100; + + /** + * 娴嬪尯鑼冨洿锛堢背锛� + */ + public double rangeOffset = 200; + + /** + * 鎮寕绾挎渶澶ц窛绂� + */ + public double xgMax = 0.005; + + /** + * 楂樼▼涓宸紙m锛� + */ + public double demTolerance = 5; + + /** + * 楂樼▼鍊肩獊鍙樼巼(榛樿鍊�200) + */ + public double demChangeRate = 200; + + /** + * 鐐逛簯瀵嗗害锛堥粯璁�1/m3锛� + */ + public double lazDensity = 1; +} diff --git a/src/main/java/com/moon/server/entity/ctrl/IdNameEntity.java b/src/main/java/com/moon/server/entity/ctrl/IdNameEntity.java new file mode 100644 index 0000000..b73ec86 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/IdNameEntity.java @@ -0,0 +1,34 @@ +package com.moon.server.entity.ctrl; + +import java.io.Serializable; + +/** + * ID-鍚嶇О瀹炰綋绫� + * @author WWW + */ +public class IdNameEntity implements Serializable { + private static final long serialVersionUID = -8485687857643406110L; + + private Integer id; + + private String name; + + public IdNameEntity() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/KeyValueEntity.java b/src/main/java/com/moon/server/entity/ctrl/KeyValueEntity.java new file mode 100644 index 0000000..2d580f2 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/KeyValueEntity.java @@ -0,0 +1,35 @@ +package com.moon.server.entity.ctrl; + +/** + * 閿�煎瀹炰綋绫� + * @author WWW + */ +public class KeyValueEntity { + private String key; + + private String value; + + public KeyValueEntity() { + } + + public KeyValueEntity(String key, String value) { + this.key = key; + this.value = value; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/MarkJsonEntity.java b/src/main/java/com/moon/server/entity/ctrl/MarkJsonEntity.java new file mode 100644 index 0000000..c9fa854 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/MarkJsonEntity.java @@ -0,0 +1,88 @@ +package com.moon.server.entity.ctrl; + +import java.io.Serializable; + +/** + * 鏍囩粯JSON瀹炰綋绫� + * @author WWW + */ +public class MarkJsonEntity implements Serializable { + private static final long serialVersionUID = 7776629022021914001L; + + private Integer id; + + private String name; + + private String type; + + private String fillColor; + + private Double opacity; + + private String bak; + + private String wkt; + + public MarkJsonEntity() { + } + + public MarkJsonEntity(Integer id) { + this.id = id; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getFillColor() { + return fillColor; + } + + public void setFillColor(String fillColor) { + this.fillColor = fillColor; + } + + public Double getOpacity() { + return opacity; + } + + public void setOpacity(Double opacity) { + this.opacity = opacity; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getWkt() { + return wkt; + } + + public void setWkt(String wkt) { + this.wkt = wkt; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/NameValueEntity.java b/src/main/java/com/moon/server/entity/ctrl/NameValueEntity.java new file mode 100644 index 0000000..fbba1b9 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/NameValueEntity.java @@ -0,0 +1,35 @@ +package com.moon.server.entity.ctrl; + +/** + * 鍚嶇О鍊煎瀹炰綋绫� + * @author WWW + */ +public class NameValueEntity { + private String name; + + private Object value; + + public NameValueEntity() { + } + + public NameValueEntity(String name, Object value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/PubEntity.java b/src/main/java/com/moon/server/entity/ctrl/PubEntity.java new file mode 100644 index 0000000..e201046 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/PubEntity.java @@ -0,0 +1,114 @@ +package com.moon.server.entity.ctrl; + +import io.swagger.models.auth.In; + +import java.util.List; + +/** + * 鍙戝竷瀹炰綋绫� + * @author WWW + */ +public class PubEntity { + public PubEntity() { + } + + private String type; + + private String token; + + private String name; + + private Integer userId; + + private Integer min; + + private Integer max; + + private Integer noData; + + private String dircode; + + private String depcode; + + private List<String> ids; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public Integer getMin() { + return min; + } + + public void setMin(Integer min) { + this.min = min; + } + + public Integer getMax() { + return max; + } + + public void setMax(Integer max) { + this.max = max; + } + + public Integer getNoData() { + return noData; + } + + public void setNoData(Integer noData) { + this.noData = noData; + } + + public String getDircode() { + return dircode; + } + + public void setDircode(String dircode) { + this.dircode = dircode; + } + + public String getDepcode() { + return depcode; + } + + public void setDepcode(String depcode) { + this.depcode = depcode; + } + + public List<String> getIds() { + return ids; + } + + public void setIds(List<String> ids) { + this.ids = ids; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/RegisterEntity.java b/src/main/java/com/moon/server/entity/ctrl/RegisterEntity.java new file mode 100644 index 0000000..77cf367 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/RegisterEntity.java @@ -0,0 +1,144 @@ +package com.moon.server.entity.ctrl; + +import com.moon.server.helper.StringHelper; + +import java.util.ArrayList; +import java.util.List; + +/** + * 娉ㄥ唽绫� + * @author WWW + */ +public class RegisterEntity { + public RegisterEntity() { + } + + public RegisterEntity(String name, String uri, String type) { + tags = new ArrayList<>(); + tags.add(type); + + this.name = name; + this.address = uri; + this.detailUrl = uri; + this.type = type; + this.description = name; + this.isrequest = true; + this.hashid = StringHelper.getGuid(); + this.ispublic = false; + } + + public RegisterEntity(Integer pubid) { + this.reason = "娉ㄥ唽"; + this.serialnum = pubid.toString(); + } + + private List<String> tags; + + private String name; + + private String address; + + private String detailUrl; + + private String type; + + private String description; + + private Boolean isrequest; + + private String hashid; + + private String reason; + + private String serialnum; + + private Boolean ispublic; + + public List<String> getTags() { + return tags; + } + + public void setTags(List<String> tags) { + this.tags = tags; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getDetailUrl() { + return detailUrl; + } + + public void setDetailUrl(String detailUrl) { + this.detailUrl = detailUrl; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Boolean getIsrequest() { + return isrequest; + } + + public void setIsrequest(Boolean isrequest) { + this.isrequest = isrequest; + } + + public String getHashid() { + return hashid; + } + + public void setHashid(String hashid) { + this.hashid = hashid; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public String getSerialnum() { + return serialnum; + } + + public void setSerialnum(String serialnum) { + this.serialnum = serialnum; + } + + public Boolean getIspublic() { + return ispublic; + } + + public void setIspublic(Boolean ispublic) { + this.ispublic = ispublic; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/SdkDecryptDataEntity.java b/src/main/java/com/moon/server/entity/ctrl/SdkDecryptDataEntity.java new file mode 100644 index 0000000..dd10405 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/SdkDecryptDataEntity.java @@ -0,0 +1,82 @@ +package com.moon.server.entity.ctrl; + +import com.alibaba.fastjson.annotation.JSONField; +import com.moon.server.entity.all.StaticData; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +/** + * SDK瑙e瘑鏁版嵁绫� + * @author WWW + */ +public class SdkDecryptDataEntity implements Serializable { + private static final long serialVersionUID = 4119527512820258035L; + + private static List<Integer> registeredModules = new ArrayList<>(); + + static { + for (int i = 1; i <= StaticData.ONE_HUNDRED; i++) { + registeredModules.add(i); + } + } + + public SdkDecryptDataEntity() { + machineId = "e7dd8a96913fb5fe62df6b5a7fd503f4"; + // registeredModules = new int[] { 1, 3, 9, 12, 13, 17, 25, 30, 33, 37 } + message = "OK"; + success = true; + + Calendar calendar = Calendar.getInstance(); + calendar.set(2050, 12, 31); + expireDate = calendar.getTime(); + } + + private String machineId; + + private String message; + + private boolean success; + + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private Date expireDate; + + public String getMachineId() { + return machineId; + } + + public void setMachineId(String machineId) { + this.machineId = machineId; + } + + public List<Integer> getRegisteredModules() { + return registeredModules; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public Date getExpireDate() { + return expireDate; + } + + public void setExpireDate(Date expireDate) { + this.expireDate = expireDate; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/SdkDecryptEntity.java b/src/main/java/com/moon/server/entity/ctrl/SdkDecryptEntity.java new file mode 100644 index 0000000..cfb8ff0 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/SdkDecryptEntity.java @@ -0,0 +1,48 @@ +package com.moon.server.entity.ctrl; + +import java.io.Serializable; + +/** + * SDK瑙e瘑绫� + * @author WWW + */ +public class SdkDecryptEntity implements Serializable { + private static final long serialVersionUID = 853291437502721609L; + + private int code; + + private String msg; + + private SdkDecryptDataEntity data; + + public SdkDecryptEntity() { + code = 200; + msg = null; + data = new SdkDecryptDataEntity(); + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public SdkDecryptDataEntity getData() { + return data; + } + + public void setData(SdkDecryptDataEntity data) { + this.data = data; + } +} + diff --git a/src/main/java/com/moon/server/entity/ctrl/SdkSecretEntity.java b/src/main/java/com/moon/server/entity/ctrl/SdkSecretEntity.java new file mode 100644 index 0000000..d8c928d --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/SdkSecretEntity.java @@ -0,0 +1,43 @@ +package com.moon.server.entity.ctrl; + +/** + * SDK鍔犲瘑绫� + * @author WWW + */ +public class SdkSecretEntity { + private int code; + + private String msg; + + private String data; + + public SdkSecretEntity() { + code = 200; + msg = null; + data = "1052f106aed368e0c29b4eec89e03a91e352059a24624d0b4fab38e57943a47a0c81e9c843d9e3b11eaed1e7853b09ad7c603d4f854f0351fa9397fe4a06e0c161ca142d0665289510535743fd11e3c47e5648a031d1240536de3640ef94808fec77d15bfea9e6f3faca2f19d15f89b1fcfe23fa7b2b4f433ba22a7484992f63766cb68a81120288e1638a16b126139833b6f1c35876932a4d730ef68fbfecc4"; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/ShpRecordEntity.java b/src/main/java/com/moon/server/entity/ctrl/ShpRecordEntity.java new file mode 100644 index 0000000..ecb9971 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/ShpRecordEntity.java @@ -0,0 +1,40 @@ +package com.moon.server.entity.ctrl; + +import java.io.Serializable; + +/** + * Shp璁板綍 + * @author WWW + */ +public class ShpRecordEntity implements Serializable { + private static final long serialVersionUID = -1366388818651675941L; + + private String wkt; + + private String csid; + + public ShpRecordEntity() { + + } + + public ShpRecordEntity(String wkt, String csid) { + this.wkt = wkt; + this.csid = csid; + } + + public String getWkt() { + return wkt; + } + + public void setWkt(String wkt) { + this.wkt = wkt; + } + + public String getCsid() { + return csid; + } + + public void setCsid(String csid) { + this.csid = csid; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/TabEntity.java b/src/main/java/com/moon/server/entity/ctrl/TabEntity.java new file mode 100644 index 0000000..a3e8c7c --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/TabEntity.java @@ -0,0 +1,84 @@ +package com.moon.server.entity.ctrl; + +import java.io.Serializable; + +/** + * 琛ㄥ疄浣撶被 + * @author WWW + */ +public class TabEntity implements Serializable { + private static final long serialVersionUID = 2786394526795387464L; + + private String ns; + + private String tab; + + private String entity; + + private String tabDesc; + + private String tableType; + + private Integer rows; + + private String bak; + + public TabEntity() { + } + + public String getNs() { + return ns; + } + + public void setNs(String ns) { + this.ns = ns; + } + + public String getTab() { + return tab; + } + + public void setTab(String tab) { + this.tab = tab; + } + + public String getEntity() { + return entity; + } + + public void setEntity(String entity) { + this.entity = entity; + } + + public String getTabDesc() { + return tabDesc; + } + + public void setTabDesc(String tabDesc) { + this.tabDesc = tabDesc; + } + + public String getTableType() { + return tableType; + } + + public void setTableType(String tableType) { + this.tableType = tableType; + } + + public Integer getRows() { + return rows; + } + + public void setRows(Integer rows) { + this.rows = rows; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } +} diff --git a/src/main/java/com/moon/server/entity/ctrl/TabMapperEntity.java b/src/main/java/com/moon/server/entity/ctrl/TabMapperEntity.java new file mode 100644 index 0000000..2207244 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/TabMapperEntity.java @@ -0,0 +1,40 @@ +package com.moon.server.entity.ctrl; + +/** + * 琛ㄦ槧灏勫疄浣撶被 + * @author WWW + */ +public class TabMapperEntity { + public TabMapperEntity() { + } + + public TabMapperEntity(String fileName, String type, String tab, String subPath) { + this.fileName = fileName; + this.type = type; + this.tab = tab; + this.subPath = subPath; + } + + private String eventid; + + private int dirid; + + private int depid; + + private int verid; + + private String fileName; + + private String extName; + + private String type; + + private String subPath; + + private String tab; + + private String entity; + + private Integer rows; + +} diff --git a/src/main/java/com/moon/server/entity/ctrl/UserUpdateEntity.java b/src/main/java/com/moon/server/entity/ctrl/UserUpdateEntity.java new file mode 100644 index 0000000..208f885 --- /dev/null +++ b/src/main/java/com/moon/server/entity/ctrl/UserUpdateEntity.java @@ -0,0 +1,46 @@ +package com.moon.server.entity.ctrl; + +import java.io.Serializable; +import java.util.List; + +/** + * 鐢ㄦ埛鏇存柊绫� + * @author WWW + */ +public class UserUpdateEntity implements Serializable { + private static final long serialVersionUID = 8390219588267518254L; + + private String adminPwd; + + private String newPwd; + + private List<Integer> ids; + + public UserUpdateEntity() { + + } + + public String getAdminPwd() { + return adminPwd; + } + + public void setAdminPwd(String adminPwd) { + this.adminPwd = adminPwd; + } + + public String getNewPwd() { + return newPwd; + } + + public void setNewPwd(String newPwd) { + this.newPwd = newPwd; + } + + public List<Integer> getIds() { + return ids; + } + + public void setIds(List<Integer> ids) { + this.ids = ids; + } +} diff --git a/src/main/java/com/moon/server/entity/data/CoordEntity.java b/src/main/java/com/moon/server/entity/data/CoordEntity.java new file mode 100644 index 0000000..3c12c4f --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/CoordEntity.java @@ -0,0 +1,51 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; + +/** + * 鍧愭爣绯� + * @author WWW + */ +public class CoordEntity implements Serializable { + private static final long serialVersionUID = 5660360983928368364L; + + private Integer id; + + private String epsgcode; + + private String coordinate; + + private String zoning; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getEpsgcode() { + return epsgcode; + } + + public void setEpsgcode(String epsgcode) { + this.epsgcode = epsgcode; + } + + public String getCoordinate() { + return coordinate; + } + + public void setCoordinate(String coordinate) { + this.coordinate = coordinate; + } + + public String getZoning() { + return zoning; + } + + public void setZoning(String zoning) { + this.zoning = zoning; + } +} diff --git a/src/main/java/com/moon/server/entity/data/DictEntity.java b/src/main/java/com/moon/server/entity/data/DictEntity.java new file mode 100644 index 0000000..ea2dc88 --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/DictEntity.java @@ -0,0 +1,235 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 瀛楀吀绠$悊 + * @author WWW + */ +public class DictEntity implements Serializable { + private static final long serialVersionUID = -343890141066128689L; + + private int id; + + private String ns; + + private String tab; + + private String tabDesc; + + private String field; + + private String alias; + + private String type; + + private int len; + + private int precision; + + private int orderNum; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String tabletype; + + private String unit; + + private String domainNa; + + private int showtype; + + private int editable; + + private String bak; + + private String createName; + + private String updateName; + + public DictEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getNs() { + return ns; + } + + public void setNs(String ns) { + this.ns = ns; + } + + public String getTab() { + return tab; + } + + public void setTab(String tab) { + this.tab = tab; + } + + public String getTabDesc() { + return tabDesc; + } + + public void setTabDesc(String tabDesc) { + this.tabDesc = tabDesc; + } + + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } + + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getLen() { + return len; + } + + public void setLen(int len) { + this.len = len; + } + + public int getPrecision() { + return precision; + } + + public void setPrecision(int precision) { + this.precision = precision; + } + + public int getOrderNum() { + return orderNum; + } + + public void setOrderNum(int orderNum) { + this.orderNum = orderNum; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getTabletype() { + return tabletype; + } + + public void setTabletype(String tabletype) { + this.tabletype = tabletype; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getDomainNa() { + return domainNa; + } + + public void setDomainNa(String domainNa) { + this.domainNa = domainNa; + } + + public int getShowtype() { + return showtype; + } + + public void setShowtype(int showtype) { + this.showtype = showtype; + } + + public int getEditable() { + return editable; + } + + public void setEditable(int editable) { + this.editable = editable; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } +} diff --git a/src/main/java/com/moon/server/entity/data/DirEntity.java b/src/main/java/com/moon/server/entity/data/DirEntity.java new file mode 100644 index 0000000..2ef7e6e --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/DirEntity.java @@ -0,0 +1,170 @@ +package com.moon.server.entity.data; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鐩綍 + * @author WWW + */ +@Data +@AllArgsConstructor +public class DirEntity implements Serializable { + private static final long serialVersionUID = -2184993363389504088L; + + private int id; + + private int pid; + + private String name; + + private String exts; + + private String descr; + + private int level; + + private int orderNum; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String checks; + + private String bak; + + private String code; + + private String fullName; + + public DirEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getPid() { + return pid; + } + + public void setPid(int pid) { + this.pid = pid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getExts() { + return exts; + } + + public void setExts(String exts) { + this.exts = exts; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getOrderNum() { + return orderNum; + } + + public void setOrderNum(int orderNum) { + this.orderNum = orderNum; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getChecks() { + return checks; + } + + public void setChecks(String checks) { + this.checks = checks; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } +} diff --git a/src/main/java/com/moon/server/entity/data/DomainEntity.java b/src/main/java/com/moon/server/entity/data/DomainEntity.java new file mode 100644 index 0000000..4485cea --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/DomainEntity.java @@ -0,0 +1,145 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鍊煎煙 + * @author WWW + */ +public class DomainEntity implements Serializable { + private static final long serialVersionUID = -334732819504445760L; + + private int id; + + private String domDesc; + + private String domName; + + private String domCode; + + private String codeDesc; + + private int level; + + private int orderid; + + private String bsm; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + public DomainEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getDomDesc() { + return domDesc; + } + + public void setDomDesc(String domDesc) { + this.domDesc = domDesc; + } + + public String getDomName() { + return domName; + } + + public void setDomName(String domName) { + this.domName = domName; + } + + public String getDomCode() { + return domCode; + } + + public void setDomCode(String domCode) { + this.domCode = domCode; + } + + public String getCodeDesc() { + return codeDesc; + } + + public void setCodeDesc(String codeDesc) { + this.codeDesc = codeDesc; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getOrderid() { + return orderid; + } + + public void setOrderid(int orderid) { + this.orderid = orderid; + } + + public String getBsm() { + return bsm; + } + + public void setBsm(String bsm) { + this.bsm = bsm; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } +} diff --git a/src/main/java/com/moon/server/entity/data/DownloadEntity.java b/src/main/java/com/moon/server/entity/data/DownloadEntity.java new file mode 100644 index 0000000..998ed0e --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/DownloadEntity.java @@ -0,0 +1,185 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 涓嬭浇璁板綍 + * @author WWW + */ +public class DownloadEntity implements Serializable { + private static final long serialVersionUID = -767416271272774912L; + + private int id; + + private String name; + + private int type; + + private double sizes; + + private int depid; + + private int dcount; + + private String pwd; + + private String url; + + private String descr; + + private String guid; + + private int createUser; + + private Timestamp createTime; + + private int downloadUser; + + private Timestamp downloadTime; + + private String geom; + + private String bak; + + private String createName; + + public DownloadEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public double getSizes() { + return sizes; + } + + public void setSizes(double sizes) { + this.sizes = sizes; + } + + public int getDepid() { + return depid; + } + + public void setDepid(int depid) { + this.depid = depid; + } + + public int getDcount() { + return dcount; + } + + public void setDcount(int dcount) { + this.dcount = dcount; + } + + public String getPwd() { + return pwd; + } + + public void setPwd(String pwd) { + this.pwd = pwd; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getDownloadUser() { + return downloadUser; + } + + public void setDownloadUser(int downloadUser) { + this.downloadUser = downloadUser; + } + + public Timestamp getDownloadTime() { + return downloadTime; + } + + public void setDownloadTime(Timestamp downloadTime) { + this.downloadTime = downloadTime; + } + + public String getGeom() { + return geom; + } + + public void setGeom(String geo) { + this.geom = geo; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } +} diff --git a/src/main/java/com/moon/server/entity/data/FmeLogEntity.java b/src/main/java/com/moon/server/entity/data/FmeLogEntity.java new file mode 100644 index 0000000..5fdcf2f --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/FmeLogEntity.java @@ -0,0 +1,105 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * FME鏃ュ織琛� + * @author WWW + */ +public class FmeLogEntity implements Serializable { + private static final long serialVersionUID = -1304153743551710249L; + + public FmeLogEntity() { + } + + private Integer id; + + private String parentid; + + private String dirpath; + + private String pgNs; + + private String tcmc; + + private String tcdm; + + private Integer count; + + private Timestamp createTime; + + private Timestamp updateTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getParentid() { + return parentid; + } + + public void setParentid(String parentid) { + this.parentid = parentid; + } + + public String getDirpath() { + return dirpath; + } + + public void setDirpath(String dirpath) { + this.dirpath = dirpath; + } + + public String getPgNs() { + return pgNs; + } + + public void setPgNs(String pgNs) { + this.pgNs = pgNs; + } + + public String getTcmc() { + return tcmc; + } + + public void setTcmc(String tcmc) { + this.tcmc = tcmc; + } + + public String getTcdm() { + return tcdm; + } + + public void setTcdm(String tcdm) { + this.tcdm = tcdm; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } +} diff --git a/src/main/java/com/moon/server/entity/data/LayerEntity.java b/src/main/java/com/moon/server/entity/data/LayerEntity.java new file mode 100644 index 0000000..915175b --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/LayerEntity.java @@ -0,0 +1,235 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鍥惧眰 + * @author WWW + */ +public class LayerEntity implements Serializable { + private static final long serialVersionUID = -159911666139919168L; + + private int id; + + private int pid; + + private String cnName; + + private String enName; + + private String url; + + private String testUrl; + + private int type; + + private String icon; + + private int level; + + private int orderNum; + + private int isShow; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + private String serveType; + + private String dataType; + + private double elev; + + private String ns; + + private Integer pubid; + + private Integer isProject; + + public LayerEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getPid() { + return pid; + } + + public void setPid(int pid) { + this.pid = pid; + } + + public String getCnName() { + return cnName; + } + + public void setCnName(String cnName) { + this.cnName = cnName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getTestUrl() { + return testUrl; + } + + public void setTestUrl(String testUrl) { + this.testUrl = testUrl; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getOrderNum() { + return orderNum; + } + + public void setOrderNum(int orderNum) { + this.orderNum = orderNum; + } + + public int getIsShow() { + return isShow; + } + + public void setIsShow(int isShow) { + this.isShow = isShow; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getServeType() { + return serveType; + } + + public void setServeType(String serveType) { + this.serveType = serveType; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + public double getElev() { + return elev; + } + + public void setElev(double elev) { + this.elev = elev; + } + + public String getNs() { + return ns; + } + + public void setNs(String ns) { + this.ns = ns; + } + + public Integer getPubid() { + return pubid; + } + + public void setPubid(Integer pubid) { + this.pubid = pubid; + } + + public Integer getIsProject() { + return isProject; + } + + public void setIsProject(Integer isProject) { + this.isProject = isProject; + } +} diff --git a/src/main/java/com/moon/server/entity/data/MetaEntity.java b/src/main/java/com/moon/server/entity/data/MetaEntity.java new file mode 100644 index 0000000..8f3c7a1 --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/MetaEntity.java @@ -0,0 +1,305 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鍏冩暟鎹� + * @author WWW + */ +public class MetaEntity implements Serializable { + private static final long serialVersionUID = -984838663593325184L; + + private int id; + + private String eventid; + + private int metaid; + + private short ismeta; + + private String dircode; + + private String depcode; + + private int verid; + + private String name; + + private String type; + + private String guid; + + private String path; + + private double sizes; + + private String tab; + + private String layer; + + private int rows; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + private String geom; + + private String uname; + + private String depName; + + private String verName; + + private String dirName; + + private Integer downCount; + + private String lastUser; + + private Timestamp lastTime; + + private String url; + + public MetaEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getEventid() { + return eventid; + } + + public void setEventid(String eventid) { + this.eventid = eventid; + } + + public int getMetaid() { + return metaid; + } + + public void setMetaid(int metaid) { + this.metaid = metaid; + } + + public short getIsmeta() { + return ismeta; + } + + public void setIsmeta(short ismeta) { + this.ismeta = ismeta; + } + + public String getDircode() { + return dircode; + } + + public void setDircode(String dircode) { + this.dircode = dircode; + } + + public String getDepcode() { + return depcode; + } + + public void setDepcode(String depcode) { + this.depcode = depcode; + } + + public int getVerid() { + return verid; + } + + public void setVerid(int verid) { + this.verid = verid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public double getSizes() { + return sizes; + } + + public void setSizes(double sizes) { + this.sizes = sizes; + } + + public String getTab() { + return tab; + } + + public void setTab(String tab) { + this.tab = tab; + } + + public String getLayer() { + return layer; + } + + public void setLayer(String layer) { + this.layer = layer; + } + + public int getRows() { + return rows; + } + + public void setRows(int rows) { + this.rows = rows; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getGeom() { + return geom; + } + + public void setGeom(String geom) { + this.geom = geom; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public String getVerName() { + return verName; + } + + public void setVerName(String verName) { + this.verName = verName; + } + + public String getDirName() { + return dirName; + } + + public void setDirName(String dirName) { + this.dirName = dirName; + } + + public Integer getDownCount() { + return downCount; + } + + public void setDownCount(Integer downCount) { + this.downCount = downCount; + } + + public String getLastUser() { + return lastUser; + } + + public void setLastUser(String lastUser) { + this.lastUser = lastUser; + } + + public Timestamp getLastTime() { + return lastTime; + } + + public void setLastTime(Timestamp lastTime) { + this.lastTime = lastTime; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } +} diff --git a/src/main/java/com/moon/server/entity/data/MetaFileEntity.java b/src/main/java/com/moon/server/entity/data/MetaFileEntity.java new file mode 100644 index 0000000..e492942 --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/MetaFileEntity.java @@ -0,0 +1,202 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鍏冩暟鎹枃浠� + * @author WWW + */ +public class MetaFileEntity implements Serializable { + private static final long serialVersionUID = -3688958480700165163L; + + private String eventid; + + private String dircode; + + private String depcode; + + private int verid; + + private String name; + + private String type; + + private String guid; + + private String path; + + private double sizes; + + private int createUser; + + private Timestamp createTime; + + private String extName; + + private String epsgCode; + + private String tab; + + private String entity; + + private int rows; + + private String msg; + + private Boolean isMeta; + + private String xlsPath; + + public String getEventid() { + return eventid; + } + + public void setEventid(String eventid) { + this.eventid = eventid; + } + + public String getDircode() { + return dircode; + } + + public void setDircode(String dircode) { + this.dircode = dircode; + } + + public String getDepcode() { + return depcode; + } + + public void setDepcode(String depcode) { + this.depcode = depcode; + } + + public int getVerid() { + return verid; + } + + public void setVerid(int verid) { + this.verid = verid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public double getSizes() { + return sizes; + } + + public void setSizes(double sizes) { + this.sizes = sizes; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public String getExtName() { + return extName; + } + + public void setExtName(String extName) { + this.extName = extName; + } + + public String getEpsgCode() { + return epsgCode; + } + + public void setEpsgCode(String epsgCode) { + this.epsgCode = epsgCode; + } + + public String getTab() { + return tab; + } + + public void setTab(String tab) { + this.tab = tab; + } + + public String getEntity() { + return entity; + } + + public void setEntity(String entity) { + this.entity = entity; + } + + public int getRows() { + return rows; + } + + public void setRows(int rows) { + this.rows = rows; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public Boolean getIsMeta() { + return isMeta; + } + + public void setIsMeta(Boolean isMeta) { + this.isMeta = isMeta; + } + + public String getXlsPath() { + return xlsPath; + } + + public void setXlsPath(String xlsPath) { + this.xlsPath = xlsPath; + } +} diff --git a/src/main/java/com/moon/server/entity/data/PublishEntity.java b/src/main/java/com/moon/server/entity/data/PublishEntity.java new file mode 100644 index 0000000..f239ba6 --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/PublishEntity.java @@ -0,0 +1,235 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鏁版嵁鍙戝竷 + * @author WWW + */ +public class PublishEntity implements Serializable { + private static final long serialVersionUID = -386130556178340032L; + + private int id; + + private String regid; + + private String name; + + private String url; + + private String path; + + private String type; + + private int status; + + private String dirid; + + private String depid; + + private int min; + + private int max; + + private String json; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String geom; + + private String bak; + + private String depName; + + private String dirName; + + private String createName; + + private String updateName; + + public PublishEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getRegid() { + return regid; + } + + public void setRegid(String regid) { + this.regid = regid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getDirid() { + return dirid; + } + + public void setDirid(String dirid) { + this.dirid = dirid; + } + + public String getDepid() { + return depid; + } + + public void setDepid(String depid) { + this.depid = depid; + } + + public int getMin() { + return min; + } + + public void setMin(int min) { + this.min = min; + } + + public int getMax() { + return max; + } + + public void setMax(int max) { + this.max = max; + } + + public String getJson() { + return json; + } + + public void setJson(String json) { + this.json = json; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getGeom() { + return geom; + } + + public void setGeom(String geom) { + this.geom = geom; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public String getDirName() { + return dirName; + } + + public void setDirName(String dirName) { + this.dirName = dirName; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } +} diff --git a/src/main/java/com/moon/server/entity/data/StyleEntity.java b/src/main/java/com/moon/server/entity/data/StyleEntity.java new file mode 100644 index 0000000..930a427 --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/StyleEntity.java @@ -0,0 +1,234 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鏍峰紡绠$悊 + * @author sws + * @date 2022-09-26 + */ + +public class StyleEntity implements Serializable { + private static final long serialVersionUID = 2421229801055033955L; + + private int id; + + private String name; + + private String type; + + private int dirid; + + private int depid; + + private String ver; + + private int status; + + private String precision; + + private String descr; + + private String fname; + + private String fileGuid; + + private String vname; + + private String viewGuid; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String depName; + + private String dirName; + + private String bak; + + private String createName; + + private String updateName; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getDirid() { + return dirid; + } + + public void setDirid(int dirid) { + this.dirid = dirid; + } + + public int getDepid() { + return depid; + } + + public void setDepid(int depid) { + this.depid = depid; + } + + public String getVer() { + return ver; + } + + public void setVer(String ver) { + this.ver = ver; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getPrecision() { + return precision; + } + + public void setPrecision(String precision) { + this.precision = precision; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public String getFileGuid() { + return fileGuid; + } + + public void setFileGuid(String fileGuid) { + this.fileGuid = fileGuid; + } + + public String getViewGuid() { + return viewGuid; + } + + public void setViewGuid(String viewGuid) { + this.viewGuid = viewGuid; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public String getDirName() { + return dirName; + } + + public void setDirName(String dirName) { + this.dirName = dirName; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getFname() { + return fname; + } + + public void setFname(String fname) { + this.fname = fname; + } + + public String getVname() { + return vname; + } + + public void setVname(String vname) { + this.vname = vname; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } +} diff --git a/src/main/java/com/moon/server/entity/data/VerEntity.java b/src/main/java/com/moon/server/entity/data/VerEntity.java new file mode 100644 index 0000000..73a34b8 --- /dev/null +++ b/src/main/java/com/moon/server/entity/data/VerEntity.java @@ -0,0 +1,113 @@ +package com.moon.server.entity.data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鐗堟湰琛� + * @author sws + * @date 2022-09-29 + */ +public class VerEntity implements Serializable { + private static final long serialVersionUID = 4765222572551658531L; + + private int id; + + private int dirid; + + private String name; + + private String descr; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String depName; + + private String createName; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getDirid() { + return dirid; + } + + public void setDirid(int dirid) { + this.dirid = dirid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } +} diff --git a/src/main/java/com/moon/server/entity/other/CheckOutLicense.java b/src/main/java/com/moon/server/entity/other/CheckOutLicense.java new file mode 100644 index 0000000..6e82e01 --- /dev/null +++ b/src/main/java/com/moon/server/entity/other/CheckOutLicense.java @@ -0,0 +1,238 @@ +package com.moon.server.entity.other; + +import org.apache.commons.codec.binary.Hex; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import java.io.ByteArrayInputStream; +import java.io.ObjectInputStream; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Random; + +/** + * CheckOutLicense + * @author WWW + */ +@SuppressWarnings("AlibabaUndefineMagicConstant") +public class CheckOutLicense { + public static String createFloatingLicense(int n, String s, long expireDate) { + int[] registeredModules = new int[]{1, 3, 4, 9, 10, 11, 12, 13, 17, 25, 30, 33, 37}; + + long n2; + if ((n2 = System.currentTimeMillis() + 86400000L) > expireDate) { + n2 = expireDate; + } + + CheckOutLicense e = new CheckOutLicense(); + e.a(n2); + e.a(n); + e.cc(s); + e.a(registeredModules); + + return e.aaa(e); + } + + public String aaa(final CheckOutLicense b) { + final CheckOutLicense e = b; + return new String(a(e.a, e.b, e.c)) + new bb().a(new StringBuilder().append(e.ee()).toString()); + } + + private char[] a(final long n, final int[] array, final int i) { + final char[] array2 = new char[48]; + final String b = b(n); + final String value = String.valueOf(i); + + final bb b2 = new bb(); + final String a = b2.a(b); + final String a2 = b2.a(value); + + final cc c = new cc(); + for (int j = 0; j < array.length; ++j) { + c.b(array[j]); + } + + final char[] a3 = c.a(); + for (int k = 0; k < 16; ++k) { + array2[k * 3] = a3[k]; + array2[k * 3 + 1] = a.charAt(k); + array2[k * 3 + 2] = a2.charAt(k); + } + return array2; + } + + private static String b(final long timeInMillis) { + final Calendar instance; + (instance = Calendar.getInstance()).setTimeInMillis(timeInMillis); + final int value = instance.get(1); + final int value2 = instance.get(2); + final int value3 = instance.get(5); + final String substring = Integer.toString(value).substring(2, 4); + String s; + if ((s = Integer.toString(value2 + 1)).length() == 1) { + s = "0".concat(String.valueOf(s)); + } + String s2; + if ((s2 = Integer.toString(value3)).length() == 1) { + s2 = "0".concat(String.valueOf(s2)); + } + return String.valueOf(substring) + s + s2; + } + + public static CheckOutLicense a(String s) { + try { + return null; + } catch (Exception ex) { + return null; + } + } + + public final String ee() { + return this.aa; + } + + private String aa; + private long a; + private int c; + private int[] b; + + public final void a(final long a) { + this.a = a; + } + + public final void a(final int c) { + this.c = c; + } + + public final void a(final int[] b) { + this.b = b; + } + + public final long a() { + return this.a; + } + + public final int[] b() { + return this.b; + } + + public final int c() { + return this.c; + } + + private void cc(String aa) { + this.aa = aa; + } + + @SuppressWarnings("AlibabaClassNamingShouldBeCamel") + public class bb { + private SecretKey a; + + public bb() { + try { + this.a = (SecretKey) new ObjectInputStream(new ByteArrayInputStream(Hex.decodeHex("aced0005737200146a6176612e73656375726974792e4b6579526570bdf94fb3889aa5430200044c0009616c676f726974686d7400124c6a6176612f6c616e672f537472696e673b5b0007656e636f6465647400025b424c0006666f726d617471007e00014c00047479706574001b4c6a6176612f73656375726974792f4b657952657024547970653b7870740003444553757200025b42acf317f8060854e00200007870000000084f5b0e52b33dbf797400035241577e7200196a6176612e73656375726974792e4b6579526570245479706500000000000000001200007872000e6a6176612e6c616e672e456e756d00000000000000001200007870740006534543524554".toCharArray()))).readObject(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + public String a(final String s) { + try { + final Cipher instance; + (instance = Cipher.getInstance("DES/ECB/PKCS5Padding")).init(1, this.a); + return Hex.encodeHexString(instance.doFinal(s.getBytes())); + } catch (Exception ex) { + return null; + } + } + + public String b(final String s) { + try { + final Cipher instance; + (instance = Cipher.getInstance("DES/ECB/PKCS5Padding")).init(2, this.a); + return new String(instance.doFinal(Hex.decodeHex(s.toCharArray()))); + } catch (Exception ex) { + return null; + } + } + } + + @SuppressWarnings("AlibabaClassNamingShouldBeCamel") + public final class cc { + private int a; + private char[] b; + private int c = 63; + + public cc() { + this.a = 0; + Arrays.fill(this.b = new char[c], '0'); + this.a = new Random().nextInt(16); + String obj; + if ((obj = Integer.toBinaryString(this.a)).length() == 1) { + obj = "000".concat(String.valueOf(obj)); + } else if (obj.length() == 2) { + obj = "00".concat(String.valueOf(obj)); + } else if (obj.length() == 3) { + obj = "0".concat(String.valueOf(obj)); + } + for (int i = 0; i < 4; ++i) { + this.b[i] = obj.charAt(i); + } + } + + public cc(String binaryString) { + this.a = 0; + Arrays.fill(this.b = new char[c], '0'); + final int length; + if ((length = (binaryString = Long.toBinaryString(Long.parseUnsignedLong(binaryString, 16))).length()) <= c) { + for (int i = 0; i < length; ++i) { + this.b[c - length + i] = binaryString.charAt(i); + } + } + final char[] value = new char[4]; + System.arraycopy(this.b, 0, value, 0, 4); + binaryString = new String(value); + this.a = Integer.parseUnsignedInt(binaryString, 2); + } + + @Override + public final String toString() { + String string = ""; + for (int i = 0; i < c; ++i) { + string = String.valueOf(string) + this.b[i]; + } + return string; + } + + public final char[] a() { + final String hexString = Long.toHexString(Long.parseUnsignedLong(this.toString(), 2)); + final int n; + final char[] array; + Arrays.fill(array = new char[n = (c + 1) / 4], '0'); + for (int length = hexString.length(), i = 0; i < length; ++i) { + array[n - length + i] = hexString.charAt(i); + } + return array; + } + + public final boolean a(int c) { + return (c = this.c(c)) < c && this.b[c] == '1' && c >= 4; + } + + private int c(int n) { + if (n >= 0 && n < 59) { + if ((n += 4 + this.a) >= 63) { + n -= 59; + } + return n; + } + return -1; + } + + public final void b(int c) { + if ((c = this.c(c)) < c && c >= 4) { + this.b[c] = '1'; + } + } + } +} diff --git a/src/main/java/com/moon/server/entity/other/FloatServerResponse.java b/src/main/java/com/moon/server/entity/other/FloatServerResponse.java new file mode 100644 index 0000000..d594ba6 --- /dev/null +++ b/src/main/java/com/moon/server/entity/other/FloatServerResponse.java @@ -0,0 +1,107 @@ +package com.moon.server.entity.other; + +import com.moon.server.helper.StringHelper; + +import java.util.Calendar; + +/** + * FloatServerResponse + * @author WWW + */ +public class FloatServerResponse { + private String modules; + + private String id; + + private String expireDate; + + private int processNum; + + private long time; + + private int availableNum; + + private String licenseCode; + + private String localId; + + public FloatServerResponse() { + } + + public FloatServerResponse(ReqParamFloatServer rfs) { + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, 2025); + + this.id = rfs.getId(); + this.localId = rfs.getLocalId(); + this.availableNum = rfs.getAvailableNum(); + this.time = calendar.getTimeInMillis(); + this.expireDate = StringHelper.YMD_FORMAT.format(this.time); + //this.licenseCode = "78a82f0920de0f557f8177bec1e48601c4dc25e4054a00728e4314b56528d3a1632de5298edee38a65412277977a174fea5d91c452b19ef138dbc2ba089ba632"; + this.licenseCode = CheckOutLicense.createFloatingLicense(rfs.getAvailableNum(), rfs.getId(), this.time); + } + + public String getModules() { + return this.modules; + } + + public void setModules(final String modules) { + this.modules = modules; + } + + public String getId() { + return this.id; + } + + public void setId(final String id) { + this.id = id; + } + + public String getExpireDate() { + return this.expireDate; + } + + public void setExpireDate(final String expireDate) { + this.expireDate = expireDate; + } + + public int getProcessNum() { + return this.processNum; + } + + public void setProcessNum(final int processNum) { + this.processNum = processNum; + } + + public int getAvailableNum() { + return this.availableNum; + } + + public void setAvailableNum(final int availableNum) { + this.availableNum = availableNum; + } + + public long getTime() { + return this.time; + } + + public void setTime(final long time) { + this.time = time; + } + + public String getLicenseCode() { + return this.licenseCode; + } + + public void setLicenseCode(final String licenseCode) { + this.licenseCode = licenseCode; + } + + public String getLocalId() { + return localId; + } + + public void setLocalId(String localId) { + this.localId = localId; + } +} diff --git a/src/main/java/com/moon/server/entity/other/ReqParamFloatServer.java b/src/main/java/com/moon/server/entity/other/ReqParamFloatServer.java new file mode 100644 index 0000000..59164c2 --- /dev/null +++ b/src/main/java/com/moon/server/entity/other/ReqParamFloatServer.java @@ -0,0 +1,143 @@ +package com.moon.server.entity.other; + +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.Enumeration; + +/** + * ReqParamFloatServer + * @author WWW + */ +public class ReqParamFloatServer { + private String id; + + private String port; + + private String modules; + + private int availableNum; + + private long time; + + private String localId; + + private String cmdType; + + public ReqParamFloatServer() { + this.localId = a(); + } + + public ReqParamFloatServer(String id, String port) { + this.id = id; + this.port = port; + this.localId = a(); + } + + public String getPort() { + return this.port; + } + + public void setPort(final String port) { + this.port = port; + } + + public String getId() { + return this.id; + } + + public void setId(final String id) { + this.id = id; + } + + public String getModules() { + return this.modules; + } + + public void setModules(final String modules) { + this.modules = modules; + } + + public int getAvailableNum() { + return this.availableNum; + } + + public void setAvailableNum(final int availableNum) { + this.availableNum = availableNum; + } + + public long getTime() { + return this.time; + } + + public void setTime(final long time) { + this.time = time; + } + + public String getLocalId() { + return this.localId; + } + + public String getCmdType() { + return this.cmdType; + } + + public void setCmdType(final String cmdType) { + this.cmdType = cmdType; + } + + public static String a() { + String string = ""; + try { + final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); + while (networkInterfaces.hasMoreElements()) { + final NetworkInterface networkInterface; + if (!(networkInterface = networkInterfaces.nextElement()).isLoopback() && !networkInterface.isVirtual() && networkInterface.isUp()) { + final Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses(); + final byte[] hardwareAddress; + if ((hardwareAddress = networkInterface.getHardwareAddress()) == null || networkInterface.getName().contains("docker")) { + continue; + } + while (inetAddresses.hasMoreElements()) { + final InetAddress inetAddress; + if ((inetAddress = inetAddresses.nextElement()) != null && inetAddress instanceof Inet4Address) { + final String a = a(inetAddress); + string = String.valueOf(inetAddress.getHostAddress()) + "|" + a; + if (!a.isEmpty()) { + return string; + } + continue; + } + } + } + } + } catch (SocketException ex) { + // + } + return string; + } + + private static String a(final InetAddress addr) { + String upperCase = ""; + try { + final byte[] hardwareAddress = NetworkInterface.getByInetAddress(addr).getHardwareAddress(); + final StringBuffer sb = new StringBuffer(""); + for (int i = 0; i < hardwareAddress.length; ++i) { + if (i != 0) { + sb.append("-"); + } + final String hexString; + if ((hexString = Integer.toHexString(hardwareAddress[i] & 0xFF)).length() == 1) { + sb.append("0".concat(String.valueOf(hexString))); + } else { + sb.append(hexString); + } + } + upperCase = sb.toString().toUpperCase(); + } catch (Exception ex) { + // + } + return upperCase; + } +} diff --git a/src/main/java/com/moon/server/entity/show/ApplyEntity.java b/src/main/java/com/moon/server/entity/show/ApplyEntity.java new file mode 100644 index 0000000..a16acbd --- /dev/null +++ b/src/main/java/com/moon/server/entity/show/ApplyEntity.java @@ -0,0 +1,225 @@ +package com.moon.server.entity.show; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鏁版嵁鐢宠 + * @author WWW + */ +public class ApplyEntity implements Serializable { + private static final long serialVersionUID = -849213119060365952L; + + private int id; + + private int userid; + + private String depids; + + private String tabs; + + private String entities; + + private String wkt; + + private String pwd; + + private int status; + + private int count; + + private String descr; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String uname; + + private Integer isVerify; + + private String depcode; + + private String dircodes; + + private String gids; + + private String filters; + + private String guid; + + public ApplyEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getUserid() { + return userid; + } + + public void setUserid(int userid) { + this.userid = userid; + } + + public String getDepids() { + return depids; + } + + public void setDepids(String depids) { + this.depids = depids; + } + + public String getTabs() { + return tabs; + } + + public void setTabs(String tabs) { + this.tabs = tabs; + } + + public String getEntities() { + return entities; + } + + public void setEntities(String entities) { + this.entities = entities; + } + + public String getWkt() { + return wkt; + } + + public void setWkt(String wkt) { + this.wkt = wkt; + } + + public String getPwd() { + return pwd; + } + + public void setPwd(String pwd) { + this.pwd = pwd; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public Integer getIsVerify() { + return isVerify; + } + + public void setIsVerify(Integer isVerify) { + this.isVerify = isVerify; + } + + public String getDepcode() { + return depcode; + } + + public void setDepcode(String depcode) { + this.depcode = depcode; + } + + public String getDircodes() { + return dircodes; + } + + public void setDircodes(String dircodes) { + this.dircodes = dircodes; + } + + public String getGids() { + return gids; + } + + public void setGids(String gids) { + this.gids = gids; + } + + public String getFilters() { + return filters; + } + + public void setFilters(String filters) { + this.filters = filters; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } +} diff --git a/src/main/java/com/moon/server/entity/show/ExportEntity.java b/src/main/java/com/moon/server/entity/show/ExportEntity.java new file mode 100644 index 0000000..7d37533 --- /dev/null +++ b/src/main/java/com/moon/server/entity/show/ExportEntity.java @@ -0,0 +1,146 @@ +package com.moon.server.entity.show; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 鍦ㄧ嚎鍒跺浘 + * @author WWW + */ +@AllArgsConstructor +@NoArgsConstructor +public class ExportEntity implements Serializable { + private static final long serialVersionUID = -2104359582441796685L; + + private String token; + + private String title; + + private String pageSize; + + private String province; + + private String scale; + + private String resolution; + + private String date; + + private String layers; + + private double rotation; + + private double xmin; + + private double ymin; + + private double ymax; + + private double xmax; + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getPageSize() { + return pageSize; + } + + public void setPageSize(String pageSize) { + this.pageSize = pageSize; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getScale() { + return scale; + } + + public void setScale(String scale) { + this.scale = scale; + } + + public String getResolution() { + return resolution; + } + + public void setResolution(String resolution) { + this.resolution = resolution; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getLayers() { + return layers; + } + + public void setLayers(String layers) { + this.layers = layers; + } + + public double getRotation() { + return rotation; + } + + public void setRotation(double rotation) { + this.rotation = rotation; + } + + public double getXmin() { + return xmin; + } + + public void setXmin(double xmin) { + this.xmin = xmin; + } + + public double getYmin() { + return ymin; + } + + public void setYmin(double ymin) { + this.ymin = ymin; + } + + public double getYmax() { + return ymax; + } + + public void setYmax(double ymax) { + this.ymax = ymax; + } + + public double getXmax() { + return xmax; + } + + public void setXmax(double xmax) { + this.xmax = xmax; + } +} diff --git a/src/main/java/com/moon/server/entity/show/FlowEntity.java b/src/main/java/com/moon/server/entity/show/FlowEntity.java new file mode 100644 index 0000000..53d6e27 --- /dev/null +++ b/src/main/java/com/moon/server/entity/show/FlowEntity.java @@ -0,0 +1,135 @@ +package com.moon.server.entity.show; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鐢宠娴佺▼ + * @author WWW + */ +public class FlowEntity implements Serializable { + private static final long serialVersionUID = -267684465864526336L; + + private int id; + + private int applyid; + + private String depcode; + + private int userid; + + private int status; + + private String descr; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String uname; + + private String depName; + + public FlowEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getApplyid() { + return applyid; + } + + public void setApplyid(int applyid) { + this.applyid = applyid; + } + + public String getDepcode() { + return depcode; + } + + public void setDepcode(String depcode) { + this.depcode = depcode; + } + + public int getUserid() { + return userid; + } + + public void setUserid(int userid) { + this.userid = userid; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } +} diff --git a/src/main/java/com/moon/server/entity/show/MarkEntity.java b/src/main/java/com/moon/server/entity/show/MarkEntity.java new file mode 100644 index 0000000..ed0c7b6 --- /dev/null +++ b/src/main/java/com/moon/server/entity/show/MarkEntity.java @@ -0,0 +1,85 @@ +package com.moon.server.entity.show; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鏍囩粯 + * @author WWW + */ +public class MarkEntity implements Serializable { + private static final long serialVersionUID = -865286612354818048L; + + private int id; + + private String name; + + private String wkt; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + public MarkEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getWkt() { + return wkt; + } + + public void setWkt(String wkt) { + this.wkt = wkt; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } +} diff --git a/src/main/java/com/moon/server/entity/show/ModelEntity.java b/src/main/java/com/moon/server/entity/show/ModelEntity.java new file mode 100644 index 0000000..bf4cb1c --- /dev/null +++ b/src/main/java/com/moon/server/entity/show/ModelEntity.java @@ -0,0 +1,155 @@ +package com.moon.server.entity.show; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 妯″瀷 + * @author WWW + */ +public class ModelEntity implements Serializable { + private static final long serialVersionUID = -41778639909708240L; + + private int id; + + private int layerid; + + private String modelid; + + private String guid; + + private String name; + + private String type; + + private String info; + + private String url; + + private String icon; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + public ModelEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getLayerid() { + return layerid; + } + + public void setLayerid(int layerid) { + this.layerid = layerid; + } + + public String getModelid() { + return modelid; + } + + public void setModelid(String modelid) { + this.modelid = modelid; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } +} diff --git a/src/main/java/com/moon/server/entity/show/OneMapEntity.java b/src/main/java/com/moon/server/entity/show/OneMapEntity.java new file mode 100644 index 0000000..a8ac325 --- /dev/null +++ b/src/main/java/com/moon/server/entity/show/OneMapEntity.java @@ -0,0 +1,294 @@ +package com.moon.server.entity.show; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 瀹樼綉涓�寮犲浘瀹炰綋 + * + * @author xing + * @date 2023/02/20 + */ +public class OneMapEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * value + */ + @JsonIgnore + private String value; + + /** + * key + */ + @JsonIgnore + private String key; + + private int id; + + private String eventid; + + private int metaid; + + private short ismeta; + + private String dircode; + + private String depcode; + + private int verid; + + private String name; + + private String type; + + private String guid; + + private String path; + + private double sizes; + + private String tab; + + private String layer; + + private int rows; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + private String geom; + + private String uname; + + private String depName; + + private String verName; + + private String dirName; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getEventid() { + return eventid; + } + + public void setEventid(String eventid) { + this.eventid = eventid; + } + + public int getMetaid() { + return metaid; + } + + public void setMetaid(int metaid) { + this.metaid = metaid; + } + + public short getIsmeta() { + return ismeta; + } + + public void setIsmeta(short ismeta) { + this.ismeta = ismeta; + } + + public String getDircode() { + return dircode; + } + + public void setDircode(String dircode) { + this.dircode = dircode; + } + + public String getDepcode() { + return depcode; + } + + public void setDepcode(String depcode) { + this.depcode = depcode; + } + + public int getVerid() { + return verid; + } + + public void setVerid(int verid) { + this.verid = verid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public double getSizes() { + return sizes; + } + + public void setSizes(double sizes) { + this.sizes = sizes; + } + + public String getTab() { + return tab; + } + + public void setTab(String tab) { + this.tab = tab; + } + + public String getLayer() { + return layer; + } + + public void setLayer(String layer) { + this.layer = layer; + } + + public int getRows() { + return rows; + } + + public void setRows(int rows) { + this.rows = rows; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getGeom() { + return geom; + } + + public void setGeom(String geom) { + this.geom = geom; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public String getVerName() { + return verName; + } + + public void setVerName(String verName) { + this.verName = verName; + } + + public String getDirName() { + return dirName; + } + + public void setDirName(String dirName) { + this.dirName = dirName; + } +} diff --git a/src/main/java/com/moon/server/entity/show/PipelineEntity.java b/src/main/java/com/moon/server/entity/show/PipelineEntity.java new file mode 100644 index 0000000..76e52d0 --- /dev/null +++ b/src/main/java/com/moon/server/entity/show/PipelineEntity.java @@ -0,0 +1,138 @@ +package com.moon.server.entity.show; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.io.Serializable; +import java.util.List; + +/** + * 绠¢亾鍒嗘瀽瀹炰綋绫� + * + * @author xingjinshuang@smartearth.cn + * @date 2022/12/26 + */ +public class PipelineEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 琛ㄥ悕 + */ + @JSONField(serialize = false) + @JsonInclude(JsonInclude.Include.NON_NULL) + private List<String> tabs; + + /** + * 瀵嗙爜 + */ + @JSONField(serialize = false) + @JsonInclude(JsonInclude.Include.NON_NULL) + private String pwd; + + /** + * 涓婚敭ID + */ + private Integer gid; + + /** + * 绠$嚎 + */ + private String pipeName; + + /** + * 绠℃ + */ + private String segName; + + /** + * 绌胯秺鍚嶇О + */ + private String acrossName; + + /** + * 绌胯秺闀垮害 + */ + private double acrossLength; + + /** + * 澶囨敞 + */ + private String remarks; + + /** + * wkt + */ + private String wkt; + + public Integer getGid() { + return gid; + } + + public void setGid(Integer gid) { + this.gid = gid; + } + + public List<String> getTabs() { + return tabs; + } + + public void setTabs(List<String> tabs) { + this.tabs = tabs; + } + + public String getPwd() { + return pwd; + } + + public void setPwd(String pwd) { + this.pwd = pwd; + } + + public String getPipeName() { + return pipeName; + } + + public void setPipeName(String pipeName) { + this.pipeName = pipeName; + } + + public String getSegName() { + return segName; + } + + public void setSegName(String segName) { + this.segName = segName; + } + + public String getAcrossName() { + return acrossName; + } + + public void setAcrossName(String acrossName) { + this.acrossName = acrossName; + } + + public double getAcrossLength() { + return acrossLength; + } + + public void setAcrossLength(double acrossLength) { + this.acrossLength = acrossLength; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getWkt() { + return wkt; + } + + public void setWkt(String wkt) { + this.wkt = wkt; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/ArgsEntity.java b/src/main/java/com/moon/server/entity/sys/ArgsEntity.java new file mode 100644 index 0000000..7c6b20f --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/ArgsEntity.java @@ -0,0 +1,145 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鍙傛暟璁剧疆 + * @author WWW + */ +public class ArgsEntity implements Serializable { + private static final long serialVersionUID = -832866207909836938L; + + private int id; + + private String name; + + private int cvalue; + + private int dvalue; + + private int minValue; + + private int maxValue; + + private int times; + + private String descr; + + private String mark; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + public ArgsEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getCvalue() { + return cvalue; + } + + public void setCvalue(int cvalue) { + this.cvalue = cvalue; + } + + public int getDvalue() { + return dvalue; + } + + public void setDvalue(int dvalue) { + this.dvalue = dvalue; + } + + public int getMinValue() { + return minValue; + } + + public void setMinValue(int minValue) { + this.minValue = minValue; + } + + public int getMaxValue() { + return maxValue; + } + + public void setMaxValue(int maxValue) { + this.maxValue = maxValue; + } + + public int getTimes() { + return times; + } + + public void setTimes(int times) { + this.times = times; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public String getMark() { + return mark; + } + + public void setMark(String mark) { + this.mark = mark; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/AttachEntity.java b/src/main/java/com/moon/server/entity/sys/AttachEntity.java new file mode 100644 index 0000000..62e2bf6 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/AttachEntity.java @@ -0,0 +1,125 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 闄勪欢 + * @author WWW + */ +public class AttachEntity implements Serializable { + private static final long serialVersionUID = -106535972611296912L; + + private int id; + + private String name; + + private String tab; + + private String tabGuid; + + private String guid; + + private String path; + + private double sizes; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + public AttachEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTab() { + return tab; + } + + public void setTab(String tab) { + this.tab = tab; + } + + public String getTabGuid() { + return tabGuid; + } + + public void setTabGuid(String tabGuid) { + this.tabGuid = tabGuid; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public double getSizes() { + return sizes; + } + + public void setSizes(double sizes) { + this.sizes = sizes; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/AuthEntity.java b/src/main/java/com/moon/server/entity/sys/AuthEntity.java new file mode 100644 index 0000000..b985957 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/AuthEntity.java @@ -0,0 +1,113 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鏉冮檺 + * @author sws + * @date 2022-09-28 + */ +public class AuthEntity implements Serializable { + private static final long serialVersionUID = 2590447372444367285L; + + private int id; + + private String name; + + private String tag; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + private String createName; + + private String updateName; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/BlacklistEntity.java b/src/main/java/com/moon/server/entity/sys/BlacklistEntity.java new file mode 100644 index 0000000..f0ef118 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/BlacklistEntity.java @@ -0,0 +1,125 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 榛戝悕鍗� + * @author WWW + */ +public class BlacklistEntity implements Serializable { + private static final long serialVersionUID = -705887305878981632L; + + private int id; + + private String ip; + + private int type; + + private int visit; + + private String descr; + + private int createUser; + + private String createName; + + private Timestamp createTime; + + private int updateUser; + + private String updateName; + + private Timestamp updateTime; + + public BlacklistEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getVisit() { + return visit; + } + + public void setVisit(int visit) { + this.visit = visit; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/DepEntity.java b/src/main/java/com/moon/server/entity/sys/DepEntity.java new file mode 100644 index 0000000..afbd649 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/DepEntity.java @@ -0,0 +1,211 @@ +package com.moon.server.entity.sys; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * sys_dep + * @author sws + * @date 2022-09-23 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DepEntity implements Serializable { + private static final long serialVersionUID = -3673810416800666364L; + + private int id; + + private int pid; + + private String name; + + private String sname; + + private String code; + + private String uncode; + + private String addr; + + private String contact; + + private String fax; + + private String email; + + private String post; + + private String website; + + private int level; + + private int orderNum; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getPid() { + return pid; + } + + public void setPid(int pid) { + this.pid = pid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSname() { + return sname; + } + + public void setSname(String sname) { + this.sname = sname; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getUncode() { + return uncode; + } + + public void setUncode(String uncode) { + this.uncode = uncode; + } + + public String getAddr() { + return addr; + } + + public void setAddr(String addr) { + this.addr = addr; + } + + public String getContact() { + return contact; + } + + public void setContact(String contact) { + this.contact = contact; + } + + public String getFax() { + return fax; + } + + public void setFax(String fax) { + this.fax = fax; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPost() { + return post; + } + + public void setPost(String post) { + this.post = post; + } + + public String getWebsite() { + return website; + } + + public void setWebsite(String website) { + this.website = website; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getOrderNum() { + return orderNum; + } + + public void setOrderNum(int orderNum) { + this.orderNum = orderNum; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/DownlogEntity.java b/src/main/java/com/moon/server/entity/sys/DownlogEntity.java new file mode 100644 index 0000000..b2d087a --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/DownlogEntity.java @@ -0,0 +1,125 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 涓嬭浇鏃ュ織 + * @author WWW + */ +public class DownlogEntity implements Serializable { + private static final long serialVersionUID = -295796504381949312L; + + private int id; + + private int downid; + + private String ip; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String uname; + + private String name; + + private int type; + + private double sizes; + + public DownlogEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getDownid() { + return downid; + } + + public void setDownid(int downid) { + this.downid = downid; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getSizes() { + return sizes; + } + + public void setSizes(double sizes) { + this.sizes = sizes; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/LoginEntity.java b/src/main/java/com/moon/server/entity/sys/LoginEntity.java new file mode 100644 index 0000000..a327cb2 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/LoginEntity.java @@ -0,0 +1,116 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鐧诲綍鏃ュ織琛� + * @author sws + * @date 2022-09-08 + */ + +public class LoginEntity implements Serializable { + private static final long serialVersionUID = 2156194736679188516L; + + private int id; + + private String uname; + + private int appid; + + private String ip; + + private int type; + + private int status; + + private String descr; + + private int userid; + + private Timestamp optime; + + + + private int count; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public int getAppid() { + return appid; + } + + public void setAppid(int appid) { + this.appid = appid; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public int getUserid() { + return userid; + } + + public void setUserid(int userid) { + this.userid = userid; + } + + public Timestamp getOptime() { + return optime; + } + + public void setOptime(Timestamp optime) { + this.optime = optime; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/MenuAuthEntity.java b/src/main/java/com/moon/server/entity/sys/MenuAuthEntity.java new file mode 100644 index 0000000..fc69a91 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/MenuAuthEntity.java @@ -0,0 +1,106 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鑿滃崟-鏉冮檺 + * @author WWW + */ +public class MenuAuthEntity implements Serializable { + private static final long serialVersionUID = -298515079682001408L; + + private int id; + + private int menuid; + + private int authid; + + private String name; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String authName; + + + public MenuAuthEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getMenuid() { + return menuid; + } + + public void setMenuid(int menuid) { + this.menuid = menuid; + } + + public int getAuthid() { + return authid; + } + + public void setAuthid(int authid) { + this.authid = authid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + public String getAuthName() { + return authName; + } + + public void setAuthName(String authName) { + this.authName = authName; + } + +} diff --git a/src/main/java/com/moon/server/entity/sys/MenuEntity.java b/src/main/java/com/moon/server/entity/sys/MenuEntity.java new file mode 100644 index 0000000..309b324 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/MenuEntity.java @@ -0,0 +1,192 @@ +package com.moon.server.entity.sys; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鑿滃崟 + * @author sws + * @date 2022-09-24 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class MenuEntity implements Serializable { + private static final long serialVersionUID = -4174396918804003518L; + + private int id; + + private int pid; + + private String cnName; + + private String enName; + + private String url; + + private String perms; + + private int type; + + private String css; + + private String icon; + + private int level; + + private int orderNum; + + private int isShow; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getPid() { + return pid; + } + + public void setPid(int pid) { + this.pid = pid; + } + + public String getCnName() { + return cnName; + } + + public void setCnName(String cnName) { + this.cnName = cnName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getPerms() { + return perms; + } + + public void setPerms(String perms) { + this.perms = perms; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getCss() { + return css; + } + + public void setCss(String css) { + this.css = css; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getOrderNum() { + return orderNum; + } + + public void setOrderNum(int orderNum) { + this.orderNum = orderNum; + } + + public int getIsShow() { + return isShow; + } + + public void setIsShow(int isShow) { + this.isShow = isShow; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/MetaDownEntity.java b/src/main/java/com/moon/server/entity/sys/MetaDownEntity.java new file mode 100644 index 0000000..95dcb7d --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/MetaDownEntity.java @@ -0,0 +1,65 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鍏冩暟鎹�-涓嬭浇 + * @author WWW + */ +public class MetaDownEntity implements Serializable { + private static final long serialVersionUID = -254142742722361696L; + + private int id; + + private int metaid; + + private int downid; + + private int createUser; + + private Timestamp createTime; + + public MetaDownEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getMetaid() { + return metaid; + } + + public void setMetaid(int metaid) { + this.metaid = metaid; + } + + public int getDownid() { + return downid; + } + + public void setDownid(int downid) { + this.downid = downid; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/OperateEntity.java b/src/main/java/com/moon/server/entity/sys/OperateEntity.java new file mode 100644 index 0000000..a400d57 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/OperateEntity.java @@ -0,0 +1,143 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鎿嶄綔鏃ュ織 + * @author sws + * @date 2022-09-28 + */ +public class OperateEntity implements Serializable { + private static final long serialVersionUID = -2335232554888606229L; + + private int id; + + private String uname; + + private String modular1; + + private String modular2; + + private String url; + + private String ip; + + private long exec; + + private String clazz; + + private int type; + + private int userid; + + private Timestamp optime; + + private String bak; + + private int count; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getModular1() { + return modular1; + } + + public void setModular1(String modular1) { + this.modular1 = modular1; + } + + public String getModular2() { + return modular2; + } + + public void setModular2(String modular2) { + this.modular2 = modular2; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getIp() { + return ip; + } + + public long getExec() { + return exec; + } + + public void setExec(long exec) { + this.exec = exec; + } + + public String getClazz() { + return clazz; + } + + public void setClazz(String clazz) { + this.clazz = clazz; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getUserid() { + return userid; + } + + public void setUserid(int userid) { + this.userid = userid; + } + + public Timestamp getOptime() { + return optime; + } + + public void setOptime(Timestamp optime) { + this.optime = optime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/ReportEntity.java b/src/main/java/com/moon/server/entity/sys/ReportEntity.java new file mode 100644 index 0000000..40880b1 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/ReportEntity.java @@ -0,0 +1,145 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鎶ュ憡妯℃澘 + * @author WWW + */ +public class ReportEntity implements Serializable { + private static final long serialVersionUID = -976039118587988992L; + + private int id; + + private String name; + + private String type; + + private String code; + + private String fname; + + private String guid; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + private String createName; + + private String updateName; + + public ReportEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getFname() { + return fname; + } + + public void setFname(String fname) { + this.fname = fname; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/ResEntity.java b/src/main/java/com/moon/server/entity/sys/ResEntity.java new file mode 100644 index 0000000..708cd6a --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/ResEntity.java @@ -0,0 +1,210 @@ +package com.moon.server.entity.sys; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * @author user + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ResEntity implements Serializable { + private static final long serialVersionUID = 9047079519693255710L; + + private int id; + + private String name; + + private String server; + + private String source; + + private int depid; + + private String depName; + + private int dirid; + + private String dirName; + + private String code; + + private String descr; + + private String img; + + private int createUser; + + private String createName; + + private Timestamp createTime; + + private int updateUser; + + private String updateName; + + private Timestamp updateTime; + + private String bak; + + + + private String fileGuid; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getServer() { + return server; + } + + public void setServer(String server) { + this.server = server; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public int getDepid() { + return depid; + } + + public void setDepid(int depid) { + this.depid = depid; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public int getDirid() { + return dirid; + } + + public void setDirid(int dirid) { + this.dirid = dirid; + } + + public String getDirName() { + return dirName; + } + + public void setDirName(String dirName) { + this.dirName = dirName; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public String getImg() { + return img; + } + + public void setImg(String img) { + this.img = img; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getFileGuid() { + return fileGuid; + } + + public void setFileGuid(String fileGuid) { + this.fileGuid = fileGuid; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/ResOpEntity.java b/src/main/java/com/moon/server/entity/sys/ResOpEntity.java new file mode 100644 index 0000000..5971972 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/ResOpEntity.java @@ -0,0 +1,94 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 璧勬簮鎿嶄綔 + * @author sws + * @date 2022-09-28 + */ + +public class ResOpEntity implements Serializable { + private static final long serialVersionUID = -7322438248126715583L; + + private int id; + + private String uname; + + private String name; + + private int resid; + + private int type; + + private String ip; + + private int userid; + + private Timestamp optime; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getResid() { + return resid; + } + + public void setResid(int resid) { + this.resid = resid; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public int getUserid() { + return userid; + } + + public void setUserid(int userid) { + this.userid = userid; + } + + public Timestamp getOptime() { + return optime; + } + + public void setOptime(Timestamp optime) { + this.optime = optime; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/RoleEntity.java b/src/main/java/com/moon/server/entity/sys/RoleEntity.java new file mode 100644 index 0000000..82167cf --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/RoleEntity.java @@ -0,0 +1,143 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 瑙掕壊琛� + * @author sws + * @date 2022-09-29 + */ +public class RoleEntity implements Serializable { + private static final long serialVersionUID = -1738125301491645446L; + + private int id; + + private int depid; + + private String name; + + private String descr; + + private int isAdmin; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + private String depName; + + private String createName; + + private String updateName; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getDepid() { + return depid; + } + + public void setDepid(int depid) { + this.depid = depid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public int getIsAdmin() { + return isAdmin; + } + + public void setIsAdmin(int isAdmin) { + this.isAdmin = isAdmin; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/RoleMenuAuthEntity.java b/src/main/java/com/moon/server/entity/sys/RoleMenuAuthEntity.java new file mode 100644 index 0000000..3aa4c10 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/RoleMenuAuthEntity.java @@ -0,0 +1,105 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 瑙掕壊-鑿滃崟 + * @author WWW + */ +public class RoleMenuAuthEntity implements Serializable { + private static final long serialVersionUID = -510981272678347904L; + + private int id; + + private int roleid; + + private int menuAuthId; + + private int menuid; + + private String name; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + public RoleMenuAuthEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getRoleid() { + return roleid; + } + + public void setRoleid(int roleid) { + this.roleid = roleid; + } + + public int getMenuAuthId() { + return menuAuthId; + } + + public void setMenuAuthId(int menuAuthId) { + this.menuAuthId = menuAuthId; + } + + public int getMenuid() { + return menuid; + } + + public void setMenuid(int menuid) { + this.menuid = menuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/RoleResEntity.java b/src/main/java/com/moon/server/entity/sys/RoleResEntity.java new file mode 100644 index 0000000..3349223 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/RoleResEntity.java @@ -0,0 +1,107 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 瑙掕壊-璧勬簮 + * @author WWW + */ +public class RoleResEntity implements Serializable { + private static final long serialVersionUID = -634834740606525312L; + + private int id; + + private int roleid; + + private int resid; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String resName; + +private String server; + + + + public RoleResEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getRoleid() { + return roleid; + } + + public void setRoleid(int roleid) { + this.roleid = roleid; + } + + public int getResid() { + return resid; + } + + public void setResid(int resid) { + this.resid = resid; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getResName() { + return resName; + } + + public void setResName(String resName) { + this.resName = resName; + } + public String getServer() { + return server; + } + + public void setServer(String server) { + this.server = server; + } + +} diff --git a/src/main/java/com/moon/server/entity/sys/RoleUserEntity.java b/src/main/java/com/moon/server/entity/sys/RoleUserEntity.java new file mode 100644 index 0000000..a2a9d36 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/RoleUserEntity.java @@ -0,0 +1,95 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 瑙掕壊-鐢ㄦ埛 + * @author WWW + */ +public class RoleUserEntity implements Serializable { + private static final long serialVersionUID = -20966072576570360L; + + private int id; + + private int roleid; + + private int userid; + + private String uname; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + public RoleUserEntity() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getRoleid() { + return roleid; + } + + public void setRoleid(int roleid) { + this.roleid = roleid; + } + + public int getUserid() { + return userid; + } + + public void setUserid(int userid) { + this.userid = userid; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/TokenEntity.java b/src/main/java/com/moon/server/entity/sys/TokenEntity.java new file mode 100644 index 0000000..4d18116 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/TokenEntity.java @@ -0,0 +1,153 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 浠ょ墝琛� + * @author sws + * @date 2022-09-28 + */ +public class TokenEntity implements Serializable { + private static final long serialVersionUID = 1419309705830103150L; + + private int id; + + private String uname; + + private String token; + + private int duration; + + private Timestamp expire; + + private int type; + + private String ip; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String createName; + + private String updateName; + + private int autoLogOut; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public int getDuration() { + return duration; + } + + public void setDuration(int duration) { + this.duration = duration; + } + + public Timestamp getExpire() { + return expire; + } + + public void setExpire(Timestamp expire) { + this.expire = expire; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } + + public int getAutoLogOut() { + return autoLogOut; + } + + public void setAutoLogOut(int autoLogOut) { + this.autoLogOut = autoLogOut; + } +} diff --git a/src/main/java/com/moon/server/entity/sys/UserEntity.java b/src/main/java/com/moon/server/entity/sys/UserEntity.java new file mode 100644 index 0000000..02d49c2 --- /dev/null +++ b/src/main/java/com/moon/server/entity/sys/UserEntity.java @@ -0,0 +1,233 @@ +package com.moon.server.entity.sys; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 鐢ㄦ埛琛� + * @author sws + * @date 2022-09-27 + */ +public class UserEntity implements Serializable { + private static final long serialVersionUID = 5676976561729666299L; + + private int id; + + private int depid; + + private String depcode; + + private String uid; + + private String uname; + + private String pwd; + + private String salt; + + private String depName; + + private int sex; + + private String natives; + + private String contact; + + private String job; + + private String email; + + private String addr; + + private String edu; + + private String idcard; + + private int status; + + private int createUser; + + private Timestamp createTime; + + private int updateUser; + + private Timestamp updateTime; + + private String bak; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getDepid() { + return depid; + } + + public void setDepid(int depid) { + this.depid = depid; + } + + public String getDepcode() { + return depcode; + } + + public void setDepcode(String depcode) { + this.depcode = depcode; + } + + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getPwd() { + return pwd; + } + + public void setPwd(String pwd) { + this.pwd = pwd; + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public String getNatives() { + return natives; + } + + public void setNatives(String natives) { + this.natives = natives; + } + + public String getContact() { + return contact; + } + + public void setContact(String contact) { + this.contact = contact; + } + + public String getJob() { + return job; + } + + public void setJob(String job) { + this.job = job; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getAddr() { + return addr; + } + + public void setAddr(String addr) { + this.addr = addr; + } + + public String getEdu() { + return edu; + } + + public void setEdu(String edu) { + this.edu = edu; + } + + public String getIdcard() { + return idcard; + } + + public void setIdcard(String idcard) { + this.idcard = idcard; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getCreateUser() { + return createUser; + } + + public void setCreateUser(int createUser) { + this.createUser = createUser; + } + + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public int getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(int updateUser) { + this.updateUser = updateUser; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getBak() { + return bak; + } + + public void setBak(String bak) { + this.bak = bak; + } +} diff --git a/src/main/java/com/moon/server/extend/CustomizedSqlInjector.java b/src/main/java/com/moon/server/extend/CustomizedSqlInjector.java new file mode 100644 index 0000000..9e69425 --- /dev/null +++ b/src/main/java/com/moon/server/extend/CustomizedSqlInjector.java @@ -0,0 +1,26 @@ +package com.moon.server.extend; + +import com.baomidou.mybatisplus.core.injector.AbstractMethod; +import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; +import com.baomidou.mybatisplus.core.metadata.TableInfo; + +import java.util.List; + +/** + * 鑷畾涔夋柟娉昐QL娉ㄥ叆鍣� + * @author WWW + */ +public class CustomizedSqlInjector extends DefaultSqlInjector { + /** + * 濡傛灉鍙渶澧炲姞鏂规硶锛屼繚鐣檓ybatis plus鑷甫鏂规硶锛� + * 鍙互鍏堣幏鍙杝uper.getMethodList()锛屽啀娣诲姞add + */ + @Override + public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) { + List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo); + methodList.add(new InsertBatchMethod()); + methodList.add(new UpdateBatchMethod()); + + return methodList; + } +} diff --git a/src/main/java/com/moon/server/extend/InsertBatchMethod.java b/src/main/java/com/moon/server/extend/InsertBatchMethod.java new file mode 100644 index 0000000..a1b85e6 --- /dev/null +++ b/src/main/java/com/moon/server/extend/InsertBatchMethod.java @@ -0,0 +1,76 @@ +package com.moon.server.extend; + +import com.baomidou.mybatisplus.core.injector.AbstractMethod; +import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; +import com.baomidou.mybatisplus.core.metadata.TableInfo; +import com.moon.server.entity.all.StaticData; +import org.apache.ibatis.executor.keygen.NoKeyGenerator; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.SqlSource; + +/** + * 鎵归噺鎻掑叆鏂规硶 + * @author WWW + */ +@SuppressWarnings("ALL") +public class InsertBatchMethod extends AbstractMethod { + /** + * insert into user(id, name, age) values (1, "a", 17), (2, "b", 18); + * <script> + * insert into user(id, name, age) values + * <foreach collection="list" item="item" index="index" open="(" separator="),(" close=")"> + * #{item.id}, #{item.name}, #{item.age} + * </foreach> + * </script> + */ + @Override + public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) { + final String sql = "<script>insert into %s %s values %s</script>"; + final String fieldSql = prepareFieldSql(tableInfo); + final String valueSql = prepareValuesSql(tableInfo); + final String sqlResult = String.format(sql, tableInfo.getTableName(), fieldSql, valueSql); + + SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass); + + // 绗笁涓弬鏁板繀椤诲拰RootMapper鐨勮嚜瀹氫箟鏂规硶鍚嶄竴鑷� + return this.addInsertMappedStatement(mapperClass, modelClass, "insertBatch", sqlSource, new NoKeyGenerator(), null, null); + } + + private String prepareFieldSql(TableInfo tableInfo) { + StringBuilder fieldSql = new StringBuilder(); + // fieldSql.append(tableInfo.getKeyColumn()).append(",") + // tableInfo.getFieldList().forEach(x -> fieldSql.append(x.getColumn()).append(",")) + for (TableFieldInfo f : tableInfo.getFieldList()) { + if (StaticData.INSERT_EXCLUDE_FIELDS.contains(f.getProperty())) { + continue; + } + + fieldSql.append(f.getColumn()).append(","); + } + + fieldSql.delete(fieldSql.length() - 1, fieldSql.length()); + fieldSql.insert(0, "("); + fieldSql.append(")"); + + return fieldSql.toString(); + } + + private String prepareValuesSql(TableInfo tableInfo) { + final StringBuilder valueSql = new StringBuilder(); + valueSql.append("<foreach collection=\"list\" item=\"item\" index=\"index\" open=\"(\" separator=\"),(\" close=\")\">"); + // valueSql.append("#{item.").append(tableInfo.getKeyProperty()).append("},") + // tableInfo.getFieldList().forEach(x -> valueSql.append("#{item.").append(x.getProperty()).append("},")) + for (TableFieldInfo f : tableInfo.getFieldList()) { + if (StaticData.INSERT_EXCLUDE_FIELDS.contains(f.getProperty())) { + continue; + } + + valueSql.append("geom".equals(f.getProperty()) ? "${item." : "#{item.").append(f.getProperty()).append("},"); + } + + valueSql.delete(valueSql.length() - 1, valueSql.length()); + valueSql.append("</foreach>"); + + return valueSql.toString(); + } +} diff --git a/src/main/java/com/moon/server/extend/UpdateBatchMethod.java b/src/main/java/com/moon/server/extend/UpdateBatchMethod.java new file mode 100644 index 0000000..3643a1d --- /dev/null +++ b/src/main/java/com/moon/server/extend/UpdateBatchMethod.java @@ -0,0 +1,86 @@ +package com.moon.server.extend; + +import com.baomidou.mybatisplus.core.injector.AbstractMethod; +import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; +import com.baomidou.mybatisplus.core.metadata.TableInfo; +import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; +import com.moon.server.entity.all.StaticData; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.SqlSource; + +/** + * 鎵归噺鏇存柊鏂规硶 + * @author WWW + */ +@SuppressWarnings("ALL") +public class UpdateBatchMethod extends AbstractMethod { + /** + * update user set name = "a", age = 17 where id = 1; + * update user set name = "b", age = 18 where id = 2; + * <script> + * <foreach collection="list" item="item" separator=";"> + * update user + * <set> + * <if test="item.name != null and item.name != ''"> + * name = #{item.name,jdbcType=VARCHAR}, + * </if> + * <if test="item.age != null"> + * age = #{item.age,jdbcType=INTEGER}, + * </if> + * </set> + * where id = #{item.id,jdbcType=INTEGER} + * </foreach> + * </script> + */ + @Override + public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) { + String sql = "<script>\n<foreach collection=\"list\" item=\"item\" separator=\";\">\nupdate %s %s where %s=#{%s} %s\n</foreach>\n</script>"; + String additional = tableInfo.isWithVersion() ? tableInfo.getVersionFieldInfo().getVersionOli("item", "item.") : "" + tableInfo.getLogicDeleteSql(true, true); + //String setSql = sqlSet(tableInfo.isWithLogicDelete(), false, tableInfo, false, "item", "item."); + String setSql = getSqlSet(tableInfo.isWithLogicDelete(), false, tableInfo, false, "item", "item."); + String sqlResult = String.format(sql, tableInfo.getTableName(), setSql, tableInfo.getKeyColumn(), "item." + tableInfo.getKeyProperty(), additional); + + // update %s %s where %s=#{%s} %s + // update tab set a=#{a} where gid=1 + + SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass); + + // 绗笁涓弬鏁板繀椤诲拰RootMapper鐨勮嚜瀹氫箟鏂规硶鍚嶄竴鑷� + return this.addUpdateMappedStatement(mapperClass, modelClass, "updateBatch", sqlSource); + } + + private String getSqlSet(boolean logic, boolean ew, TableInfo table, boolean judgeAliasNull, final String alias, final String prefix) { + // String sqlScript = table.getAllSqlSet(logic, prefix); + String sqlScript = getSqlSet(table); + if (judgeAliasNull) { + sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", alias), true); + } + if (ew) { + sqlScript = sqlScript + "\n"; + sqlScript = sqlScript + this.convertIfEwParam("ew.sqlSet", false); + } + + sqlScript = SqlScriptUtils.convertSet(sqlScript); + + return sqlScript; + } + + private String getSqlSet(TableInfo tableInfo) { + StringBuilder sb = new StringBuilder(); + for (TableFieldInfo f : tableInfo.getFieldList()) { + if (StaticData.UPDATE_EXCLUDE_FIELDS.contains(f.getProperty())) { + continue; + } + + if ("geom".equals(f.getProperty())) { + sb.append("<if test=\"item['geom'] != null\">geom=${item.geom},</if>\n"); + continue; + } + + sb.append(String.format("<if test=\"item['%s'] != null\">%s=#{item.%s},</if>\n", f.getProperty(), f.getColumn(), f.getProperty())); + } + sb.deleteCharAt(sb.length() - 1); + + return sb.toString(); + } +} diff --git a/src/main/java/com/moon/server/helper/AccessHelper.java b/src/main/java/com/moon/server/helper/AccessHelper.java new file mode 100644 index 0000000..2888aef --- /dev/null +++ b/src/main/java/com/moon/server/helper/AccessHelper.java @@ -0,0 +1,107 @@ +package com.moon.server.helper; + +import com.moon.server.entity.all.StaticData; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.sql.*; +import java.util.*; + +/** + * Access甯姪绫� + * @author WWW + */ +public class AccessHelper { + private final static Log log = LogFactory.getLog(AccessHelper.class); + + /** + * 璇诲彇.mdb鏂囦欢 + * + * @param mdbPath mdb鏂囦欢鍦板潃 + * @param username 鐢ㄦ埛鍚� + * @param password 瀵嗙爜 + */ + public static List<Map<String, Object>> readMdb(String mdbPath, String username, String password) { + List<Map<String, Object>> list = new ArrayList<>(); + + Connection conn = null; + PreparedStatement ps = null; + ResultSet tables = null; + ResultSet rs = null; + + try { + Properties prop = new Properties(); + prop.put("charSet", "UTF-8"); + prop.put("user", username); + prop.put("password", password); + + String dbUrl = "jdbc:ucanaccess://" + mdbPath; + Class.forName("net.ucanaccess.jdbc.UcanaccessDriver").newInstance(); + + conn = DriverManager.getConnection(dbUrl, prop); + tables = conn.getMetaData().getTables(mdbPath, null, null, new String[]{"TABLE"}); + while (tables.next()) { + Map<String, Object> tableMap = new HashMap<>(4); + Set<String> columnList = new HashSet<>(); + List<Map<String, String>> dataList = new ArrayList<>(); + + String tableName = tables.getString(3); + ps = conn.prepareStatement("select * from " + tableName); + rs = ps.executeQuery(); + + ResultSetMetaData data = rs.getMetaData(); + while (rs.next()) { + Map<String, String> map = new HashMap<>(5); + for (int i = 1; i <= data.getColumnCount(); i++) { + String columnName = data.getColumnName(i); + if (StaticData.MDB_EXCLUDE_FIELDS.contains(columnName)) { + continue; + } + + map.put(columnName, rs.getString(i)); + columnList.add(columnName); + } + dataList.add(map); + } + + tableMap.put("name", tableName); + tableMap.put("column", columnList); + tableMap.put("data", dataList); + list.add(tableMap); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + closeA1l(conn, ps, tables, rs); + } + + return list; + } + + /** + * 鍏抽棴鎵�鏈夌殑璧勬簮閾炬帴 + * + * @param conn 杩炴帴 + * @param ps 鎵ц璇彞 + * @param tables 缁撴灉闆� + * @param rs 缁撴灉闆� + */ + private static void closeA1l(Connection conn, PreparedStatement ps, ResultSet tables, ResultSet rs) { + try { + if (null != rs) { + rs.close(); + } + if (null != tables) { + tables.close(); + } + if (null != ps) { + ps.close(); + } + if (null != conn) { + conn.close(); + } + } catch (Exception ex) { + // + } + } +} \ No newline at end of file diff --git a/src/main/java/com/moon/server/helper/AesHelper.java b/src/main/java/com/moon/server/helper/AesHelper.java new file mode 100644 index 0000000..4610cd3 --- /dev/null +++ b/src/main/java/com/moon/server/helper/AesHelper.java @@ -0,0 +1,128 @@ +package com.moon.server.helper; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; +import java.util.Base64; + +/** + * AES鍔犲瘑甯姪 + * @author WWW + */ +@SuppressWarnings("restriction") +public class AesHelper { + /** + * 瀵嗛挜闀垮害蹇呴』鏄�16 + */ + private static final String DEFAULT_KEY = "A#s_lF_sErve_k.y"; + + private static final String KEY_ALGORITHM = "AES"; + + /** + * 绠楁硶 + */ + private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding"; + + /** + * aes瑙e瘑 + * + * @param encrypt 鍐呭 + * @return + * @throws Exception + */ + public static String decrypt(String encrypt) throws Exception { + return decrypt(encrypt, DEFAULT_KEY); + } + + /** + * aes鍔犲瘑 + * + * @param content 鍐呭 + * @return + * @throws Exception + */ + public static String encrypt(String content) throws Exception { + return encrypt(content, DEFAULT_KEY); + } + + /** + * base 64 encode + * + * @param bytes 寰呯紪鐮佺殑byte[] + * @return 缂栫爜鍚庣殑base64 code + */ + private static String base64Encode(byte[] bytes) { + return Base64.getEncoder().encodeToString(bytes); + } + + /** + * base 64 decode + * + * @param base64Code 寰呰В鐮佺殑base64 code + * @return 瑙g爜鍚庣殑byte[] + * @throws Exception + */ + private static byte[] base64Decode(String base64Code) { + return StringHelper.isEmpty(base64Code) ? null : Base64.getDecoder().decode(base64Code); + } + + /** + * AES鍔犲瘑 + * + * @param content 寰呭姞瀵嗙殑鍐呭 + * @param encryptKey 鍔犲瘑瀵嗛挜 + * @return 鍔犲瘑鍚庣殑byte[] + * @throws Exception + */ + private static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception { + // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) + // kGen.init(128) + + Cipher cipher = Cipher.getInstance(ALGORITHMSTR); + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), KEY_ALGORITHM)); + + return cipher.doFinal(content.getBytes("utf-8")); + } + + /** + * AES鍔犲瘑涓篵ase 64 code + * + * @param content 寰呭姞瀵嗙殑鍐呭 + * @param encryptKey 鍔犲瘑瀵嗛挜 + * @return 鍔犲瘑鍚庣殑base 64 code + * @throws Exception + */ + public static String encrypt(String content, String encryptKey) throws Exception { + return base64Encode(aesEncryptToBytes(content, encryptKey)); + } + + /** + * 灏哹ase 64 code AES瑙e瘑 + * + * @param encryptStr 寰呰В瀵嗙殑base 64 code + * @param decryptKey 瑙e瘑瀵嗛挜 + * @return 瑙e瘑鍚庣殑string + * @throws Exception + */ + public static String decrypt(String encryptStr, String decryptKey) throws Exception { + return StringHelper.isEmpty(encryptStr) ? null : aesDecryptByBytes(base64Decode(encryptStr), decryptKey); + } + + /** + * AES瑙e瘑 + * + * @param encryptBytes 寰呰В瀵嗙殑byte[] + * @param decryptKey 瑙e瘑瀵嗛挜 + * @return 瑙e瘑鍚庣殑String + * @throws Exception + */ + private static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception { + // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) + // kGen.init(128) + + Cipher cipher = Cipher.getInstance(ALGORITHMSTR); + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), KEY_ALGORITHM)); + byte[] decryptBytes = cipher.doFinal(encryptBytes); + + return new String(decryptBytes); + } +} diff --git a/src/main/java/com/moon/server/helper/ClassHelper.java b/src/main/java/com/moon/server/helper/ClassHelper.java new file mode 100644 index 0000000..f94a2c2 --- /dev/null +++ b/src/main/java/com/moon/server/helper/ClassHelper.java @@ -0,0 +1,135 @@ +package com.moon.server.helper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.mapper.all.GeomBaseMapper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.aop.support.AopUtils; + +import java.lang.reflect.Type; + +/** + * 绫诲府鍔╃被 + * @author WWW + */ +public class ClassHelper { + private final static Log log = LogFactory.getLog(ClassHelper.class); + + /** + * 鏍规嵁绫诲悕鍒涘缓瀹炰緥 + * + * @param className 绫诲悕 + * @return 瀹炰綋 + */ + public static Object createInstance(String className) { + try { + Class clazz = Class.forName(className); + Object obj = clazz.newInstance(); + + return obj; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } + } + + /** + * 鑾峰彇Bean + * + * @param className 绫诲悕 + * @return Bean + */ + public static Object getBean(String className) { + try { + Object obj = SpringContextHelper.getBean(className); + + return obj; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } + } + + /** + * 鑾峰彇鐖禡apper + * + * @param name Mapper鍚� + * @return BaseMapper + */ + public static BasicMapper getBasicMapper(String name) { + if (StringHelper.isEmpty(name)) { + return null; + } + + Object obj = getBean(name.trim() + "Mapper"); + if (!(obj instanceof BasicMapper)) { + return null; + } + + return (BasicMapper) obj; + } + + /** + * 鑾峰彇绌洪棿鐖禡apper + * + * @param name Mapper鍚� + * @return GeomBaseMapper + */ + public static GeomBaseMapper getGeoBaseMapper(String name) { + if (StringHelper.isEmpty(name)) { + return null; + } + + Object obj = getBean(name.trim() + "Mapper"); + if (!(obj instanceof GeomBaseMapper)) { + return null; + } + + return (GeomBaseMapper) obj; + } + + /** + * 鑾峰彇绫诲悕 + * + * @param baseMapper 鐖禡apper + * @return 绫诲悕 + */ + public static String getClassName(BaseMapper baseMapper) { + Type[] genericInterfaces = AopUtils.getTargetClass(baseMapper).getGenericInterfaces(); + + return genericInterfaces[0].getTypeName(); + } + + /** + * 鏍规嵁Mapper绫诲悕鑾峰彇瀹炰綋绫荤殑Class + * + * @param className Mapper绫诲悕 + * @return 瀹炰綋绫荤殑Class + */ + public static Class getEntityClass(String className) { + try { + className = className.replace(".mapper", ".entity").replace("Mapper", "Entity"); + Class clazz = Class.forName(className); + + return clazz; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } + } + + + /** + * 鏍规嵁BaseMapper鍒涘缓瀹炰綋绫� + * + * @param baseMapper 鐖禡apper + * @return 瀹炰綋绫� + */ + public static Object createEntityByMapper(BaseMapper baseMapper) { + String className = getClassName(baseMapper); + className = className.replace(".mapper", ".entity").replace("Mapper", "Entity"); + + return createInstance(className); + } +} diff --git a/src/main/java/com/moon/server/helper/EnumHelper.java b/src/main/java/com/moon/server/helper/EnumHelper.java new file mode 100644 index 0000000..e811f3b --- /dev/null +++ b/src/main/java/com/moon/server/helper/EnumHelper.java @@ -0,0 +1,84 @@ +package com.moon.server.helper; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.lang.reflect.Method; + +/** + * 鏋氫妇甯姪绫� + * @author WWW + */ +public class EnumHelper { + private static final String GETTER_PREFIX = "get"; + + private static Log log = LogFactory.getLog(EnumHelper.class); + + /** + * 鏍规嵁鍚嶇О鑾峰彇鏋氫妇 + * + * @param clazz 鏋氫妇绫诲瀷 + * @param name 鏋氫妇鐨勫悕绉帮紝濡傦細SqlParamType涓殑AND + * @return 杩斿洖鏋氫妇鍊� + */ + public static <T extends Enum<T>> T nameOf(Class<T> clazz, String name) { + return Enum.valueOf(clazz, name); + } + + /** + * 鏍规嵁灞炴�у悕+鍊艰幏鍙栨灇涓� + * + * @param clazz 鏋氫妇绫诲瀷 + * @param propertyName 瀛楁,濡俷ame,id + * @param value 鍊�,濡傚紶涓� + * @return 杩斿洖鏋氫妇鍊� + */ + public static <T extends Enum<T>> T getByString(Class<T> clazz, String propertyName, String value) { + String getterMethodName = GETTER_PREFIX + StringHelper.firstCharToUpperCase(propertyName); + T result = null; + try { + T[] arr = clazz.getEnumConstants(); + Method targetMethod = clazz.getDeclaredMethod(getterMethodName); + String typeCodeVal = null; + for (T entity : arr) { + typeCodeVal = targetMethod.invoke(entity).toString(); + if (typeCodeVal.contentEquals(value)) { + result = entity; + break; + } + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + + return result; + } + + /** + * 鏍规嵁鏁存暟鑾峰彇鏋氫妇 + * + * @param clazz 鏋氫妇绫诲瀷 + * @param propertyName 瀛楁,濡� age + * @param value 鍊�,濡�18 + * @return 杩斿洖鏋氫妇鍊� + */ + public static <T extends Enum<T>> T getByInt(Class<T> clazz, String propertyName, int value) { + String getterMethodName = GETTER_PREFIX + StringHelper.firstCharToUpperCase(propertyName); + T result = null; + try { + T[] arr = clazz.getEnumConstants(); + Method targetMethod = clazz.getDeclaredMethod(getterMethodName); + int typeCodeVal; + for (T entity : arr) { + typeCodeVal = Integer.parseInt(targetMethod.invoke(entity).toString()); + if (typeCodeVal == value) { + result = entity; + break; + } + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + return result; + } +} diff --git a/src/main/java/com/moon/server/helper/ExcelHelper.java b/src/main/java/com/moon/server/helper/ExcelHelper.java new file mode 100644 index 0000000..bbb0791 --- /dev/null +++ b/src/main/java/com/moon/server/helper/ExcelHelper.java @@ -0,0 +1,97 @@ +package com.moon.server.helper; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelReader; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.enums.WriteDirectionEnum; +import com.alibaba.excel.event.AnalysisEventListener; +import com.alibaba.excel.read.metadata.ReadSheet; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.excel.write.metadata.fill.FillConfig; +import com.alibaba.excel.write.metadata.fill.FillWrapper; +import com.moon.server.annotation.ExcelHead; + +import java.util.*; + +/** + * Excel甯姪绫� + * @author WWW + */ +public class ExcelHelper { + /** + * 璇诲彇Excel + * + * @param pathName 鏂囦欢璺緞 + * @param <T> 娉涘瀷绫� + * @return 娉涘瀷绫婚泦鍚� + */ + public static <T> List<T> readExcel(Class<?> clazz, String pathName) { + ExcelHead head = getExcelHead(clazz); + int headRowNumber = head == null ? 1 : head.headRows(); + String[] strs = null == head || StringHelper.isEmpty(head.excludeSheets()) ? null : head.excludeSheets().split(","); + List<String> excludeSheets = null == strs ? null : Arrays.asList(strs); + + List<T> list = new ArrayList<T>(); + ExcelReader reader = EasyExcel.read(pathName, clazz, new AnalysisEventListener<T>() { + @Override + public void invoke(T t, AnalysisContext context) { + list.add(t); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + // + } + }).headRowNumber(headRowNumber).build(); + + List<ReadSheet> sheets = reader.excelExecutor().sheetList(); + for (ReadSheet sheet : sheets) { + if (strs != null && excludeSheets.contains(sheet.getSheetName())) { + continue; + } + + reader.read(sheet); + } + reader.finish(); + + return list; + } + + /** + * 鑾峰彇Excel澶存敞瑙g被 + * + * @param clazz Class + * @param <T> 娉涘瀷绫� + * @return 澶磋鏁� + */ + public static <T> ExcelHead getExcelHead(Class<?> clazz) { + ExcelHead head = clazz.getAnnotation(ExcelHead.class); + + return head; + } + + /** + * 鍐欏叆Excel妯℃澘 + * + * @param source 婧愭枃浠讹紙妯℃澘锛� + * @param target 鐩綍鏂囦欢 + * @param map 鏁版嵁婧� + */ + public static <T> void writeToTemplate(String source, String target, Map<String, List<T>> map) { + // 鏍规嵁妯℃澘鍐欏叆鏁版嵁锛屽鏋滅洰鏍囨枃浠朵笉瀛樺湪锛屽垯鑷姩鍒涘缓鏂囦欢 + ExcelWriter excelWriter = EasyExcel.write(target).withTemplate(source).build(); + + // 鍦ㄥ伐浣滅翱0涓啓鍏ユ暟鎹紝濡傛灉妯℃澘涓笉瀛樺湪缁冧範宸ヤ綔绨匡紝鍒欎細鍦ㄧ洰鏍囨枃浠朵腑鑷姩鍒涘缓 + WriteSheet writeSheet = EasyExcel.writerSheet(0).build(); + + // 鍨傜洿鍐欏叆鏁版嵁锛屽鏋滆姘村钩鍐欏叆锛屽皢VERTICAL鏇挎崲涓篐ORIZONTAL + FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).build(); + + // 鍐欏叆鏁版嵁 + map.forEach((k, v) -> excelWriter.fill(new FillWrapper(k, v), fillConfig, writeSheet)); + + // 缁撴潫鍐欏叆 + excelWriter.finish(); + } +} diff --git a/src/main/java/com/moon/server/helper/FileHelper.java b/src/main/java/com/moon/server/helper/FileHelper.java new file mode 100644 index 0000000..730056f --- /dev/null +++ b/src/main/java/com/moon/server/helper/FileHelper.java @@ -0,0 +1,448 @@ +package com.moon.server.helper; + +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.data.MetaFileEntity; +import com.twmacinta.util.MD5; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.*; +import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.text.DecimalFormat; +import java.util.List; + +/** + * 鏂囦欢甯姪绫� + * @author WWW + */ +public class FileHelper { + private final static Log log = LogFactory.getLog(FileHelper.class); + + /** + * 鑾峰彇鏂囦欢鍚� + * + * @param file + * @return + */ + public static String getFileName(String file) { + int idx = file.lastIndexOf(File.separator); + if (idx > -1) { + return file.substring(idx + 1); + } + + return ""; + } + + /** + * 鑾峰彇鏂囦欢鎵╁睍鍚� + */ + public static String getExtension(File file) { + if (file == null) { + return null; + } + + String fileName = file.getName().toLowerCase(); + + int idx = fileName.indexOf(StaticData.POINT); + if (idx == -1) { + return ""; + } + + return fileName.substring(idx); + } + + /** + * 鑾峰彇鏂囦欢鎵╁睍鍚� + */ + public static String getExtension(String fileName) { + if (StringHelper.isEmpty(fileName)) { + return ""; + } + + int idx = fileName.lastIndexOf(StaticData.POINT); + if (idx == -1) { + return ""; + } + + return fileName.substring(idx).toLowerCase(); + } + + /** + * 鑾峰彇澶氱敤閫斾簰鑱旂綉閭欢鎵╁睍绫诲瀷 + * + * @param ext 鏂囦欢鎵╁睍鍚� + * @return + */ + public static String getMime(String ext) { + switch (ext) { + // 鍥剧墖 + case ".tif": + case ".tiff": + return "image/tiff"; + case ".img": + return "application/x-img"; + case ".gif": + return "image/gif"; + case ".jpg": + case ".jpeg": + return "image/jpeg"; + case ".png": + return "image/png"; + // 闊�/瑙嗛 + case ".mp3": + return "audio/mp3"; + case ".mp4": + return "video/mpeg4"; + case ".avi": + return "video/avi"; + case ".mpg": + case ".mpeg": + return "video/mpg"; + case ".wav": + return "audio/wav"; + case ".wma": + return "audio/x-ms-wma"; + case ".swf": + return "application/x-shockwave-flash"; + case ".wmv": + return "video/x-ms-wmv"; + case ".rm": + return "application/vnd.rn-realmedia"; + case ".rmvb": + return "application/vnd.rn-realmedia-vbr"; + // 缃戦〉 + case ".js": + return "application/x-javascript"; + case ".css": + return "text/css"; + case ".asp": + return "text/asp"; + case ".mht": + return "message/rfc822"; + case ".jsp": + case ".htm": + case ".html": + case ".xhtml": + return "text/html"; + case ".xml": + case ".svg": + return "text/xml"; + // 鏂囦欢 + case ".txt": + return "text/plain"; + case ".dbf": + return "application/x-dbf"; + case ".mdb": + return "application/msaccess"; + case ".pdf": + return "application/pdf"; + case ".ppt": + case ".pptx": + return "application/x-ppt"; + case ".doc": + case ".docx": + return "application/msword"; + case ".xls": + case ".xlsx": + return "application/vnd.ms-excel"; + case ".dgn": + return "application/x-dgn"; + case ".dwg": + return "application/x-dwg"; + case ".ext": + return "application/x-msdownload"; + // 榛樿 + default: + return "application/octet-stream"; + } + } + + /** + * 瀛楄妭鍗曚綅鎹㈢畻 + */ + public static String formatByte(long byteNumber) { + double kbNumber = byteNumber / StaticData.D1024; + if (kbNumber < StaticData.D1024) { + return new DecimalFormat("#.##KB").format(kbNumber); + } + double mbNumber = kbNumber / StaticData.D1024; + if (mbNumber < StaticData.D1024) { + return new DecimalFormat("#.##MB").format(mbNumber); + } + double gbNumber = mbNumber / StaticData.D1024; + if (gbNumber < StaticData.D1024) { + return new DecimalFormat("#.##GB").format(gbNumber); + } + double tbNumber = gbNumber / StaticData.D1024; + + return new DecimalFormat("#.##TB").format(tbNumber); + } + + /** + * 鑾峰彇鏂囦欢澶у皬 + */ + public static String getSizes(double mbNumber) { + if (mbNumber < StaticData.D1024) { + return new DecimalFormat("#.##MB").format(mbNumber); + } + + double gbNumber = mbNumber / StaticData.D1024; + if (gbNumber < StaticData.D1024) { + return new DecimalFormat("#.##GB").format(gbNumber); + } + + double tbNumber = gbNumber / StaticData.D1024; + + return new DecimalFormat("#.##TB").format(tbNumber); + } + + /** + * byte杞琈B + */ + public static double sizeToMb(long size) { + if (size < StaticData.D1050) { + return 0.001; + } + + String str = String.format("%.3f", size / StaticData.D1024 / StaticData.D1024); + + return Double.parseDouble(str); + } + + /** + * 3.鑾峰彇鏂囦欢MD5鐮侊紙JDK锛� + */ + public static String getMd5ByJdk(String filePath) throws IOException { + FileInputStream fileStream = new FileInputStream(filePath); + String md5 = DigestUtils.md5Hex(fileStream); + fileStream.close(); + + return md5; + } + + /** + * 2.鑾峰彇蹇�� MD5 鐮� + */ + public static String getFastMd5(String filePath) throws IOException { + String hash = MD5.asHex(MD5.getHash(new File(filePath))); + + MD5 md5 = new MD5(); + md5.Update(hash, null); + + return md5.asHex(); + } + + /** + * 鍒犻櫎鏂囦欢 + */ + public static void deleteFiles(List<MetaFileEntity> list) { + try { + for (MetaFileEntity mf : list) { + File f = new File(mf.getPath()); + if (f.exists()) { + f.delete(); + } + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 鍒犻櫎鏂囦欢澶� + * + * @param dir 鏂囦欢澶� + */ + public static void deleteDir(String dir) { + File file = new File(dir); + + deleteFiles(file); + } + + /** + * 绾ц仈鍒犻櫎鏂囦欢 + * + * @param file 鏂囦欢 + */ + public static void deleteFiles(File file) { + if (null == file || !file.exists()) { + return; + } + + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (null != files && files.length > 0) { + for (File f : files) { + if (f.isDirectory()) { + deleteFiles(f); + } else { + f.delete(); + } + } + } + } + + file.delete(); + } + + /** + * 鑾峰彇鐩稿璺緞 + * + * @param file 鏂囦欢 + * @return 鐩稿璺緞 + */ + public static String getRelativePath(String file) { + if (StringHelper.isEmpty(file)) { + return null; + } + + int idx = file.lastIndexOf(File.separator); + int start = file.lastIndexOf(File.separator, idx - 1); + + return file.substring(start + 1); + } + + /** + * 鑾峰彇璺緞 + * + * @param file 鏂囦欢 + * @return 鏂囦欢璺緞 + */ + public static String getPath(String file) { + if (StringHelper.isEmpty(file)) { + return null; + } + + int end = file.lastIndexOf(File.separator); + + return file.substring(0, end); + } + + /** + * 1.鑾峰彇鏂囦欢鐨凪D5 + */ + @SuppressWarnings("unused") + public static String getFileMd5(String filePath) { + FileInputStream fis = null; + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + + fis = new FileInputStream(new File(filePath)); + FileChannel fChannel = fis.getChannel(); + ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 1024); + + while (fChannel.read(buffer) != -1) { + buffer.flip(); + md.update(buffer); + buffer.compact(); + } + byte[] b = md.digest(); + + return byteToHexString(b); + } catch (Exception ex) { + ex.printStackTrace(); + return null; + } finally { + try { + if (null != fis) { + fis.close(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + /** + * 瀛楄妭鐮佽浆16杩涘埗 + */ + public static String byteToHexString(byte[] tmp) { + // 姣忎釜瀛楄妭鐢� 16 杩涘埗琛ㄧず鐨勮瘽锛屼娇鐢ㄤ袱涓瓧绗︼紝 + char[] str = new char[16 * 2]; + + // 鎵�浠ヨ〃绀烘垚 16 杩涘埗闇�瑕� 32 涓瓧绗︼紝琛ㄧず杞崲缁撴灉涓搴旂殑瀛楃浣嶇疆 + int k = 0; + // 浠庣涓�涓瓧鑺傚紑濮嬶紝瀵� MD5 鐨勬瘡涓�涓瓧鑺� + for (int i = 0; i < StaticData.SIXTEEN; i++) { + // 杞崲鎴� 16 杩涘埗瀛楃鐨勮浆鎹� + byte byte0 = tmp[i]; + // 鍙栧瓧鑺備腑楂� 4 浣嶇殑鏁板瓧杞崲 + str[k++] = StaticData.HEX_DIGITS[byte0 >>> 4 & 0xf]; + // >>> 涓洪�昏緫鍙崇Щ锛屽皢绗﹀彿浣嶄竴璧峰彸绉伙紝 鍙栧瓧鑺備腑浣� 4 浣嶇殑鏁板瓧杞崲 + str[k++] = StaticData.HEX_DIGITS[byte0 & 0xf]; + } + // 鎹㈠悗鐨勭粨鏋滆浆鎹负瀛楃涓� + return new String(str); + } + + /** + * 鑾峰彇瀛楃涓茬殑MD5鐮� + */ + public static String getStringMd5(String text) { + StringBuilder builder = new StringBuilder(); + try { + MessageDigest md5 = MessageDigest.getInstance("MD5"); + + byte[] bytes = md5.digest(text.getBytes(StandardCharsets.UTF_8)); + for (byte aByte : bytes) { + builder.append(Integer.toHexString((0x000000FF & aByte) | 0xFFFFFF00).substring(6)); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + + return builder.toString(); + } + + /** + * 鏍规嵁璺緞鑾峰彇鏂囦欢 + */ + public static void getFilesByPath(List<File> list, String path) { + File file = new File(path); + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (null == files) { + return; + } + + for (File f : files) { + if (f.isDirectory()) { + getFilesByPath(list, f.getPath()); + } else { + list.add(f); + } + } + } else { + list.add(file); + } + } + + /** + * 澶嶅埗鏂囦欢 + * + * @param src 婧愭枃浠� + * @param dest 鐩綍鏂囦欢 + */ + public static void copyFile(File src, File dest) throws IOException { + InputStream is = null; + OutputStream os = null; + try { + is = new FileInputStream(src); + os = new FileOutputStream(dest); + + byte[] buffer = new byte[1024]; + + int length; + while ((length = is.read(buffer)) > 0) { + os.write(buffer, 0, length); + } + } finally { + os.close(); + is.close(); + } + } +} diff --git a/src/main/java/com/moon/server/helper/GdalHelper.java b/src/main/java/com/moon/server/helper/GdalHelper.java new file mode 100644 index 0000000..d92f91c --- /dev/null +++ b/src/main/java/com/moon/server/helper/GdalHelper.java @@ -0,0 +1,371 @@ +package com.moon.server.helper; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.gdal.gdal.Band; +import org.gdal.gdal.Driver; +import org.gdal.gdal.gdal; +import org.gdal.gdal.Dataset; +import org.gdal.gdalconst.gdalconstConstants; +import org.gdal.ogr.*; +import org.gdal.osr.SpatialReference; + +import java.io.File; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * GDAL甯姪绫� + * @author WWW + */ +@SuppressWarnings("ALL") +public class GdalHelper { + private final static Log log = LogFactory.getLog(GdalHelper.class); + + public static void init(String gdalPath) { + // 鏀寔涓枃璺緞 + gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); + // 灞炴�ц〃鏀寔涓枃锛欳P936 + gdal.SetConfigOption("SHAPE_ENCODING", ""); + gdal.SetConfigOption("PGEO_DRIVER_TEMPLATE", "DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=%s"); + gdal.SetConfigOption("MDB_DRIVER_TEMPLATE", "DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=%s"); + + // 閰嶇疆鐜鍙橀噺 + if (!StringHelper.isEmpty(gdalPath)) { + gdal.SetConfigOption("GDAL_DATA", gdalPath + File.separator + "gdal-data"); + gdal.SetConfigOption("PROJ_LIB", gdalPath + File.separator + "proj7" + File.separator + "share"); + //System.setProperty("PROJ_LIB", gdalPath + File.separator + "proj7" + File.separator + "share") + gdal.SetConfigOption("GDAL_DRIVER_PATH", gdalPath + File.separator + "gdalplugins"); + + String path = System.getenv("PATH"); + if (!path.contains(gdalPath)) { + System.setProperty("PATH", path + ";" + gdalPath); + } + } + + // 娉ㄥ唽鎵�鏈夌殑椹卞姩 + gdal.AllRegister(); + ogr.RegisterAll(); + } + + /** + * 璇诲彇tif鏂囦欢 + * + * @param fileName + */ + public static void readTif(String fileName) { + // 璇诲彇褰卞儚鏁版嵁 + Dataset dataset = gdal.Open(fileName, gdalconstConstants.GA_ReadOnly); + if (dataset == null) { + System.out.println("read fail!"); + return; + } + + // providing various methods for a format specific driver. + Driver driver = dataset.GetDriver(); + System.out.println("driver name: " + driver.getLongName()); + + // 璇诲彇褰卞儚淇℃伅 + int xSize = dataset.getRasterXSize(); + int ySzie = dataset.getRasterYSize(); + int rasterCount = dataset.getRasterCount(); + System.out.println("dataset xSize: " + xSize + ", ySzie = " + ySzie + ", rasterCount = " + rasterCount); + + Band band = dataset.GetRasterBand(1); + // the data type of the band. + int type = band.GetRasterDataType(); + System.out.println("data type = " + type + ", " + (type == gdalconstConstants.GDT_Byte)); + + // Frees the native resource associated to a Dataset object and close the file. + dataset.delete(); + + gdal.GDALDestroyDriverManager(); + } + + /** + * 璇诲彇shp鏂囦欢 + * + * @param filePath + */ + public static void readShp(String filePath) { + try { + org.gdal.ogr.Driver driver = ogr.GetDriverByName("ESRI shapefile"); + if (driver == null) { + System.out.println(" ESRI shapefile椹卞姩涓嶅彲鐢紒\n"); + System.out.println("fail"); + } + + DataSource dataSource = driver.Open(filePath); + Layer layer = dataSource.GetLayer(0); + + String layerName = layer.GetName(); + System.out.println("鍥惧眰鍚嶇О锛�" + layerName); + + SpatialReference spatialReference = layer.GetSpatialRef(); + // System.out.println(spatialReference) + System.out.println("绌洪棿鍙傝�冨潗鏍囩郴锛�" + spatialReference.GetAttrValue("AUTHORITY", 0) + spatialReference.GetAttrValue("AUTHORITY", 1)); + + double[] layerExtent = layer.GetExtent(); + System.out.println("鍥惧眰鑼冨洿锛歮inx:" + layerExtent[0] + ",maxx:" + layerExtent[1] + ",miny:" + layerExtent[2] + ",maxy:" + layerExtent[3]); + + FeatureDefn featureDefn = layer.GetLayerDefn(); + Map<String, Object> fieldMap = new HashMap(5); + for (int i = 0, count = featureDefn.GetFieldCount(); i < count; i++) { + FieldDefn fieldDefn = featureDefn.GetFieldDefn(i); + //寰楀埌灞炴�у瓧娈电被鍨� + int fieldType = fieldDefn.GetFieldType(); + String fieldTypeName = fieldDefn.GetFieldTypeName(fieldType); + //寰楀埌灞炴�у瓧娈靛悕绉� + String fieldName = fieldDefn.GetName(); + + fieldMap.put(fieldTypeName, fieldName); + } + + long featureCount = layer.GetFeatureCount(); + System.out.println("鍥惧眰瑕佺礌涓暟锛�" + featureCount); + for (int i = 0; i < featureCount; i++) { + Feature feature = layer.GetFeature(i); + Object[] arr = fieldMap.values().toArray(); + for (int k = 0; k < arr.length; k++) { + String value = feature.GetFieldAsString(arr[k].toString()); + System.out.print(" 灞炴�у悕绉�:" + arr[k].toString() + ",灞炴�у��:" + value); + } + System.out.println(); + break; + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + public static void getLayerDto(String filePath) { + org.gdal.ogr.Driver driver = ogr.GetDriverByName("OpenFileGDB"); + if (driver == null) { + return; + } + + List<Map> list = new ArrayList<>(); + List<Map<String, String>> mapList = new ArrayList<>(); + DataSource dataSource = null; + try { + dataSource = driver.Open(filePath, 0); + int num = dataSource.GetLayerCount(); + for (int i = 0; i < num; i++) { + // 鑾峰彇鍥惧眰 + Layer layer = dataSource.GetLayer(i); + // 琛ㄥ悕绉� + String strlayerName = layer.GetName(); + // 鑾峰彇鍥惧眰瑕佹暟涓暟 + long count = layer.GetFeatureCount(); + if (0 != count) { + do { + // 鑾峰彇鍥惧眰涓嬬殑瑕佺礌 + Feature feature = layer.GetNextFeature(); + if (null == feature) { + break; + } + // 鑾峰彇杈圭晫鍧愭爣 + Geometry geometry = feature.GetGeometryRef(); + if (geometry != null) { + String geometryJson = geometry.ExportToJson(); + String str = geometryJson.substring(geometryJson.lastIndexOf(":") + 1, geometryJson.length()); + if (!" [ [ ] ] }".equals(str)) { + String s1 = str.substring(7, str.length() - 8); + String[] split = s1.replaceAll(" ", "").replaceAll("\\[", "").replaceAll("]", "").split(","); + List<String> xList = new ArrayList(); + List<String> yList = new ArrayList(); + Map<String, String> map1 = new HashMap(5); + for (int j = 0; j < split.length; j++) { + if (j != (split.length - 1) && j % 2 == 0) { + map1.put(split[j], split[j + 1]); + } + } + mapList.add(map1); + } + } + Map map = new HashMap(5); + //鑾峰彇灞炴�� + for (int p = 0; p < feature.GetFieldCount(); p++) { + map.put(feature.GetFieldDefnRef(p).GetName(), getProperty(feature, p)); + } + list.add(map); + feature.delete(); + } while (true); + } + //layerDto.setLayerName(strlayerName); + //layerDto.setList(list); + //layerDto.setCount(count); + //layerDto.setMap(mapList); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + if (dataSource != null) { + dataSource.delete(); + } + } + } + + /** + * 璇诲彇gdb鏂囦欢 + * + * @param filePath + */ + public static void readGdb(String filePath) { + try { + org.gdal.ogr.Driver driver = ogr.GetDriverByName("OpenFileGDB"); + if (driver == null) { + return; + } + DataSource dataSource = driver.Open(filePath, 0); + + for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { + // 鑾峰彇鍥惧眰 + Layer layer = dataSource.GetLayer(i); + System.out.println(i + "\t" + layer.GetName()); + do { + // 鑾峰彇鍥惧眰涓嬬殑瑕佺礌 + Feature feature = layer.GetNextFeature(); + if (null == feature) { + break; + } + // 鑾峰彇鏍峰紡锛岃繖閲屾槸绌猴紝寰呯‘瀹� + System.out.println(feature.GetStyleString()); + // 鑾峰彇geometry锛屼篃鍙互ExportToWkb() gml绛夌瓑 + System.out.println(feature.GetGeometryRef().ExportToWkt()); + // 鑾峰彇灞炴�� + System.out.println("----------------------------------"); + for (int p = 0; p < feature.GetFieldCount(); p++) { + System.out.println(feature.GetFieldDefnRef(p).GetName() + "\t" + getProperty(feature, p)); + } + System.out.println("----------------------------------"); + break; + } while (true); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + public static Object getProperty(Feature feature, int index) { + int type = feature.GetFieldType(index); + + PropertyGetter propertyGetter; + if (type < 0 || type >= PROPERTY_GETTERS.length) { + propertyGetter = STRING_PROPERTY_GETTER; + } else { + propertyGetter = PROPERTY_GETTERS[type]; + } + + try { + return propertyGetter.get(feature, index); + } catch (Exception ex) { + // ex.printStackTrace() + log.error(ex.getMessage(), ex); + + return null; + } + } + + /** + * 灞炴�ц幏鍙栧櫒 + */ + @FunctionalInterface + private interface PropertyGetter { + /** + * 鑾峰彇灞炴�� + * + * @param feature + * @param index + * @return + */ + Object get(Feature feature, int index); + } + + private static final PropertyGetter STRING_PROPERTY_GETTER = (feature, index) -> feature.GetFieldAsString(index); + + /** + * feature.GetFieldType(index)寰楀埌涓�涓睘鎬х被鍨嬬殑int鍊�,璇ュ�煎搴斿叿浣撶被鍨� + */ + private static final PropertyGetter[] PROPERTY_GETTERS = new PropertyGetter[]{ + // 0-Integer + (feature, index) -> feature.GetFieldAsInteger(index), + // 1-IntegerList + (feature, index) -> feature.GetFieldAsIntegerList(index), + // 2-Real + (feature, index) -> feature.GetFieldAsDouble(index), + // 3-RealList + (feature, index) -> feature.GetFieldAsDoubleList(index), + // 4-String + STRING_PROPERTY_GETTER, + // 5-StringList + (feature, index) -> feature.GetFieldAsStringList(index), + // 6-unknown + STRING_PROPERTY_GETTER, + // 7-unknown + STRING_PROPERTY_GETTER, + // 8-Binary + (feature, index) -> feature.GetFieldAsBinary(index), + // 9-Date + (feature, index) -> { + int[] pnYear = new int[1]; + int[] pnMonth = new int[1]; + int[] pnDay = new int[1]; + int[] pnHour = new int[1]; + int[] pnMinute = new int[1]; + float[] pfSecond = new float[1]; + int[] pnTZFlag = new int[1]; + feature.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTZFlag); + java.sql.Date date = java.sql.Date.valueOf(LocalDate.of(pnYear[0], pnMonth[0], pnDay[0])); + return date; + }, + // 10-Time + (feature, index) -> { + int[] pnYear = new int[1]; + int[] pnMonth = new int[1]; + int[] pnDay = new int[1]; + int[] pnHour = new int[1]; + int[] pnMinute = new int[1]; + float[] pfSecond = new float[1]; + int[] pnTZFlag = new int[1]; + feature.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTZFlag); + float fSecond = pfSecond[0]; + int s = (int) fSecond; + int ns = (int) (1000000000 * fSecond - s); + Time time = Time.valueOf(LocalTime.of(pnHour[0], pnMinute[0], s, ns)); + return time; + }, + // 11-DateTime + (feature, index) -> { + int[] pnYear = new int[1]; + int[] pnMonth = new int[1]; + int[] pnDay = new int[1]; + int[] pnHour = new int[1]; + int[] pnMinute = new int[1]; + float[] pfSecond = new float[1]; + int[] pnTZFlag = new int[1]; + feature.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTZFlag); + float fSecond = pfSecond[0]; + int s = (int) fSecond; + int ns = (int) (1000000000 * fSecond - s); + LocalDateTime localDateTime = LocalDateTime.of( + LocalDate.of(pnYear[0], pnMonth[0], pnDay[0]), + LocalTime.of(pnHour[0], pnMinute[0], s, ns) + ); + Timestamp timestamp = Timestamp.valueOf(localDateTime); + return timestamp; + }, + // 12-Integer64 + (feature, index) -> feature.GetFieldAsInteger64(index), + // 13 Integer64List + (feature, index) -> feature.GetFieldAsIntegerList(index) + // >=14 (unknown) + }; +} diff --git a/src/main/java/com/moon/server/helper/GdbHelper.java b/src/main/java/com/moon/server/helper/GdbHelper.java new file mode 100644 index 0000000..fd780e8 --- /dev/null +++ b/src/main/java/com/moon/server/helper/GdbHelper.java @@ -0,0 +1,622 @@ +package com.moon.server.helper; + +import com.moon.server.entity.all.BaseGeoEntity; +import com.moon.server.entity.all.StaticData; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.mapper.all.GeomBaseMapper; +import com.moon.server.service.all.BaseQueryService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.gdal.ogr.*; +import org.gdal.osr.SpatialReference; + +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.*; + +/** + * GDB甯姪绫� + * @author WWW + */ +public class GdbHelper { + private final static Log log = LogFactory.getLog(GdbHelper.class); + + /** + * 閿�姣佽祫婧� + */ + public static void delete(Layer layer) { + try { + if (null != layer) { + layer.delete(); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 閿�姣佽祫婧� + */ + public static void delete(DataSource dataSource, Driver driver) { + try { + if (null != dataSource) { + dataSource.delete(); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + + try { + if (null != driver) { + driver.delete(); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 閿�姣佽祫婧� + */ + public static void delete(Layer layer, DataSource dataSource, Driver driver) { + delete(layer); + delete(dataSource, driver); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + public static List<String> getTabNames(String filePath) { + List<String> list = new ArrayList<>(); + + Driver driver = null; + DataSource dataSource = null; + try { + // driver = ogr.GetDriverByName("OpenFileGDB") + driver = ogr.GetDriverByName("FileGDB"); + if (null == driver) { + log.error("GdbHelper.getTabNames.driver is null."); + return list; + } + + dataSource = driver.Open(filePath, 0); + if (null == dataSource) { + log.error("GdbHelper.getTabNames.dataSource is null. " + filePath); + return list; + } + + for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { + Layer layer = dataSource.GetLayer(i); + list.add(layer.GetName()); + + layer.delete(); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + GdbHelper.delete(dataSource, driver); + } + + return list; + } + + /** + * 璇诲彇鏁版嵁 + */ + public static <T> List<T> readData(Class clazz, String filePath, String layerName) { + List<T> list = new ArrayList<>(); + + Driver driver = null; + DataSource dataSource = null; + try { + // driver = ogr.GetDriverByName("OpenFileGDB") + driver = ogr.GetDriverByName("FileGDB"); + if (null == driver) { + return list; + } + + dataSource = driver.Open(filePath, 0); + if (null == dataSource) { + return list; + } + + for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { + Layer layer = dataSource.GetLayer(i); + if (layer.GetName().equals(layerName)) { + GdbHelper.readLayer(clazz, layer, list); + break; + } + + layer.delete(); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + GdbHelper.delete(dataSource, driver); + } + + return list; + } + + /** + * 璇诲彇鍥惧眰 + */ + public static <T> void readLayer(Class clazz, Layer layer, List<T> list) { + try { + Field gField = getGeomField(clazz); + + Map<Integer, Field> map = new HashMap<>(3); + getFieldMapper(clazz, layer, map); + if (map.isEmpty() || 0 == layer.GetFeatureCount()) { + return; + } + + do { + Feature f = layer.GetNextFeature(); + if (null == f) { + break; + } + + T t = (T) clazz.newInstance(); + readFeature(t, f, map, gField); + list.add(t); + } while (true); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + GdbHelper.delete(layer); + } + } + + /** + * 鑾峰彇 geom 瀛楁 + */ + private static Field getGeomField(Class clazz) { + try { + Field gField = clazz.getSuperclass().getDeclaredField("geom"); + gField.setAccessible(true); + + return gField; + } catch (Exception ex) { + return null; + } + } + + /** + * 鑾峰彇瀛楁鏄犲皠 + */ + private static void getFieldMapper(Class clazz, Layer layer, Map<Integer, Field> map) { + try { + FeatureDefn fd = layer.GetLayerDefn(); + for (int i = 0, count = fd.GetFieldCount(); i < count; i++) { + FieldDefn fieldDefn = fd.GetFieldDefn(i); + try { + String name = fieldDefn.GetName().toLowerCase(); + if (StaticData.READ_EXCLUDE_FIELDS.contains(name)) { + continue; + } + + Field field = clazz.getDeclaredField(name); + field.setAccessible(true); + + map.put(i, field); + } catch (Exception e) { + // + } + } + + if (!StaticData.OBJECT.equals(clazz.getSuperclass().getName())) { + getFieldMapper(clazz.getSuperclass(), layer, map); + } + } catch (Exception ex) { + // + } + } + + /** + * 璇诲彇Feature + */ + private static <T> void readFeature(T t, Feature f, Map<Integer, Field> map, Field gField) { + for (Integer i : map.keySet()) { + try { + Field field = map.get(i); + setValue(t, f, field, i); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + + if (null != gField) { + setGeom(t, f, gField); + } + } + + /** + * 璁剧疆鍊� + */ + public static <T> void setValue(T t, Feature f, Field field, Integer i) throws Exception { + switch (field.getType().getName()) { + case "java.math.BigDecimal": + double dd = f.GetFieldAsDouble(i); + field.set(t, BigDecimal.valueOf(dd)); + break; + case "java.lang.Double": + case "double": + field.set(t, f.GetFieldAsDouble(i)); + break; + case "java.lang.Long": + case "long": + field.set(t, f.GetFieldAsInteger64(i)); + break; + case "java.lang.Integer": + case "int": + field.set(t, f.GetFieldAsInteger(i)); + break; + case "java.sql.Timestamp": + Timestamp ts = getTimestamp(f, i); + if (null != ts) { + field.set(t, ts); + } + break; + case "java.time.LocalDate": + LocalDate ld = getLocalDate(f, i); + if (null != ld) { + field.set(t, ld); + } + break; + default: + field.set(t, f.GetFieldAsString(i)); + break; + } + } + + /** + * 璁剧疆 geom 瀛楁鍊� + * <p> + * wkbUnknown = 0, + * wkbPoint = 1, + * wkbLineString = 2, + * wkbPolygon = 3, + * wkbMultiPoint = 4, + * wkbMultiLineString = 5, + * wkbMultiPolygon = 6, + * wkbGeometryCollection = 7, + * wkbNone = 100, + * wkbLinearRing = 101 + */ + private static <T> void setGeom(T t, Feature f, Field gField) { + try { + String geo = "null"; + if (null != f.GetGeometryRef()) { + String wkt = f.GetGeometryRef().ExportToWkt(); + // f.GetGeometryRef().GetGeometryType() + if (wkt.contains(StaticData.LINESTRING) && !wkt.contains(StaticData.MULTILINESTRING)) { + wkt = wkt.replace("LINESTRING (", "MULTILINESTRING ((") + ")"; + } + if (wkt.contains(StaticData.POLYGON) && !wkt.contains(StaticData.MULTIPOLYGON)) { + wkt = wkt.replace("POLYGON (", "MULTIPOLYGON ((") + ")"; + } + wkt = wkt.replace(" 0,", ",").replace(" 0)", ")"); + + geo = String.format("ST_GeomFromText('%s')", wkt); + } + + gField.set(t, geo); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 鑾峰彇 Timestamp + */ + public static Timestamp getTimestamp(Feature f, int index) { + int[] pnYear = new int[1]; + int[] pnMonth = new int[1]; + int[] pnDay = new int[1]; + int[] pnHour = new int[1]; + int[] pnMinute = new int[1]; + float[] pfSecond = new float[1]; + int[] pnTzFlag = new int[1]; + + f.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTzFlag); + + float fSecond = pfSecond[0]; + int s = (int) fSecond; + int ns = (int) (1000000000 * fSecond - s); + + if (pnYear[0] > StaticData.I2050 || pnMonth[0] > StaticData.I12 || pnDay[0] > StaticData.I31 || pnHour[0] > StaticData.I24 || pnMinute[0] > StaticData.I60) { + return null; + } + + LocalDateTime localDateTime = LocalDateTime.of( + LocalDate.of(pnYear[0], pnMonth[0], pnDay[0]), + LocalTime.of(pnHour[0], pnMinute[0], s, ns) + ); + + return Timestamp.valueOf(localDateTime); + } + + /** + * 鑾峰彇 LocalDate + */ + public static LocalDate getLocalDate(Feature f, int index) { + int[] pnYear = new int[1]; + int[] pnMonth = new int[1]; + int[] pnDay = new int[1]; + int[] pnHour = new int[1]; + int[] pnMinute = new int[1]; + float[] pfSecond = new float[1]; + int[] pnTzFlag = new int[1]; + + f.GetFieldAsDateTime(index, pnYear, pnMonth, pnDay, pnHour, pnMinute, pfSecond, pnTzFlag); + if (pnYear[0] > StaticData.I2050 || pnMonth[0] > StaticData.I12 || pnDay[0] > StaticData.I31) { + return null; + } + + return LocalDate.of(pnYear[0], pnMonth[0], pnDay[0]); + } + + /** + * 鍒涘缓GDB + */ + public static void createGdb(String filePath, Map<String, List<?>> map) throws Exception { + Driver driver = null; + DataSource dataSource = null; + try { + driver = ogr.GetDriverByName("FileGDB"); + if (null == driver) { + log.error("GdbHelper.createGdb.driver(FileGDB) is null."); + return; + } + dataSource = driver.CreateDataSource(filePath, null); + if (null == dataSource) { + log.error("GdbHelper.createGdb.dataSource is null. " + filePath); + return; + } + + for (String key : map.keySet()) { + Layer layer = null; + try { + BasicMapper baseMapper = ClassHelper.getBasicMapper(key); + if (null == baseMapper) { + continue; + } + layer = createLayer(dataSource, baseMapper); + if (null == layer) { + continue; + } + + String className = ClassHelper.getClassName(baseMapper); + Class clazz = ClassHelper.getEntityClass(className); + if (null == clazz) { + continue; + } + + List<Field> fields = new ArrayList<>(); + getFields(clazz, fields, StaticData.GDB_EXCLUDE_FIELDS); + addLayerField(layer, fields); + + setLayerData(layer, fields, map.get(key)); + } finally { + if (null != layer) { + layer.delete(); + } + } + } + + dataSource.SyncToDisk(); + dataSource.FlushCache(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + throw ex; + } finally { + GdbHelper.delete(dataSource, driver); + } + } + + /** + * 鍒涘缓鍥惧眰 + */ + private static Layer createLayer(DataSource dataSource, BasicMapper baseMapper ) { + String tab = BaseQueryService.getTabName(baseMapper); + if (StringHelper.isNull(tab)) { + return null; + } + + Integer srid = null; + String geomType = null; + if (baseMapper instanceof GeomBaseMapper) { + GeomBaseMapper geomMapper = (GeomBaseMapper) baseMapper; + geomType = geomMapper.selectGeometryType(tab); + + srid = geomMapper.selectSrid(tab); + } + + SpatialReference sr = new SpatialReference(); + sr.ImportFromEPSG(null == srid ? 4490 : srid); + + return dataSource.CreateLayer(tab.replace(".", "_"), sr, getGeomType(geomType), null); + } + + /** + * 鑾峰彇Geom绫诲埆 + */ + private static Integer getGeomType(String geomType) { + if (StringHelper.isEmpty(geomType)) { + return ogr.wkbPoint; + } + + switch (geomType) { + case "ST_Point": + return ogr.wkbPoint; + case "ST_MultiPoint": + return ogr.wkbMultiPoint; + case "ST_LineString": + return ogr.wkbLineString; + case "ST_MultiLineString": + return ogr.wkbMultiLineString; + case "ST_Polygon": + return ogr.wkbPolygon; + case "ST_MultiPolygon": + return ogr.wkbMultiPolygon; + default: + return ogr.wkbUnknown; + } + } + + /** + * 鑾峰彇瀛楁 + */ + public static void getFields(Class clazz, List<Field> list, List<String> excludeFields) { + try { + Field[] fields = clazz.getDeclaredFields(); + for (Field f : fields) { + if (excludeFields.contains(f.getName())) { + continue; + } + + f.setAccessible(true); + list.add(f); + } + + if (!StaticData.OBJECT.equals(clazz.getSuperclass().getName())) { + getFields(clazz.getSuperclass(), list, excludeFields); + } + } catch (Exception ex) { + // + } + } + + /** + * 娣诲姞鍥惧眰瀛楁 + */ + public static void addLayerField(Layer layer, List<Field> list) { + for (int i = 0, c = list.size(); i < c; i++) { + Field f = list.get(i); + + int fieldType = getFieldType(f); + FieldDefn fd = new FieldDefn(f.getName(), fieldType); + + layer.CreateField(fd, i + 1); + } + } + + /** + * 鑾峰彇瀛楁绫诲瀷 + */ + private static Integer getFieldType(Field f) { + switch (f.getType().getName()) { + case "java.math.BigDecimal": + case "java.lang.Double": + case "double": + return ogr.OFTReal; + case "java.lang.Long": + case "long": + return ogr.OFTInteger64; + case "java.lang.Integer": + case "int": + return ogr.OFTInteger; + case "java.sql.Timestamp": + return ogr.OFTDateTime; + case "java.time.LocalDate": + return ogr.OFTDate; + default: + return ogr.OFTString; + } + } + + /** + * 璁剧疆鍥惧眰鏁版嵁 + */ + private static <T> void setLayerData(Layer layer, List<Field> fields, List<T> list) throws Exception { + for (T t : list) { + Feature f = new Feature(layer.GetLayerDefn()); + + if (t instanceof BaseGeoEntity) { + BaseGeoEntity geoEntity = (BaseGeoEntity) t; + if (!StringHelper.isEmpty(geoEntity.getGeom())) { + Geometry geom = Geometry.CreateFromWkt(geoEntity.getGeom()); + f.SetGeometry(geom); + } + } + + setFeatureData(f, fields, t); + layer.CreateFeature(f); + } + } + + /** + * 璁剧疆瑕佺礌鐨勬暟鎹� + */ + public static <T> void setFeatureData(Feature f, List<Field> fields, T t) throws Exception { + for (int i = 0, c = fields.size(); i < c; i++) { + Field field = fields.get(i); + Object val = field.get(t); + if (null == val) { + continue; + } + + switch (field.getType().getName()) { + case "java.math.BigDecimal": + BigDecimal big = (BigDecimal) val; + f.SetField(i, big.doubleValue()); + break; + case "java.lang.Double": + case "double": + double d = (double) val; + f.SetField(i, d); + break; + case "java.lang.Long": + case "long": + long l = (long) val; + f.SetField(i, l); + break; + case "java.lang.Integer": + case "int": + int n = (int) val; + f.SetField(i, n); + break; + case "java.sql.Timestamp": + Timestamp timestamp = (Timestamp) field.get(t); + setTimestamp(f, i, timestamp); + break; + case "java.time.LocalDate": + LocalDate localDate = (LocalDate) field.get(t); + setLocalDate(f, i, localDate); + break; + default: + String str = (String) val; + f.SetField(i, str); + break; + } + } + } + + /** + * 璁剧疆Timestamp + */ + private static void setTimestamp(Feature f, int i, Timestamp time) { + if (null == time) { + return; + } + + LocalDateTime local = time.toLocalDateTime(); + f.SetField(i, local.getYear(), local.getMonthValue(), local.getDayOfMonth(), local.getHour(), local.getMinute(), local.getSecond(), 8); + } + + /** + * 璁剧疆LocalDate + */ + private static void setLocalDate(Feature f, int i, LocalDate local) { + if (null == local) { + return; + } + + f.SetField(i, local.getYear(), local.getMonthValue(), local.getDayOfMonth(), 0, 0, 0, 8); + } +} diff --git a/src/main/java/com/moon/server/helper/HttpHelper.java b/src/main/java/com/moon/server/helper/HttpHelper.java new file mode 100644 index 0000000..7148fba --- /dev/null +++ b/src/main/java/com/moon/server/helper/HttpHelper.java @@ -0,0 +1,278 @@ +package com.moon.server.helper; + +import org.apache.http.*; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.utils.URIUtils; +import org.apache.http.entity.InputStreamEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicHttpEntityEnclosingRequest; +import org.apache.http.message.BasicHttpRequest; +import org.apache.http.message.HeaderGroup; +import org.apache.http.util.EntityUtils; + +import javax.servlet.ServletException; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.OutputStream; +import java.net.HttpCookie; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Enumeration; + +/** + * Http甯姪绫� + * @author WWW + */ +public class HttpHelper { + private final static String HTTP_SLASH2 = "://"; + + private final static String HTTP_SLASH = "/"; + + private final static Integer THREE = 3; + + protected static final HeaderGroup HOP_HEADERS; + + static { + HOP_HEADERS = new HeaderGroup(); + + String[] headers = new String[]{ + "Connection", "Keep-Alive", "Proxy-Authenticate", "Proxy-Authorization", + "TE", "Trailers", "Transfer-Encoding", "Upgrade", + //"X-RateLimit-Burst-Capacity", "X-RateLimit-Remaining", "X-RateLimit-Replenish-Rate", + "Access-Control-Allow-Origin", "Access-Control-Allow-Credentials", "Access-Control-Allow-Headers"}; + + for (String header : headers) { + HOP_HEADERS.addHeader(new BasicHeader(header, null)); + } + } + + public void service(HttpServletRequest request, HttpServletResponse response, String url, String cookie) throws ServletException, IOException { + HttpRequest proxyRequest; + if (request.getHeader(HttpHeaders.CONTENT_LENGTH) != null || request.getHeader(HttpHeaders.TRANSFER_ENCODING) != null) { + proxyRequest = newProxyRequestWithEntity(request, url); + } else { + proxyRequest = new BasicHttpRequest(request.getMethod(), url); + } + + HttpHost host = this.getTargetHost(url); + // copyRequestHeaders(request, proxyRequest, host); + //setXrForwardedForHeader(request, proxyRequest); + + if (!StringHelper.isEmpty(cookie)) { + proxyRequest.addHeader("Cookie", cookie + "; "); + } + + CloseableHttpClient client = null; + HttpResponse proxyResponse = null; + + try { + client = this.createHttpClient(); + proxyResponse = client.execute(host, proxyRequest); + + int statusCode = proxyResponse.getStatusLine().getStatusCode(); + // response.setStatus(statusCode, proxyResponse.getStatusLine().getReasonPhrase()) + response.setStatus(statusCode); + + copyResponseHeaders(proxyResponse, request, response, url); + + if (statusCode == HttpServletResponse.SC_NOT_MODIFIED) { + response.setIntHeader(HttpHeaders.CONTENT_LENGTH, 0); + } else { + copyResponseEntity(proxyResponse, response); + } + } catch (Exception ex) { + throw new ServletException(ex.getMessage()); + } finally { + if (proxyResponse != null) { + EntityUtils.consumeQuietly(proxyResponse.getEntity()); + } + if (client != null) { + client.close(); + } + } + } + + protected HttpRequest newProxyRequestWithEntity(HttpServletRequest request, String url) throws IOException { + String method = request.getMethod(); + HttpEntityEnclosingRequest proxyRequest = new BasicHttpEntityEnclosingRequest(method, url); + proxyRequest.setEntity(new InputStreamEntity(request.getInputStream(), getContentLength(request))); + //String str = EntityUtils.toString(proxyRequest.getEntity(), "UTF-8") + + return proxyRequest; + } + + private long getContentLength(HttpServletRequest request) { + String contentLengthHeader = request.getHeader("Content-Length"); + if (contentLengthHeader != null) { + return Long.parseLong(contentLengthHeader); + } + + return -1L; + } + + protected void copyRequestHeaders(HttpServletRequest request, HttpRequest proxyRequest, HttpHost host) { + @SuppressWarnings("unchecked") + Enumeration<String> enumerationOfHeaderNames = request.getHeaderNames(); + + while (enumerationOfHeaderNames.hasMoreElements()) { + String headerName = enumerationOfHeaderNames.nextElement(); + copyRequestHeader(request, proxyRequest, host, headerName); + } + } + + protected void copyRequestHeader(HttpServletRequest request, HttpRequest proxyRequest, HttpHost host, String headerName) { + if (headerName.equalsIgnoreCase(HttpHeaders.CONTENT_LENGTH) || HOP_HEADERS.containsHeader(headerName)) { + return; + } + + @SuppressWarnings("unchecked") + Enumeration<String> headers = request.getHeaders(headerName); + while (headers.hasMoreElements()) { + String headerValue = headers.nextElement(); + if (headerName.equalsIgnoreCase(HttpHeaders.HOST)) { + headerValue = host.getHostName(); + if (host.getPort() != -1) { + headerValue += ":" + host.getPort(); + } + } else if (headerName.equalsIgnoreCase(org.apache.http.cookie.SM.COOKIE)) { + headerValue = getRealCookie(headerValue); + } + + proxyRequest.addHeader(headerName, headerValue); + } + } + + protected HttpHost getTargetHost(String url) throws ServletException { + try { + URI uri = new URI(url); + + return URIUtils.extractHost(uri); + } catch (URISyntaxException ex) { + throw new ServletException(ex.getMessage()); + } + } + + protected String getRealCookie(String cookieValue) { + StringBuilder escapedCookie = new StringBuilder(); + + String[] cookies = cookieValue.split("[;,]"); + for (String cookie : cookies) { + String[] cookieSplit = cookie.split("="); + if (cookieSplit.length == 2) { + String cookieName = cookieSplit[0].trim(); + if (cookieName.startsWith(cookieName)) { + cookieName = cookieName.substring(cookieName.length()); + if (escapedCookie.length() > 0) { + escapedCookie.append("; "); + } + escapedCookie.append(cookieName).append("=").append(cookieSplit[1].trim()); + } + } + } + + return escapedCookie.toString(); + } + + private void setXrForwardedForHeader(HttpServletRequest request, HttpRequest proxyRequest) { + String forHeaderName = "X-Forwarded-For"; + String forHeader = request.getRemoteAddr(); + String existingForHeader = request.getHeader(forHeaderName); + if (existingForHeader != null) { + forHeader = existingForHeader + ", " + forHeader; + } + proxyRequest.setHeader(forHeaderName, forHeader); + + String protoHeaderName = "X-Forwarded-Proto"; + String protoHeader = request.getScheme(); + proxyRequest.setHeader(protoHeaderName, protoHeader); + } + + protected CloseableHttpClient createHttpClient() { + RequestConfig requestConfig = RequestConfig.custom() + .setRedirectsEnabled(false) + .setCookieSpec(CookieSpecs.IGNORE_COOKIES) + .setConnectTimeout(-1) + .setSocketTimeout(-1) + .build(); + + // return HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build() + return HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); + } + + protected void copyResponseHeaders(HttpResponse proxyResponse, HttpServletRequest request, HttpServletResponse response, String url) { + for (Header header : proxyResponse.getAllHeaders()) { + copyResponseHeader(request, response, header, url); + } + } + + protected void copyResponseHeader(HttpServletRequest request, HttpServletResponse response, Header header, String url) { + String headerName = header.getName(); + if (HOP_HEADERS.containsHeader(headerName)) { + return; + } + + String headerValue = header.getValue(); + if (headerName.equalsIgnoreCase(org.apache.http.cookie.SM.SET_COOKIE) || headerName.equalsIgnoreCase(org.apache.http.cookie.SM.SET_COOKIE2)) { + copyProxyCookie(request, response, headerValue); + } else if (headerName.equalsIgnoreCase(HttpHeaders.LOCATION)) { + response.addHeader(headerName, rewriteUrlFromResponse(request, url, headerValue)); + } else { + response.addHeader(headerName, headerValue); + } + } + + protected void copyProxyCookie(HttpServletRequest request, HttpServletResponse response, String headerValue) { + String path = request.getContextPath() + request.getServletPath(); + if (path.isEmpty()) { + path = "/"; + } + + for (HttpCookie cookie : HttpCookie.parse(headerValue)) { + Cookie servletCookie = new Cookie(cookie.getName(), cookie.getValue()); + servletCookie.setComment(cookie.getComment()); + servletCookie.setMaxAge((int) cookie.getMaxAge()); + servletCookie.setPath(path); + + servletCookie.setSecure(cookie.getSecure()); + servletCookie.setVersion(cookie.getVersion()); + response.addCookie(servletCookie); + } + } + + protected String rewriteUrlFromResponse(HttpServletRequest request, String targetUri, String theUrl) { + if (theUrl.startsWith(targetUri)) { + StringBuffer curUrl = request.getRequestURL(); + + int pos; + if ((pos = curUrl.indexOf(HTTP_SLASH2)) >= 0) { + if ((pos = curUrl.indexOf(HTTP_SLASH, pos + THREE)) >= 0) { + curUrl.setLength(pos); + } + } + + curUrl.append(request.getContextPath()); + curUrl.append(request.getServletPath()); + curUrl.append(theUrl, targetUri.length(), theUrl.length()); + + return curUrl.toString(); + } + + return theUrl; + } + + protected void copyResponseEntity(HttpResponse proxyResponse, HttpServletResponse response) throws IOException { + HttpEntity entity = proxyResponse.getEntity(); + if (entity != null) { + //String str = EntityUtils.toString(entity, "UTF-8") + OutputStream servletOutputStream = response.getOutputStream(); + entity.writeTo(servletOutputStream); + } + } +} diff --git a/src/main/java/com/moon/server/helper/JsonHelper.java b/src/main/java/com/moon/server/helper/JsonHelper.java new file mode 100644 index 0000000..98e3688 --- /dev/null +++ b/src/main/java/com/moon/server/helper/JsonHelper.java @@ -0,0 +1,79 @@ +package com.moon.server.helper; + +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; + +/** + * Json甯姪绫� + * @author WWW + */ +public class JsonHelper { + /** + * json涓诧紝杞负LinkedHashMap + * @param json + * @return + * @throws IOException + */ + @SuppressWarnings("unchecked") + public static LinkedHashMap<String, Object> json2Map(String json) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true).configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); + return mapper.readValue(json, LinkedHashMap.class); + } + + /** + * 瀵硅薄杞琷son + * @param obj + * @return + * @throws IOException + */ + public static String map2Json(Object obj) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true).configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); + return mapper.writeValueAsString(obj); + } + + /** + * json涓诧紝杞负List<LinkedHashMap<String, Object>> + * @param json + * @return + * @throws IOException + */ + @SuppressWarnings("unchecked") + public static List<LinkedHashMap<String, Object>> json2ListMap(String json) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true).configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); + return mapper.readValue(json, List.class); + } + + /** + * 灏唈son瀛楃涓茶浆涓哄璞� + * @param json + * @param valueType + * @param <T> + * @return + * @throws IOException + */ + public static <T> T json2Object(String json, Class<T> valueType) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true).configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); + return mapper.readValue(json, valueType); + } + + /** + * fastjson 杞璞� + * + * @param obj + * @param valueType + * @param <T> + * @return + */ + public static <T> T obj2Vo(Object obj, Class<T> valueType) { + return JSONObject.parseObject(JSONObject.toJSONString(obj), valueType); + } +} diff --git a/src/main/java/com/moon/server/helper/LicHelper.java b/src/main/java/com/moon/server/helper/LicHelper.java new file mode 100644 index 0000000..0a5fa08 --- /dev/null +++ b/src/main/java/com/moon/server/helper/LicHelper.java @@ -0,0 +1,105 @@ +package com.moon.server.helper; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.Charset; + +/** + * 璁稿彲甯姪绫� + * @author WWW + */ +public class LicHelper { + private String a; + private String b; + private static String c; + private static String d; + private static String e; + private static final Logger f; + + static { + c = "utf-8"; + d = "AES"; + e = "AES/CBC/PKCS5Padding"; + f = LoggerFactory.getLogger(LicHelper.class); + } + + private IvParameterSpec a() { + try { + return new IvParameterSpec(this.b.getBytes(c)); + } catch (Exception ex) { + return null; + } + } + + public final String a(final String s) { + String str = null; + try { + // final Cipher instance + // (instance = Cipher.getInstance(e)).init(1, new SecretKeySpec(this.a.getBytes(c), d), this.a()) + // str = a(instance.doFinal(s.getBytes(Charset.forName(c)))) + + Cipher instance = Cipher.getInstance(e); + IvParameterSpec ips = this.a(); + SecretKeySpec sks = new SecretKeySpec(this.a.getBytes(c), d); + instance.init(1, sks, ips); + + byte[] bytes = s.getBytes(Charset.forName(c)); + str = a(instance.doFinal(bytes)); + } catch (Exception ex) { + System.out.println(ex.getStackTrace()); + } + return str; + } + + public final String b(final String s) { + String s2 = null; + try { + final Cipher instance; + (instance = Cipher.getInstance(e)).init(2, new SecretKeySpec(this.a.getBytes(c), d), this.a()); + s2 = new String(instance.doFinal(this.e(s)), c); + } catch (Exception ex) { + String str = ex.getMessage(); + } + return s2; + } + + private static String a(final byte[] array) { + final StringBuilder sb = new StringBuilder(); + for (int i = 0; i < array.length; ++i) { + final String hexString; + if ((hexString = Integer.toHexString(array[i] & 0xFF)).length() < 2) { + sb.append("0"); + } + sb.append(hexString); + } + return sb.toString(); + } + + private byte[] e(String upperCase) { + final int n = (upperCase = upperCase.toUpperCase()).length() / 2; + final char[] charArray = upperCase.toCharArray(); + final byte[] array = new byte[n]; + for (int i = 0; i < n; ++i) { + final int n2 = i << 1; + array[i] = (byte) ((byte) "0123456789ABCDEF".indexOf(charArray[n2]) << 4 | (byte) "0123456789ABCDEF".indexOf(charArray[n2 + 1])); + } + return array; + } + + public final void c(String string) { + final String substring = (string = string).substring(2, 5); + final StringBuilder sb; + (sb = new StringBuilder(string)).replace(2, 5, string.substring(7, 10)); + sb.replace(7, 10, substring); + string = sb.toString(); + this.a = string; + } + + public final void d(final String b) { + this.b = b; + } +} diff --git a/src/main/java/com/moon/server/helper/Md5Helper.java b/src/main/java/com/moon/server/helper/Md5Helper.java new file mode 100644 index 0000000..f9ef484 --- /dev/null +++ b/src/main/java/com/moon/server/helper/Md5Helper.java @@ -0,0 +1,109 @@ +package com.moon.server.helper; + +import org.apache.commons.codec.binary.Hex; + +import java.security.MessageDigest; +import java.util.Random; + +/** + * MD5甯姪绫� + * @author WWW + */ +public class Md5Helper { + private final static int M3 = 3; + + private final static int M16 = 16; + + private final static int M48 = 48; + + /** + * 鐢熸垚鍚湁闅忔満鐩愮殑瀵嗙爜 + * + * @param password + * @return + */ + public static String generate(String password) { + Random r = new Random(); + StringBuilder sb = new StringBuilder(16); + sb.append(r.nextInt(99999999)).append(r.nextInt(99999999)); + + int len = sb.length(); + if (len < M16) { + for (int i = 0; i < M16 - len; i++) { + sb.append("0"); + } + } + + String salt = sb.toString(); + password = md5Hex(password + salt); + char[] cs = new char[48]; + for (int i = 0; i < M48; i += M3) { + cs[i] = password.charAt(i / 3 * 2); + char c = salt.charAt(i / 3); + cs[i + 1] = c; + cs[i + 2] = password.charAt(i / 3 * 2 + 1); + } + + return new String(cs); + } + + /** + * 鏍¢獙瀵嗙爜鏄惁姝g‘ + * + * @param password + * @param md5 + * @return + */ + public static boolean verify(String password, String md5) { + char[] cs1 = new char[32]; + char[] cs2 = new char[16]; + for (int i = 0; i < M48; i += M3) { + cs1[i / 3 * 2] = md5.charAt(i); + cs1[i / 3 * 2 + 1] = md5.charAt(i + 2); + cs2[i / 3] = md5.charAt(i + 1); + } + String salt = new String(cs2); + + return md5Hex(password + salt).equals(new String(cs1)); + } + + /** + * 鑾峰彇鍗佸叚杩涘埗瀛楃涓插舰寮忕殑MD5鎽樿 + * + * @param src + * @return + */ + public static String md5Hex(String src) { + try { + MessageDigest md5 = MessageDigest.getInstance("MD5"); + byte[] bs = md5.digest(src.getBytes()); + + return new String(new Hex().encode(bs)); + } catch (Exception e) { + return null; + } + } + + /** + * 鍙嶈浆 + * + * @param pass + * @return + */ + public static String reverse(String pass) { + StringBuilder sb = new StringBuilder(pass); + + return sb.reverse().toString(); + } + + /** + * 楠岃瘉瀵嗙爜 + * + * @param originalPassword + * @param dbPassword + * @return + */ + public static boolean validatePassword(String originalPassword, String dbPassword) { + return verify(originalPassword, reverse(dbPassword)); + } +} diff --git a/src/main/java/com/moon/server/helper/MdbHelper.java b/src/main/java/com/moon/server/helper/MdbHelper.java new file mode 100644 index 0000000..1c33390 --- /dev/null +++ b/src/main/java/com/moon/server/helper/MdbHelper.java @@ -0,0 +1,92 @@ +package com.moon.server.helper; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.gdal.ogr.DataSource; +import org.gdal.ogr.Driver; +import org.gdal.ogr.Layer; +import org.gdal.ogr.ogr; + +import java.util.ArrayList; +import java.util.List; + +/** + * MDB甯姪绫� + * @author WWW + */ +public class MdbHelper { + private final static Log log = LogFactory.getLog(MdbHelper.class); + + /** + * 鑾峰彇琛ㄥ悕 + */ + public static List<String> getTabNames(String filePath) { + List<String> list = new ArrayList<>(); + + Driver driver = null; + DataSource dataSource = null; + try { + driver = ogr.GetDriverByName("PGeo"); + if (null == driver) { + log.error("MdbHelper.getTabNames: PGeo is null"); + return list; + } + + dataSource = driver.Open(filePath, 0); + if (null == dataSource) { + log.error("MdbHelper.getTabNames.dataSource is null. " + filePath); + return list; + } + + for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { + Layer layer = dataSource.GetLayer(i); + list.add(layer.GetName()); + + layer.delete(); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + GdbHelper.delete(dataSource, driver); + } + + return list; + } + + /** + * 璇诲彇鏁版嵁 + */ + public static <T> List<T> readData(Class clazz, String filePath, String layerName) { + List<T> list = new ArrayList<>(); + + Driver driver = null; + DataSource dataSource = null; + try { + driver = ogr.GetDriverByName("PGeo"); + if (null == driver) { + return list; + } + + dataSource = driver.Open(filePath, 0); + if (null == dataSource) { + return list; + } + + for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { + Layer layer = dataSource.GetLayer(i); + if (layer.GetName().equals(layerName)) { + GdbHelper.readLayer(clazz, layer, list); + break; + } + + layer.delete(); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + GdbHelper.delete(dataSource, driver); + } + + return list; + } +} diff --git a/src/main/java/com/moon/server/helper/PathHelper.java b/src/main/java/com/moon/server/helper/PathHelper.java new file mode 100644 index 0000000..89c4c18 --- /dev/null +++ b/src/main/java/com/moon/server/helper/PathHelper.java @@ -0,0 +1,166 @@ +package com.moon.server.helper; + +import com.moon.server.config.PropertiesConfig; +import com.moon.server.entity.all.SettingData; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.util.Date; + +/** + * 璺緞甯姪绫� + * @author WWW + */ +@Component +public class PathHelper { + @Autowired + private PropertiesConfig config; + + private static int downloadPath = 1; + + private static int uploadPath = 1; + + private final static double D80 = 80; + + private final static Log log = LogFactory.getLog(PathHelper.class); + + public PropertiesConfig getConfig() { + return config; + } + + public static int getDownloadPath() { + return downloadPath; + } + + public static int getUploadPath() { + return uploadPath; + } + + /** + * 鍒濆鍖� + */ + public void init() { + downloadPath = getSubPath(config.getDownloadPath(), downloadPath); + uploadPath = getSubPath(config.getUploadPath(), uploadPath); + } + + private static int getSubPath(String parentPath, int subPath) { + while (true) { + String path = parentPath + File.separator + subPath; + + File file = new File(path); + if (!file.exists() && !file.isDirectory()) { + file.mkdirs(); + return subPath; + } + + File[] files = file.listFiles(); + if (null == files || files.length < SettingData.MAX_FILES) { + return subPath; + } + + subPath++; + } + } + + /** + * 鑾峰彇涓嬭浇瀹屾暣鐩綍 + */ + public String getDownloadFullPath() { + downloadPath = getSubPath(config.getDownloadPath(), downloadPath); + + return config.getDownloadPath() + File.separator + downloadPath; + } + + /** + * 鑾峰彇涓婁紶瀹屾暣鐩綍 + */ + public String getUploadFullPath() { + uploadPath = getSubPath(config.getUploadPath(), uploadPath); + + return config.getUploadPath() + File.separator + uploadPath; + } + + /** + * 鑾峰彇涓存椂璺緞 + */ + public String getTempPath() { + String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); + String path = config.getTempPath() + File.separator + tempName; + + File file = new File(path); + if (!file.exists() && !file.isDirectory()) { + file.mkdirs(); + } + + deleteOldPath(config.getTempPath()); + + return path; + } + + /** + * 鑾峰彇涓存椂璺緞 + */ + public String getTempPath(String subPath) { + if (!StringHelper.isEmpty(subPath)) { + String path = config.getTempPath() + File.separator + subPath; + + File file = new File(path); + if (file.exists() && file.isDirectory()) { + return path; + } + } + + deleteOldPath(config.getTempPath()); + + return getTempPath(); + } + + /** + * 鑾峰彇涓存椂璺緞鍚嶇О + */ + public String getTempPathName() { + String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); + String path = config.getTempPath() + File.separator + tempName; + + File file = new File(path); + if (!file.exists() && !file.isDirectory()) { + file.mkdirs(); + } + + deleteOldPath(config.getTempPath()); + + return tempName; + } + + /** + * 鍒犻櫎鏃ц矾寰� + */ + public void deleteOldPath(String tempPath) { + try { + double ran = Math.random() * 99; + if (ran < D80) { + return; + } + + File file = new File(tempPath); + String str = StringHelper.YMD2_FORMAT.format(new Date()); + + File[] files = file.listFiles(); + if (null != files) { + for (File f : files) { + if (f.getPath().contains(str)) { + continue; + } + + FileHelper.deleteFiles(f); + } + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } +} diff --git a/src/main/java/com/moon/server/helper/RestHelper.java b/src/main/java/com/moon/server/helper/RestHelper.java new file mode 100644 index 0000000..d23fa83 --- /dev/null +++ b/src/main/java/com/moon/server/helper/RestHelper.java @@ -0,0 +1,258 @@ +package com.moon.server.helper; + +import com.moon.server.entity.all.StaticData; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.springframework.web.client.RestTemplate; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Rest鏈嶅姟甯姪绫� + * @author WWW + */ +public class RestHelper { + private static RestTemplate restTemplate; + + private final static Log log = LogFactory.getLog(RestHelper.class); + + /** + * 鑾峰彇RestTemplate + * + * @return RestTemplate + */ + public static RestTemplate getRestTemplate() { + if (restTemplate == null) { + restTemplate = SpringContextHelper.getBean(RestTemplate.class); + } + + return restTemplate; + } + + /** + * Get璇锋眰-HttpURLConnection + * + * @param url URL鍦板潃 + * @return 瀛楃涓� + * @throws IOException IO寮傚父 + */ + public static String getForConn(String url) throws IOException { + BufferedReader br = null; + HttpURLConnection conn = null; + + try { + URL restUrl = new URL(url); + + conn = (HttpURLConnection) restUrl.openConnection(); + // POST,GET,PUT,DELETE + conn.setRequestMethod("GET"); + conn.setRequestProperty("Accept", "application/json"); + + br = new BufferedReader(new InputStreamReader(conn.getInputStream())); + + String line; + StringBuilder sb = new StringBuilder(); + while ((line = br.readLine()) != null) { + sb.append(line); + } + + return sb.toString(); + } finally { + if (br != null) { + br.close(); + } + if (conn != null) { + conn.disconnect(); + } + } + } + + /** + * Post璇锋眰-HttpURLConnection + * + * @param url URL鍦板潃 + * @param query 鏌ヨ鏉′欢 + * @return 瀛楃涓� + * @throws IOException IO寮傚父 + */ + public static String postForConn(String url, String query) throws IOException { + BufferedReader br = null; + HttpURLConnection conn = null; + + try { + URL restUrl = new URL(url); + + conn = (HttpURLConnection) restUrl.openConnection(); + // POST,GET,PUT,DELETE + conn.setRequestMethod("POST"); + conn.setRequestProperty("Content-Type", "application/json"); + conn.setDoOutput(true); + + PrintStream ps = new PrintStream(conn.getOutputStream()); + ps.print(query); + ps.close(); + + // OutputStream out = conn.getOutputStream() + // out.write(query.getBytes()) + // out.close() + + br = new BufferedReader(new InputStreamReader(conn.getInputStream())); + + String line; + StringBuilder sb = new StringBuilder(); + while ((line = br.readLine()) != null) { + sb.append(line); + } + + return sb.toString(); + } finally { + if (br != null) { + br.close(); + } + if (conn != null) { + conn.disconnect(); + } + } + } + + /** + * Get璇锋眰-CloseableHttpClient + * + * @param uri Uri鍦板潃 + * @return 鍝嶅簲瀛楃涓� + */ + public static String get(String uri) { + try { + CloseableHttpClient httpClient = HttpClients.custom().build(); + + HttpGet httpGet = new HttpGet(uri); + + CloseableHttpResponse closeResponse = httpClient.execute(httpGet); + // 鍙栧嚭杩斿洖浣� + HttpEntity entity = closeResponse.getEntity(); + + return EntityUtils.toString(entity, StaticData.TEXT_ENCODER); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + + return getErrorInfo(uri, ex); + } + } + + /** + * Post璇锋眰-CloseableHttpClient + * + * @param uri Uri鍦板潃 + * @param postData 寰呭彂閫佹暟鎹� + * @return 鍝嶅簲瀛楃涓� + */ + public static String post(String uri, List<NameValuePair> postData) { + try { + CloseableHttpClient httpClient = HttpClients.custom().build(); + + UrlEncodedFormEntity postEntity = new UrlEncodedFormEntity(postData, StaticData.TEXT_ENCODER); + HttpPost httpPost = new HttpPost(uri); + httpPost.setEntity(postEntity); + + CloseableHttpResponse closeResponse = httpClient.execute(httpPost); + + // 鍙栧嚭杩斿洖浣� + HttpEntity entity = closeResponse.getEntity(); + + return EntityUtils.toString(entity, StaticData.TEXT_ENCODER); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + + return getErrorInfo(uri, ex); + } + } + + /** + * 鑾峰彇閿欒淇℃伅 + * + * @param uri Uri鍦板潃 + * @param ex 寮傚父 + * @return 閿欒淇℃伅 + */ + public static String getErrorInfo(String uri, Exception ex) { + Map<String, Object> map = new LinkedHashMap<>(); + map.put("result", null); + map.put("message", ex.getMessage()); + map.put("code", 400); + map.put("uri", uri); + //map.put("tag", StaticData.CACHE_PREFIX) + + return map.toString(); + } + + /** + * GET璇锋眰锛圧EST锛� + */ + public static String getForRest(String uri) { + RestTemplate rest = getRestTemplate(); + + return rest.getForObject(uri, String.class); + } + + /** + * GET璇锋眰锛圧EST锛� + */ + public static <T> T getForRest(String uri, Class<T> clazz) { + RestTemplate rest = getRestTemplate(); + + return rest.getForObject(uri, clazz); + } + + /** + * POST璇锋眰锛圧EST锛� + */ + public static String postForRest(String uri, Map<String, Object> map) { + RestTemplate rest = getRestTemplate(); + + return rest.postForObject(uri, map, String.class); + } + + /** + * POST璇锋眰锛圧EST锛� + */ + public static <T> String postForRest(String uri, List<T> list) { + RestTemplate rest = getRestTemplate(); + + return rest.postForObject(uri, list, String.class); + } + + /** + * POST璇锋眰锛圧EST锛� + */ + public static <T> String postForRest(String uri, T t) { + RestTemplate rest = getRestTemplate(); + + return rest.postForObject(uri, t, String.class); + } + + /** + * DELETE璇锋眰锛圧EST锛� + */ + public static void deleteForRest(String uri) { + RestTemplate rest = getRestTemplate(); + + rest.delete(uri); + } +} diff --git a/src/main/java/com/moon/server/helper/RsaHelper.java b/src/main/java/com/moon/server/helper/RsaHelper.java new file mode 100644 index 0000000..172eb36 --- /dev/null +++ b/src/main/java/com/moon/server/helper/RsaHelper.java @@ -0,0 +1,209 @@ +package com.moon.server.helper; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.core.io.ClassPathResource; + +import javax.crypto.Cipher; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.security.*; +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.HashMap; +import java.util.Map; + +/** + * RSA宸ュ叿绫� + * @author WWW + */ +public class RsaHelper { + /** + * 绉侀挜 + */ + private static String privateKey; + + /** + * 鍏挜 + */ + private static String publicKey; + + /** + * 瀵嗛挜绠楁硶 + */ + private static final String KEY_ALGORITHM = "RSA"; + + /** + * RSA瀵嗛挜闀垮害锛�1024 鎴� 2048 + */ + private static final int DEFAULT_RSA_KEY_SIZE = 1024; + + /** + * 鏃ュ織 + */ + private final static Log log = LogFactory.getLog(RsaHelper.class); + + /** + * 鐢熸垚鍏閽� + */ + public static void generate() { + Map<String, String> result = generateRsaKey(DEFAULT_RSA_KEY_SIZE); + System.out.println("鍏挜涓猴細" + result.get("publicKey")); + System.out.println("绉侀挜涓猴細" + result.get("privateKey")); + } + + /** + * 鑾峰彇RSA鍔犲瘑绉侀挜 + * + * @return + * @throws IOException + */ + public static String getPrivateKey() throws IOException { + if (privateKey == null) { + InputStream inPrivate = new ClassPathResource("config" + File.separator + "rsa_private_key.txt").getInputStream(); + privateKey = inputStream2String(inPrivate); + inPrivate.close(); + } + + return privateKey; + } + + /** + * 鑾峰彇RSA鍔犲瘑鍏挜 + * + * @return + * @throws IOException + */ + public static String getPublicKey() throws IOException { + if (publicKey == null) { + InputStream inPrivate = new ClassPathResource("config" + File.separator + "rsa_public_key.txt").getInputStream(); + publicKey = inputStream2String(inPrivate); + inPrivate.close(); + } + + return publicKey; + } + + /** + * 璇诲彇鏂囨湰鏂囦欢 + * + * @param fileName 鏂囦欢璺緞 + * @return + * @throws IOException + */ + public static String readFile(String fileName) throws IOException { + File file = new File(fileName); + BufferedReader br = new BufferedReader(new FileReader(file)); + + StringBuilder result = new StringBuilder(); + + String line = null; + while ((line = br.readLine()) != null) { + result.append(System.lineSeparator() + line); + } + br.close(); + + return result.toString(); + } + + /** + * 鎶奿nputStream杞垚String + * + * @param is + * @return + * @throws IOException + */ + private static String inputStream2String(InputStream is) throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + int i = -1; + while ((i = is.read()) != -1) { + baos.write(i); + } + + String str = baos.toString(); + baos.close(); + + return str; + } + + /** + * 鐢熸垚RSA鐨勫叕绉侀挜 + * + * @param keySize 1025 鎴� 2048 + * @return + */ + public static Map<String, String> generateRsaKey(int keySize) { + Map<String, String> result = new HashMap<>(2); + try { + KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); + + // 鍒濆鍖栧瘑閽ュ鐢熸垚鍣紝瀵嗛挜澶у皬涓�1024 2048浣� + keyPairGen.initialize(keySize, new SecureRandom()); + + // 鐢熸垚涓�涓瘑閽ュ锛屼繚瀛樺湪keyPair涓� + KeyPair keyPair = keyPairGen.generateKeyPair(); + + // 寰楀埌鍏挜瀛楃涓� + String pub = new String(Base64.encodeBase64(keyPair.getPublic().getEncoded())); + result.put("publicKey", pub); + + // 寰楀埌绉侀挜瀛楃涓� + String pri = new String(Base64.encodeBase64(keyPair.getPrivate().getEncoded())); + result.put("privateKey", pri); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + + return result; + } + + /** + * RSA绉侀挜瑙e瘑 + * + * @param str 鍔犲瘑鐨勫瓧绗︿覆 + * @return 瑙e瘑瀛楃涓� + * @throws Exception 鍔犲瘑杩囩▼涓殑寮傚父淇℃伅 + */ + public static String decrypt(String str) throws Exception { + // 64浣嶈В鐮佸姞瀵嗗悗鐨勫瓧绗︿覆 + byte[] inputByte = Base64.decodeBase64(str.getBytes(StandardCharsets.UTF_8)); + + // Base64缂栫爜鐨勭閽� + byte[] decoded = Base64.decodeBase64(getPrivateKey()); + RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded)); + + // RSA瑙e瘑锛歊SA/ECB/NoPadding + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.DECRYPT_MODE, priKey); + + String outStr = new String(cipher.doFinal(inputByte)); + + return outStr; + } + + /** + * RSA鍏挜鍔犲瘑 + * + * @param str 闇�瑕佸姞瀵嗙殑瀛楃涓� + * @return 瀵嗘枃 + * @throws Exception 鍔犲瘑杩囩▼涓殑寮傚父淇℃伅 + */ + public static String encrypt(String str) throws Exception { + // Base64缂栫爜鐨勫叕閽� + byte[] decoded = Base64.decodeBase64(getPublicKey()); + + RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded)); + + // RSA鍔犲瘑锛歊SA/ECB/NoPadding + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, pubKey); + + String outStr = Base64.encodeBase64String(cipher.doFinal(str.getBytes(StandardCharsets.UTF_8))); + + return outStr; + } +} diff --git a/src/main/java/com/moon/server/helper/ShpHelper.java b/src/main/java/com/moon/server/helper/ShpHelper.java new file mode 100644 index 0000000..aba74c0 --- /dev/null +++ b/src/main/java/com/moon/server/helper/ShpHelper.java @@ -0,0 +1,243 @@ +package com.moon.server.helper; + +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.MarkJsonEntity; +import com.moon.server.entity.ctrl.ShpRecordEntity; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.gdal.ogr.*; +import org.gdal.osr.SpatialReference; + +import java.io.File; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * ShapeFile甯姪绫� + * @author WWW + */ +public class ShpHelper { + private final static Log log = LogFactory.getLog(ShpHelper.class); + + /** + * 璇诲彇Shp绗竴鏉¤褰曠殑WKT + */ + public static ShpRecordEntity readShpFirstRecord(String filePath) { + Driver driver = null; + DataSource dataSource = null; + Layer layer = null; + try { + driver = ogr.GetDriverByName("ESRI shapefile"); + if (null == driver) { + return null; + } + + dataSource = driver.Open(filePath); + if (null == dataSource) { + return null; + } + + layer = dataSource.GetLayer(0); + if (layer.GetFeatureCount() < 1) { + return null; + } + + SpatialReference spatialReference = layer.GetSpatialRef(); + String csid = spatialReference.GetAttrValue("AUTHORITY", 1); + + Feature feature = layer.GetFeature(0); + String wkt = feature.GetGeometryRef().ExportToWkt(); + + return new ShpRecordEntity(wkt, csid); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } finally { + GdbHelper.delete(layer, dataSource, driver); + } + } + + /** + * 璇诲彇ShapeFile鏂囦欢鑾峰彇Mark瀹炰綋绫� + */ + public static List<MarkJsonEntity> readShpForMarks(String filePath) { + Driver driver = null; + DataSource dataSource = null; + Layer layer = null; + try { + driver = ogr.GetDriverByName("ESRI shapefile"); + if (null == driver) { + return null; + } + + dataSource = driver.Open(filePath); + if (null == dataSource) { + return null; + } + + layer = dataSource.GetLayer(0); + if (layer.GetFeatureCount() == 0) { + return null; + } + + Map<Integer, Field> fields = getShpFields(layer); + + return setMarkJsonEntity(layer, fields); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } finally { + GdbHelper.delete(layer, dataSource, driver); + } + } + + /** + * 鑾峰彇shp瀛楁淇℃伅 + */ + private static Map<Integer, Field> getShpFields(Layer layer) { + FeatureDefn featureDefn = layer.GetLayerDefn(); + + Map<Integer, Field> fields = new HashMap(3); + for (int i = 0, count = featureDefn.GetFieldCount(); i < count; i++) { + try { + FieldDefn fieldDefn = featureDefn.GetFieldDefn(i); + Field field = MarkJsonEntity.class.getDeclaredField(fieldDefn.GetName()); + field.setAccessible(true); + + fields.put(i, field); + } catch (Exception e) { + // + } + } + + return fields; + } + + /** + * 璁剧疆鏍囩粯瀹炰綋绫� + */ + private static List<MarkJsonEntity> setMarkJsonEntity(Layer layer, Map<Integer, Field> fieldMap) throws Exception { + List<MarkJsonEntity> list = new ArrayList<>(); + for (int i = 0; i < layer.GetFeatureCount(); i++) { + Feature f = layer.GetFeature(i); + + MarkJsonEntity me = new MarkJsonEntity(i + 1); + for (Integer key : fieldMap.keySet()) { + Field field = fieldMap.get(key); + GdbHelper.setValue(me, f, field, key); + } + me.setWkt(f.GetGeometryRef().ExportToWkt()); + + list.add(me); + } + + return list; + } + + /** + * 鍒涘缓ShapeFile鏂囦欢 + * + * @param list 鏍囩粯JSON瀹炰綋绫婚泦鍚� + * @param path 璺緞 + * @param type 绫诲瀷锛歅OINT,LINESTRING,POLYGON + * @return ShapeFile鏂囦欢鍚� + */ + public static String createShp(List<MarkJsonEntity> list, String path, String type) { + Driver driver = null; + DataSource dataSource = null; + Layer layer = null; + try { + driver = ogr.GetDriverByName("ESRI shapefile"); + if (null == driver) { + return null; + } + + String filePath = path + File.separator + type.toLowerCase() + ".shp"; + // DataSource ds = driver.Open(filePath, 0) + dataSource = driver.CreateDataSource(filePath, null); + if (null == dataSource) { + return null; + } + + SpatialReference sr = new SpatialReference(); + sr.ImportFromEPSG(4326); + + int geoType = getGeometryType(type); + layer = dataSource.CreateLayer(type.toLowerCase(), sr, geoType); + if (null == layer) { + return null; + } + + List<Field> fields = new ArrayList<>(); + GdbHelper.getFields(MarkJsonEntity.class, fields, StaticData.MARK_EXCLUDE_FIELDS); + GdbHelper.addLayerField(layer, fields); + + FeatureDefn featureDefn = layer.GetLayerDefn(); + for (MarkJsonEntity t : list) { + Feature f = new Feature(featureDefn); + GdbHelper.setFeatureData(f, fields, t); + + Geometry geo = Geometry.CreateFromWkt(t.getWkt()); + f.SetGeometry(geo); + + layer.CreateFeature(f); + } + + return filePath; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } finally { + GdbHelper.delete(layer, dataSource, driver); + } + } + + /** + * 鑾峰彇鍥惧舰绫诲瀷 + */ + private static int getGeometryType(String type) { + switch (type) { + case "POINT": + return ogr.wkbPoint; + case "LINESTRING": + return ogr.wkbLineString; + case "POLYGON": + return ogr.wkbPolygon; + default: + return ogr.wkbUnknown; + } + } + + /** + * 璇诲彇鏁版嵁 + */ + public static <T> List<T> readData(Class clazz, String filePath) { + List<T> list = new ArrayList<>(); + + Driver driver = null; + DataSource dataSource = null; + try { + driver = ogr.GetDriverByName("ESRI shapefile"); + if (null == driver) { + return list; + } + + dataSource = driver.Open(filePath); + if (null == dataSource) { + return list; + } + + Layer layer = dataSource.GetLayer(0); + GdbHelper.readLayer(clazz, layer, list); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + GdbHelper.delete(dataSource, driver); + } + + return list; + } +} diff --git a/src/main/java/com/moon/server/helper/SpringContextHelper.java b/src/main/java/com/moon/server/helper/SpringContextHelper.java new file mode 100644 index 0000000..c988023 --- /dev/null +++ b/src/main/java/com/moon/server/helper/SpringContextHelper.java @@ -0,0 +1,86 @@ +package com.moon.server.helper; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * Spring涓婁笅鏂囧府鍔╃被 + * @author WWW + */ +@Component +public class SpringContextHelper implements ApplicationContextAware { + private static ApplicationContext context = null; + + /** + * 璁剧疆搴旂敤绋嬪簭涓婁笅鏂� + * + * @param applicationContext + * @throws BeansException + */ + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + context = applicationContext; + } + + /** + * 鏍规嵁鍚嶇О鑾峰彇Bean + * + * @param name 绫诲悕绉� + * @return + */ + public static <T> T getBean(String name) { + return (T) context.getBean(name); + } + + /** + * 鏍规嵁绫诲瀷鑾峰彇Bean + * + * @param clazz 绫� + * @param <T> 娉涘瀷 + * @return + */ + public static <T> T getBean(Class<T> clazz) { + return context.getBean(clazz); + } + + /** + * 鍒ゆ柇鏄惁鍖呭惈瀵瑰簲鍚嶇О鐨凚ean瀵硅薄 + * + * @param name Bean鍚嶇О + * @return 鍖呭惈锛氳繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse銆� + */ + public static boolean containsBean(String name) { + return context.containsBean(name); + } + + /** + * 鑾峰彇瀵瑰簲Bean鍚嶇О鐨勭被鍨� + * + * @param name Bean鍚嶇О + * @return 杩斿洖瀵瑰簲鐨凚ean绫诲瀷 + */ + public static Class<?> getType(String name) { + return context.getType(name); + } + + /** + * 鑾峰彇涓婁笅鏂囧璞★紝鍙繘琛屽悇绉峉pring鐨勪笂涓嬫枃鎿嶄綔 + * + * @return Spring涓婁笅鏂囧璞� + */ + public static ApplicationContext getContext() { + return context; + } + + + /** + * 鑾峰彇褰撳墠鐜 + * + * @return Profile + */ + public static String getActiveProfile() { + return context.getEnvironment().getActiveProfiles()[0]; + } +} diff --git a/src/main/java/com/moon/server/helper/StringHelper.java b/src/main/java/com/moon/server/helper/StringHelper.java new file mode 100644 index 0000000..e2a4fff --- /dev/null +++ b/src/main/java/com/moon/server/helper/StringHelper.java @@ -0,0 +1,229 @@ +package com.moon.server.helper; + +import com.moon.server.entity.all.StaticData; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 瀛楃涓插府鍔╃被 + * @author WWW + */ +public class StringHelper { + /** + * 鏁板瓧姝e垯 + */ + public static final Pattern NUMBER_PATTERN = Pattern.compile("-?\\d+(\\.\\d+)?"); + + /** + * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 1 + */ + public static final SimpleDateFormat YMD_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); + + /** + * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 2 + */ + public static final SimpleDateFormat YMDHMS_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + /** + * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 3 + */ + public static final SimpleDateFormat YMD2_FORMAT = new SimpleDateFormat("yyyyMMdd"); + + /** + * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 4 + */ + public static final SimpleDateFormat YMDHMS2_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss"); + + /** + * 鍒ゆ柇瀛楃涓�,鏄惁涓烘暣鏁� + */ + public static boolean isInteger(String str) { + return str != null && str.matches("[0-9]+"); + } + + /** + * 鍒ゆ柇瀛楃涓�,鏄惁涓烘诞鐐规暟 + */ + public static boolean isNumeric(String str) { + return str != null && str.matches("-?\\d+(\\.\\d+)?"); + } + + /** + * 鍒ゆ柇瀛楃涓�,鏄惁涓烘诞鐐规暟 + */ + public static boolean isNumeric2(String str) { + return str != null && NUMBER_PATTERN.matcher(str).matches(); + } + + /** + * 鏃ユ湡姝e垯 + */ + public static Pattern datePattern = Pattern.compile("^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/]((((0?[13578])|(1[02]))[\\-\\/]((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/]((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/]((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/]((((0?[13578])|(1[02]))[\\-\\/]((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/]((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/]((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s(((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$"); + + /** + * SQL姝e垯 + */ + public static Pattern sqlPattern = Pattern.compile("|and|exec|execute|insert|select|delete|update|count|drop|\\*|%|chr|mid|master|truncate|char|declare|sitename|net user|xp_cmdshell|;|or|-|\\+|,|like"); + + /** + * 瀛楃涓茶浆涓烘棩鏈� + */ + public static Date parseDate(String str) { + try { + return YMD_FORMAT.parse(str); + } catch (Exception ex) { + return null; + } + } + + /** + * 瀛楃涓茶浆涓烘棩鏈熸椂闂� + */ + public static Date parseTime(String str) { + try { + return YMDHMS_FORMAT.parse(str); + } catch (Exception e) { + return null; + } + } + + /** + * 鍒ゆ柇鍊兼槸鍚︿负鏃ユ湡鏍煎紡 + */ + public static boolean isDate(String strDate) { + Matcher m = datePattern.matcher(strDate); + + return m.matches(); + } + + /** + * 瀛楃涓诧紝鏄惁涓簄ull 鎴� "" + */ + public static boolean isNull(String str) { + return null == str || str.length() == 0; + } + + /** + * 瀛楃涓�,鏄惁涓虹┖null鍜岀┖鏍� + */ + public static boolean isEmpty(String str) { + return null == str || "".equals(str.trim()); + } + + /** + * 鑾峰彇 like 瀛楃涓� + */ + public static String getLikeStr(String str) { + return StringHelper.isEmpty(str) ? null : "%" + str.trim() + "%"; + } + + /** + * 鑾峰彇 like 瀛楃涓� + */ + public static String getLikeUpperStr(String str) { + return StringHelper.isEmpty(str) ? null : "%" + str.trim().toUpperCase() + "%"; + } + + /** + * 鑾峰彇 鍙砽ike 瀛楃涓� + */ + public static String getRightLike(String str) { + return StringHelper.isEmpty(str) ? null : str.trim() + "%"; + } + + /** + * 鑾峰彇鍥惧舰鐨刉KT瀛楃涓� + * + * @param wkt + * @return + */ + public static String getGeomWkt(String wkt) { + if (StringHelper.isEmpty(wkt)) { + return "null"; + } + + return String.format("ST_GeomFromText('%s')", wkt); + } + + /** + * 棣栧瓧姣嶅ぇ鍐� + */ + public static String firstCharToUpperCase(String str) { + return str.substring(0, 1).toUpperCase() + str.substring(1); + } + + /** + * 棣栧瓧姣嶅皬鍐� + */ + public static String firstCharToLowerCase(String str) { + return str.substring(0, 1).toLowerCase() + str.substring(1); + } + + /** + * 鍒ゆ柇鍊兼槸鍚﹀瓨鍦⊿QL娉ㄥ叆 + * + * @param str 瀛楃涓� + * @return 鏄�/鍚� + */ + public static boolean isSqlInjection(String str) { + if (null == str) { + return false; + } + + Matcher m = sqlPattern.matcher(str); + + return m.matches(); + } + + /** + * 鏍¢獙瀵嗙爜鏄�/鍚﹀悎娉� + * + * @param pwd 瀵嗙爜 + * @return 鏄�/鍚︿负鏃犳晥鐨� + */ + public static boolean isPwdInvalid(String pwd) { + return !Pattern.matches(StaticData.PWD_REG, pwd); + } + + /** + * 鑾峰彇GUID + * + * @return + */ + public static String getGuid() { + return UUID.randomUUID().toString(); + } + + /** + * 杩炴帴List闆嗗悎 + * + * @param list list 鏁存暟闆嗗悎 + * @param join join 杩炴帴瀛楃 + * @param <T> 娉涘瀷绫� + * @return 瀛楃涓� + */ + public static <T> String join(List<T> list, String join) { + if (null == list || list.isEmpty()) { + return ""; + } + + StringBuilder sb = new StringBuilder(); + for (T t : list) { + if (null != t) { + sb.append(t.toString() + join); + } + } + + if (sb.length() > 0 && sb.lastIndexOf(join) == sb.length() - join.length()) { + // 鍒犻櫎浠庣储寮� start 寮�濮嬪埌 end 涔嬮棿鐨勫瓧绗︼紝鍗� 鍓嶅寘鎷� 鍚庝笉鍖呮嫭銆� + sb.delete(sb.length() - join.length(), sb.length()); + } + + return sb.toString(); + } +} diff --git a/src/main/java/com/moon/server/helper/WebHelper.java b/src/main/java/com/moon/server/helper/WebHelper.java new file mode 100644 index 0000000..e9f25d1 --- /dev/null +++ b/src/main/java/com/moon/server/helper/WebHelper.java @@ -0,0 +1,404 @@ +package com.moon.server.helper; + +import com.alibaba.fastjson.JSON; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.SettingData; +import com.moon.server.entity.all.StaticData; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.ServletContext; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.FileInputStream; +import java.io.PrintWriter; +import java.net.URLEncoder; +import java.sql.Timestamp; +import java.util.*; + +/** + * Web甯姪绫� + * @author WWW + */ +public class WebHelper { + private final static String UNKNOWN = "unknown"; + + private final static String COMMA = ","; + + private final static Log log = LogFactory.getLog(WebHelper.class); + + /** + * 鑾峰彇GUID + */ + public static String getGuid() { + return UUID.randomUUID().toString(); + } + + /** + * 鑾峰彇鐢ㄦ埛ip + */ + public static String getIpAddress(HttpServletRequest request) { + String ip = request.getHeader("X-Forwarded-For"); + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_CLUSTER_CLIENT_IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_CLIENT_IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_FORWARDED_FOR"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_FORWARDED"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_VIA"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("REMOTE_ADDR"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + if (ip.contains(COMMA)) { + return ip.split(",")[0]; + } + + return ip; + } + + /** + * 鑾峰彇褰撳墠鏃堕棿鐨凾imestamp + */ + public static Timestamp getCurrentTimestamp() { + return new Timestamp(System.currentTimeMillis()); + } + + /** + * 鑾峰彇褰撳墠鏃堕棿鎸囧畾鍒嗛挓鏁板悗鐨凾imestamp + */ + public static Timestamp getTimestamp(int min) { + Calendar now = Calendar.getInstance(); + now.add(Calendar.MINUTE, min); + + return new Timestamp(now.getTimeInMillis()); + } + + /** + * 浠嶤ookie涓幏鍙杢oken + */ + public static String getTokenFromCookie(HttpServletRequest request) { + Cookie[] cookies = request.getCookies(); + if (cookies == null || cookies.length == 0) { + return null; + } + + for (Cookie cookie : cookies) { + switch (cookie.getName()) { + case StaticData.TOKEN_COOKIE_KEY: + return cookie.getValue(); + default: + break; + } + } + + return null; + } + + /** + * 鍚慍ookie涓坊鍔爐oken + */ + public static void saveToken2Cookie(String token, HttpServletRequest request, HttpServletResponse response) { + // 鍏堝垹闄� + deleteCookies(request, response); + + // 鍐嶄繚瀛� + saveCookie(StaticData.TOKEN_COOKIE_KEY, token, response); + } + + /** + * 淇濆瓨Cookie + */ + public static void saveCookie(String key, String value, HttpServletResponse response) { + Cookie cookie = new Cookie(key, value); + // 璁剧疆cookie澶辨晥鏃堕棿锛屽崟浣嶄负绉� + cookie.setMaxAge(SettingData.COOKIE_MAX_AGE); + cookie.setHttpOnly(false); + cookie.setPath("/"); + //cookie.setDomain("*") + + response.setHeader("P3P", "CP=CAO PSA OUR"); + response.addCookie(cookie); + } + + /** + * 鍒犻櫎cookie涓殑鍊� + */ + public static void deleteCookie(String cookieKey, HttpServletRequest request, HttpServletResponse response) { + Cookie[] cookies = request.getCookies(); + if (cookies != null && cookies.length > 0) { + for (Cookie c : cookies) { + if (cookieKey.equalsIgnoreCase(c.getName())) { + c.setMaxAge(0); + c.setPath("/"); + response.addCookie(c); + } + } + } + } + + /** + * 鍒犻櫎鎵�鏈塁ookie + */ + public static void deleteCookies(HttpServletRequest request, HttpServletResponse response) { + Cookie[] cookies = request.getCookies(); + if (cookies != null && cookies.length > 0) { + for (Cookie c : cookies) { + c.setMaxAge(0); + c.setPath("/"); + response.addCookie(c); + } + } + } + + /** + * 鏍规嵁閿幏鍙朇ookie鍊� + */ + public static String getCookieByKey(String key, HttpServletRequest request) { + Cookie[] cookies = request.getCookies(); + if (cookies == null || cookies.length == 0) { + return null; + } + + for (Cookie c : cookies) { + if (key.equals(c.getName())) { + return c.getValue(); + } + } + + return null; + } + + /** + * 鑾峰彇Token + */ + public static String getToken(HttpServletRequest request) { + // 1.浠巙rl鍙傛暟涓紝鑾峰彇token + String token = request.getParameter(StaticData.TOKEN_KEY); + + // 2.涓虹┖锛屽垯浠巋eader閲岃幏鍙� + if (token == null) { + token = request.getHeader(StaticData.TOKEN_KEY); + } + + // 3.杩樹负绌猴紝鍒欎粠cookie閲岃幏鍙� + if (token == null) { + token = getTokenFromCookie(request); + } + + return token; + } + + /** + * 鑾峰彇Request + */ + public static HttpServletRequest getRequest() { + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + + return servletRequestAttributes.getRequest(); + } + + /** + * 鑾峰彇Response + */ + public static HttpServletResponse getResponse() { + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + + return servletRequestAttributes.getResponse(); + } + + /** + * 鑾峰彇Session + */ + public static HttpSession getSession() { + return getRequest().getSession(); + } + + /** + * 鑾峰彇鐪熷疄璺緞 + */ + public static String getRealPath(String path) { + HttpServletRequest req = getRequest(); + ServletContext ctx = req.getSession().getServletContext(); + + return ctx.getRealPath("/" + path); + } + + /** + * 杈撳嚭str鑷冲墠绔� + */ + public static boolean writeStr2Page(HttpServletResponse res, String str) { + try { + res.setContentType("application/json;charset=UTF-8"); + res.setHeader("Cache-Control", "no-cache"); + res.setHeader("Pragma", "No-cache"); + res.setDateHeader("Expires", 0); + + PrintWriter out = res.getWriter(); + out.print(str); + + out.flush(); + out.close(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + + return false; + } + + /** + * 杈撳嚭json鑷冲墠绔� + */ + public static void writeJson2Page(HttpServletResponse res, String str) { + String json = JSON.toJSONString(new ResponseMsg<>(HttpStatus.ERROR, str)); + writeStr2Page(res, json); + } + + /** + * 鑾峰彇閿欒JSON + */ + public static String getErrJson(HttpStatus status, String msg) { + return JSON.toJSONString(new ResponseMsg<String>(status, msg)); + } + + /** + * 鍐欏搷搴斾俊鎭� + */ + public static void writeInfo(HttpStatus status, String info, HttpServletResponse res) { + WebHelper.writeStr2Page(res, WebHelper.getErrJson(status, info)); + } + + /** + * 鑾峰彇闅忔満鏁存暟 + */ + public static int getRandomInt(int min, int max) { + return new Random().nextInt(max) % (max - min + 1) + min; + } + + /** + * 涓嬭浇鏂囦欢 + */ + public static void download(String file, String fileName, HttpServletResponse res) throws Exception { + download(file, fileName, false, res); + } + + /** + * 涓嬭浇鏂囦欢 + * + * @param file 鏂囦欢 + * @param fileName 鏂囦欢鍚� + * @param res 鍝嶅簲 + * @throws Exception 寮傚父 + */ + public static void download(String file, String fileName, boolean inline, HttpServletResponse res) throws Exception { + if (StringHelper.isEmpty(fileName)) { + fileName = StringHelper.YMDHMS2_FORMAT.format(new Date()); + } + fileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20"); + String dispose = inline ? "inline" : "attachment"; + + // 璁剧疆鍝嶅簲澶翠腑鏂囦欢鐨勪笅杞芥柟寮忎负闄勪欢鏂瑰紡锛屼互鍙婅缃枃浠跺悕 + res.setHeader("Content-Disposition", dispose + "; filename*=UTF-8''" + fileName); + // 璁剧疆鍝嶅簲澶寸殑缂栫爜鏍煎紡涓� UTF-8 + res.setCharacterEncoding("UTF-8"); + + // 閫氳繃response瀵硅薄璁剧疆鍝嶅簲鏁版嵁鏍煎紡(濡傦細"text/plain; charset=utf-8") + String ext = FileHelper.getExtension(file); + String mime = FileHelper.getMime(ext); + res.setContentType(mime); + + // 閫氳繃response瀵硅薄锛岃幏鍙栧埌杈撳嚭娴� + ServletOutputStream outputStream = res.getOutputStream(); + // 瀹氫箟杈撳叆娴侊紝閫氳繃杈撳叆娴佽鍙栨枃浠跺唴瀹� + FileInputStream fileInputStream = new FileInputStream(file); + + int len = 0; + byte[] bytes = new byte[1024]; + while ((len = fileInputStream.read(bytes)) != -1) { + // 閫氳繃杈撳叆娴佽鍙栨枃浠舵暟鎹紝鐒跺悗閫氳繃涓婅堪鐨勮緭鍑烘祦鍐欏洖娴忚鍣� + outputStream.write(bytes, 0, len); + outputStream.flush(); + } + + // 鍏抽棴璧勬簮 + fileInputStream.close(); + outputStream.close(); + } + + /** + * 鎵ц鍛戒护 + * + * @param cmd 鍛戒护 + */ + public static void exec(String cmd) { + try { + Runtime.getRuntime().exec(cmd); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 鑾峰彇璇锋眰鐨勫弬鏁板�� + * + * @param req 璇锋眰 + * @param key 鍙傛暟鍚� + * @return 鍙傛暟鍊� + */ + public static String getReqParamVal(HttpServletRequest req, String key) { + Map<String, String[]> maps = req.getParameterMap(); + for (Map.Entry<String, String[]> entry : maps.entrySet()) { + if (entry.getKey().equalsIgnoreCase(key)) { + return null == entry.getValue() || 0 == entry.getValue().length ? null : entry.getValue()[0]; + } + } + + return null; + } + + /** + * 鑾峰彇璇锋眰鐨勫弬鏁板�� + * + * @param req 璇锋眰 + * @param key 鍙傛暟鍚� + * @return 鍙傛暟鍊� + */ + public static String[] getReqParamVals(HttpServletRequest req, String key) { + Map<String, String[]> maps = req.getParameterMap(); + for (Map.Entry<String, String[]> entry : maps.entrySet()) { + if (entry.getKey().equalsIgnoreCase(key)) { + return entry.getValue(); + } + } + + return null; + } +} diff --git a/src/main/java/com/moon/server/helper/WordHelper.java b/src/main/java/com/moon/server/helper/WordHelper.java new file mode 100644 index 0000000..fc1d69a --- /dev/null +++ b/src/main/java/com/moon/server/helper/WordHelper.java @@ -0,0 +1,346 @@ +package com.moon.server.helper; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.poi.xwpf.usermodel.*; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; + +import java.io.*; +import java.util.List; +import java.util.Map; + +/** + * Word甯姪绫� + * @author WWW + */ +public class WordHelper { + private final static Log log = LogFactory.getLog(WordHelper.class); + + /** + * 閫氳繃word妯℃澘鐢熸垚word鐨勪富鏂规硶 + */ + public static void generateWord(String inputFile, String outPutFile, Map<String, String> insertTextMap, List<String[]> addList) { + FileInputStream inputStream = null; + FileOutputStream outputStream = null; + + try { + inputStream = new FileInputStream(inputFile); + outputStream = new FileOutputStream(outPutFile); + + // 鑾峰彇docx瑙f瀽瀵硅薄 + XWPFDocument xwpfDocument = new XWPFDocument(inputStream); + + // 澶勭悊鎵�鏈夋枃娈垫暟鎹紝闄や簡琛ㄦ牸 + if (null != insertTextMap && insertTextMap.size() > 0) { + handleParagraphs(xwpfDocument, insertTextMap); + } + + // 澶勭悊琛ㄦ牸鏁版嵁 + handleTable(xwpfDocument, insertTextMap, addList); + + // 鍐欏叆鏁版嵁 + xwpfDocument.write(outputStream); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + try { + if (outputStream != null) { + outputStream.close(); + } + if (inputStream != null) { + inputStream.close(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + } + + /** + * 澶勭悊鎵�鏈夋枃娈垫暟鎹紝闄や簡琛ㄦ牸 + */ + public static void handleParagraphs(XWPFDocument xwpfDocument, Map<String, String> insertTextMap) { + for (XWPFParagraph paragraph : xwpfDocument.getParagraphs()) { + String text = paragraph.getText(); + if (isReplacement(text)) { + for (XWPFRun run : paragraph.getRuns()) { + // 鍒ゆ柇甯︽湁 ${} 鐨剅un + run.setText(matchesValue(run.text(), insertTextMap), 0); + } + } + } + } + + /** + * 澶勭悊琛ㄦ牸鏁版嵁鏂规硶 + */ + public static void handleTable(XWPFDocument xwpfDocument, Map<String, String> map, List<String[]> addList) { + List<XWPFTable> tables = xwpfDocument.getTables(); + for (XWPFTable table : tables) { + List<XWPFTableRow> rows = table.getRows(); + if (rows.size() < 2) { + continue; + } + + if (isReplacement(table.getText())) { + if (null == map || map.isEmpty()) { + continue; + } + + replaceData(rows, map); + } else { + insertData(table, addList); + } + } + } + + /** + * 鏇挎崲鏁版嵁 + */ + private static void replaceData(List<XWPFTableRow> rows, Map<String, String> map) { + for (XWPFTableRow row : rows) { + List<XWPFTableCell> tableCells = row.getTableCells(); + for (XWPFTableCell tableCell : tableCells) { + if (isReplacement(tableCell.getText())) { + List<XWPFParagraph> paragraphs = tableCell.getParagraphs(); + for (XWPFParagraph paragraph : paragraphs) { + List<XWPFRun> runs = paragraph.getRuns(); + for (XWPFRun run : runs) { + run.setText(matchesValue(tableCell.getText(), map), 0); + } + } + } + } + } + } + + /** + * 鎻掑叆鏁版嵁 + */ + private static void insertData(XWPFTable table, List<String[]> addList) { + for (int i = 1, c = addList.size(); i < c; i++) { + table.createRow(); + } + + List<XWPFTableCell> oldCells = table.getRow(1).getTableCells(); + List<XWPFTableRow> rowList = table.getRows(); + for (int i = 0, c = addList.size(); i < c; i++) { + XWPFTableRow xwpfTableRow = rowList.get(i + 1); + + List<XWPFTableCell> tableCells = xwpfTableRow.getTableCells(); + for (int j = 0; j < tableCells.size(); j++) { + XWPFTableCell oldCell = oldCells.get(j); + XWPFTableCell newCell = tableCells.get(j); + + if (0 == i) { + // newCell.setText(addList.get(i)[j]) + setCellText(newCell, addList.get(i)[j]); + } else { + setCellText(oldCell, newCell, addList.get(i)[j]); + } + } + } + } + + /** + * 璁剧疆鍗曞厓鏍兼枃鏈� + */ + private static void setCellText(XWPFTableCell cell, String text) { + List<XWPFParagraph> paragraphs = cell.getParagraphs(); + for (XWPFParagraph paragraph : paragraphs) { + List<XWPFRun> runs = paragraph.getRuns(); + for (XWPFRun run : runs) { + run.setText(text, 0); + } + } + } + + /** + * 鏈�${}鐨勫�煎尮閰嶅嚭鏇挎崲鐨勬暟鎹紝娌℃湁${}灏辫繑鍥炲師鏉ョ殑鏁版嵁 + * + * @param wordValue ${...} 甯�${}鐨勫彉閲� + * @param map 瀛樺偍闇�瑕佹浛鎹㈢殑鏁版嵁 + * @return java.lang.String + */ + public static String matchesValue(String wordValue, Map<String, String> map) { + for (String s : map.keySet()) { + String s1 = "${" + s + "}"; + if (s1.equals(wordValue)) { + wordValue = map.get(s); + } + } + + return wordValue; + } + + /** + * 娴嬭瘯鏄惁鍖呭惈闇�瑕佹浛鎹㈢殑鏁版嵁 + */ + public static boolean isReplacement(String text) { + return text.contains("$"); + } + + /** + * 澶嶅埗妯℃澘琛岀殑灞炴�� + */ + private static void setCellText(XWPFTableCell tmpCell, XWPFTableCell cell, String text) { + CTTc cttc2 = tmpCell.getCTTc(); + CTTcPr ctPr2 = cttc2.getTcPr(); + CTTc cttc = cell.getCTTc(); + CTTcPr ctPr = cttc.addNewTcPr(); + if (ctPr2.getTcW() != null) { + ctPr.addNewTcW().setW(ctPr2.getTcW().getW()); + } + if (ctPr2.getVAlign() != null) { + ctPr.addNewVAlign().setVal(ctPr2.getVAlign().getVal()); + } + if (ctPr2.getTcBorders() != null) { + ctPr.setTcBorders(ctPr2.getTcBorders()); + } + + XWPFParagraph tmpP = tmpCell.getParagraphs().get(0); + XWPFParagraph cellP = cell.getParagraphs().get(0); + XWPFRun tmpR = null; + if (tmpP.getRuns() != null && tmpP.getRuns().size() > 0) { + tmpR = tmpP.getRuns().get(0); + } + XWPFRun cellR = cellP.createRun(); + cellR.setText(text); + + // 澶嶅埗瀛椾綋淇℃伅 + copyFontInfo(cellR, tmpR); + + // 澶嶅埗娈佃惤淇℃伅 + cellP.setAlignment(tmpP.getAlignment()); + cellP.setVerticalAlignment(tmpP.getVerticalAlignment()); + cellP.setBorderBetween(tmpP.getBorderBetween()); + cellP.setBorderBottom(tmpP.getBorderBottom()); + cellP.setBorderLeft(tmpP.getBorderLeft()); + cellP.setBorderRight(tmpP.getBorderRight()); + cellP.setBorderTop(tmpP.getBorderTop()); + cellP.setPageBreak(tmpP.isPageBreak()); + + if (tmpP.getCTP() != null&&tmpP.getCTP().getPPr() != null) { + CTPPr tmpPpr = tmpP.getCTP().getPPr(); + CTPPr cellPpr = cellP.getCTP().getPPr() != null ? cellP.getCTP().getPPr() : cellP.getCTP().addNewPPr(); + + // 澶嶅埗娈佃惤闂磋窛淇℃伅 + copySpacing(tmpPpr, cellPpr); + + // 澶嶅埗娈佃惤缂╄繘淇℃伅 + copyParagraph(tmpPpr, cellPpr); + } + } + + /** + * 澶嶅埗瀛椾綋淇℃伅 + */ + private static void copyFontInfo(XWPFRun cellR, XWPFRun tmpR) { + if (tmpR == null) { + return; + } + if (!cellR.isBold()) { + cellR.setBold(tmpR.isBold()); + } + cellR.setItalic(tmpR.isItalic()); + cellR.setUnderline(tmpR.getUnderline()); + cellR.setColor(tmpR.getColor()); + cellR.setTextPosition(tmpR.getTextPosition()); + if (tmpR.getFontSize() != -1) { + cellR.setFontSize(tmpR.getFontSize()); + } + if (tmpR.getFontFamily() != null) { + cellR.setFontFamily(tmpR.getFontFamily()); + } + if (tmpR.getCTR() != null) { + if (tmpR.getCTR().isSetRPr()) { + CTRPr tmpRpr = tmpR.getCTR().getRPr(); + if (tmpRpr.isSetRFonts()) { + CTFonts tmpFonts = tmpRpr.getRFonts(); + CTRPr cellRpr = cellR.getCTR().isSetRPr() ? cellR + .getCTR().getRPr() : cellR.getCTR().addNewRPr(); + CTFonts cellFonts = cellRpr.isSetRFonts() ? cellRpr + .getRFonts() : cellRpr.addNewRFonts(); + cellFonts.setAscii(tmpFonts.getAscii()); + cellFonts.setAsciiTheme(tmpFonts.getAsciiTheme()); + cellFonts.setCs(tmpFonts.getCs()); + cellFonts.setCstheme(tmpFonts.getCstheme()); + cellFonts.setEastAsia(tmpFonts.getEastAsia()); + cellFonts.setEastAsiaTheme(tmpFonts.getEastAsiaTheme()); + cellFonts.setHAnsi(tmpFonts.getHAnsi()); + cellFonts.setHAnsiTheme(tmpFonts.getHAnsiTheme()); + } + } + } + } + + /** + * 澶嶅埗娈佃惤闂磋窛淇℃伅 + */ + private static void copySpacing(CTPPr tmpPpr, CTPPr cellPpr) { + CTSpacing tmpSpacing = tmpPpr.getSpacing(); + if (tmpSpacing != null) { + CTSpacing cellSpacing = cellPpr.getSpacing() != null ? cellPpr.getSpacing() : cellPpr.addNewSpacing(); + if (tmpSpacing.getAfter() != null) { + cellSpacing.setAfter(tmpSpacing.getAfter()); + } + if (tmpSpacing.getAfterAutospacing() != null) { + cellSpacing.setAfterAutospacing(tmpSpacing + .getAfterAutospacing()); + } + if (tmpSpacing.getAfterLines() != null) { + cellSpacing.setAfterLines(tmpSpacing.getAfterLines()); + } + if (tmpSpacing.getBefore() != null) { + cellSpacing.setBefore(tmpSpacing.getBefore()); + } + if (tmpSpacing.getBeforeAutospacing() != null) { + cellSpacing.setBeforeAutospacing(tmpSpacing + .getBeforeAutospacing()); + } + if (tmpSpacing.getBeforeLines() != null) { + cellSpacing.setBeforeLines(tmpSpacing.getBeforeLines()); + } + if (tmpSpacing.getLine() != null) { + cellSpacing.setLine(tmpSpacing.getLine()); + } + if (tmpSpacing.getLineRule() != null) { + cellSpacing.setLineRule(tmpSpacing.getLineRule()); + } + } + } + + /** + * 澶嶅埗娈佃惤缂╄繘淇℃伅 + */ + private static void copyParagraph(CTPPr tmpPpr, CTPPr cellPpr) { + CTInd tmpInd = tmpPpr.getInd(); + if (tmpInd != null) { + CTInd cellInd = cellPpr.getInd() != null ? cellPpr.getInd() : cellPpr.addNewInd(); + if (tmpInd.getFirstLine() != null) { + cellInd.setFirstLine(tmpInd.getFirstLine()); + } + if (tmpInd.getFirstLineChars() != null) { + cellInd.setFirstLineChars(tmpInd.getFirstLineChars()); + } + if (tmpInd.getHanging() != null) { + cellInd.setHanging(tmpInd.getHanging()); + } + if (tmpInd.getHangingChars() != null) { + cellInd.setHangingChars(tmpInd.getHangingChars()); + } + if (tmpInd.getLeft() != null) { + cellInd.setLeft(tmpInd.getLeft()); + } + if (tmpInd.getLeftChars() != null) { + cellInd.setLeftChars(tmpInd.getLeftChars()); + } + if (tmpInd.getRight() != null) { + cellInd.setRight(tmpInd.getRight()); + } + if (tmpInd.getRightChars() != null) { + cellInd.setRightChars(tmpInd.getRightChars()); + } + } + } +} diff --git a/src/main/java/com/moon/server/helper/Zip4jHelper.java b/src/main/java/com/moon/server/helper/Zip4jHelper.java new file mode 100644 index 0000000..a81e7f3 --- /dev/null +++ b/src/main/java/com/moon/server/helper/Zip4jHelper.java @@ -0,0 +1,154 @@ +package com.moon.server.helper; + +import net.lingala.zip4j.ZipFile; +import net.lingala.zip4j.exception.ZipException; +import net.lingala.zip4j.model.ZipParameters; +import net.lingala.zip4j.model.enums.AesKeyStrength; +import net.lingala.zip4j.model.enums.CompressionLevel; +import net.lingala.zip4j.model.enums.CompressionMethod; +import net.lingala.zip4j.model.enums.EncryptionMethod; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.File; +import java.nio.charset.StandardCharsets; + +/** + * Zip4j甯姪绫� + * @author WWW + */ +public class Zip4jHelper { + private final static Log log = LogFactory.getLog(Zip4jHelper.class); + + /** + * Zip鍘嬬缉 + * + * @param zipFile zip鏂囦欢 + * @param sourcePath 婧愯矾寰� + * @param pwd 瀵嗙爜 + * @return 鎴愬姛鏄惁 + */ + public static boolean zip(String zipFile, String sourcePath, String pwd) { + try { + ZipFile zip = StringHelper.isEmpty(pwd) ? new ZipFile(zipFile) : new ZipFile(zipFile, pwd.toCharArray()); + zip.setCharset(StandardCharsets.UTF_8); + + File f = zip.getFile(); + if (!f.getParentFile().exists()) { + f.getParentFile().mkdirs(); + } + if (f.exists()) { + f.delete(); + } + + ZipParameters params = getZipParams(!StringHelper.isEmpty(pwd)); + + // 瑕佹墦鍖呯殑鏂囦欢鎴栨枃浠跺す + File currentFile = new File(sourcePath); + if (currentFile.isDirectory()) { + zip.addFolder(currentFile, params); + } else { + zip.addFile(currentFile, params); + } + + return true; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return false; + } + } + + /** + * 鍒涘缓ZipFile + */ + public static ZipFile createZipFile(String zipFile, String pwd) { + try { + ZipFile zip = StringHelper.isEmpty(pwd) ? new ZipFile(zipFile) : new ZipFile(zipFile, pwd.toCharArray()); + // zip.setCharset(Charset.forName("GBK")) + zip.setCharset(StandardCharsets.UTF_8); + + File f = zip.getFile(); + if (!f.getParentFile().exists()) { + f.getParentFile().mkdirs(); + } + if (f.exists()) { + f.delete(); + } + + return zip; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } + } + + /** + * 鑾峰彇ZipParameters + */ + public static ZipParameters getZipParams(boolean hasPwd) { + // 璁剧疆鍘嬬缉鏂囦欢鍙傛暟 + ZipParameters params = new ZipParameters(); + // 鍘嬬缉鏂瑰紡 + params.setCompressionMethod(CompressionMethod.DEFLATE); + // 鍘嬬缉绾у埆 + params.setCompressionLevel(CompressionLevel.MAXIMUM); + + if (hasPwd) { + // 鏄惁璁剧疆鍔犲瘑鏂囦欢 + params.setEncryptFiles(true); + // 璁剧疆AES鍔犲瘑寮哄害锛欿EY_STRENGTH_256 + params.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_128); + // 璁剧疆鍔犲瘑绠楁硶 + params.setEncryptionMethod(EncryptionMethod.AES); + } + + return params; + } + + /** + * 娣诲姞鏂囦欢鑷冲帇缂╁寘 + * + * @param zip ZipFile + * @param params ZipParameters + * @param file File + * @throws ZipException + */ + private static void addZipFile(ZipFile zip, ZipParameters params, File file) throws ZipException { + if (file.isDirectory()) { + File[] files = file.listFiles(); + for (File f : files) { + addZipFile(zip, params, f); + } + } else { + zip.addFile(file, params); + } + } + + /** + * Zip瑙e帇 + * + * @param zipFile zip鏂囦欢 + * @param toPath 瑙e帇璺緞 + * @param password 瀵嗙爜 + * @return 鎴愬姛鏄�/鍚� + */ + public static boolean unzip(String zipFile, String toPath, String password) { + try { + // 鐢熸垚鐨勫帇缂╂枃浠� + ZipFile zip = new ZipFile(zipFile); + + // 璁剧疆瀵嗙爜 + if (!StringHelper.isEmpty(password)) { + zip.setPassword(password.toCharArray()); + } + + // 瑙e帇缂╂墍鏈夋枃浠朵互鍙婃枃浠跺す + zip.extractAll(toPath); + + return true; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return false; + } + } +} diff --git a/src/main/java/com/moon/server/helper/ZipHelper.java b/src/main/java/com/moon/server/helper/ZipHelper.java new file mode 100644 index 0000000..9a56595 --- /dev/null +++ b/src/main/java/com/moon/server/helper/ZipHelper.java @@ -0,0 +1,149 @@ +package com.moon.server.helper; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.*; +import java.nio.charset.Charset; +import java.util.Enumeration; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; + +/** + * Zip甯姪绫� + * @author WWW + */ +public class ZipHelper { + private final static int BUFFER_SIZE = 1024; + + private final static byte[] BUFFER = new byte[1024]; + + private final static Log log = LogFactory.getLog(ZipHelper.class); + + /** + * Zip瑙e帇 + * + * @param filePath zip鏂囦欢 + * @param zipDir 瑙e帇璺緞 + * @return 鎴愬姛鏄�/鍚� + */ + public static boolean unzip(String filePath, String zipDir) { + ZipFile zipFile = null; + try { + File dir = new File(zipDir); + if (!dir.exists() || !dir.isDirectory()) { + dir.mkdirs(); + } + + int count; + zipFile = new ZipFile(filePath, Charset.forName("GBK")); + Enumeration e = zipFile.entries(); + while (e.hasMoreElements()) { + ZipEntry entry = (ZipEntry) e.nextElement(); + if (entry.isDirectory()) { + File f = new File(zipDir + File.separator + entry.getName()); + if (!f.exists()) { + f.mkdirs(); + } + continue; + } + + BufferedInputStream is = new BufferedInputStream(zipFile.getInputStream(entry)); + FileOutputStream fos = new FileOutputStream(zipDir + File.separator + entry.getName()); + BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE); + while ((count = is.read(BUFFER, 0, BUFFER_SIZE)) != -1) { + dest.write(BUFFER, 0, count); + } + + dest.flush(); + dest.close(); + fos.close(); + is.close(); + } + + return true; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return false; + } finally { + try { + if (null != zipFile) { + zipFile.close(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + } + + /** + * Zip鍘嬬缉 + * + * @param zipFile zip婧愭枃浠� + * @param sourceDir 婧愭枃浠跺す + * @return 鎴愬姛鏄�/鍚� + */ + public static boolean zip(String zipFile, String sourceDir) { + FileOutputStream fos = null; + ZipOutputStream zos = null; + try { + fos = new FileOutputStream(zipFile); + zos = new ZipOutputStream(fos); + + File sourceFile = new File(sourceDir); + compress(sourceFile, zos, sourceFile.getName()); + + return true; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return false; + } finally { + try { + if (null != zos) { + zos.close(); + } + if (null != fos) { + fos.close(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + } + + /** + * Zip鍘嬬缉 + * + * @param sourceFile zip婧愭枃浠� + * @param zos zip杈撳嚭娴� + * @param name zip鏂囦欢鍚嶇О + * @throws Exception + */ + public static void compress(File sourceFile, ZipOutputStream zos, String name) throws Exception { + if (sourceFile.isFile()) { + // 鍚憐ip杈撳嚭娴佷腑娣诲姞涓�涓獄ip瀹炰綋锛屾瀯閫犲櫒涓璶ame涓簔ip瀹炰綋鐨勬枃浠剁殑鍚嶅瓧 + zos.putNextEntry(new ZipEntry(name)); + + // copy鏂囦欢鍒皕ip杈撳嚭娴佷腑 + int len; + FileInputStream in = new FileInputStream(sourceFile); + while ((len = in.read(BUFFER)) != -1) { + zos.write(BUFFER, 0, len); + } + zos.closeEntry(); + in.close(); + } else { + File[] listFiles = sourceFile.listFiles(); + if (listFiles == null || listFiles.length == 0) { + // 绌烘枃浠跺す鐨勫鐞嗭細娌℃湁鏂囦欢锛屼笉闇�瑕佹枃浠剁殑copy + zos.putNextEntry(new ZipEntry(name + "/")); + zos.closeEntry(); + } else { + for (File file : listFiles) { + compress(file, zos, name + "/" + file.getName()); + } + } + } + } +} diff --git a/src/main/java/com/moon/server/interceptor/AuthInterceptor.java b/src/main/java/com/moon/server/interceptor/AuthInterceptor.java new file mode 100644 index 0000000..d583207 --- /dev/null +++ b/src/main/java/com/moon/server/interceptor/AuthInterceptor.java @@ -0,0 +1,184 @@ +package com.moon.server.interceptor; + +import com.alibaba.fastjson.JSON; +import com.moon.server.entity.all.HttpStatus; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.sys.TokenEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.service.all.SysService; +import com.moon.server.entity.all.StaticData; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 韬唤璁よ瘉鎷︽埅鍣� + * @author WWW + */ +@Configuration +public class AuthInterceptor implements HandlerInterceptor { + private final SysService sysService; + + private static final Log log = LogFactory.getLog(AuthInterceptor.class); + + private static final String NO_TOKEN = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.TOKEN_ERROR, "鎵句笉鍒颁护鐗�")); + + private static final String NO_LOGIN = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NO_LOGIN_ERROR, "鐢ㄦ埛鏈櫥褰�")); + + private static final String USER_LOCK = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.USER_LOCK_ERROR, "鐢ㄦ埛ID宸茬鐢�")); + + private static final String NO_AUTH = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NO_AUTH_ERROR, "鏃犳潈闄愯闂�")); + + private static final String IP_NULL = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.UNAUTHORIZED, "IP鍦板潃涓虹┖")); + + private static final String BLACK_LIST = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.UNAUTHORIZED, "璇P鍏ラ粦鍚嶅崟")); + + private static final String ILLEGAL_TOKEN = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.UNAUTHORIZED, "浠ょ墝鏉ユ簮闈炴硶")); + + public AuthInterceptor(SysService sysService) { + this.sysService = sysService; + } + + /** + * Controller鎵ц涔嬪墠鎵ц锛屽鏋滆繑鍥炲�兼槸true鍒欎唬琛ㄦ斁琛岋紝杩斿洖false鍒欐嫤鎴� + */ + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { + // noinspection AlibabaRemoveCommentedCode + try { + // 1.闈炴柟娉� 鎴� 鏃犻渶鎺堟潈锛屾棤闇�鎷︽埅 + if (!(handler instanceof HandlerMethod) || noNeedAuth(request)) { + return true; + } + + // 2.鑾峰彇浠ょ墝 + String token = WebHelper.getToken(request); + if (StringHelper.isNull(token)) { + return WebHelper.writeStr2Page(response, NO_TOKEN); + } + + // 3.鑾峰彇鐢ㄦ埛浠ょ墝 + UserEntity ue = sysService.tokenService.getCurrentUser(request); + if (ue == null) { + return WebHelper.writeStr2Page(response, NO_LOGIN); + } + + // 4.鑾峰彇IP + String ip = WebHelper.getIpAddress(request); + if (StringHelper.isEmpty(ip)) { + return WebHelper.writeStr2Page(response, IP_NULL); + } + + // 5.妫�鏌ラ粦鍚嶅崟 + if (!checkBlackList(ip, request)) { + return WebHelper.writeStr2Page(response, BLACK_LIST); + } + + // 6.admin璺宠繃鏉冮檺妫�娴� + if (StaticData.ADMIN.equals(ue.getUid())) { + return true; + } + + // 7.妫�鏌ョ櫧鍚嶅崟 + if (!checkWhiteList(ip, request)) { + // 妫�鏌P涓�鑷存�� + if (!checkIpSource(ip, token)) { + return WebHelper.writeStr2Page(response, ILLEGAL_TOKEN); + } + } + + // 8.妫�鏌ョ敤鎴稩D鏄惁绂佺敤 + if (sysService.tokenService.isUidDisable(ue)) { + return WebHelper.writeStr2Page(response, USER_LOCK); + } + + // 9.鏉冮檺鏍¢獙 + if (!checkPerms(ue, request)) { + System.out.println("鏃犳潈闄愯闂細" + request.getRequestURI().toLowerCase()); + return WebHelper.writeStr2Page(response, NO_AUTH); + } + + return true; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return false; + } + } + + /** + * 鏃犻渶鎺堟潈 + */ + private static boolean noNeedAuth(HttpServletRequest request) { + String uri = request.getRequestURI().toLowerCase(); + for (String page : StaticData.EXCLUDE_PATH) { + if (uri.contains(page)) { + return true; + } + } + + return false; + } + + /** + * 妫�鏌ユ潈闄� + */ + private boolean checkPerms(UserEntity ue, HttpServletRequest request) { + List<String> list = sysService.permsService.selectPerms(ue.getUid()); + if (list == null || list.size() == 0) { + return false; + } + + String url = request.getRequestURI(); + for (String perm : list) { + if (url.contains(perm)) { + return true; + } + } + + return false; + } + + /** + * 妫�鏌ラ粦鍚嶅崟 + */ + private boolean checkBlackList(String ip, HttpServletRequest request) { + List<String> blackList = sysService.blacklistService.selectIpList(1); + if (blackList == null || blackList.isEmpty()) { + return true; + } + if (blackList.contains(ip)) { + return false; + } + + return true; + } + + /** + * 妫�鏌ョ櫧鍚嶅崟 + */ + private boolean checkWhiteList(String ip, HttpServletRequest request) { + List<String> whiteList = sysService.blacklistService.selectIpList(2); + if (whiteList == null || whiteList.isEmpty()) { + return false; + } + + return whiteList.contains(ip); + } + + /** + * 妫�鏌P涓�鑷存�� + */ + private boolean checkIpSource(String ip, String token) { + TokenEntity te = sysService.tokenService.getEntityByToken(token); + + return te.getIp().equals(ip); + } +} diff --git a/src/main/java/com/moon/server/interceptor/CrosFilter.java b/src/main/java/com/moon/server/interceptor/CrosFilter.java new file mode 100644 index 0000000..6305acd --- /dev/null +++ b/src/main/java/com/moon/server/interceptor/CrosFilter.java @@ -0,0 +1,42 @@ +package com.moon.server.interceptor; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 璺ㄥ煙杩囨护鍣� + * @author WWW + * @date 2022-09-27 + */ +public class CrosFilter implements Filter { + private static final String OPTIONS = "OPTIONS"; + + @Override + public void init(FilterConfig filterConfig) { + // + } + + @Override + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { + HttpServletResponse response = (HttpServletResponse) res; + HttpServletRequest request = (HttpServletRequest) req; + if (OPTIONS.equalsIgnoreCase(request.getMethod())) { + response.setHeader("Access-Control-Allow-Origin", "*"); + response.setHeader("Access-Control-Allow-Credentials", "true"); + response.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS"); + response.setHeader("Access-Control-Max-Age", "3600"); + response.setHeader("Access-Control-Allow-Headers", "*"); + + response.setStatus(HttpServletResponse.SC_OK); + } else { + chain.doFilter(req, res); + } + } + + @Override + public void destroy() { + // + } +} diff --git a/src/main/java/com/moon/server/mapper/all/BaseQueryMapper.java b/src/main/java/com/moon/server/mapper/all/BaseQueryMapper.java new file mode 100644 index 0000000..ceca52e --- /dev/null +++ b/src/main/java/com/moon/server/mapper/all/BaseQueryMapper.java @@ -0,0 +1,111 @@ +package com.moon.server.mapper.all; + +import com.moon.server.entity.ctrl.IdNameEntity; +import com.moon.server.entity.ctrl.KeyValueEntity; +import com.moon.server.entity.ctrl.TabEntity; +import com.moon.server.entity.data.DictEntity; +import com.moon.server.entity.data.DomainEntity; +import com.moon.server.entity.sys.AttachEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鐖舵煡璇apper + * @author WWW + */ +@Mapper +@Repository +public interface BaseQueryMapper { + /** + * 妯$硦鎼滅储鐢ㄦ埛 + * + * @param name 鐢ㄦ埛鍚� + * @return 瀹炰綋绫婚泦鍚� + */ + public List<IdNameEntity> selectUserFuzzy(String name); + + /** + * 妯$硦鎼滅储鍗曚綅 + * + * @param name 鍗曚綅鍚� + * @return 瀹炰綋绫婚泦鍚� + */ + public List<IdNameEntity> selectDepFuzzy(String name); + + /** + * 鏍规嵁琛ㄥ悕鏌ヨ璁板綍鏁� + * + * @param tab 琛ㄥ悕 + * @param field 瀛楁 + * @return + */ + public Integer selectTabsForCount(String tab, String field); + + /** + * 鏍规嵁琛ㄥ悕鍒嗛〉鏌ヨ + * + * @param tab 琛ㄥ悕 + * @param field 瀛楁 + * @param filters 杩囨护鏉′欢 + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return + */ + public List<TabEntity> selectTabsByPage(String tab, String field, String filters, Integer limit, Integer offset); + + /** + * 鏌ヨ瀛楁淇℃伅 + * + * @param ns 鍚嶇О绌洪棿 + * @param tab 琛ㄥ悕 + * @return 瀹炰綋绫婚泦鍚� + */ + public List<DictEntity> selectFields(String ns, String tab); + + /** + * 鏌ヨ鍊煎煙淇℃伅 + * + * @param ns 鍚嶇О绌洪棿 + * @param tab 琛ㄥ悕 + * @return 瀹炰綋绫婚泦鍚� + */ + public List<DomainEntity> selectDomains(String ns, String tab); + + /** + * 鏌ヨ璺綉 + * + * @param x1 X1 + * @param y1 Y1 + * @param x2 X2 + * @param y2 Y2 + * @return 澶氱嚎 + */ + public String selectRoute(double x1, double y1, double x2, double y2); + + /** + * 鏌ヨ浣嶇疆 + * + * @param wkt WKT瀛楃涓� + * @return 浣嶇疆 + */ + public List<KeyValueEntity> selectLocation(String wkt); + + /** + * 鏌ヨ鐩綍绫诲埆 + * + * @param name + * @return + */ + public List<KeyValueEntity> selectDirTypes(String name); + + /** + * 鏍规嵁琛ㄥ悕鏌ヨ闄勪欢 + * + * @param tab 琛ㄥ悕 + * @param gids Gid瀛楃涓� + * @return 闄勪欢 + */ + public List<AttachEntity> selectAnnexByTab(String tab, String gids); +} diff --git a/src/main/java/com/moon/server/mapper/all/BasicMapper.java b/src/main/java/com/moon/server/mapper/all/BasicMapper.java new file mode 100644 index 0000000..a1cd709 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/all/BasicMapper.java @@ -0,0 +1,55 @@ +package com.moon.server.mapper.all; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.moon.server.entity.sys.AttachEntity; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * 鍩虹Mapper + * @author WWW + * @param <T> 娉涘瀷 + */ +public interface BasicMapper<T> extends BaseMapper<T> { + /** + * 妯$硦鎼滅储瀛楁 + * + * @param tab 琛ㄥ悕 + * @param field 瀛楁 + * @param value 鍊� + * @return 缁撴灉鍒楄〃 + */ + @Select("select ${field} from ${tab} where upper(${field}) like #{value} order by ${field} limit 10") + public List<String> selectFieldFuzzy(@Param("tab") String tab, @Param("field") String field, @Param("value") String value); + + /** + * 鑷畾涔夋壒閲忔彃鍏� + * 濡傛灉瑕佽嚜鍔ㄥ~鍏咃紝@Param(xx) xx鍙傛暟鍚嶅繀椤绘槸 list/collection/array 3涓殑鍏朵腑涔嬩竴 + * + * @param list + * @return + */ + public int insertBatch(@Param("list") List<T> list); + + /** + * 鑷畾涔夋壒閲忔洿鏂帮紝鏉′欢涓轰富閿� + * 濡傛灉瑕佽嚜鍔ㄥ~鍏咃紝@Param(xx) xx鍙傛暟鍚嶅繀椤绘槸 list/collection/array 3涓殑鍏朵腑涔嬩竴 + * + * @param list + * @return + */ + public int updateBatch(@Param("list") List<T> list); + + /** + * 鏌ヨ闄勪欢 + * + * @param tab 琛ㄥ悕 + * @param wrapper 鏌ヨ鍖呰鍣� + * @return + */ + @Select("select * from lf.sys_attach where tab = #{tab} and tab_guid in (select eventid from ${tab} ${ew.customSqlSegment})") + public List<AttachEntity> selectAnnex(@Param("tab") String tab, @Param("ew") QueryWrapper wrapper); +} diff --git a/src/main/java/com/moon/server/mapper/all/GeomBaseMapper.java b/src/main/java/com/moon/server/mapper/all/GeomBaseMapper.java new file mode 100644 index 0000000..01d5153 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/all/GeomBaseMapper.java @@ -0,0 +1,70 @@ +package com.moon.server.mapper.all; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +import java.util.List; + +/** + * 绌洪棿鍩虹Mapper + * @author WWW + * @param <T> 娉涘瀷 + */ +public interface GeomBaseMapper<T> extends BasicMapper<T> { + /** + * 鏍规嵁ID鏌ヨWKT + * + * @param tab 琛ㄥ悕 + * @param gid GID + * @return WKT + */ + @Select("select ST_AsText(geom) geom from ${tab} where gid = #{gid} limit 1") + public String selectWktById(@Param("tab") String tab, @Param("gid") Integer gid); + + /** + * 鏍规嵁琛ㄥ悕鏌ヨ绌洪棿鍙傝�� + * + * @param tab 琛ㄥ悕 + * @return SRID + */ + @Select("select ST_SRID(geom) from ${tab} where geom is not null limit 1") + public Integer selectSrid(@Param("tab") String tab); + + /** + * 鏍规嵁琛ㄥ悕鏌ヨ绌洪棿绫诲瀷 + * + * @param tab 琛ㄥ悕 + * @return SRID + */ + @Select("select ST_GeometryType(geom) from ${tab} where geom is not null limit 1") + public String selectGeometryType(@Param("tab") String tab); + + /** + * 鏌ヨDB涓孩鍑虹殑鍗曚綅ID + * + * @param tab 琛ㄥ悕 + * @param depid 鍗曚綅ID + * @param geoFilter 绌洪棿杩囨护鏉′欢 + * @return 婧㈠嚭鐨勫崟浣岻D + */ + @Select("<script>" + + " select depid from ${tab} where depid is not null and depid not like '${depid}%'" + + " <if test='geoFilter != null'>" + + " and ${geoFilter}" + + " </if>" + + " group by depid" + + "</script>") + public List<Integer> selectDbOverflowDep(@Param("tab") String tab, @Param("depid") String depid, @Param("geoFilter") String geoFilter); + + /** + * 鏇存柊绌洪棿浣嶇疆 + * + * @param tab 琛ㄥ悕 + * @param gid GID + * @param wkt WKT + * @return 褰卞搷琛屾暟 + */ + @Update("update ${tab} set geom = ST_GeomFromText('${wkt}') where gid = #{gid} limit 1") + public Integer updateGeom(@Param("tab") String tab, @Param("gid") Integer gid, @Param("wkt") String wkt); +} diff --git a/src/main/java/com/moon/server/mapper/all/PermsMapper.java b/src/main/java/com/moon/server/mapper/all/PermsMapper.java new file mode 100644 index 0000000..2d112f1 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/all/PermsMapper.java @@ -0,0 +1,67 @@ +package com.moon.server.mapper.all; + +import com.moon.server.entity.all.MenusAuthEntity; +import com.moon.server.entity.all.PermsAuthEntity; +import com.moon.server.entity.all.ResAuthEntity; +import com.moon.server.entity.sys.MenuEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鎺堟潈绠$悊 + * @author WWW + */ +@Mapper +@Repository +public interface PermsMapper { + /** + * 鏍规嵁鐢ㄦ埛Uid鏌ヨ璧勬簮鎺堟潈 + * + * @param uid + * @return + */ + public List<ResAuthEntity> selectRes(String uid); + + /** + * 鏍规嵁鐢ㄦ埛Uid鏌ヨ鑿滃崟鎺堟潈 + * + * @param uid + * @return + */ + public List<MenusAuthEntity> selectMenus(String uid); + + /** + * 鏍规嵁鐢ㄦ埛Uid鏌ヨ鏉冮檺鎺堟潈 + * + * @param uid + * @return + */ + public List<String> selectPerms(String uid); + + /** + * 鏍规嵁鐢ㄦ埛Uid鏌ヨ鏉冮檺鎺堟潈瀹炰綋闆嗗悎 + * + * @param uid + * @return + */ + public List<PermsAuthEntity> selectPermsEntity(String uid); + + /** + * 鏍规嵁鐢ㄦ埛Uid鏌ヨ瑙掕壊ID + * + * @param uid + * @return + */ + public List<Integer> selectRoles(String uid); + + /** + * 鏍规嵁鐢ㄦ埛Uid閫掑綊鏌ヨ鑿滃崟闆嗗悎 + * + * @param id + * @param uid + * @return + */ + public List<MenuEntity> selectMenuRecursive(int id, String uid); +} diff --git a/src/main/java/com/moon/server/mapper/data/DictMapper.java b/src/main/java/com/moon/server/mapper/data/DictMapper.java new file mode 100644 index 0000000..9638731 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/DictMapper.java @@ -0,0 +1,101 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.ctrl.TabEntity; +import com.moon.server.entity.data.DictEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 瀛楀吀绠$悊 + * @author WWW + */ +@Mapper +@Repository +public interface DictMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param ns 琛ㄧ┖闂� + * @param tab 琛ㄥ悕 + * @return 璁板綍鏁� + */ + public Integer selectCount(String ns, String tab); + + /** + * 鍒嗛〉鏌ヨ + * + * @param ns 琛ㄧ┖闂� + * @param tab 琛ㄥ悕 + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<DictEntity> selectByPage(String ns, String tab, Integer limit, Integer offset); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public DictEntity selectById(int id); + + /** + * 鏌ヨ瀛楀吀琛ㄧ粨鏋� + * + * @param name + * @param field + * @return + */ + public List<TabEntity> selectDictTab(String name, String field); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(DictEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<DictEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(DictEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<DictEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/data/DirMapper.java b/src/main/java/com/moon/server/mapper/data/DirMapper.java new file mode 100644 index 0000000..b69d475 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/DirMapper.java @@ -0,0 +1,118 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.data.DirEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * Dir + * @author sws + * @date 2022-09-24 + */ + +@Mapper +@Repository +public interface DirMapper { + /** + * 鎻掑叆涓�鏉� + * + * @param dirEntity + * @return + */ + public Integer insert(DirEntity dirEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<DirEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteDir(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteDirs(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param dirEntity + * @return + */ + public Integer update(DirEntity dirEntity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<DirEntity> list); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public DirEntity selectDir(int id); + + /** + * 鏍规嵁Code鏌ヨ鐩綍 + * + * @param code + * @return + */ + public DirEntity selectByCode(String code); + + /** + * 鏌ヨ澶氭潯鏁版嵁 + * + * @return + */ + public List<DirEntity> selectDirAll(); + + /** + * 鏌ヨ鏍圭洰褰� + * + * @return + */ + public List<DirEntity> selectDirRoot(); + + /** + * 鏌ヨ椤圭洰 + * + * @param name + * @return + */ + public List<DirEntity> selectProject(String name); + + /** + * 閫掑綊鏌ヨ + * + * @param id + * @return + */ + public List<DirEntity> selectRecursiveById(Integer id); + + /** + * 鏌ヨ椤圭洰鐩綍鏍� + * + * @return + */ + public List<DirEntity> selectDirsForPrj(); +} diff --git a/src/main/java/com/moon/server/mapper/data/DomainMapper.java b/src/main/java/com/moon/server/mapper/data/DomainMapper.java new file mode 100644 index 0000000..0580a85 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/DomainMapper.java @@ -0,0 +1,109 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.data.DomainEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鍊煎煙 + * @author WWW + */ +@Mapper +@Repository +public interface DomainMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param ns 鍚嶇О绌洪棿 + * @param tab 琛ㄥ悕 + * @param name 鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectCount(String ns, String tab, String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param ns 鍚嶇О绌洪棿 + * @param tab 琛ㄥ悕 + * @param name 鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<DomainEntity> selectByPage(String ns, String tab, String name, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<DomainEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public DomainEntity selectById(int id); + + /** + * 鏍规嵁琛ㄥ悕鏌ヨ鍊煎煙鍚嶇О + * + * @param ns 鍚嶇О绌洪棿 + * @param tab 琛ㄥ悕 + * @return 鍊煎煙鍚嶇О闆嗗悎 + */ + public List<String> selectDomainNames(String ns, String tab); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(DomainEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<DomainEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(DomainEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<DomainEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/data/DownloadMapper.java b/src/main/java/com/moon/server/mapper/data/DownloadMapper.java new file mode 100644 index 0000000..bdcdd3b --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/DownloadMapper.java @@ -0,0 +1,126 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.data.DownloadEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 涓嬭浇璁板綍 + * @author WWW + */ +@Mapper +@Repository +public interface DownloadMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name 鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectCount(String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name 鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<DownloadEntity> selectByPage(String name, Integer limit, Integer offset); + + /** + * 鏍规嵁鐢ㄦ埛ID鏌ヨ璁板綍鏁帮紙鍦ㄧ嚎鍒跺浘锛� + * + * @param createUser 鐢ㄦ埛ID + * @param types 绫诲埆 + * @param name 鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectCountForUser(Integer createUser, String types, String name); + + /** + * 鏍规嵁鐢ㄦ埛ID鍒嗛〉鏌ヨ锛堝湪绾垮埗鍥撅級 + * + * @param createUser 鐢ㄦ埛ID + * @param types 绫诲埆 + * @param name 鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<DownloadEntity> selectByPageForUser(Integer createUser, String types, String name, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<DownloadEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public DownloadEntity selectById(int id); + + /** + * 鏍规嵁Guid鏌ヨ + * + * @param guid + * @return + */ + public DownloadEntity selectByGuid(String guid); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(DownloadEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<DownloadEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(DownloadEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<DownloadEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/data/LayerMapper.java b/src/main/java/com/moon/server/mapper/data/LayerMapper.java new file mode 100644 index 0000000..35aac9d --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/LayerMapper.java @@ -0,0 +1,96 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.data.LayerEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鍥惧眰 + * @author WWW + */ +@Mapper +@Repository +public interface LayerMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param cnName 涓枃鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectCount(String cnName); + + /** + * 鍒嗛〉鏌ヨ + * + * @param cnName 涓枃鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<LayerEntity> selectByPage(String cnName, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<LayerEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public LayerEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(LayerEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<LayerEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(LayerEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<LayerEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/data/MetaMapper.java b/src/main/java/com/moon/server/mapper/data/MetaMapper.java new file mode 100644 index 0000000..a38c393 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/MetaMapper.java @@ -0,0 +1,204 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.data.MetaEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鍏冩暟鎹� + * @author WWW + */ +@Mapper +@Repository +public interface MetaMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param depcode 鍗曚綅缂栫爜 + * @param dircode 鐩綍缂栫爜 + * @param verid 鐗堟湰ID + * @param name 鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectCount(String depcode, String dircode, Integer verid, String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param depcode 鍗曚綅缂栫爜 + * @param dircode 鐩綍缂栫爜 + * @param verid 鐗堟湰ID + * @param name 鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<MetaEntity> selectByPage(String depcode, String dircode, Integer verid, String name, Integer limit, Integer offset); + + /** + * 鏌ヨ璁板綍鏁� + * + * @param depcode + * @param dirs + * @param name + * @return + */ + public Integer selectMetasForCount(String depcode, String dirs, String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param depcode + * @param dirs + * @param name + * @param limit + * @param offset + * @return + */ + public List<MetaEntity> selectMetasForPage(String depcode, String dirs, String name, Integer limit, Integer offset); + + /** + * 鏌ヨ涓婁紶璁板綍鏁� + * + * @param name 鍚嶇О + * @param createUser 鐢ㄦ埛ID + * @param types 鏂囦欢绫诲瀷 + * @return 璁板綍鏁� + */ + public Integer selectCountForUpload(String name, Integer createUser, String types); + + /** + * 鍒嗛〉鏌ヨ涓婁紶璁板綍 + * + * @param name 鍚嶇О + * @param createUser 鐢ㄦ埛ID + * @param types 鏂囦欢绫诲瀷 + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<MetaEntity> selectByPageForUpload(String name, Integer createUser, String types, Integer limit, Integer offset); + + /** + * 鏍规嵁鐖禝D鏌ヨ璁板綍鏁� + * + * @param metaid + * @param name + * @return + */ + public Integer selectCountByPid(Integer metaid, String name); + + /** + * 鏍规嵁鐖禝D鍒嗛〉鏌ヨ + * + * @param metaid + * @param name + * @param limit + * @param offset + * @return + */ + public List<MetaEntity> selectPageByPid(Integer metaid, String name, Integer limit, Integer offset); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public MetaEntity selectById(int id); + + /** + * 鏍规嵁GUID鏌ヨ + * + * @param guid 鏂囦欢GUID + * @param dircode 鐩綍缂栫爜 + * @param tab 琛ㄥ悕 + * @return + */ + public MetaEntity selectByGuid(String guid, String dircode, String tab); + + /** + * 鏍规嵁澶氫釜ID鏌ヨ鍏冩暟鎹紙鏁版嵁琛級 + * + * @param ids + * @return + */ + public List<MetaEntity> selectByIdsForTab(String ids); + + /** + * 鏌ヨ鍏冩暟鎹枃浠� + * + * @param ids 鍏冩暟鎹甀D闆嗗悎 + * @return 鍏冩暟鎹枃浠堕泦鍚� + */ + public List<MetaEntity> selectMetaFiles(List<Integer> ids); + + /** + * 鏌ヨExcel鍏冩暟鎹� + * + * @param ids 鍏冩暟鎹甀D闆嗗悎 + * @param tabs 琛ㄥ悕瀛楃涓� + * @return 鍏冩暟鎹枃浠堕泦鍚� + */ + public List<MetaEntity> selectXlsAnnex(Integer[] ids, String tabs); + + /** + * 鏍规嵁鐩綍缂栫爜鏌ヨ鍏冩暟鎹枃浠� + * + * @param dircode + * @return + */ + public List<MetaEntity> selectMetasByDirCode(String dircode); + + /** + * 鏌ヨ鍏冩暟鎹腑婧㈠嚭鐨勫崟浣岻D + * + * @param ids + * @param depcode + * @return + */ + public List<String> selectMetaOverflowDep(String ids, String depcode); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(MetaEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<MetaEntity> list); + + /** + * 鍒犻櫎澶氭潯 + * + * @param sql + * @param ids + * @return + */ + public Integer deletes(String sql, String ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(MetaEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<MetaEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/data/PublishMapper.java b/src/main/java/com/moon/server/mapper/data/PublishMapper.java new file mode 100644 index 0000000..0499a8e --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/PublishMapper.java @@ -0,0 +1,141 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.data.PublishEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鏁版嵁鍙戝竷 + * @author WWW + */ +@Mapper +@Repository +public interface PublishMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name 鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectCount(String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name 鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<PublishEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public PublishEntity selectById(int id); + + /** + * 鏍规嵁ID瀛楃涓叉煡璇� + * + * @param ids ID瀛楃涓� + * @return 璁板綍闆嗗悎 + */ + public List<PublishEntity> selectByIds(String ids); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(PublishEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<PublishEntity> list); + + /** + * 鎻掑叆鏁版嵁鍙戝竷-涓嬭浇琛� + * + * @param pubid + * @param downid + * @param createUser + * @return + */ + public Integer insertPubDown(Integer pubid, Integer downid, Integer createUser); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(String ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(PublishEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<PublishEntity> list); + + /** + * 鏌ヨ鍏冩暟鎹褰曟暟 + * + * @param depcode 鍗曚綅缂栫爜 + * @param dircode 鐩綍缂栫爜 + * @param verid 鐗堟湰ID + * @param types 绫诲埆 + * @param name 鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectMetasByCount(String depcode, String dircode, Integer verid, String types, String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param depcode 鍗曚綅缂栫爜 + * @param dircode 鐩綍缂栫爜 + * @param verid 鐗堟湰ID + * @param types 绫诲埆 + * @param name 鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<MetaEntity> selectMetasByPage(String depcode, String dircode, Integer verid, String types, String name, Integer limit, Integer offset); +} diff --git a/src/main/java/com/moon/server/mapper/data/StyleMapper.java b/src/main/java/com/moon/server/mapper/data/StyleMapper.java new file mode 100644 index 0000000..756d3a9 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/StyleMapper.java @@ -0,0 +1,89 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.data.StyleEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +/** + * 鏍峰紡绠$悊 + * @author sws + * @date 2022-09-26 + */ +@Mapper +@ResponseBody +public interface StyleMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name 鏍峰紡鍚� + * @return 璁板綍鏁� + */ + public Integer selectCount(String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name 鏍峰紡鍚� + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<StyleEntity> selectByPage(String name, Integer limit, Integer offset); + + /** + * 鎻掑叆涓�鏉� + * + * @param styleEntity + * @return + */ + public Integer insertStyle(StyleEntity styleEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertStyles(List<StyleEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteStyle(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteStyles(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param styleEntity + * @return + */ + public Integer updateStyle(StyleEntity styleEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public StyleEntity selectStyle(int id); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<StyleEntity> selectStyleAll(); +} diff --git a/src/main/java/com/moon/server/mapper/data/UploadMapper.java b/src/main/java/com/moon/server/mapper/data/UploadMapper.java new file mode 100644 index 0000000..558b4c0 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/UploadMapper.java @@ -0,0 +1,48 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.data.CoordEntity; +import com.moon.server.entity.data.DirEntity; +import com.moon.server.entity.data.FmeLogEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +/** + * 鏁版嵁涓婁紶 + * @author WWW + */ +@Mapper +@ResponseBody +public interface UploadMapper { + /** + * 鏌ヨ鍧愭爣绯� + * + * @param zoning + * @return + */ + public List<CoordEntity> selectCoords(String zoning); + + /** + * 鏍规嵁EPSG缂栫爜缁熻 + * + * @param epsgCode + * @return + */ + public Integer selectCount4Coord(String epsgCode); + + /** + * 鏌ヨ椤圭洰鍚嶇О + * + * @return + */ + public List<DirEntity> selectProject(); + + /** + * 鏌ヨFME鏃ュ織 + * + * @param parentid + * @return + */ + public List<FmeLogEntity> selectFmeLog(String parentid); +} diff --git a/src/main/java/com/moon/server/mapper/data/VerMapper.java b/src/main/java/com/moon/server/mapper/data/VerMapper.java new file mode 100644 index 0000000..0ae2d7d --- /dev/null +++ b/src/main/java/com/moon/server/mapper/data/VerMapper.java @@ -0,0 +1,99 @@ +package com.moon.server.mapper.data; + +import com.moon.server.entity.data.VerEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +/** + * 鐗堟湰琛� + * @author sws + * @date 2022-09-29 + */ +@Mapper +@ResponseBody +public interface VerMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param dirid 鐩綍ID + * @param name 鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectCount(Integer dirid, String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param dirid 鐩綍ID + * @param name 鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<VerEntity> selectByPage(Integer dirid, String name, Integer limit, Integer offset); + + /** + * 鏍规嵁鐩綍ID鏌ヨ鐗堟湰鍒楄〃 + * + * @param dirid + * @return + */ + public List<VerEntity> selectByDirid(Integer dirid); + + /** + * 鎻掑叆涓�鏉� + * + * @param verEntity + * @return + */ + public Integer insertVersion(VerEntity verEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertVersions(List<VerEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteVersion(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteVersions(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param verEntity + * @return + */ + public Integer updateVersion(VerEntity verEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public VerEntity selectVersion(int id); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<VerEntity> selectVersionAll(); +} diff --git a/src/main/java/com/moon/server/mapper/show/ApplyMapper.java b/src/main/java/com/moon/server/mapper/show/ApplyMapper.java new file mode 100644 index 0000000..fefcc13 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/show/ApplyMapper.java @@ -0,0 +1,168 @@ +package com.moon.server.mapper.show; + +import com.moon.server.entity.show.ApplyEntity; +import com.moon.server.entity.show.FlowEntity; +import com.moon.server.entity.sys.UserEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 鏁版嵁鐢宠 + * @author WWW + */ +@Mapper +@Repository +public interface ApplyMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param uname 鐢ㄦ埛鍚� + * @param status 瀹℃牳鐘舵�� + * @param start 寮�濮嬫椂闂� + * @param end 缁撴潫鏃堕棿 + * @return 璁板綍鏁� + */ + public Integer selectCount(String uname, Integer status, Timestamp start, Timestamp end); + + /** + * 鍒嗛〉鏌ヨ + * + * @param userid 鐢ㄦ埛ID + * @param uname 鐢ㄦ埛鍚� + * @param status 瀹℃牳鐘舵�� + * @param start 寮�濮嬫椂闂� + * @param end 缁撴潫鏃堕棿 + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<ApplyEntity> selectByPage(Integer userid, String uname, Integer status, Timestamp start, Timestamp end, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<ApplyEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public ApplyEntity selectById(int id); + + /** + * 鏍规嵁鍗曚綅缂栫爜鏌ヨ鐢ㄦ埛 + * + * @param depcode 鍗曚綅缂栫爜 + * @return 鐢ㄦ埛 + */ + public UserEntity selectUserByDepcode(String depcode); + + /** + * 鏌ヨ寰呭鏍告暟 + * + * @param userid 鐢ㄦ埛ID + * @return 寰呭鏍告暟 + */ + public Integer selectSubmits(Integer userid); + + /** + * 鏌ヨ娴佺▼ + * + * @param applyid 鏁版嵁鐢宠ID + * @return 鏁版嵁娴佺▼ + */ + public List<FlowEntity> selectFlows(Integer applyid); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(ApplyEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<ApplyEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(ApplyEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<ApplyEntity> list); + + /** + * 搴熷純鐢宠 + * + * @param userid 鐢ㄦ埛ID + * @param id 鏁版嵁鐢宠ID + * @return 琛屾暟 + */ + public Integer updateForDiscard(Integer userid, Integer id); + + /** + * 閲嶆柊鎻愪氦 + * + * @param userid 鐢ㄦ埛ID + * @param id 鏁版嵁鐢宠ID + * @return 琛屾暟 + */ + public Integer updateForResubmit(Integer userid, Integer id); + + /** + * 鎻愪氦娴佺▼ + * + * @param userid 鐢ㄦ埛ID + * @param applyid 鐢宠娴佺▼ID + * @param flowId 鐢宠娴佺▼ID + * @return 琛屾暟 + */ + public Integer updateForSubmit(Integer userid, Integer applyid, Integer flowId); + + /** + * 鎵撳洖娴佺▼ + * + * @param userid 鐢ㄦ埛ID + * @param applyid 鐢宠娴佺▼ID + * @param flowId 鐢宠娴佺▼ID + * @return 琛屾暟 + */ + public Integer updateForReject(Integer userid, Integer applyid, Integer flowId); +} diff --git a/src/main/java/com/moon/server/mapper/show/FlowMapper.java b/src/main/java/com/moon/server/mapper/show/FlowMapper.java new file mode 100644 index 0000000..cd84692 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/show/FlowMapper.java @@ -0,0 +1,96 @@ +package com.moon.server.mapper.show; + +import com.moon.server.entity.show.FlowEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鐢宠娴佺▼ + * @author WWW + */ +@Mapper +@Repository +public interface FlowMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param userid 鐢ㄦ埛ID + * @return 璁板綍鏁� + */ + public Integer selectCount(Integer userid); + + /** + * 鍒嗛〉鏌ヨ + * + * @param userid 鐢ㄦ埛ID + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<FlowEntity> selectByPage(Integer userid, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<FlowEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public FlowEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(FlowEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<FlowEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(FlowEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<FlowEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/show/MarkMapper.java b/src/main/java/com/moon/server/mapper/show/MarkMapper.java new file mode 100644 index 0000000..e7ee489 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/show/MarkMapper.java @@ -0,0 +1,96 @@ +package com.moon.server.mapper.show; + +import com.moon.server.entity.show.MarkEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鏍囩粯 + * @author WWW + */ +@Mapper +@Repository +public interface MarkMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param uid 鐢ㄦ埛ID + * @return 璁板綍鏁� + */ + public Integer selectCount(Integer uid); + + /** + * 鍒嗛〉鏌ヨ + * + * @param uid 鐢ㄦ埛ID + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<MarkEntity> selectByPage(Integer uid, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<MarkEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public MarkEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(MarkEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<MarkEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(MarkEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<MarkEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/show/ModelMapper.java b/src/main/java/com/moon/server/mapper/show/ModelMapper.java new file mode 100644 index 0000000..3ca9730 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/show/ModelMapper.java @@ -0,0 +1,105 @@ +package com.moon.server.mapper.show; + +import com.moon.server.entity.show.ModelEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 妯″瀷 + * @author WWW + */ +@Mapper +@Repository +public interface ModelMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param layerid 鍥惧眰ID + * @return 璁板綍鏁� + */ + public Integer selectCount(Integer layerid); + + /** + * 鍒嗛〉鏌ヨ + * + * @param layerid 鍥惧眰ID + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<ModelEntity> selectByPage(Integer layerid, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<ModelEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public ModelEntity selectById(int id); + + /** + * 鏍规嵁Guid鏌ヨ妯″瀷 + * + * @param layerid + * @param modelid + * @return + */ + public ModelEntity selectModelByGuid(int layerid, String modelid); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(ModelEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<ModelEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(ModelEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<ModelEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/show/OneMapMapper.java b/src/main/java/com/moon/server/mapper/show/OneMapMapper.java new file mode 100644 index 0000000..919058b --- /dev/null +++ b/src/main/java/com/moon/server/mapper/show/OneMapMapper.java @@ -0,0 +1,220 @@ +package com.moon.server.mapper.show; + +import com.moon.server.entity.show.OneMapEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 绠$綉涓�寮犲浘Mapper + * + * @author 閭㈤敠鍙� + */ +@Mapper +@Repository +public interface OneMapMapper { + /** + * 椤圭洰绫诲埆conut + * + * @return {@link List}<{@link String}> + */ + public List<String> projectCategoryCount(); + + /** + * 椤圭洰浣嶇疆conut + * + * @return {@link List}<{@link String}> + */ + public List<String> projectLocationCount(); + + /** + * 鍥藉缁村害conut + * + * @return {@link List}<{@link String}> + */ + public List<String> countryDimensionCount(); + + /** + * 鐪佺淮conut + * + * @return {@link List}<{@link String}> + */ + public List<String> provinceDimensionCount(); + + /** + * 鍏ㄥ浗缁村害-鎸夌収椤硅嚜绫诲瀷缁熻涓嶅悓椤圭洰涓暟 + * + * @return {@link List}<{@link String}> + */ + public List<String> countProjectTypeNumber(); + + /** + * 鏁版嵁瀛樺偍conut + * + * @return {@link List}<{@link String}> + */ + public List<String> dataStorageCount(); + + /** + * 缁熻鏁版嵁绫诲埆 + * + * @return {@link List}<{@link String}> + */ + public List<String> statisticalDataCategories(); + + /** + * 缁熻鏁版嵁鏈嶅姟绫诲瀷 + * + * @return {@link List}<{@link String}> + */ + public List<String> statisticalDataServiceType(); + + /** + * 鐧诲綍浜烘暟缁熻 + * + * @return {@link List}<{@link String}> + */ + public List<String> loginNumberStatistics(); + + /** + * 鏂囦欢鏍煎紡conut + * + * @return {@link List}<{@link String}> + */ + public List<String> fileFormatCount(); + + /** + * 鏁版嵁鐢宠conut + * + * @return {@link List}<{@link String}> + */ + public List<String> dataApplyCount(); + + /** + * 鏁版嵁璁块棶conut + * + * @return {@link List}<{@link String}> + */ + public List<String> dataVisitCount(); + + /** + * 涓嬭浇鏁扮粺璁� + * + * @return {@link List}<{@link String}> + */ + public List<String> countDownloads(); + + /** + * 缁熻椤圭洰鏄剧ず + * + * @return {@link List}<{@link String}> + */ + public List<String> countProjectDisplay(); + + /** + * 閫夋嫨椤圭洰鍙傝鍒楄〃 + * + * @return {@link List}<{@link String}> + */ + public List<String> selectProjectTour(); + + /** + * 缁熻椤圭洰绫诲瀷 + * + * @return {@link List}<{@link String}> + */ + public List<OneMapEntity> selectProjectType1(); + + /** + * 閫夋嫨椤圭洰绫诲瀷 + * + * @param endSql 鏈�缁坰ql + * @return {@link List}<{@link OneMapEntity}> + */ + public List<OneMapEntity> selectProjectTypeOne(@Param("endSql") String endSql); + + /** + * 鏌ヨ琛ㄤ俊鎭� + * + * @param tableName + * @return {@link List}<{@link String}> + */ + public List<String> queryTableInfo(@Param("tableName") String tableName); + + /** + * 璁$畻鍏ㄧ悆绠¢亾鍥� + * + * @return {@link List}<{@link String}> + */ + public List<String> countGlobalPipeMap(); + + /** + * 璁$畻鍏ㄥ浗绠¢亾鍥� + * + * @return {@link List}<{@link String}> + */ + public List<String> countNationalPipeMap(); + + /** + * 鍏ㄥ浗绠$綉鍥捐緭閫佷粙璐ㄩ暱搴� + * + * @return {@link List}<{@link String}> + */ + public List<String> countZhPipeMapLenByMed(); + + /** + * 鍏ㄥ浗绔欏満搴ф暟銆侀榾瀹ゃ�佺閬撴暟绛� + * + * @return {@link List}<{@link String}> + */ + public List<String> countZhPipeStations(); + + /** + * 鎸夐」鐩粺璁¢」鐩瓨鍌ㄩ噺 + * + * @return {@link List}<{@link String}> + */ + public List<String> countStorageByProject(); + + /** + * 閫夋嫨椤圭洰淇℃伅 + * 鏌ヨ椤圭洰淇℃伅 + * + * @param projectCode 椤圭洰缂栫爜 + * @return {@link List}<{@link String}> + */ + public List<String> selectProjectInfo(String projectCode); + + /** + * 閫夋嫨椤圭洰鏂囦欢鍒楄〃 + * + * @return {@link List}<{@link String}> + */ + public List<String> selectProjectFileList(); + + /** + * 璁$畻瀛樺偍椤圭洰 + * + * @param projectCode 椤圭洰浠g爜 + * @return {@link List}<{@link String}> + */ + public List<String> countProjectStorage(String projectCode); + + /** + * 鍗曚釜椤圭洰鏂囦欢鏁伴噺 + * + * @param projectCode 椤圭洰浠g爜 + * @return {@link List}<{@link String}> + */ + public List<String> countProjectType(String projectCode); + + /** + * 缁熻椤圭洰涓� + * + * @param projectCode 椤圭洰浠g爜 + * @return {@link List}<{@link String}> + */ + public List<String> countProjectDown(String projectCode); +} diff --git a/src/main/java/com/moon/server/mapper/show/PipelineMapper.java b/src/main/java/com/moon/server/mapper/show/PipelineMapper.java new file mode 100644 index 0000000..16858e0 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/show/PipelineMapper.java @@ -0,0 +1,39 @@ +package com.moon.server.mapper.show; + +import com.moon.server.entity.show.PipelineEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 绠¢亾鍒嗘瀽鏄犲皠绫� + * @author WWW + */ +@Mapper +@Repository +public interface PipelineMapper { + /** + * 鏌ヨ绠¢亾 + * + * @param name + * @return + */ + public List<PipelineEntity> selectPipelines(String name); + + /** + * 鏌ヨ绠℃ + * + * @return 绠$嚎瀹炰綋绫婚泦鍚� + */ + public List<PipelineEntity> selectSegNames(); + + /** + * 鏌ヨ绠$嚎鍒嗘瀽 + * + * @param tab 琛ㄥ悕 + * @param gid ID + * @return 绠$嚎瀹炰綋绫婚泦鍚� + */ + public List<PipelineEntity> selectPipeAnalysis(String tab, Integer gid); +} diff --git a/src/main/java/com/moon/server/mapper/sys/ArgsMapper.java b/src/main/java/com/moon/server/mapper/sys/ArgsMapper.java new file mode 100644 index 0000000..40c0cd5 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/ArgsMapper.java @@ -0,0 +1,104 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.ArgsEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鍙傛暟璁剧疆 + * @author WWW + */ +@Mapper +@Repository +public interface ArgsMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name 鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectCount(String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name 鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<ArgsEntity> selectByPage(String name, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<ArgsEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public ArgsEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(ArgsEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<ArgsEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(ArgsEntity entity); + + /** + * 鏇存柊鏁板�� + * + * @param entity + * @return + */ + public Integer updateForValue(ArgsEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<ArgsEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/sys/AttachMapper.java b/src/main/java/com/moon/server/mapper/sys/AttachMapper.java new file mode 100644 index 0000000..1d3c843 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/AttachMapper.java @@ -0,0 +1,168 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.data.FmeLogEntity; +import com.moon.server.entity.sys.AttachEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 闄勪欢 + * @author WWW + */ +@Mapper +@Repository +public interface AttachMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name 鏂囦欢鍚� + * @return 璁板綍鏁� + */ + public Integer selectCount(String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name 鏂囦欢鍚� + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<AttachEntity> selectByPage(String name, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<AttachEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public AttachEntity selectById(int id); + + /** + * 鏍规嵁Guid鏌ヨ + * + * @param guid + * @return + */ + public AttachEntity selectByGuid(String guid); + + /** + * 鏍规嵁Guid鏁扮粍鏌ヨ + * + * @param guids + * @return + */ + public List<AttachEntity> selectByGuids(List<String> guids); + + /** + * 鏍规嵁琛ㄥ悕鍜孏UID鏌ヨ + * + * @param tab + * @param tabGuid + * @param guid + * @return + */ + public AttachEntity selectByTabAndGuid(String tab, String tabGuid, String guid); + + /** + * 鏍规嵁琛ㄥ悕鍜孏UID鏁扮粍鏌ヨ + * + * @param tab + * @param guids + * @return + */ + public List<AttachEntity> selectByTabGuids(String tab, List<String> guids); + + /** + * 鏍规嵁琛ㄥ拰GUID鏌ヨ + * + * @param tab + * @param guid + * @return + */ + public List<AttachEntity> selectByTab(String tab, String guid); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(AttachEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<AttachEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(AttachEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<AttachEntity> list); + + /** + * 鏌ヨFME鏃ュ織 + * + * @param tabs + * @return + */ + public List<FmeLogEntity> selectFmeLogs(String tabs); + + /** + * 鏇存柊FME鏃ュ織 + * + * @param id ID + * @return + */ + public Integer updateFmeLog(Integer id); + + /** + * 鏍规嵁鍏冩暟鎹悕绉版彃鍏ラ檮浠� + * + * @param tab + * @param tabGuid + * @param metaName + * @param dirid + * @return + */ + public Integer insertAttachByMeta(String tab, String tabGuid, String metaName, String dirid); +} diff --git a/src/main/java/com/moon/server/mapper/sys/AuthMapper.java b/src/main/java/com/moon/server/mapper/sys/AuthMapper.java new file mode 100644 index 0000000..615c9a7 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/AuthMapper.java @@ -0,0 +1,107 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.AuthEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +/** + * 鏉冮檺琛� + * @author + */ + +@Mapper +@ResponseBody +public interface AuthMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name 鍚嶇О + * @return 璁板綍鏁� + */ + public Integer selectCount(String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name 鍚嶇О + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<AuthEntity> selectByPage(String name, Integer limit, Integer offset); + + /** + * 鏍规嵁鑿滃崟鏌ヨ璁板綍鏁� + * + * @param menuid + * @return + */ + public Integer selectCountForMenu(Integer menuid); + + /** + * 鏍规嵁鑿滃崟鍒嗛〉鏌ヨ + * + * @param menuid + * @param limit + * @param offset + * @return + */ + public List<AuthEntity> selectByPageForMenu(Integer menuid, Integer limit, Integer offset); + + /** + * 鎻掑叆涓�鏉� + * + * @param authEntity + * @return + */ + public Integer insertAuth(AuthEntity authEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertAuths(List<AuthEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteAuth(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteAuths(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param authEntity + * @return + */ + public Integer updateAuth(AuthEntity authEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public AuthEntity selectAuth(int id); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<AuthEntity> selectAuthAll(); +} diff --git a/src/main/java/com/moon/server/mapper/sys/BlacklistMapper.java b/src/main/java/com/moon/server/mapper/sys/BlacklistMapper.java new file mode 100644 index 0000000..4c6d689 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/BlacklistMapper.java @@ -0,0 +1,105 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.BlacklistEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 榛戝悕鍗� + * @author WWW + */ +@Mapper +@Repository +public interface BlacklistMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param ip IP鍦板潃 + * @param type 绫诲埆 + * @return 璁板綍鏁� + */ + public Integer selectCount(String ip, Integer type); + + /** + * 鍒嗛〉鏌ヨ + * + * @param ip IP鍦板潃 + * @param type 绫诲埆 + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<BlacklistEntity> selectByPage(String ip, Integer type, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<BlacklistEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public BlacklistEntity selectById(int id); + + /** + * 鏌ヨIP鍒楄〃 + * @param type 绫诲埆 + * @return + */ + public List<String> selectIpList(Integer type); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(BlacklistEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<BlacklistEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(BlacklistEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<BlacklistEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/sys/DepMapper.java b/src/main/java/com/moon/server/mapper/sys/DepMapper.java new file mode 100644 index 0000000..2e6e2a9 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/DepMapper.java @@ -0,0 +1,97 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.ctrl.IdNameEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; +import com.moon.server.entity.sys.DepEntity; + +import java.util.List; + +/** + * 缁勭粐鏈烘瀯 + * @author sws + * @date 2022-09-23 + */ + +@Mapper +@Repository +public interface DepMapper { + /** + * 鎻掑叆涓�鏉� + * + * @param depEntity + * @return + */ + public Integer insertDep(DepEntity depEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertDeps(List<DepEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteDep(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteDeps(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param depEntity + * @return + */ + public Integer updateDep(DepEntity depEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public DepEntity selectDep(int id); + + /** + * 鏍规嵁鍗曚綅缂栫爜鏁扮粍鏌ヨ + * + * @param codes + * @return + */ + public List<IdNameEntity> selectDepsByCodes(String[] codes); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<DepEntity> selectDepAll(); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updateDeps(List<DepEntity> list); + + /** + * 閫掑綊鏌ヨ + * + * @param name + * @return + */ + public List<DepEntity> selectDepRecursive(String name); +} diff --git a/src/main/java/com/moon/server/mapper/sys/DownlogMapper.java b/src/main/java/com/moon/server/mapper/sys/DownlogMapper.java new file mode 100644 index 0000000..17b20a3 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/DownlogMapper.java @@ -0,0 +1,103 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.DownlogEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 涓嬭浇鏃ュ織 + * @author WWW + */ +@Mapper +@Repository +public interface DownlogMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param uname + * @param type + * @param start + * @param end + * @return + */ + public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end); + + /** + * 鍒嗛〉鏌ヨ + * + * @param uname + * @param type + * @param start + * @param end + * @param limit + * @param offset + * @return + */ + public List<DownlogEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<DownlogEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public DownlogEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(DownlogEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<DownlogEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(DownlogEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<DownlogEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/sys/LoginMapper.java b/src/main/java/com/moon/server/mapper/sys/LoginMapper.java new file mode 100644 index 0000000..456d6d5 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/LoginMapper.java @@ -0,0 +1,105 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.LoginEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 鐧诲綍鏃ュ織 + * @author sws + * @date 2022-09-28 + */ +@Mapper +@ResponseBody +public interface LoginMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param uname + * @param type + * @param start + * @param end + * @return + */ + public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end); + + /** + * 鍒嗛〉鏌ヨ + * + * @param uname + * @param type + * @param start + * @param end + * @param limit + * @param offset + * @return + */ + public List<LoginEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); + + /** + * 鎻掑叆涓�鏉� + * + * @param loginEntity + * @return + */ + public Integer insertLogin(LoginEntity loginEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertLogins(List<LoginEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteLogin(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteLogins(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param loginEntity + * @return + */ + public Integer updateLogin(LoginEntity loginEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public LoginEntity selectLogin(int id); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<LoginEntity> selectLoginAll(); + + + /** + * 鐢ㄦ埛鐧诲綍鐘舵�� + * + * @return + */ + public List<LoginEntity> selectLoginCounts(); + +} diff --git a/src/main/java/com/moon/server/mapper/sys/MenuAuthMapper.java b/src/main/java/com/moon/server/mapper/sys/MenuAuthMapper.java new file mode 100644 index 0000000..506c430 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/MenuAuthMapper.java @@ -0,0 +1,116 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.MenuAuthEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鑿滃崟-鏉冮檺 + * @author WWW + */ +@Mapper +@Repository +public interface MenuAuthMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param menuid 鑿滃崟ID + * @return 璁板綍鏁� + */ + public Integer selectCount(Integer menuid); + + /** + * 鍒嗛〉鏌ヨ + * + * @param menuid 鑿滃崟ID + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<MenuAuthEntity> selectByPage(Integer menuid, Integer limit, Integer offset); + + /** + * 鏍规嵁瑙掕壊ID+鑿滃崟ID鏌ヨ璁板綍鏁� + * + * @param roleid + * @param menuid + * @return + */ + public Integer selectCountForRole(Integer roleid, Integer menuid); + + /** + * 鏍规嵁瑙掕壊ID+鑿滃崟ID鍒嗛〉鏌ヨ + * + * @param roleid + * @param menuid + * @param limit + * @param offset + * @return + */ + public List<MenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<MenuAuthEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public MenuAuthEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(MenuAuthEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<MenuAuthEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(MenuAuthEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<MenuAuthEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/sys/MenuMapper.java b/src/main/java/com/moon/server/mapper/sys/MenuMapper.java new file mode 100644 index 0000000..5fffe6d --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/MenuMapper.java @@ -0,0 +1,77 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.MenuEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鑿滃崟 + * @author sws + * @date 2022.09.24 + */ +@Mapper +@Repository +public interface MenuMapper { + /** + * 鎻掑叆涓�鏉� + * @param menuEntity + * @return + */ + public Integer insertMenu(MenuEntity menuEntity); + + /** + * 鎻掑叆澶氭潯 + * @param list + * @return + */ + public Integer insertMenus(List<MenuEntity> list); + /** + * 鍒犻櫎涓�鏉� + * @param id + * @return + */ + public Integer deleteMenu(int id); + + /** + * 鍒犻櫎澶氭潯 + * @param ids + * @return + */ + public Integer deleteMenus(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * @param menuEntity + * @return + */ + public Integer updateMenu(MenuEntity menuEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * @param id + * @return + */ + public MenuEntity selectMenu(int id); + + /** + * 鏌ヨ鎵�鏈� + * @return + */ + public List<MenuEntity> selectMenuAll(); + + /** + * 鏇存柊澶氭潯 + * @param list + * @return + */ + public Integer updateMenus(List<MenuEntity> list); + + /** + * 閫掑綊鏌ヨ + * @param name + * @return + */ + public List<MenuEntity> selectMenuRecursive(String name); +} diff --git a/src/main/java/com/moon/server/mapper/sys/MetaDownMapper.java b/src/main/java/com/moon/server/mapper/sys/MetaDownMapper.java new file mode 100644 index 0000000..c34cf5d --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/MetaDownMapper.java @@ -0,0 +1,96 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.MetaDownEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鍏冩暟鎹�-涓嬭浇 + * @author WWW + */ +@Mapper +@Repository +public interface MetaDownMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param metaid 鍏冩暟鎹甀D + * @return 璁板綍鏁� + */ + public Integer selectCount(Integer metaid); + + /** + * 鍒嗛〉鏌ヨ + * + * @param metaid 鍏冩暟鎹甀D + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<MetaDownEntity> selectByPage(Integer metaid, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<MetaDownEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public MetaDownEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(MetaDownEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<MetaDownEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(MetaDownEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<MetaDownEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/sys/OperateMapper.java b/src/main/java/com/moon/server/mapper/sys/OperateMapper.java new file mode 100644 index 0000000..d1da802 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/OperateMapper.java @@ -0,0 +1,103 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.OperateEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 鎿嶄綔鏃ュ織 + * @author sws + * @date 2022-09-28 + */ +@Mapper +@ResponseBody +public interface OperateMapper { + /** + * 鏌ヨ璁板綍鏁� + * @param uname + * @param type + * @param start + * @param end + * @return + */ + public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end); + + /** + * 鍒嗛〉鏌ヨ + * @param uname + * @param type + * @param start + * @param end + * @param limit + * @param offset + * @return + */ + public List<OperateEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); + + /** + * 鎻掑叆涓�鏉� + * + * @param operateEntity + * @return + */ + public Integer insertOperate(OperateEntity operateEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertOperates(List<OperateEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteOperate(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteOperates(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param operateEntity + * @return + */ + public Integer updateOperate(OperateEntity operateEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public OperateEntity selectOperate(int id); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<OperateEntity> selectOperateAll(); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<OperateEntity> operateCount(); + + +} diff --git a/src/main/java/com/moon/server/mapper/sys/ReportMapper.java b/src/main/java/com/moon/server/mapper/sys/ReportMapper.java new file mode 100644 index 0000000..c7d7173 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/ReportMapper.java @@ -0,0 +1,120 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.ctrl.CountEntity; +import com.moon.server.entity.sys.ReportEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鎶ュ憡妯℃澘 + * @author WWW + */ +@Mapper +@Repository +public interface ReportMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name 鍚嶇О + * @param code 缂栫爜 + * @return 璁板綍鏁� + */ + public Integer selectCount(String name, String code); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name 鍚嶇О + * @param code 缂栫爜 + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<ReportEntity> selectByPage(String name, String code, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<ReportEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public ReportEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(ReportEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<ReportEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(ReportEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<ReportEntity> list); + + /** + * 鏁版嵁閲忕粺璁� + * + * @return + */ + public List<CountEntity> countSizes(); + + /** + * 鏈嶅姟璋冪敤閲忕粺璁� + * + * @return + */ + public List<CountEntity> countServices(); + + /** + * 鐢ㄦ埛娴侀噺缁熻 + * + * @return + */ + public List<CountEntity> countOperates(); +} diff --git a/src/main/java/com/moon/server/mapper/sys/ResMapper.java b/src/main/java/com/moon/server/mapper/sys/ResMapper.java new file mode 100644 index 0000000..7a5861b --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/ResMapper.java @@ -0,0 +1,110 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.ResEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +/** + * 璧勬簮琛� + * @author sws + * @date 2022-09-28 + */ +@Mapper +@ResponseBody +public interface ResMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name 琛ㄥ悕 + * @return 璁板綍鏁� + */ + public Integer selectCount(String name); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name 琛ㄥ悕 + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<ResEntity> selectByPage(String name, Integer limit, Integer offset); + + /** + * 鏍规嵁瑙掕壊鏌ヨ璁板綍鏁� + * + * @param roleid + * @return + */ + public Integer selectCountForRole(Integer roleid); + + /** + * 鏍规嵁瑙掕壊鍒嗛〉鏌ヨ + * + * @param roleid + * @param limit + * @param offset + * @return + */ + public List<ResEntity> selectByPageForRole(Integer roleid, Integer limit, Integer offset); + + /** + * 鎻掑叆涓�鏉� + * + * @param resEntity + * @return + */ + public Integer insertRes(ResEntity resEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertRess(List<ResEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteRes(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteRess(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param resEntity + * @return + */ + public Integer updateRes(ResEntity resEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public ResEntity selectRes(int id); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<ResEntity> selectResAll(); + + + +} diff --git a/src/main/java/com/moon/server/mapper/sys/ResOpMapper.java b/src/main/java/com/moon/server/mapper/sys/ResOpMapper.java new file mode 100644 index 0000000..af94f0a --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/ResOpMapper.java @@ -0,0 +1,96 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.ResOpEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 璧勬簮鎿嶄綔 + * @author sws + * @date 2022-09-28 + */ +@Mapper +@ResponseBody +public interface ResOpMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name + * @param type + * @param start + * @param end + * @return + */ + public Integer selectCount(String name, Integer type, Timestamp start, Timestamp end); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name + * @param type + * @param start + * @param end + * @param limit + * @param offset + * @return + */ + public List<ResOpEntity> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); + + /** + * 鎻掑叆涓�鏉� + * + * @param resOpEntity + * @return + */ + public Integer insertResOp(ResOpEntity resOpEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertResOps(List<ResOpEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteResOp(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteResOps(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param resOpEntity + * @return + */ + public Integer updateResOp(ResOpEntity resOpEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public ResOpEntity selectResOp(int id); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<ResOpEntity> selectResOpAll(); +} diff --git a/src/main/java/com/moon/server/mapper/sys/RoleMapper.java b/src/main/java/com/moon/server/mapper/sys/RoleMapper.java new file mode 100644 index 0000000..c1c2433 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/RoleMapper.java @@ -0,0 +1,91 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.RoleEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +/** + * 瑙掕壊琛� + * @author sws + * @date 2022-09-29 + */ +@Mapper +@ResponseBody +public interface RoleMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name 鍚嶇О + * @param depid 鍗曚綅ID + * @return 璁板綍鏁� + */ + public Integer selectCount(String name, Integer depid); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name 鍚嶇О + * @param depid 鍗曚綅ID + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<RoleEntity> selectByPage(String name, Integer depid, Integer limit, Integer offset); + + /** + * 鎻掑叆涓�鏉� + * + * @param roleEntity + * @return + */ + public Integer insertRole(RoleEntity roleEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertRoles(List<RoleEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteRole(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteRoles(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param roleEntity + * @return + */ + public Integer updateRole(RoleEntity roleEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public RoleEntity selectRole(int id); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<RoleEntity> selectRoleAll(); +} diff --git a/src/main/java/com/moon/server/mapper/sys/RoleMenuAuthMapper.java b/src/main/java/com/moon/server/mapper/sys/RoleMenuAuthMapper.java new file mode 100644 index 0000000..da3d95e --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/RoleMenuAuthMapper.java @@ -0,0 +1,116 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.RoleMenuAuthEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 瑙掕壊-鑿滃崟 + * @author WWW + */ +@Mapper +@Repository +public interface RoleMenuAuthMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param roleid 瑙掕壊ID + * @return 璁板綍鏁� + */ + public Integer selectCount(Integer roleid); + + /** + * 鍒嗛〉鏌ヨ + * + * @param roleid 瑙掕壊ID + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<RoleMenuAuthEntity> selectByPage(Integer roleid, Integer limit, Integer offset); + + /** + * 鏍规嵁瑙掕壊ID+鑿滃崟ID鏌ヨ璁板綍鏁� + * + * @param roleid + * @param menuid + * @return + */ + public Integer selectCountForRole(Integer roleid, Integer menuid); + + /** + * 鏍规嵁瑙掕壊ID+鑿滃崟ID鍒嗛〉鏌ヨ + * + * @param roleid + * @param menuid + * @param limit + * @param offset + * @return + */ + public List<RoleMenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<RoleMenuAuthEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public RoleMenuAuthEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(RoleMenuAuthEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<RoleMenuAuthEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(RoleMenuAuthEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<RoleMenuAuthEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/sys/RoleResMapper.java b/src/main/java/com/moon/server/mapper/sys/RoleResMapper.java new file mode 100644 index 0000000..c2f7c38 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/RoleResMapper.java @@ -0,0 +1,96 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.RoleResEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 瑙掕壊-璧勬簮 + * @author WWW + */ +@Mapper +@Repository +public interface RoleResMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param roleid 瑙掕壊ID + * @return 璁板綍鏁� + */ + public Integer selectCount(Integer roleid); + + /** + * 鍒嗛〉鏌ヨ + * + * @param roleid 瑙掕壊ID + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<RoleResEntity> selectByPage(Integer roleid, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<RoleResEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public RoleResEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(RoleResEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<RoleResEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(RoleResEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<RoleResEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/sys/RoleUserMapper.java b/src/main/java/com/moon/server/mapper/sys/RoleUserMapper.java new file mode 100644 index 0000000..ad38a15 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/RoleUserMapper.java @@ -0,0 +1,96 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.RoleUserEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 瑙掕壊-鐢ㄦ埛 + * @author WWW + */ +@Mapper +@Repository +public interface RoleUserMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param roleid 瑙掕壊ID + * @return 璁板綍鏁� + */ + public Integer selectCount(Integer roleid); + + /** + * 鍒嗛〉鏌ヨ + * + * @param roleid 瑙掕壊ID + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<RoleUserEntity> selectByPage(Integer roleid, Integer limit, Integer offset); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<RoleUserEntity> selectAll(); + + /** + * 鏍规嵁ID鏌ヨ + * + * @param id + * @return + */ + public RoleUserEntity selectById(int id); + + /** + * 鎻掑叆涓�鏉� + * + * @param entity + * @return + */ + public Integer insert(RoleUserEntity entity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer inserts(List<RoleUserEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer delete(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deletes(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param entity + * @return + */ + public Integer update(RoleUserEntity entity); + + /** + * 鏇存柊澶氭潯 + * + * @param list + * @return + */ + public Integer updates(List<RoleUserEntity> list); +} diff --git a/src/main/java/com/moon/server/mapper/sys/TokenMapper.java b/src/main/java/com/moon/server/mapper/sys/TokenMapper.java new file mode 100644 index 0000000..69bc776 --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/TokenMapper.java @@ -0,0 +1,108 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.TokenEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +/** + * 浠ょ墝琛� + * @author sws + * @date 2022-09-28 + */ + +@Mapper +@ResponseBody +public interface TokenMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param name + * @param type + * @return + */ + public Integer selectCount(String name, Integer type); + + /** + * 鍒嗛〉鏌ヨ + * + * @param name + * @param type + * @param limit + * @param offset + * @return + */ + public List<TokenEntity> selectByPage(String name, Integer type, Integer limit, Integer offset); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public TokenEntity selectToken(int id); + + /** + * 鏍规嵁token鍊兼煡璇竴鏉¤褰� + * + * @param token + * @return + */ + public TokenEntity selectOneByToken(String token); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<TokenEntity> selectTokenAll(); + + /** + * 鎻掑叆涓�鏉� + * + * @param tokenEntity + * @return + */ + public Integer insertToken(TokenEntity tokenEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param list + * @return + */ + public Integer insertTokens(List<TokenEntity> list); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteToken(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteTokens(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param tokenEntity + * @return + */ + public Integer updateToken(TokenEntity tokenEntity); + + /** + * 鏇存柊浠ょ墝涓哄け鏁� + * + * @param tokenEntity + * @return + */ + public Integer updateTokenExpire(TokenEntity tokenEntity); +} diff --git a/src/main/java/com/moon/server/mapper/sys/UserMapper.java b/src/main/java/com/moon/server/mapper/sys/UserMapper.java new file mode 100644 index 0000000..c9ee89b --- /dev/null +++ b/src/main/java/com/moon/server/mapper/sys/UserMapper.java @@ -0,0 +1,172 @@ +package com.moon.server.mapper.sys; + +import com.moon.server.entity.sys.RoleEntity; +import com.moon.server.entity.sys.UserEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 鐢ㄦ埛绠$悊 + * @author sws + * @date 2022-09-27 + */ +@Mapper +@Repository +public interface UserMapper { + /** + * 鏌ヨ璁板綍鏁� + * + * @param uname 鐢ㄦ埛鍚� + * @param depcode 鍗曚綅缂栫爜 + * @return 璁板綍鏁� + */ + public Integer selectCount(String uname, String depcode); + + /** + * 鍒嗛〉鏌ヨ + * + * @param uname 鐢ㄦ埗鍚� + * @param depcode 鍗曚綅缂栫爜 + * @param limit 璁板綍鏁� + * @param offset 鍋忕Щ閲� + * @return 鍒楄〃 + */ + public List<UserEntity> selectByPage(String uname, String depcode, Integer limit, Integer offset); + + /** + * 鏍规嵁token鏈夋晥鏈熸煡璇� + * + * @param token + * @return + */ + public UserEntity selectByToken(String token); + + /** + * 鏌ヨ鏄�/鍚︿负Admin + * + * @param id ID + * @return 缁熻鏁� + */ + public Integer selectForIsAdmin(Integer id); + + /** + * 鏌ヨ绠$悊鍛樼敤鎴� + * + * @param type 绠$悊鍛樼被鍒� + * @return + */ + public List<UserEntity> selectAdminUsers(Integer type); + + /** + * 鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊 + * + * @param id 鐢ㄦ埛ID + * @return 瑙掕壊闆嗗悎 + */ + public List<RoleEntity> selectRoleByUserId(Integer id); + + /** + * 鏍规嵁瑙掕壊鏌ヨ鐢ㄦ埛 + * + * @param roleId 瑙掕壊ID + * @return 鐢ㄦ埛闆嗗悎 + */ + public List<UserEntity> selectUserByRoleId(Integer roleId); + + /** + * 鎻掑叆涓�鏉� + * + * @param userEntity + * @return + */ + public Integer insertUser(UserEntity userEntity); + + /** + * 鎻掑叆澶氭潯 + * + * @param userEntity + * @return + */ + public Integer insertUsers(List<UserEntity> userEntity); + + /** + * 鍒犻櫎涓�鏉� + * + * @param id + * @return + */ + public Integer deleteUser(int id); + + /** + * 鍒犻櫎澶氭潯 + * + * @param ids + * @return + */ + public Integer deleteUsers(List<Integer> ids); + + /** + * 鏇存柊涓�鏉� + * + * @param userEntity + * @return + */ + public Integer updateUser(UserEntity userEntity); + + /** + * 鏌ヨ鍗曟潯鏁版嵁 + * + * @param id + * @return + */ + public UserEntity selectUser(int id); + + /** + * 鏍规嵁uid鏌ヨ + * + * @param uid + * @return + */ + public UserEntity selectByUid(String uid); + + /** + * 鏌ヨ鎵�鏈� + * + * @return + */ + public List<UserEntity> selectUserAll(); + + /** + * 鏍规嵁瑙掕壊+鍗曚綅鏌ヨ璁板綍鏁� + * + * @param uname + * @param roleid + * @param depcode + * @return + */ + public Integer selectCountForRole(String uname, Integer roleid, String depcode); + + /** + * 鏍规嵁瑙掕壊+鍗曚綅鍒嗛〉鏌ヨ + * + * @param uname + * @param roleid + * @param depcode + * @param limit + * @param offset + * @return + */ + public List<UserEntity> selectByPageForRole(String uname, Integer roleid, String depcode, Integer limit, Integer offset); + + /** + * 鏇存柊澶氫釜鐢ㄦ埛瀵嗙爜 + * + * @param updateUser + * @param pwd + * @param ids + * @return + */ + public Integer updateUsersPwd(Integer updateUser, String pwd, List<Integer> ids); +} \ No newline at end of file diff --git a/src/main/java/com/moon/server/service/all/BaseQueryService.java b/src/main/java/com/moon/server/service/all/BaseQueryService.java new file mode 100644 index 0000000..cba44ef --- /dev/null +++ b/src/main/java/com/moon/server/service/all/BaseQueryService.java @@ -0,0 +1,312 @@ +package com.moon.server.service.all; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.moon.server.entity.all.RedisCacheKey; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.IdNameEntity; +import com.moon.server.entity.ctrl.KeyValueEntity; +import com.moon.server.entity.ctrl.TabEntity; +import com.moon.server.entity.data.DictEntity; +import com.moon.server.entity.data.DomainEntity; +import com.moon.server.entity.sys.AttachEntity; +import com.moon.server.helper.AesHelper; +import com.moon.server.helper.ClassHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.all.BaseQueryMapper; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.mapper.all.GeomBaseMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 鐖舵煡璇㈡湇鍔$被 + * @author WWW + */ +@Service +public class BaseQueryService implements BaseQueryMapper { + @Autowired + BaseQueryMapper baseQueryMapper; + + @Autowired + RedisService redisService; + + /** + * 琛ㄥ悕Map + */ + private static Map<String, String> tabMap = new HashMap<>(3); + + /** + * 娣诲姞杩囨护鏉′欢 + * + * @param wrapper QueryWrapper + * @param filter 鍘熷杩囨护鏉′欢瀛楃涓� + */ + public void addFilterWrapper(QueryWrapper wrapper, String filter) { + if (StringHelper.isEmpty(filter)) { + return; + } + + String[] strs = filter.trim().split(" (?i)and "); + for (String str : strs) { + int start = str.indexOf(" "); + if (start == -1) { + continue; + } + int end = str.indexOf(" ", start + 1); + if (end == -1) { + continue; + } + + String field = str.substring(0, start).trim(); + String express = str.substring(start + 1, end).trim().toLowerCase(); + String value = str.substring(end + 1).trim(); + + addWrapper(wrapper, field, express, getObjectVal(express, value)); + } + } + + /** + * 鑾峰彇鍊煎璞� + * + * @param val 鍊� + * @return 瀵硅薄 + */ + private Object getObjectVal(String express, String val) { + if (StringHelper.isInteger(val)) { + return Long.parseLong(val); + } + if (StringHelper.isNumeric(val)) { + return Double.parseDouble(val); + } + if (StaticData.IN.equals(express)) { + return val; + } + + return val.replace("'", ""); + } + + /** + * 娣诲姞鍖呰鍣� + * + * @param wrapper QueryWrapper + * @param field 瀛楁 + * @param express 琛ㄨ揪寮� + * @param val 鍊� + */ + private void addWrapper(QueryWrapper wrapper, String field, String express, Object val) { + if (StringHelper.isDate(val.toString())) { + wrapper.apply(String.format("%s %s '%s'", field, express, val)); + return; + } + + switch (express) { + case "like": + wrapper.like("UPPER(" + field + ")", val.toString().toUpperCase()); + break; + case ">": + wrapper.gt(field, val); + break; + case ">=": + wrapper.ge(field, val); + break; + case "<>": + case "!=": + wrapper.ne(field, val); + break; + case "=": + wrapper.eq(field, val); + break; + case "<": + wrapper.lt(field, val); + break; + case "<=": + wrapper.le(field, val); + break; + case "in": + if (val.toString().contains(StaticData.SINGLE_QUOTES)) { + wrapper.in(field, getStringList(val.toString())); + } else { + wrapper.in(field, getIntegerList(val.toString())); + } + break; + default: + break; + } + } + + /** + * 鑾峰彇瀛楃涓插垪琛� + */ + private List<String> getStringList(String val) { + return Arrays.asList(val.replace(StaticData.SINGLE_QUOTES, "").split(StaticData.COMMA)); + } + + /** + * 鑾峰彇鏁存暟鍒楄〃 + */ + private List<Integer> getIntegerList(String val) { + List<Integer> list = new ArrayList<>(); + for (String str : val.split(StaticData.COMMA)) { + list.add(Integer.parseInt(str)); + } + + return list; + } + + /** + * 娣诲姞绌洪棿杩囨护鏉′欢 + * + * @param basicMapper 鐖禡apper + * @param wrapper QueryWrapper + * @param wkt WKT锛堣憲鍚嶆枃鏈級 + * @throws Exception 寮傚父 + */ + public void addGeomWrapper(BasicMapper basicMapper, QueryWrapper wrapper, String wkt) throws Exception { + if (basicMapper instanceof GeomBaseMapper && !StringHelper.isEmpty(wkt)) { + wkt = AesHelper.decrypt(wkt); + + Integer srid = getSrid((GeomBaseMapper) basicMapper); + wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid)); + } + } + + /** + * 鑾峰彇鍑犱綍瀵硅薄鐨勭┖闂村弬鑰� + * + * @param basicMapper 绌洪棿鍩虹Mapper + * @return SRID + */ + public Integer getSrid(GeomBaseMapper basicMapper) { + String tab = getTabName(basicMapper); + String key = RedisCacheKey.sridKey(tab); + + Object obj = redisService.get(key); + if (obj instanceof Integer) { + return (Integer) obj; + } + + Integer srid = basicMapper.selectSrid(tab); + if (null == srid) { + return StaticData.I4490; + } + redisService.put(key, srid, 5, TimeUnit.MINUTES); + + return srid; + } + + /** + * 鏍规嵁Mapper鑾峰彇琛ㄥ悕 + * + * @param basicMapper Mapper + * @return 琛ㄥ悕 + */ + public static String getTabName(BasicMapper basicMapper) { + String className = ClassHelper.getClassName(basicMapper); + if (tabMap.containsKey(className)) { + return tabMap.get(className); + } + + return getTabName(className); + } + + /** + * 鏍规嵁Mapper鑾峰彇琛ㄥ悕 + * + * @param className Mapper绫诲悕 + * @return 琛ㄥ悕 + */ + private static String getTabName(String className) { + Class clazz = ClassHelper.getEntityClass(className); + if (clazz == null) { + return null; + } + + TableName annotation = (TableName) clazz.getAnnotation(TableName.class); + + String tabName = annotation.value(); + if (tabName != null && !tabMap.containsKey(className)) { + tabMap.put(className, tabName); + } + + return tabName; + } + + /** + * 娣诲姞缂撳啿鍖鸿繃婊ゆ潯浠� + * + * @param baseMapper 鐖禡apper + * @param wrapper QueryWrapper + * @param wkt WKT锛堣憲鍚嶆枃鏈級 + */ + public void addBufferWrapper(GeomBaseMapper baseMapper, QueryWrapper wrapper, String wkt, double buffer) { + Integer srid = getSrid(baseMapper); + // buffer = buffer * 0.00000899928 + buffer = buffer / 1852 / 60; + + wrapper.apply(String.format("ST_Intersects(geom, ST_Buffer(ST_GeomFromText('%s', %d), %f, 'endcap=round join=round'))", wkt, srid, buffer)); + } + + @Override + public List<IdNameEntity> selectUserFuzzy(String name) { + name = StringHelper.getLikeUpperStr(name); + + return baseQueryMapper.selectUserFuzzy(name); + } + + @Override + public List<IdNameEntity> selectDepFuzzy(String name) { + name = StringHelper.getLikeUpperStr(name); + + return baseQueryMapper.selectDepFuzzy(name); + } + + @Override + public Integer selectTabsForCount(String tab, String field) { + tab = StringHelper.getLikeUpperStr(tab); + + return baseQueryMapper.selectTabsForCount(tab, field); + } + + @Override + public List<TabEntity> selectTabsByPage(String tab, String field, String filters, Integer limit, Integer offset) { + tab = StringHelper.getLikeUpperStr(tab); + + return baseQueryMapper.selectTabsByPage(tab, field, filters, limit, offset); + } + + @Override + public List<DictEntity> selectFields(String ns, String tab) { + return baseQueryMapper.selectFields(ns, tab); + } + + @Override + public List<DomainEntity> selectDomains(String ns, String tab) { + return baseQueryMapper.selectDomains(ns, tab); + } + + @Override + public String selectRoute(double x1, double y1, double x2, double y2) { + return baseQueryMapper.selectRoute(x1, y1, x2, y2); + } + + @Override + public List<KeyValueEntity> selectLocation(String wkt) { + return baseQueryMapper.selectLocation(wkt); + } + + @Override + public List<KeyValueEntity> selectDirTypes(String name) { + name = StringHelper.getLikeUpperStr(name); + + return baseQueryMapper.selectDirTypes(name); + } + + @Override + public List<AttachEntity> selectAnnexByTab(String tab, String gids) { + return baseQueryMapper.selectAnnexByTab(tab, gids); + } +} diff --git a/src/main/java/com/moon/server/service/all/BaseUploadService.java b/src/main/java/com/moon/server/service/all/BaseUploadService.java new file mode 100644 index 0000000..6813b85 --- /dev/null +++ b/src/main/java/com/moon/server/service/all/BaseUploadService.java @@ -0,0 +1,538 @@ +package com.moon.server.service.all; + +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.data.DirEntity; +import com.moon.server.entity.data.MetaFileEntity; +import com.moon.server.entity.data.VerEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.data.DirService; +import com.moon.server.helper.*; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.*; + +/** + * 鐖朵笂浼犳湇鍔� + * @author WWW + */ +@Service +public class BaseUploadService { + @Autowired + protected DirService dirService; + + @Autowired + protected PathHelper pathHelper; + + public final Log log = LogFactory.getLog(getClass()); + + /** + * 鏌ヨ鐩綍 + */ + public String selectPath() { + return pathHelper.getTempPathName(); + } + + /** + * 涓婁紶鏂囦欢 + */ + public <T> List<MetaFileEntity> uploadData(T t, String path, boolean isGetGuid, HttpServletRequest req, HttpServletResponse res) throws Exception { + StandardMultipartHttpServletRequest request = (StandardMultipartHttpServletRequest) req; + req.setCharacterEncoding("utf-8"); + res.setContentType("application/json;charset=utf-8"); + + if (t != null) { + setEntity(t, request); + } + + return getFiles(path, isGetGuid, request); + } + + /** + * 璁剧疆瀹炰綋绫� + */ + private <T> void setEntity(T t, StandardMultipartHttpServletRequest req) { + Enumeration<String> enumeration = req.getParameterNames(); + while (enumeration.hasMoreElements()) { + String key = enumeration.nextElement(); + + try { + Field field = t.getClass().getDeclaredField(key); + field.setAccessible(true); + String value = req.getParameter(key); + + switch (field.getType().toString()) { + case "double": + field.set(t, Double.valueOf(value)); + break; + case "long": + field.set(t, Long.valueOf(value)); + break; + case "int": + field.set(t, Integer.valueOf(value)); + break; + case "class java.sql.Timestamp": + field.set(t, Timestamp.valueOf(value)); + break; + //case "class java.lang.String": + default: + field.set(t, value); + break; + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } + + /** + * 鑾峰彇鏂囦欢 + */ + public List<MetaFileEntity> getFiles(String subPath, boolean isGetGuid, StandardMultipartHttpServletRequest req) throws Exception { + List<MetaFileEntity> list = new ArrayList<>(); + + String path = pathHelper.getTempPath(subPath); + Iterator<String> iterator = req.getFileNames(); + while (iterator.hasNext()) { + MultipartFile file = req.getFile(iterator.next()); + if (null == file || StringHelper.isEmpty(file.getOriginalFilename())) { + continue; + } + + MetaFileEntity mf = new MetaFileEntity(); + mf.setName(file.getOriginalFilename()); + + double sizes = FileHelper.sizeToMb(file.getSize()); + mf.setSizes(sizes); + mf.setPath(path + File.separator + mf.getName()); + + file.transferTo(new File(mf.getPath())); + if (isGetGuid) { + mf.setGuid(FileHelper.getFileMd5(mf.getPath())); + } + + list.add(mf); + } + + return list; + } + + /** + * 鏌ヨ鏂囦欢 + */ + public List<MetaFileEntity> selectFiles(String subPath) { + String root = pathHelper.getConfig().getTempPath() + File.separator + subPath; + + File file = new File(root); + if (!file.exists() && !file.isDirectory()) { + return null; + } + File[] files = file.listFiles(); + if (null == files || files.length == 0) { + return null; + } + + List<MetaFileEntity> list = new ArrayList<>(); + for (File f : files) { + String fileName = FileHelper.getFileName(f.getPath()); + String extName = FileHelper.getExtension(fileName); + if (!isExtValid(extName)) { + continue; + } + + MetaFileEntity mf = new MetaFileEntity(); + mf.setName(fileName); + mf.setExtName(extName); + mf.setSizes(FileHelper.sizeToMb(f.length())); + mf.setPath(subPath + File.separator + fileName); + if (!StaticData.ZIP.equals(extName)) { + mf.setGuid(FileHelper.getFileMd5(f.getPath())); + } + + list.add(mf); + } + + return list; + } + + /** + * 鍒犻櫎鏂囦欢 + */ + public Integer deleteFiles(List<MetaFileEntity> list) { + String root = pathHelper.getConfig().getTempPath(); + + int count = 0; + for (MetaFileEntity entity : list) { + if (!StringHelper.isEmpty(entity.getPath())) { + String file = root + File.separator + entity.getPath(); + + File f = new File(file); + if (f.exists()) { + f.delete(); + count++; + } + } + } + + return count; + } + + /** + * 鏌ヨ鏄犲皠 + */ + public List<MetaFileEntity> selectMappers(UserEntity ue, String path, DirEntity dir, VerEntity ver, String epsgCode) { + List<MetaFileEntity> metas = selectFiles(path); + if (null == metas || metas.isEmpty()) { + return null; + } + + List<MetaFileEntity> list = new ArrayList<>(); + List<DirEntity> dirs = dirService.selectRecursiveById(dir.getId()); + for (MetaFileEntity meta : metas) { + meta.setEventid(StringHelper.getGuid()); + meta.setDircode(dir.getCode()); + meta.setDepcode(ue.getDepcode()); + meta.setVerid(ver.getId()); + meta.setCreateUser(ue.getId()); + meta.setEpsgCode(epsgCode); + + if (StaticData.ZIP.equals(meta.getExtName())) { + List<MetaFileEntity> subs = getMapperFiles(path, dir, dirs, meta); + if (null != subs && subs.size() > 0) { + list.addAll(subs); + continue; + } + } + + list.add(meta); + } + setMetaType(list); + + return list; + } + + /** + * 鑾峰彇鏄犲皠鏂囦欢 + */ + private List<MetaFileEntity> getMapperFiles(String path, DirEntity dir, List<DirEntity> dirs, MetaFileEntity meta) { + String tempPath = pathHelper.getConfig().getTempPath(); + String zipFile = tempPath + File.separator + meta.getPath(); + File file = new File(zipFile); + if (!file.exists() || file.isDirectory()) { + return null; + } + + File zipFolder = new File(pathHelper.getConfig().getTempPath() + File.separator + path + "_zip"); + if (!zipFolder.exists() || !zipFolder.isDirectory()) { + zipFolder.mkdirs(); + } + + // String subPath = zipFolder + File.separator + meta.getName().toLowerCase().replace(".zip", "") .replace("锛�","").replace("锛�","").replace(" ","") + String subPath = zipFolder.getPath(); + ZipHelper.unzip(zipFile, subPath); + + List<File> files = new ArrayList<>(); + getFilesByPath(files, subPath); + + return getMapperFiles(files, dir, dirs, meta, tempPath.length() + 1); + } + + /** + * 鏍规嵁璺緞鑾峰彇鏂囦欢 + */ + private void getFilesByPath(List<File> list, String path) { + File file = new File(path); + if (!file.isDirectory()) { + String extName = FileHelper.getExtension(file); + if (isExtValid(extName)) { + list.add(file); + } + return; + } + + if (isGdbFile(file)) { + list.add(file); + return; + } + + File[] files = file.listFiles(); + if (null == files) { + return; + } + for (File f : files) { + if (f.isDirectory()) { + getFilesByPath(list, f.getPath()); + } else { + String extName = FileHelper.getExtension(f); + if (isExtValid(extName)) { + list.add(f); + } + } + } + } + + /** + * 鎵╁睍鏄惁鏈夋晥 + */ + private boolean isExtValid(String extName) { + return StaticData.ALL_EXTENSION.contains(extName) && !StaticData.MAPPER_EXCLUDE_EXT.contains(extName); + } + + /** + * 鑾峰彇鏄犲皠鏂囦欢 + */ + private List<MetaFileEntity> getMapperFiles(List<File> files, DirEntity dir, List<DirEntity> dirs, MetaFileEntity meta, int start) { + List<MetaFileEntity> list = new ArrayList<>(); + for (File f : files) { + boolean isGdb = isGdbFile(f); + if (!isGdb && f.isDirectory()) { + continue; + } + + String fileName = FileHelper.getFileName(f.getPath()); + String extName = FileHelper.getExtension(fileName); + if (!isExtValid(extName) || fileName.startsWith("~")) { + continue; + } + + String dircode = getDirByPath(f.getPath(), fileName, dir, dirs); + boolean isShp = StaticData.SHP.equals(extName); + if (isGdb) { + List<MetaFileEntity> rs = getGdbMappers(f, meta, dircode, start); + if (null != rs && rs.size() > 0) { + list.addAll(rs); + } + continue; + } + + MetaFileEntity mf = createMetaFileEntity(meta); + mf.setDircode(dircode); + mf.setEventid(StringHelper.getGuid()); + mf.setName(fileName); + mf.setExtName(extName); + mf.setPath(f.getPath().substring(start)); + + if (isShp) { + List<String> shpFiles = getShpFiles(f.getPath()); + mf.setTab(fileName.replace(StaticData.SHP, "")); + mf.setSizes(getFilesSize(shpFiles)); + mf.setGuid(getFilesMd5(shpFiles)); + } else { + mf.setSizes(FileHelper.sizeToMb(f.length())); + mf.setGuid(FileHelper.getFileMd5(f.getPath())); + } + list.add(mf); + } + + return list; + } + + /** + * 鍒涘缓鍏冩暟鎹枃浠跺疄浣撶被 + */ + private MetaFileEntity createMetaFileEntity(MetaFileEntity meta) { + MetaFileEntity mf = new MetaFileEntity(); + mf.setDircode(meta.getDircode()); + mf.setDepcode(meta.getDepcode()); + mf.setVerid(meta.getVerid()); + mf.setCreateUser(meta.getCreateUser()); + mf.setEpsgCode(meta.getEpsgCode()); + + return mf; + } + + /** + * 鏍规嵁鏂囦欢璺緞鑾峰彇鐩綍ID + */ + private String getDirByPath(String filePath,String fileName, DirEntity dir, List<DirEntity> dirs) { + if (0 != dir.getPid() || null == dirs || dirs.isEmpty()) { + return dir.getCode(); + } + if (StaticData.SLASH.equals(File.separator)) { + filePath = filePath.replace("/", "\\"); + } + + fileName = fileName.toLowerCase(); + filePath = filePath.toLowerCase(); + for (DirEntity entity : dirs) { + if (filePath.contains(entity.getFullName().toLowerCase() + "\\" + fileName)) { + return entity.getCode(); + } + } + + return dir.getCode(); + } + + /** + * 鑾峰彇SHP鏂囦欢闆嗗悎 + */ + private List<String> getShpFiles(String shpPath) { + List<String> list = new ArrayList<>(); + list.add(shpPath); + + for (int i = 0, c = StaticData.SHP_EXT.size(); i < c; i++) { + String path = shpPath.replace(".shp", StaticData.SHP_EXT.get(i)); + + File f = new File(path); + if (f.exists() && !f.isDirectory()) { + list.add(path); + } + } + + return list; + } + + /** + * 鑾峰彇GDB鏂囦欢闆嗗悎 + */ + private List<String> getGdbFiles(String path) { + List<String> list = new ArrayList<>(); + + File[] files = new File(path).listFiles(); + if (null == files || files.length == 0) { + return list; + } + for (File f : files) { + list.add(f.getPath()); + } + + return list; + } + + /** + * 鑾峰彇澶氭枃浠剁殑MD5 + */ + private String getFilesMd5(List<String> files) { + List<String> list = new ArrayList<>(); + for (String file : files) { + String md5 = FileHelper.getFileMd5(file); + if (null != md5) { + list.add(md5); + } + } + + if (list.size() > 0) { + String str = StringHelper.join(list, ","); + return FileHelper.getStringMd5(str); + } + + return StringHelper.getGuid(); + } + + /** + * 鑾峰彇澶氭枃浠剁殑澶у皬 + */ + private double getFilesSize(List<String> files) { + long size = 0L; + for (String file : files) { + File f = new File(file); + if (f.exists() && !f.isDirectory()) { + size += f.length(); + } + } + + return FileHelper.sizeToMb(size); + } + + /** + * 鑾峰彇GDB鏂囦欢鏄犲皠 + */ + private List<MetaFileEntity> getGdbMappers(File f, MetaFileEntity meta, String dircode, int start) { + List<String> tabs = GdbHelper.getTabNames(f.getPath()); + if (null == tabs || tabs.size() == 0) { + return null; + } + + String fileName = FileHelper.getFileName(f.getPath()); + String extName = FileHelper.getExtension(fileName); + + List<String> gdbFiles = getGdbFiles(f.getPath()); + String md5 = getFilesMd5(gdbFiles); + double sizes = getFilesSize(gdbFiles); + + List<MetaFileEntity> list = new ArrayList<>(); + for (String tab : tabs) { + MetaFileEntity mf = createMetaFileEntity(meta); + mf.setDircode(dircode); + mf.setEventid(StringHelper.getGuid()); + mf.setName(fileName); + mf.setExtName(extName); + mf.setSizes(FileHelper.sizeToMb(f.length())); + mf.setPath(f.getPath().substring(start)); + mf.setTab(tab); + mf.setSizes(sizes); + mf.setGuid(md5); + list.add(mf); + } + + return list; + } + + /** + * 鏄�/鍚︿负GDB鏂囦欢 + */ + private boolean isGdbFile(File f) { + if (f.isDirectory() && f.getName().toLowerCase().endsWith(StaticData.GDB)) { + File[] files = f.listFiles(); + if (null == files || files.length == 0) { + return false; + } + + for (File file : files) { + if ("gdb".equals(file.getName())) { + return true; + } + } + } + + return false; + } + + /** + * 璁剧疆鍏冩暟鎹枃浠剁殑绫诲瀷 + */ + private void setMetaType(List<MetaFileEntity> list) { + for (MetaFileEntity mf : list) { + if (null != mf.getExtName()) { + mf.setType(mf.getExtName().replace(".", "")); + } + } + } + + /** + * 澶勭悊鐩綍 + */ + public void copePath(List<MetaFileEntity> list) { + String basePath = pathHelper.getConfig().getTempPath() + File.separator; + for (MetaFileEntity mf : list) { + mf.setPath(mf.getPath().replace(basePath, "")); + } + } + + /** + * 鑾峰彇鍙傛暟 * + * Enumeration<String> headers = req.getHeaderNames(); + * Enumeration<String> attributes = req.getAttributeNames(); + */ + public Map<String, String> getParams(StandardMultipartHttpServletRequest req) { + Map<String, String> map = new HashMap<>(3); + + Enumeration<String> enumeration = req.getParameterNames(); + while (enumeration.hasMoreElements()) { + String key = enumeration.nextElement(); + String value = req.getParameter(key); + map.put(key, value); + } + + return map; + } +} diff --git a/src/main/java/com/moon/server/service/all/CommonsFileuploadService.java b/src/main/java/com/moon/server/service/all/CommonsFileuploadService.java new file mode 100644 index 0000000..2f30828 --- /dev/null +++ b/src/main/java/com/moon/server/service/all/CommonsFileuploadService.java @@ -0,0 +1,115 @@ +package com.moon.server.service.all; + +import com.moon.server.entity.ctrl.FileInfoEntity; +import com.moon.server.helper.PathHelper; +import com.moon.server.helper.StringHelper; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.fileupload.servlet.ServletFileUpload; +import org.apache.commons.fileupload.servlet.ServletRequestContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * CommonsFileupload涓婁紶鏈嶅姟 + * @author WWW + */ +@Service +public class CommonsFileuploadService { + @Autowired + PathHelper pathHelper; + + private final static Log log = LogFactory.getLog(CommonsFileuploadService.class); + + public Object fileUpload(HttpServletRequest req, HttpServletResponse res) throws Exception { + List<FileItem> items = getFileItem(req, res); + + return copeFileItems(items, req); + } + + /** + * 鑾峰彇鏂囦欢椤� + */ + private List<FileItem> getFileItem(HttpServletRequest req, HttpServletResponse res) throws Exception { + // 澶勭悊涓枃涔辩爜闂 + req.setCharacterEncoding("utf-8"); + // text/html;charset=utf-8 + res.setContentType("application/json;charset=utf-8"); + + // 妫�鏌ヨ姹傛槸/鍚︿负multipart/form-data绫诲瀷 + if (!ServletFileUpload.isMultipartContent(req)) { + throw new RuntimeException("琛ㄥ崟鐨別nctype灞炴�т笉鏄痬ultipart/form-data绫诲瀷"); + } + + // 鍒涘缓涓婁紶鎵�闇�瑕佺殑涓や釜瀵硅薄锛氱鐩樻枃浠跺璞�+鏂囦欢涓婁紶瀵硅薄 + DiskFileItemFactory factory = new DiskFileItemFactory(); + ServletFileUpload sfu = new ServletFileUpload(factory); + ServletRequestContext ctx = new ServletRequestContext(req); + + // 璁剧疆缂栫爜鏂瑰紡 + sfu.setHeaderEncoding("utf-8"); + factory.setSizeThreshold(4096); + + // 鑾峰彇琛ㄥ崟涓殑鎵�鏈夋暟鎹俊鎭� + List<FileItem> list = sfu.parseRequest(ctx); + + return list; + } + + /** + * 澶勭悊瑙f瀽鍐呭锛氬鐞嗘櫘閫氳〃鍗曞煙鍜屾枃浠惰〃鍗曞煙 + */ + private Object copeFileItems(List<FileItem> items, HttpServletRequest req) throws Exception { + Map<String, String> map = new HashMap<String, String>(3); + List<FileInfoEntity> list = new ArrayList<FileInfoEntity>(); + + String path = pathHelper.getTempPath(); + for (FileItem item : items) { + if (item.isFormField()) { + String key = item.getFieldName(); + String value = item.getString("utf-8"); + map.put(key, value); + continue; + } + + FileInfoEntity fi = copeFile(item, path, req); + if (fi != null) { + list.add(fi); + } + } + + return map; + } + + /** + * 澶勭悊鏂囦欢 + */ + private FileInfoEntity copeFile(FileItem item, String path, HttpServletRequest req) { + try { + // 鑾峰彇鏂囦欢鍚嶏紝鍒ゆ柇鏄惁鍚堟硶 + FileInfoEntity fi = new FileInfoEntity(item.getName()); + if (StringHelper.isEmpty(fi.getFileName())) { + return null; + } + + fi.setSize(item.getSize()); + fi.setPath(path + File.separator + fi.getFileName()); + item.write(new File(fi.getPath())); + + return fi; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } + } +} diff --git a/src/main/java/com/moon/server/service/all/PermsService.java b/src/main/java/com/moon/server/service/all/PermsService.java new file mode 100644 index 0000000..af884db --- /dev/null +++ b/src/main/java/com/moon/server/service/all/PermsService.java @@ -0,0 +1,111 @@ +package com.moon.server.service.all; + +import com.moon.server.entity.all.*; +import com.moon.server.entity.sys.MenuEntity; +import com.moon.server.mapper.all.PermsMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * 鎺堟潈鏈嶅姟 + * @author WWW + */ +@Service +public class PermsService implements PermsMapper { + @Autowired + PermsMapper permsMapper; + + @Autowired + RedisService redisService; + + @Override + public List<ResAuthEntity> selectRes(String uid) { + String key = RedisCacheKey.permsResKey(uid); + Object obj = redisService.get(key); + if (obj instanceof List<?>) { + return (List<ResAuthEntity>) obj; + } + + List<ResAuthEntity> list = permsMapper.selectRes(uid); + if (list != null && list.size() > 0) { + redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); + } + + return list; + } + + @Override + public List<MenusAuthEntity> selectMenus(String uid) { + String key = RedisCacheKey.permsMenusKey(uid); + Object obj = redisService.get(key); + if (obj instanceof List<?>) { + return (List<MenusAuthEntity>) obj; + } + + List<MenusAuthEntity> list = permsMapper.selectMenus(uid); + if (list != null && list.size() > 0) { + redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); + } + + return list; + } + + @Override + public List<String> selectPerms(String uid) { + String key = RedisCacheKey.permsPermsKey(uid); + Object obj = redisService.get(key); + if (obj instanceof List<?>) { + return (List<String>) obj; + } + + List<String> list = permsMapper.selectPerms(uid); + if (list != null && list.size() > 0) { + redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); + } + + return list; + } + + @Override + public List<PermsAuthEntity> selectPermsEntity(String uid) { + String key = RedisCacheKey.permsPermsEntityKey(uid); + Object obj = redisService.get(key); + if (obj instanceof List<?>) { + return (List<PermsAuthEntity>) obj; + } + + List<PermsAuthEntity> list = permsMapper.selectPermsEntity(uid); + if (list != null && list.size() > 0) { + redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); + } + + return list; + } + + @Override + public List<Integer> selectRoles(String uid) { + return permsMapper.selectRoles(uid); + } + + @Override + public List<MenuEntity> selectMenuRecursive(int id, String uid) { + return permsMapper.selectMenuRecursive(id, uid); + } + + public void clearResCache() { + redisService.clearKeys(RedisCacheKey.permsResKey("")); + } + + public void clearPermsCache() { + redisService.clearKeys(RedisCacheKey.permsMenusKey("")); + redisService.clearKeys(RedisCacheKey.permsPermsKey("")); + redisService.clearKeys(RedisCacheKey.permsPermsEntityKey("")); + } + + public void clearAllCache() { + redisService.clearKeys(RedisCacheKey.permsRootKey()); + } +} diff --git a/src/main/java/com/moon/server/service/all/RedisService.java b/src/main/java/com/moon/server/service/all/RedisService.java new file mode 100644 index 0000000..9216e48 --- /dev/null +++ b/src/main/java/com/moon/server/service/all/RedisService.java @@ -0,0 +1,96 @@ +package com.moon.server.service.all; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import java.util.Set; +import java.util.concurrent.TimeUnit; + +/** + * Redis鏈嶅姟绫� + * @author WWW + */ +@Service("redisService") +public class RedisService { + @Autowired + private RedisTemplate<String, Object> redisTemplate; + + /** + * 鑾峰彇Redis妯℃澘 + * + * @return + */ + public RedisTemplate<String, Object> getRedisTemplate() { + return redisTemplate; + } + + /** + * 璁剧疆鍊煎埌redis涓� + * + * @param key 閿� + * @param value 鍊� + */ + public void put(String key, Object value) { + redisTemplate.opsForValue().set(key, value); + } + + /** + * 璁剧疆鍊煎埌redis涓�,骞惰缃繃鏈熸椂闂� + * + * @param key 閿� + * @param value 鍊� + * @param timeout 鏃堕棿 + * @param unit 鍗曚綅 + */ + public void put(String key, Object value, long timeout, TimeUnit unit) { + redisTemplate.opsForValue().set(key, value, timeout, unit); + } + + /** + * 鏍规嵁key鑾峰彇value + * + * @param key 閿� + * @return + */ + public Object get(String key) { + return redisTemplate.opsForValue().get(key); + } + + /** + * 鏄惁瀛樺湪key + * + * @param key 閿� + * @return + */ + public boolean hasKey(String key) { + return redisTemplate.hasKey(key); + } + + /** + * 绉婚櫎key + * + * @param key 閿� + */ + public void delete(String key) { + redisTemplate.delete(key); + } + + /** + * 娓呯┖鎸囧畾閿墠缂� + * + * @param subKeyString 閿墠缂� + */ + public void clearKeys(String subKeyString) { + Set<String> keys = redisTemplate.keys(subKeyString + "*"); + redisTemplate.delete(keys); + } + + /** + * 娓呯┖鎵�鏈� + */ + public void clearAll() { + Set<String> keys = redisTemplate.keys("*"); + redisTemplate.delete(keys); + } +} diff --git a/src/main/java/com/moon/server/service/all/ScheduleService.java b/src/main/java/com/moon/server/service/all/ScheduleService.java new file mode 100644 index 0000000..32eb04b --- /dev/null +++ b/src/main/java/com/moon/server/service/all/ScheduleService.java @@ -0,0 +1,249 @@ +package com.moon.server.service.all; + +import com.moon.server.entity.all.RedisCacheKey; +import com.moon.server.entity.sys.LoginEntity; +import com.moon.server.entity.sys.OperateEntity; +import com.moon.server.entity.sys.ResEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.FileHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.sys.LoginService; +import com.moon.server.service.sys.OperateService; +import com.moon.server.service.sys.ResService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Service; + +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.URI; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import oshi.SystemInfo; +import oshi.hardware.CentralProcessor; +import oshi.hardware.GlobalMemory; + +/** + * 鏃ョ▼鏈嶅姟绫� + * @author WWW + */ +@Service +public class ScheduleService { + @Autowired + private ResService resService; + + @Autowired + private LoginService loginService; + + @Autowired + private OperateService operateService; + + @Autowired + private RedisTemplate<String, Object> redisTemplate; + + private static final Log log = LogFactory.getLog(ScheduleService.class); + + /** + * 鏌ヨ鏈嶅姟鍣ㄧ姸鎬� + */ + public JSONObject selectServerStatus() throws InterruptedException { + JSONObject json = new JSONObject(); + json.put("cpuInfo", selectCpuInfo()); + json.put("memInfo", selectMemInfo()); + + return json; + } + + /** + * 鏌ヨCpu淇℃伅 + */ + public JSONObject selectCpuInfo() throws InterruptedException { + SystemInfo systemInfo = new SystemInfo(); + CentralProcessor processor = systemInfo.getHardware().getProcessor(); + long[] prevTicks = processor.getSystemCpuLoadTicks(); + + // 鐫$湢1s + TimeUnit.SECONDS.sleep(1); + long[] ticks = processor.getSystemCpuLoadTicks(); + long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()]; + long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()]; + long softIrq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()]; + long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()]; + long cSys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()]; + long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()]; + long ioWait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()]; + long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()]; + long totalCpu = user + nice + cSys + idle + ioWait + irq + softIrq + steal; + + JSONObject map = new JSONObject(); + map.put("cpuCore", processor.getLogicalProcessorCount()); + map.put("cpuSysUsage", new DecimalFormat("#.##%").format(cSys * 1.0 / totalCpu)); + map.put("cpuUserUsage", new DecimalFormat("#.##%").format(user * 1.0 / totalCpu)); + map.put("cpuRtcWaitUsage", new DecimalFormat("#.##%").format(ioWait * 1.0 / totalCpu)); + map.put("cpuRtcUseUsage", new DecimalFormat("#.##%").format(1.0 - (idle * 1.0 / totalCpu))); + + return map; + } + + /** + * 鏌ヨ鍐呭瓨淇℃伅 + */ + public JSONObject selectMemInfo() { + JSONObject map = new JSONObject(); + SystemInfo systemInfo = new SystemInfo(); + GlobalMemory memory = systemInfo.getHardware().getMemory(); + + // 鎬诲唴瀛� + long totalByte = memory.getTotal(); + + // 鍓╀綑 + long surplusByte = memory.getAvailable(); + map.put("totalMem", FileHelper.formatByte(totalByte)); + map.put("use", FileHelper.formatByte(totalByte - surplusByte)); + map.put("remainMem", FileHelper.formatByte(surplusByte)); + map.put("usage", new DecimalFormat("#.##%").format((totalByte - surplusByte) * 1.0 / totalByte)); + + return map; + } + + /** + * 鏌ヨ鍦ㄧ嚎鐢ㄦ埛 + */ + public List<JSONObject> selectOnlineUsers() { + List<JSONObject> list = new ArrayList<JSONObject>(); + + Set<String> keys = redisTemplate.keys(RedisCacheKey.signUserKey("*")); + for (String key : keys) { + Object obj = redisTemplate.opsForValue().get(key); + if (obj instanceof UserEntity) { + UserEntity ue = (UserEntity) obj; + + JSONObject map = new JSONObject(); + map.put("uid", ue.getUid()); + map.put("uname", ue.getUname()); + map.put("loginTime", ue.getBak()); + + list.add(map); + } + } + + return list; + } + + /** + * 缁熻鍦ㄧ嚎鐢ㄦ埛鏁� + * @return + */ + public int countOnlineUsers() { + Set<String> keys = redisTemplate.keys(RedisCacheKey.signUserKey("*")); + + return null == keys ? 0 : keys.size(); + } + + /** + * 鏌ヨ鏈嶅姟璧勬簮鐘舵�� + */ + public List<ResEntity> selectResStatus() { + List<ResEntity> resList = resService.selectResAll(); + + return testResStatus(resList); + } + + private List<ResEntity> testResStatus(List<ResEntity> resList) { + List<ResEntity> list = new ArrayList<ResEntity>(); + for (ResEntity re : resList) { + Socket socket = new Socket(); + try { + if (StringHelper.isEmpty(re.getServer())) { + list.add(re); + continue; + } + + URI uri = new URI(re.getServer()); + SocketAddress add = new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()); + + // Ping閫氬湴鍧� + socket.connect(add, 2000); + } catch (Exception e) { + log.error(e.getMessage()); + list.add(re); + } finally { + try { + socket.close(); + } catch (Exception ex) { + log.error(ex.getMessage()); + } + } + } + + return list; + } + + /** + * 缁熻鏈嶅姟璧勬簮鐘舵�� + */ + public JSONObject countResStatus() { + List<ResEntity> resList = resService.selectResAll(); + List<ResEntity> unableList = testResStatus(resList); + + JSONObject jsonObject = new JSONObject(); + + // 璧勬簮鍙敤 + jsonObject.put("resAbleCount", resList.size() - unableList.size()); + // 璧勬簮涓嶅彲鐢� + jsonObject.put("resUnableCount", unableList.size()); + + return jsonObject; + } + + /** + * 璧勬簮鎿嶄綔鐘舵�� + */ + public JSONObject operateCount() { + List<OperateEntity> list = operateService.operateCount(); + JSONObject jsonObject = new JSONObject(); + if (list.isEmpty()) { + return null; + } else { + List<JSONObject> lister = new ArrayList<JSONObject>(); + for (OperateEntity key : list) { + JSONObject map = new JSONObject(); + map.put("count", key.getCount()); + map.put("modular2", key.getModular2()); + lister.add(map); + } + jsonObject.put("operateCount", lister); + return jsonObject; + } + } + + /** + * 鐢ㄦ埛鐧诲綍鐘舵�� + */ + public JSONObject userLoginCount() { + List<LoginEntity> list = loginService.selectLoginCounts(); + if (list == null || list.isEmpty()) { + return null; + } + + JSONObject jsonObject = new JSONObject(); + List<JSONObject> lister = new ArrayList<JSONObject>(); + for (LoginEntity key : list) { + JSONObject map = new JSONObject(); + map.put("count", key.getCount()); + map.put("optime", key.getOptime()); + lister.add(map); + } + jsonObject.put("userLoginCount", lister); + + return jsonObject; + } +} diff --git a/src/main/java/com/moon/server/service/all/SignService.java b/src/main/java/com/moon/server/service/all/SignService.java new file mode 100644 index 0000000..2eefeee --- /dev/null +++ b/src/main/java/com/moon/server/service/all/SignService.java @@ -0,0 +1,69 @@ +package com.moon.server.service.all; + +import com.moon.server.config.PropertiesConfig; +import com.moon.server.entity.all.StaticData; +import com.moon.server.helper.WebHelper; +import org.apache.http.Header; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + +/** + * 绛惧悕鏈嶅姟绫� + * @author WWW + */ +@Service +public class SignService { + @Autowired + PropertiesConfig propertiesConfig; + + private final static String SUCCESS = "success"; + + /** + * 鑷姩鐧诲綍Druid + */ + public void loginDruid(HttpServletRequest req, HttpServletResponse res) throws Exception { + List<NameValuePair> list = new ArrayList<>(); + list.add(new BasicNameValuePair("loginUsername", propertiesConfig.getDruidUser())); + list.add(new BasicNameValuePair("loginPassword", propertiesConfig.getDruidPwd())); + + String url = req.getRequestURL().toString().replace("/sign/toDruid", "/druid/submitLogin"); + CloseableHttpClient httpClient = HttpClients.custom().build(); + + UrlEncodedFormEntity postEntity = new UrlEncodedFormEntity(list, StaticData.TEXT_ENCODER); + HttpPost httpPost = new HttpPost(url); + httpPost.setEntity(postEntity); + + CloseableHttpResponse closeResponse = httpClient.execute(httpPost); + HttpEntity entity = closeResponse.getEntity(); + + String rs = EntityUtils.toString(entity, StaticData.TEXT_ENCODER); + if (!SUCCESS.equals(rs)) { + return; + } + + Header[] headers = closeResponse.getAllHeaders(); + for (int i = 0; i < headers.length; i++) { + Header header = headers[i]; + if ("Set-Cookie".equals(header.getName())) { + String val = header.getValue(); + String sessionId = val.substring(val.indexOf("=") + 1, val.indexOf(";")); + WebHelper.saveCookie(StaticData.DRUID_COOKIE_KEY, sessionId, res); + break; + } + } + } +} diff --git a/src/main/java/com/moon/server/service/all/SysService.java b/src/main/java/com/moon/server/service/all/SysService.java new file mode 100644 index 0000000..374fc2d --- /dev/null +++ b/src/main/java/com/moon/server/service/all/SysService.java @@ -0,0 +1,25 @@ +package com.moon.server.service.all; + +import com.moon.server.service.sys.BlacklistService; +import com.moon.server.service.sys.TokenService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 绯荤粺鏈嶅姟绫� + * @author WWW + */ +@Service +public class SysService { + @Autowired + public TokenService tokenService; + + @Autowired + public RedisService redisService; + + @Autowired + public PermsService permsService; + + @Autowired + public BlacklistService blacklistService; +} diff --git a/src/main/java/com/moon/server/service/all/TestService.java b/src/main/java/com/moon/server/service/all/TestService.java new file mode 100644 index 0000000..6d8d2c7 --- /dev/null +++ b/src/main/java/com/moon/server/service/all/TestService.java @@ -0,0 +1,188 @@ +package com.moon.server.service.all; + +import com.moon.server.entity.all.MenusAuthEntity; +import com.moon.server.entity.all.PermsAuthEntity; +import com.moon.server.entity.all.ResAuthEntity; +import com.moon.server.entity.data.CoordEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.data.MetaFileEntity; +import com.moon.server.helper.*; +import com.moon.server.service.data.MetaService; +import com.moon.server.service.data.UploadService; +import com.moon.server.service.sys.ArgsService; +import com.moon.server.service.sys.BlacklistService; +import com.moon.server.service.sys.ReportService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * 娴嬭瘯鏈嶅姟绫� + * @author WWW + */ +@Service +@SuppressWarnings("AlibabaRemoveCommentedCode") +public class TestService { + @Autowired + PathHelper pathHelper; + + @Autowired + ArgsService argsService; + + @Autowired + PermsService permsService; + + @Autowired + BlacklistService blacklistService; + + @Autowired + BaseQueryService baseQueryService; + + @Autowired + Environment env; + + @Autowired + ReportService reportService; + + @Autowired + UploadService uploadService; + + @Autowired + MetaService metaService; + + private final static Log log = LogFactory.getLog(TestService.class); + + public void testGdal() { + GdalHelper.readTif("E:\\data\\7.Insar\\insartest.tif"); + GdalHelper.readShp("E:\\data\\13.cppe\\shps\\addr.shp"); + GdalHelper.readGdb("E:\\Test\\addr.gdb"); + //GdalHelper.readShpFirstRecord("D:\\LF\\data\\shp\\extent.shp"); + RsaHelper.generate(); + //FloatServerController.test(); + + testReadExcel(); + 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"); + } + + public void testMeta() { + List<MetaEntity> list = metaService.selectByIdsForTab("1501,1500,1491,1492"); + String sql = metaService.getDelTabsSql(list); + } + + public void testReadShp() { + MetaFileEntity mf = new MetaFileEntity(); + //mf.setPath("D:\\model_data\\m_sitepoint.shp"); + mf.setPath("D:\\shpto\\m_sitepoint.shp"); + mf.setEntity("msitepoint"); + mf.setGuid("msitepoint"); + mf.setTab("bs.m_sitepoint"); + mf.setExtName(".shp"); + + uploadService.loadSpatialData(mf); + } + + public 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); + } + } + + public void testPerms() { + List<ResAuthEntity> raeList = permsService.selectRes("admin"); + List<ResAuthEntity> raeList2 = permsService.selectRes("admin"); + + List<MenusAuthEntity> maeList = permsService.selectMenus("admin"); + List<MenusAuthEntity> maeList2 = permsService.selectMenus("admin"); + + List<String> pList = permsService.selectPerms("admin"); + List<String> pList2 = permsService.selectPerms("admin"); + + List<PermsAuthEntity> pauList = permsService.selectPermsEntity("admin"); + List<PermsAuthEntity> pauList2 = permsService.selectPermsEntity("admin"); + + permsService.clearResCache(); + permsService.clearPermsCache(); + + raeList = permsService.selectRes("admin"); + maeList = permsService.selectMenus("admin"); + pList = permsService.selectPerms("admin"); + pauList = permsService.selectPermsEntity("admin"); + permsService.clearAllCache(); + } + + public void testBlacklist() { + List<String> list1 = blacklistService.selectIpList(1); + List<String> list2 = blacklistService.selectIpList(1); + List<String> list3 = blacklistService.selectIpList(2); + List<String> list4 = blacklistService.selectIpList(2); + blacklistService.clearCache(); + List<String> list5 = blacklistService.selectIpList(1); + } + + public void testReadExcel() { + List<?> listMdZxcg = ExcelHelper.readExcel(CoordEntity.class, "D:\\LF\\data\\xls\\娴嬬粯\\1-椤圭洰鎴愭灉-瑗夸笁涓璡\1-1涓嚎鎴愭灉琛╘\娴峰師鍘夸腑绾挎垚鏋滆〃.xlsx"); + int r1 = listMdZxcg.size(); + + //List<MdGdcgEntity> listGdcg = ExcelHelper.readExcel(MdGdcgEntity.class, "D:\\LF\\data\\xls\\娴嬬粯\\2-鍦颁笅绠$嚎鎺㈡祴鎴愭灉\\2-2 绠$嚎鎴愭灉琛�.xlsx"); + //int r2 = listGdcg.size(); + + String entityName = "Gxcg"; + String xls = "D:\\LF\\data\\xls\\娴嬬粯\\2-鍦颁笅绠$嚎鎺㈡祴鎴愭灉\\2-2 绠$嚎鎴愭灉琛�.xlsx"; + + String className = "com.lf.server.entity.bs." + entityName; + Object obj = ClassHelper.createInstance(className); + + List<?> list = ExcelHelper.readExcel(obj.getClass(), xls); + int r3 = list.size(); + } + + public void testAccess() { + List<Map<String, Object>> list = AccessHelper.readMdb("D:\\LF\\data\\test.mdb", "", ""); + int count = null == list || list.isEmpty() ? 0 : list.size(); + } + + public void testMd5() { + try { + String file = "E:\\data\\mpt\\A4mpt20131125.mpt"; + + long stime = System.currentTimeMillis(); + // 2a0befb05146cd30213ee4b95038aca0 + String md51 = FileHelper.getFileMd5(file); + long etime = System.currentTimeMillis(); + String s1 = String.format("鎵ц鏃堕暱锛�%d 姣.", (etime - stime)); + + stime = System.currentTimeMillis(); + // 2a0befb05146cd30213ee4b95038aca0 + String md52 = FileHelper.getMd5ByJdk(file); + etime = System.currentTimeMillis(); + String s2 = String.format("鎵ц鏃堕暱锛�%d 姣.", (etime - stime)); + + stime = System.currentTimeMillis(); + // 9f1b7f050f41598710ffc08252484397 + String md53 = FileHelper.getFastMd5(file); + etime = System.currentTimeMillis(); + String s3 = String.format("鎵ц鏃堕暱锛�%d 姣.", (etime - stime)); + + etime = System.currentTimeMillis(); + } catch (Exception ex) { + // + } + } +} diff --git a/src/main/java/com/moon/server/service/all/UploadAttachService.java b/src/main/java/com/moon/server/service/all/UploadAttachService.java new file mode 100644 index 0000000..ff752c5 --- /dev/null +++ b/src/main/java/com/moon/server/service/all/UploadAttachService.java @@ -0,0 +1,515 @@ +package com.moon.server.service.all; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.moon.server.controller.all.BaseController; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.SettingData; +import com.moon.server.entity.ctrl.KeyValueEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.data.MetaFileEntity; +import com.moon.server.entity.sys.AttachEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.mapper.data.DownloadMapper; +import com.moon.server.service.sys.AttachService; +import com.moon.server.entity.all.BaseEntity; +import com.moon.server.entity.all.StaticData; +import com.moon.server.helper.*; +import net.lingala.zip4j.ZipFile; +import net.lingala.zip4j.model.FileHeader; +import net.lingala.zip4j.model.ZipParameters; +import org.apache.commons.io.FileUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.lang.reflect.Field; +import java.util.*; + +/** + * 涓婁紶闄勪欢鏈嶅姟绫� + * @author WWW + */ +@Service +public class UploadAttachService { + @Autowired + PathHelper pathHelper; + + @Autowired + AttachService attachService; + + @Autowired + DownloadMapper downloadMapper; + + private static String tabs = "''"; + + public final static Map<String, String> ATTACH_TABS = new HashMap<>(); + + private final static Log log = LogFactory.getLog(UploadAttachService.class); + + /** + * 鑾峰彇琛ㄥ悕 + */ + public static String getTabs() { + return tabs; + } + + /** + * 鍒濆鍖栭檮浠惰〃 + */ + public static void init(String cfg) { + if (StringHelper.isEmpty(cfg)) { + return; + } + + String[] strs = cfg.split(StaticData.COMMA); + if (strs.length == 0) { + return; + } + + List<String> keys = new ArrayList<>(); + for (String str : strs) { + if (ATTACH_TABS.containsKey(str)) { + continue; + } + + ATTACH_TABS.put(str, str.contains("bd.") ? "materiname" : "photono"); + keys.add("'" + str + "'"); + } + tabs = StringHelper.join(keys, ","); + } + + /** + * 涓婁紶鏂囦欢 + */ + public ResponseMsg<String> upload(UserEntity ue, String tab, MultipartFile file, BaseController ctrl) { + try { + if (file == null && file.isEmpty()) { + return ctrl.fail("鏂囦欢涓婁紶涓虹┖", null); + } + if (file.getSize() > SettingData.MAX_FILE_SIZE) { + return ctrl.fail(String.format("鏂囦欢澶т簬 %d MB", SettingData.MAX_FILE_SIZE / 1024 / 1024), null); + } + + // 浼犺緭鏂囦欢 + String oldName = file.getOriginalFilename(); + String filePath = pathHelper.getTempPath() + File.separator + oldName; + File newFile = new File(filePath); + file.transferTo(newFile); + double sizes = FileHelper.sizeToMb(file.getSize()); + + // 鑾峰彇MD5 + String md5 = FileHelper.getFileMd5(filePath); + AttachEntity entity = attachService.selectByGuid(md5); + if (entity != null) { + newFile.delete(); + return ctrl.success("鏂囦欢宸插瓨鍦�", md5); + } + + AttachEntity ae = getAttachEntity(ue, tab, oldName, md5, sizes); + String targetPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); + newFile.renameTo(new File(targetPath)); + + int rows = attachService.insert(ae); + + return rows > 0 ? ctrl.success(md5) : ctrl.fail("淇濆瓨鏂囦欢澶辫触", null); + } catch (Exception ex) { + return ctrl.fail(ex.getMessage(), null); + } + } + + /** + * 鑾峰彇闄勪欢瀹炰綋绫� + */ + protected AttachEntity getAttachEntity(UserEntity ue, String tab, String oldName, String md5, double sizes) { + AttachEntity entity = new AttachEntity(); + entity.setName(oldName); + entity.setTab(tab); + entity.setGuid(md5); + String subPath = PathHelper.getUploadPath() + File.separator + md5 + FileHelper.getExtension(oldName); + entity.setPath(subPath); + entity.setSizes(sizes); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + return entity; + } + + /** + * 涓嬭浇鏂囦欢 + */ + public void download(String guid, HttpServletResponse res) { + download(guid, false, res); + } + + /** + * 涓嬭浇鏂囦欢 + */ + public void download(String guid, boolean inline, HttpServletResponse res) { + try { + if (StringHelper.isEmpty(guid)) { + WebHelper.writeStr2Page(res, StaticData.NO_FILE); + return; + } + + AttachEntity entity = attachService.selectByGuid(guid); + if (entity == null) { + WebHelper.writeStr2Page(res, StaticData.NO_FILE); + return; + } + + String filePath = pathHelper.getConfig().getUploadPath() + File.separator + entity.getPath(); + File file = new File(filePath); + if (!file.exists() || file.isDirectory()) { + WebHelper.writeJson2Page(res, "鏂囦欢涓嶅瓨鍦�"); + } + + WebHelper.download(filePath, entity.getName(), inline, res); + } catch (Exception ex) { + WebHelper.writeJson2Page(res, "鏂囦欢涓嬭浇鍑洪敊"); + log.error(ex.getMessage(), ex); + } + } + + /** + * 涓婁紶Excel闄勪欢 + */ + public List<KeyValueEntity> uploadXlsAnnex(UserEntity ue, List<MetaEntity> ms, List<MetaFileEntity> list, String path) { + List<String> files = getAttachFiles(list, path); + if (files.size() == 0) { + return null; + } + + List<KeyValueEntity> rs = new ArrayList<>(); + for (MetaEntity meta : ms) { + int rows = uploadXlsAnnex(ue, meta, files); + rs.add(new KeyValueEntity(meta.getName(), String.valueOf(rows))); + } + + return rs; + } + + /** + * 鑾峰彇闄勪欢鏂囦欢 + */ + private List<String> getAttachFiles(List<MetaFileEntity> list, String path) { + List<String> files = new ArrayList<>(); + + for (MetaFileEntity mf : list) { + if (mf.getName().contains(StaticData.ZIP)) { + List<String> subs = getZipFiles(mf, path); + if (null != subs && subs.size() > 0) { + files.addAll(subs); + } + continue; + } + + files.add(mf.getPath()); + } + + return files; + } + + /** + * 鑾峰彇zip涓殑鏂囦欢 + */ + private List<String> getZipFiles(MetaFileEntity mf, String path) { + File file = new File(mf.getPath()); + if (!file.exists() || file.isDirectory()) { + return null; + } + + File zipFolder = new File(pathHelper.getConfig().getTempPath() + File.separator + path + "_zip"); + if (!zipFolder.exists() || !zipFolder.isDirectory()) { + zipFolder.mkdirs(); + } + + String subPath = zipFolder + File.separator + mf.getName().toLowerCase().replace(".zip", ""); + ZipHelper.unzip(mf.getPath(), subPath); + + List<String> files = new ArrayList<>(); + getFilesByPath(files, subPath); + + return files; + } + + /** + * 鏍规嵁璺緞鑾峰彇鏂囦欢 + */ + private void getFilesByPath(List<String> list, String path) { + File file = new File(path); + if (!file.isDirectory()) { + list.add(file.getPath()); + return; + } + + File[] files = file.listFiles(); + if (null == files) { + return; + } + + for (File f : files) { + if (f.isDirectory()) { + getFilesByPath(list, f.getPath()); + } else { + list.add(f.getPath()); + } + } + } + + /** + * 涓婁紶Excel闄勪欢 + */ + private int uploadXlsAnnex(UserEntity ue, MetaEntity meta, List<String> files) { + List<?> list = queryXlsData(meta); + if (null == list || list.size() == 0) { + return 0; + } + + Field field = getAnnexField(list.get(0), meta.getTab()); + String folder = meta.getName().split("\\.")[0].trim().toLowerCase() + File.separator; + + int rows = 0; + for (Object obj : list) { + String[] names = getNames(getAnnexName(obj, field)); + if (null == names || names.length == 0) { + continue; + } + + for (String name : names) { + String file = findAnnexFile(name, folder, files); + if (null == file) { + continue; + } + + rows += insertXlsAnnex(ue, meta, (BaseEntity) obj, file); + } + } + + return rows; + } + + /** + * 鑾峰彇鍚嶇О + */ + public static String[] getNames(String str) { + if (StringHelper.isEmpty(str)) { + return null; + } + + return str.replace("锛�", ",").replace("锛�", ",").split(","); + } + + /** + * 鏌ヨExcel鏁版嵁 + */ + private List<?> queryXlsData(MetaEntity meta) { + String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); + BasicMapper basicMapper = ClassHelper.getBasicMapper(entity); + if (null == basicMapper) { + return null; + } + + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("parentid", meta.getEventid()); + + List<?> list = basicMapper.selectList(wrapper); + if (null == list || list.size() == 0) { + return null; + } + if (!(list.get(0) instanceof BaseEntity)) { + return null; + } + + return list; + } + + /** + * 鑾峰彇闄勪欢瀛楁 + */ + public static Field getAnnexField(Object obj, String tab) { + try { + String str = ATTACH_TABS.get(tab); + + Field field = obj.getClass().getDeclaredField(str); + field.setAccessible(true); + + return field; + } catch (Exception ex) { + return null; + } + } + + /** + * 鑾峰彇闄勪欢鍚嶇О + */ + public static String getAnnexName(Object obj, Field field) { + try { + Object val = field.get(obj); + + return null == val ? null : val.toString().trim(); + } catch (Exception ex) { + return null; + } + } + + /** + * 鏌ユ壘闄勪欢鏂囦欢 + */ + private String findAnnexFile(String name, String folder, List<String> files) { + name = File.separator + name.split("\\.")[0].trim().toLowerCase(); + for (String file : files) { + if (file.toLowerCase().contains(folder) && file.toLowerCase().contains(name)) { + return file; + } + } + for (String file : files) { + if (file.toLowerCase().contains(name)) { + return file; + } + } + + return null; + } + + /** + * 鎻掑叆Excel闄勪欢 + */ + private int insertXlsAnnex(UserEntity ue, MetaEntity meta, BaseEntity be, String file) { + File f = new File(file); + if (!f.exists() || f.isDirectory()) { + return 0; + } + + String md5 = FileHelper.getFileMd5(file); + AttachEntity old = attachService.selectByTabAndGuid(meta.getTab(), be.getEventid(), md5); + if (null != old) { + return 0; + } + + String fileName = FileHelper.getFileName(file); + double sizes = FileHelper.sizeToMb(f.length()); + + AttachEntity ae = getAttachEntity(ue, meta.getTab(), be.getEventid(), fileName, md5, sizes); + String targetPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); + + try { + FileUtils.copyFile(f, new File(targetPath)); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + + return attachService.insert(ae); + } + + /** + * 鑾峰彇闄勪欢瀹炰綋绫� + */ + protected AttachEntity getAttachEntity(UserEntity ue, String tabName, String eventid, String fileName, String md5, double sizes) { + AttachEntity entity = new AttachEntity(); + entity.setTab(tabName); + entity.setTabGuid(eventid); + entity.setName(fileName); + entity.setGuid(md5); + String subPath = PathHelper.getUploadPath() + File.separator + md5 + FileHelper.getExtension(fileName); + entity.setPath(subPath); + entity.setSizes(sizes); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + return entity; + } + + /** + * 璇锋眰涓嬭浇 + */ + public String downloadReqForGuids(UserEntity ue, List<String> guids) { + List<AttachEntity> list = attachService.selectByGuids(guids); + + return downloadReq(ue, list); + } + + /** + * 璇锋眰涓嬭浇 + */ + public String downloadReqForTabGuids(UserEntity ue, String tab, List<String> guids) { + List<AttachEntity> list = attachService.selectByTabGuids(tab, guids); + + return downloadReq(ue, list); + } + + /** + * 璇锋眰涓嬭浇 + */ + protected String downloadReq(UserEntity ue, List<AttachEntity> list) { + if (null == list || list.isEmpty()) { + return null; + } + + String zipName = StringHelper.YMDHMS2_FORMAT.format(new Date()) + ".zip"; + String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName; + + ZipFile zip = Zip4jHelper.createZipFile(zipFile, null); + ZipParameters params = Zip4jHelper.getZipParams(false); + addZipFiles(zip, params, list); + + DownloadEntity downloadEntity = getDownloadEntity(ue, zipFile, null); + int rows = downloadMapper.insert(downloadEntity); + + return rows > 0 ? downloadEntity.getGuid() : null; + } + + /** + * 娣诲姞Zip鏂囦欢 + */ + private void addZipFiles(ZipFile zip, ZipParameters params, List<AttachEntity> list) { + int i = 1; + String uploadPath = pathHelper.getConfig().getUploadPath(); + for (AttachEntity ae : list) { + try { + String filePath = uploadPath + File.separator + ae.getPath(); + + File file = new File(filePath); + if (!file.exists() || file.isDirectory()) { + continue; + } + + zip.addFile(file, params); + FileHeader header = zip.getFileHeader(file.getName()); + if (null != header) { + zip.renameFile(header, i + "_" + ae.getName()); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } + + /** + * 鑾峰彇涓嬭浇瀹炰綋绫� + */ + private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { + DownloadEntity de = new DownloadEntity(); + de.setName(FileHelper.getFileName(file)); + // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 + de.setType(7); + de.setSizes(FileHelper.sizeToMb(new File(file).length())); + de.setDepid(ue.getDepid()); + de.setDcount(0); + de.setPwd(pwd); + de.setUrl(FileHelper.getRelativePath(file)); + de.setDescr("闄勪欢鏂囦欢"); + de.setGuid(FileHelper.getFileMd5(file)); + de.setCreateUser(ue.getId()); + // de.setGeom(null) + + return de; + } +} diff --git a/src/main/java/com/moon/server/service/all/WebSocketService.java b/src/main/java/com/moon/server/service/all/WebSocketService.java new file mode 100644 index 0000000..2d3d690 --- /dev/null +++ b/src/main/java/com/moon/server/service/all/WebSocketService.java @@ -0,0 +1,130 @@ +package com.moon.server.service.all; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import javax.websocket.*; +import javax.websocket.server.ServerEndpoint; +import java.io.IOException; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * WebSocket鏈嶅姟绫� + * @author WWW + */ +@ServerEndpoint(value = "/ws/select") +@Component +public class WebSocketService { + @PostConstruct + public void init() { + System.out.println("websocket 鍔犺浇"); + } + + private final static Logger log = LoggerFactory.getLogger(WebSocketService.class); + + private static final AtomicInteger ONLINE_COUNT = new AtomicInteger(0); + + /** + * 鐢ㄦ潵瀛樻斁姣忎釜瀹㈡埛绔搴旂殑Session瀵硅薄锛堢嚎绋嬪畨鍏⊿et锛� + */ + private final static CopyOnWriteArraySet<Session> SESSION_SET = new CopyOnWriteArraySet<Session>(); + + /** + * 杩炴帴寤虹珛鎴愬姛璋冪敤鐨勬柟娉� + */ + @OnOpen + public void onOpen(Session session) { + SESSION_SET.add(session); + + int cnt = ONLINE_COUNT.incrementAndGet(); + log.info("鏈夎繛鎺ュ姞鍏ワ紝褰撳墠杩炴帴鏁颁负锛歿}", cnt); + sendMessage(session, "杩炴帴鎴愬姛"); + } + + /** + * 杩炴帴鍏抽棴璋冪敤鐨勬柟娉� + */ + @OnClose + public void onClose(Session session) { + SESSION_SET.remove(session); + + int cnt = ONLINE_COUNT.decrementAndGet(); + log.info("鏈夎繛鎺ュ叧闂紝褰撳墠杩炴帴鏁颁负锛歿}", cnt); + } + + /** + * 鏀跺埌瀹㈡埛绔秷鎭悗璋冪敤鐨勬柟娉� + * + * @param message 瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅 + */ + @OnMessage + public void onMessage(String message, Session session) { + log.info("鏉ヨ嚜瀹㈡埛绔殑娑堟伅锛歿}", message); + sendMessage(session, "鏀跺埌娑堟伅锛屾秷鎭唴瀹癸細" + message); + } + + /** + * 鍑虹幇閿欒 + * + * @param session + * @param error + */ + @OnError + public void onError(Session session, Throwable error) { + log.error("鍙戠敓閿欒锛歿}锛孲ession ID锛� {}", error.getMessage(), session.getId()); + } + + /** + * 鍙戦�佹秷鎭紝瀹炶返琛ㄦ槑锛屾瘡娆℃祻瑙堝櫒鍒锋柊锛宻ession浼氬彂鐢熷彉鍖栥�� + * + * @param session + * @param message + */ + public static void sendMessage(Session session, String message) { + try { + session.getBasicRemote().sendText(String.format("%s", message)); + } catch (Exception ex) { + log.error("鍙戦�佹秷鎭嚭閿欙細{}", ex.getMessage()); + } + } + + /** + * 缇ゅ彂娑堟伅 + * + * @param message + * @throws IOException + */ + public static void broadCastInfo(String message) throws IOException { + for (Session session : SESSION_SET) { + if (session.isOpen()) { + sendMessage(session, message); + } + } + } + + /** + * 鎸囧畾Session鍙戦�佹秷鎭� + * + * @param sessionId + * @param message + * @throws IOException + */ + public static void sendMessage(String message, String sessionId) throws IOException { + Session session = null; + for (Session s : SESSION_SET) { + if (s.getId().equals(sessionId)) { + session = s; + break; + } + } + + if (session != null) { + sendMessage(session, message); + } else { + log.info("娌℃湁鎵惧埌浣犳寚瀹欼D鐨勪細璇濓細{}", sessionId); + } + } +} diff --git a/src/main/java/com/moon/server/service/data/DataQueryService.java b/src/main/java/com/moon/server/service/data/DataQueryService.java new file mode 100644 index 0000000..914e417 --- /dev/null +++ b/src/main/java/com/moon/server/service/data/DataQueryService.java @@ -0,0 +1,92 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.all.SettingData; +import com.moon.server.entity.sys.AttachEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.FileHelper; +import com.moon.server.helper.PathHelper; +import com.moon.server.service.sys.AttachService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * 鏁版嵁妫�绱㈡湇鍔� + * @author WWW + */ +@Service +public class DataQueryService { + @Autowired + PathHelper pathHelper; + + @Autowired + AttachService attachService; + + /** + * 涓婁紶鏂囦欢 + */ + public Integer uploadFiles(UserEntity ue, String tabName, String eventid, MultipartFile[] files, HttpServletRequest req) throws IOException { + List<AttachEntity> list = new ArrayList<AttachEntity>(); + for (MultipartFile file : files) { + if (file.getSize() > SettingData.MAX_FILE_SIZE) { + continue; + } + + // 浼犺緭鏂囦欢 + String fileName = file.getOriginalFilename(); + String filePath = pathHelper.getTempPath() + File.separator + fileName; + File newFile = new File(filePath); + file.transferTo(newFile); + double sizes = FileHelper.sizeToMb(file.getSize()); + + // 鑾峰彇MD5 + String md5 = FileHelper.getFileMd5(filePath); + AttachEntity entity = attachService.selectByGuid(md5); + + AttachEntity ae = getAttachEntity(ue, tabName, eventid, fileName, md5, sizes); + if (entity != null) { + ae.setPath(entity.getPath()); + + String oldPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); + File f = new File(oldPath); + if (!f.exists() || f.isDirectory()) { + newFile.renameTo(new File(oldPath)); + } else { + newFile.delete(); + } + } else { + String targetPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); + newFile.renameTo(new File(targetPath)); + } + + list.add(ae); + } + + return attachService.inserts(list); + } + + /** + * 鑾峰彇闄勪欢瀹炰綋绫� + */ + protected AttachEntity getAttachEntity(UserEntity ue, String tabName, String eventid, String fileName, String md5, double sizes) { + AttachEntity entity = new AttachEntity(); + entity.setTab(tabName); + entity.setTabGuid(eventid); + entity.setName(fileName); + entity.setGuid(md5); + String subPath = PathHelper.getUploadPath() + File.separator + md5 + FileHelper.getExtension(fileName); + entity.setPath(subPath); + entity.setSizes(sizes); + if (ue != null) { + entity.setCreateUser(ue.getId()); + } + + return entity; + } +} diff --git a/src/main/java/com/moon/server/service/data/DictService.java b/src/main/java/com/moon/server/service/data/DictService.java new file mode 100644 index 0000000..c599ca7 --- /dev/null +++ b/src/main/java/com/moon/server/service/data/DictService.java @@ -0,0 +1,78 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.ctrl.TabEntity; +import com.moon.server.entity.data.DictEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.data.DictMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 瀛楀吀 + * @author WWW + */ +@Service +public class DictService implements DictMapper { + @Autowired + DictMapper dictMapper; + + @Override + public Integer selectCount(String ns, String tab) { + ns = StringHelper.isNull(ns) ? null : ns.trim(); + tab = StringHelper.getLikeUpperStr(tab); + + return dictMapper.selectCount(ns, tab); + } + + @Override + public List<DictEntity> selectByPage(String ns, String tab, Integer limit, Integer offset) { + ns = StringHelper.isNull(ns) ? null : ns.trim(); + tab = StringHelper.getLikeUpperStr(tab); + + return dictMapper.selectByPage(ns, tab, limit, offset); + } + + @Override + public DictEntity selectById(int id) { + return dictMapper.selectById(id); + } + + @Override + public List<TabEntity> selectDictTab(String name, String field) { + name = StringHelper.getLikeUpperStr(name); + + return dictMapper.selectDictTab(name, field); + } + + @Override + public Integer insert(DictEntity entity) { + return dictMapper.insert(entity); + } + + @Override + public Integer inserts(List<DictEntity> list) { + return dictMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return dictMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return dictMapper.deletes(ids); + } + + @Override + public Integer update(DictEntity entity) { + return dictMapper.update(entity); + } + + @Override + public Integer updates(List<DictEntity> list) { + return dictMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/data/DirService.java b/src/main/java/com/moon/server/service/data/DirService.java new file mode 100644 index 0000000..61ed8db --- /dev/null +++ b/src/main/java/com/moon/server/service/data/DirService.java @@ -0,0 +1,129 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.data.DirEntity; +import com.moon.server.helper.PathHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.Zip4jHelper; +import com.moon.server.mapper.data.DirMapper; +import net.lingala.zip4j.ZipFile; +import net.lingala.zip4j.model.ZipParameters; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.List; + +/** + * dir + * @author sws + * @date 2022-09-24 + */ + +@Service +public class DirService implements DirMapper { + @Autowired + PathHelper pathHelper; + + @Autowired + DirMapper dirMapper; + + @Override + public Integer insert(DirEntity dirEntity) { + return dirMapper.insert(dirEntity); + } + + @Override + public Integer inserts(List<DirEntity> dirEntity) { + return dirMapper.inserts(dirEntity); + } + + @Override + public Integer deleteDir(int id) { + return dirMapper.deleteDir(id); + } + + @Override + public Integer deleteDirs(List<Integer> ids) { + return dirMapper.deleteDirs(ids); + } + + @Override + public Integer update(DirEntity dirEntity) { + return dirMapper.update(dirEntity); + } + + @Override + public Integer updates(List<DirEntity> dirEntity) { + return dirMapper.updates(dirEntity); + } + + @Override + public DirEntity selectDir(int id) { + return dirMapper.selectDir(id); + } + + @Override + public DirEntity selectByCode(String code) { + return dirMapper.selectByCode(code); + } + + @Override + public List<DirEntity> selectDirAll() { + return dirMapper.selectDirAll(); + } + + @Override + public List<DirEntity> selectDirRoot() { + return dirMapper.selectDirRoot(); + } + + @Override + public List<DirEntity> selectProject(String name) { + name = StringHelper.getLikeUpperStr(name); + + return dirMapper.selectProject(name); + } + + @Override + public List<DirEntity> selectRecursiveById(Integer id) { + return dirMapper.selectRecursiveById(id); + } + + @Override + public List<DirEntity> selectDirsForPrj() { + return dirMapper.selectDirsForPrj(); + } + + /** + * 鍒涘缓鏁版嵁鐩綍 + */ + public String createDirs(int id) throws Exception { + List<DirEntity> list = selectRecursiveById(id); + if (null == list || list.isEmpty()) { + return null; + } + + String tempPath = pathHelper.getTempPath(); + for (DirEntity dir : list) { + String path = tempPath + File.separator + dir.getFullName(); + File f = new File(path); + if (f.exists() && f.isDirectory()) { + continue; + } + + f.mkdirs(); + } + + File file = new File(tempPath + File.separator + list.get(0).getName()); + if (!file.exists() || !file.isDirectory()) { + file.mkdirs(); + } + + String zipFile = tempPath + File.separator + list.get(0).getName() + ".zip"; + ZipFile zip = Zip4jHelper.createZipFile(zipFile, null); + ZipParameters params = Zip4jHelper.getZipParams(false); + zip.addFolder(file, params); + + return zipFile; + } +} diff --git a/src/main/java/com/moon/server/service/data/DomainService.java b/src/main/java/com/moon/server/service/data/DomainService.java new file mode 100644 index 0000000..a18e467 --- /dev/null +++ b/src/main/java/com/moon/server/service/data/DomainService.java @@ -0,0 +1,78 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.data.DomainEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.data.DomainMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鍊煎煙 + * @author WWW + */ +@Service +public class DomainService implements DomainMapper { + @Autowired + DomainMapper domainMapper; + + @Override + public Integer selectCount(String ns, String tab, String name) { + name = StringHelper.getLikeUpperStr(name); + + return domainMapper.selectCount(ns, tab, name); + } + + @Override + public List<DomainEntity> selectByPage(String ns, String tab, String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return domainMapper.selectByPage(ns, tab, name, limit, offset); + } + + @Override + public List<DomainEntity> selectAll() { + return domainMapper.selectAll(); + } + + @Override + public DomainEntity selectById(int id) { + return domainMapper.selectById(id); + } + + @Override + public List<String> selectDomainNames(String ns, String tab) { + return domainMapper.selectDomainNames(ns, tab); + } + + @Override + public Integer insert(DomainEntity entity) { + return domainMapper.insert(entity); + } + + @Override + public Integer inserts(List<DomainEntity> list) { + return domainMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return domainMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return domainMapper.deletes(ids); + } + + @Override + public Integer update(DomainEntity entity) { + return domainMapper.update(entity); + } + + @Override + public Integer updates(List<DomainEntity> list) { + return domainMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/data/DownloadService.java b/src/main/java/com/moon/server/service/data/DownloadService.java new file mode 100644 index 0000000..09f7dce --- /dev/null +++ b/src/main/java/com/moon/server/service/data/DownloadService.java @@ -0,0 +1,173 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.all.AbstractPwdEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.show.PipelineEntity; +import com.moon.server.helper.PathHelper; +import com.moon.server.helper.RsaHelper; +import com.moon.server.mapper.data.DownloadMapper; +import com.moon.server.helper.StringHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.*; + +/** + * 涓嬭浇璁板綍 + * @author WWW + */ +@Service +public class DownloadService implements DownloadMapper { + @Autowired + PathHelper pathHelper; + + @Autowired + DownloadMapper downloadMapper; + + private final static Log log = LogFactory.getLog(DownloadService.class); + + @Override + public Integer selectCount(String name) { + name = StringHelper.getLikeUpperStr(name); + + return downloadMapper.selectCount(name); + } + + @Override + public List<DownloadEntity> selectByPage(String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return downloadMapper.selectByPage(name, limit, offset); + } + + @Override + public Integer selectCountForUser(Integer createUser, String types, String name) { + name = StringHelper.getLikeUpperStr(name); + + return downloadMapper.selectCountForUser(createUser, types, name); + } + + @Override + public List<DownloadEntity> selectByPageForUser(Integer createUser, String types, String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return downloadMapper.selectByPageForUser(createUser, types, name, limit, offset); + } + + @Override + public List<DownloadEntity> selectAll() { + return downloadMapper.selectAll(); + } + + @Override + public DownloadEntity selectById(int id) { + return downloadMapper.selectById(id); + } + + @Override + public DownloadEntity selectByGuid(String guid) { + return downloadMapper.selectByGuid(guid); + } + + @Override + public Integer insert(DownloadEntity entity) { + return downloadMapper.insert(entity); + } + + @Override + public Integer inserts(List<DownloadEntity> list) { + return downloadMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return downloadMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return downloadMapper.deletes(ids); + } + + @Override + public Integer update(DownloadEntity entity) { + return downloadMapper.update(entity); + } + + @Override + public Integer updates(List<DownloadEntity> list) { + return downloadMapper.updates(list); + } + + /** + * 鑾峰彇涓嬭浇鏂囦欢璺緞 + * + * @param de 涓嬭浇瀹炰綋绫� + * @return 涓嬭浇鏂囦欢璺緞 + */ + public String getDownloadFilePath(DownloadEntity de) { + return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); + } + + /** + * 瑙e瘑 + * + * @param entity 瀵嗙爜鎶借薄绫� + * @return 鏄�/鍚﹁В瀵嗘垚鍔� + */ + public static boolean decryptPwd(AbstractPwdEntity entity) { + try { + String pwd = RsaHelper.decrypt(entity.getPwd()); + if (StringHelper.isEmpty(pwd)) { + return false; + } + + entity.setPwd(pwd); + + return true; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return false; + } + } + + /** + * 瑙e瘑 + * + * @param pe 绠¢亾鍒嗘瀽瀹炰綋绫� + * @return 鏄�/鍚﹁В瀵嗘垚鍔� + */ + public static boolean decryptPwd(PipelineEntity pe) { + try { + String pwd = RsaHelper.decrypt(pe.getPwd()); + if (StringHelper.isEmpty(pwd)) { + return false; + } + + pe.setPwd(pwd); + + return true; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return false; + } + } + + /** + * 瑙e瘑 + * + * @param pwd 鍔犲瘑瀵嗙爜 + * @return 鍘熷瀵嗙爜 + */ + public static String decryptPwd(String pwd) { + try { + return RsaHelper.decrypt(pwd); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } + } +} diff --git a/src/main/java/com/moon/server/service/data/FmeService.java b/src/main/java/com/moon/server/service/data/FmeService.java new file mode 100644 index 0000000..12db7fc --- /dev/null +++ b/src/main/java/com/moon/server/service/data/FmeService.java @@ -0,0 +1,344 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.ctrl.FmeReqEntity; +import com.moon.server.entity.ctrl.NameValueEntity; +import com.moon.server.entity.ctrl.RegisterEntity; +import com.moon.server.entity.data.MetaFileEntity; +import com.moon.server.helper.RestHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * FME鏈嶅姟绫� + * @author WWW + */ +@Service +public class FmeService { + @Value("${sys.fmeUrl}") + private String fmeUrl; + + /** + * 鑾峰彇浠诲姟鐘舵�� + */ + public Object getTaskStatus(String id, HttpServletRequest req) { + String url = getUrl("datax/task/get", req) + "&id=" + id; + + return RestHelper.getForRest(url, Object.class); + } + + /** + * 涓嬭浇璐ㄦ閿欒缁撴灉 + */ + public String getDownloadUrl(String id, HttpServletRequest req) { + return getUrl("datax/task/downloadResult", req) + "&id=" + id; + } + + /** + * 1.OSGB妫�鏌ワ細.osgb + *鍊炬枩鎽勫奖*.xls/.xlsx + */ + public String checkOsgb(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/A8鎴愭灉璐ㄦ_OSGB妫�鏌�", req); + + List<NameValueEntity> list = getKeyValues("OSGB妫�鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + list.add(new NameValueEntity("DMYX_FBL", fme.imgResolution)); + + return RestHelper.postForRest(url, list); + } + + /** + * 2.琛ㄦ牸鏁版嵁妫�鏌ワ細.xls/.xlsx锛堟帓闄ゅ厓鏁版嵁锛� + */ + public String checkXls(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/A3鎴愭灉璐ㄦ_琛ㄦ牸鏁版嵁妫�鏌�", req); + + List<NameValueEntity> list = getKeyValues("琛ㄦ牸鏁版嵁妫�鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("SJZY", fme.sjzy)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + + return RestHelper.postForRest(url, list); + } + + /** + * 3.鐐逛簯妫�鏌ワ細.laz + *婵�鍏夌偣浜�*.xls/.xlsx + */ + public String checkLaz(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/A9鎴愭灉璐ㄦ_鐐逛簯妫�鏌�", req); + + List<NameValueEntity> list = getKeyValues("鐐逛簯妫�鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + list.add(new NameValueEntity("LAZ_MD", fme.lazDensity)); + + return RestHelper.postForRest(url, list); + } + + /** + * 4.楂樼▼妫�鏌ワ細.tif/.prj/.tfw/.tif.ovr + *鍦板舰鍥�*.dwg + */ + public String checkDem(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/A6鎴愭灉璐ㄦ_楂樼▼妫�鏌�", req); + + List<NameValueEntity> list = getKeyValues("楂樼▼妫�鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + list.add(new NameValueEntity("GCZWC", fme.demTolerance)); + list.add(new NameValueEntity("ChangeRate", fme.demChangeRate)); + + return RestHelper.postForRest(url, list); + } + + /** + * 5.灞炴�ф鏌ワ細*dlg*.gdb + *鍦板舰鍥�*.dwg + */ + public String checkAttrs(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/A5鎴愭灉璐ㄦ_灞炴�ф鏌�", req); + + List<NameValueEntity> list = getKeyValues("灞炴�ф鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("SJZY", fme.sjzy)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + + return RestHelper.postForRest(url, list); + } + + /** + * 6.鎷撴墤妫�鏌ワ細*鍦板舰鍥�*.dwg + */ + public String checkTopology(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/A4鎴愭灉璐ㄦ_鎷撴墤妫�鏌�", req); + + List<NameValueEntity> list = getKeyValues("鎷撴墤妫�鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + list.add(new NameValueEntity("S_MCDRC", fme.tolerance)); + list.add(new NameValueEntity("S_XCDRC", fme.tolerance)); + list.add(new NameValueEntity("S_DCDRC", fme.tolerance)); + list.add(new NameValueEntity("OFFSET_GCD", fme.gcdOffset)); + list.add(new NameValueEntity("OFFSET_KZD", fme.kzdOffset)); + list.add(new NameValueEntity("Range_OFFSET", fme.rangeOffset)); + list.add(new NameValueEntity("XG_MAX", fme.xgMax)); + + return RestHelper.postForRest(url, list); + } + + /** + * 7.鍥鹃潰鏁撮グ妫�鏌ワ細.dwg + */ + public String checkDecorate(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/A10鎴愭灉璐ㄦ_鍥鹃潰鏁撮グ妫�鏌�", req); + + List<NameValueEntity> list = getKeyValues("鍥鹃潰鏁撮グ妫�鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + list.add(new NameValueEntity("S_XLS", "$(ZJPZWJ)\\璐ㄦ閰嶇疆琛ㄦ��.xlsx")); + list.add(new NameValueEntity("S_XLS2", "D:\\Project\\Data\\LF\\temp\\20230107010101\\鏂囦欢娓呭崟.xlsx")); + + return RestHelper.postForRest(url, list); + } + + /** + * 8.鍘熺偣妫�鏌ワ細*鍓栭潰鍥�*.dwg + */ + public String checkOrigin(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/A11鎴愭灉璐ㄦ_鍘熺偣妫�鏌�", req); + + List<NameValueEntity> list = getKeyValues("鍘熺偣妫�鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + + return RestHelper.postForRest(url, list); + } + + /** + * 9.鏍呮牸妫�鏌ワ細.tif/.prj/.tfw/.tif.ovr + .xls/.xlsx + */ + public String checkDom(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/A7鎴愭灉璐ㄦ_鏍呮牸妫�鏌�", req); + + List<NameValueEntity> list = getKeyValues("鏍呮牸妫�鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("SJZY", fme.sjzy)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + list.add(new NameValueEntity("S_CoordinateSystem", fme.coordinateSystem)); + list.add(new NameValueEntity("DMYX_FBL", fme.imgResolution)); + + return RestHelper.postForRest(url, list); + } + + /** + * 10.鏁板鍩虹妫�鏌ワ細.shp, .gdb, *鍏冩暟鎹�*.xls/.xlsx + */ + public String checkMath(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/B1鍏ュ簱璐ㄦ_鏁板鍩虹妫�鏌�", req); + + List<NameValueEntity> list = getKeyValues("鏁板鍩虹妫�鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("SJZY", fme.sjzy)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + + return RestHelper.postForRest(url, list); + } + + /** + * 11.鍏冩暟鎹鏌ワ細*鍏冩暟鎹�*.xls/.xlsx + */ + public String checkMeta(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/B5鍏ュ簱璐ㄦ_鍏冩暟鎹鏌�", req); + + List<NameValueEntity> list = getKeyValues("鍏冩暟鎹鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("SJZY", fme.sjzy)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + + return RestHelper.postForRest(url, list); + } + + /** + * 12.鎬昏川妫�锛�.zip/.7z + .xls/.xlsx + */ + public String checkMain(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/B0鍏ュ簱璐ㄦ__鎬�", req); + + List<NameValueEntity> list = getKeyValues("鎬昏川妫�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("SJZY", fme.sjzy)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + list.add(new NameValueEntity("S_WBSBG", fme.wbsPath)); + list.add(new NameValueEntity("S_DZDK", fme.isDiZai)); + list.add(new NameValueEntity("DZ_ZLLX", fme.diZaiType)); + + return RestHelper.postForRest(url, list); + } + + /** + * 13.閫昏緫涓�鑷存�ф鏌ワ細.dwg/.xls/.xlsx + */ + public String checkLogical(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/B3鍏ュ簱璐ㄦ_閫昏緫涓�鑷存�ф鏌�", req); + + List<NameValueEntity> list = getKeyValues("閫昏緫涓�鑷存�ф鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("SJZY", fme.sjzy)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + + return RestHelper.postForRest(url, list); + } + + /** + * 14.鍗曢」鎴愭灉瀹屾暣鎬ф鏌ワ細.* + */ + public String checkSingleIntegrity(FmeReqEntity fme, HttpServletRequest req) { + String url = getUrl("datax/task/run/B6鍏ュ簱璐ㄦ_鍗曢」鎴愭灉瀹屾暣鎬ф鏌�", req); + + List<NameValueEntity> list = getKeyValues("鍗曢」鎴愭灉瀹屾暣鎬ф鏌�"); + list.add(new NameValueEntity("XMMC", fme.xmmc)); + list.add(new NameValueEntity("SJZY", fme.sjzy)); + list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); + list.add(new NameValueEntity("SJFL", fme.sjfl)); + + return RestHelper.postForRest(url, list); + } + + /** + * a.琛ㄦ牸鍏ュ簱锛歋_RKBG銆乨irid銆乸arentid锛屽涓互鑻辨枃閫楀彿闅斿紑 + */ + public String excelLoader(MetaFileEntity meta, HttpServletRequest req) { + String url = getUrl("datax/task/run/琛ㄦ牸鍏ュ簱", req); + + List<NameValueEntity> list = getKeyValues("琛ㄦ牸鍏ュ簱"); + list.add(new NameValueEntity("S_RKBG", meta.getPath())); + list.add(new NameValueEntity("COORDSYS", meta.getEpsgCode())); + list.add(new NameValueEntity("dirid", meta.getName())); + list.add(new NameValueEntity("depid", meta.getDepcode())); + list.add(new NameValueEntity("verid", meta.getVerid())); + list.add(new NameValueEntity("createuser", meta.getCreateUser())); + list.add(new NameValueEntity("parentid", meta.getEventid())); + + return RestHelper.postForRest(url, list); + } + + /** + * b.CRDS骞冲彴浜や粯 + */ + public String crdsPackaging(String dirCode, String major, String isCut, HttpServletRequest req) { + // datax/task/run/CRDS骞冲彴浜や粯_娴嬭瘯 + String url = getUrl("datax/task/run/CRDS骞冲彴浜や粯_code娴嬭瘯", req); + + List<NameValueEntity> list = getKeyValues("CRDS骞冲彴浜や粯"); + list.add(new NameValueEntity("S_FFXMMC", dirCode)); + list.add(new NameValueEntity("MBZY", major)); + list.add(new NameValueEntity("P_WBFW", isCut)); + + return RestHelper.postForRest(url, list); + } + + /** + * c.鏈嶅姟娉ㄥ唽 + */ + public RegisterEntity serverRegister(String name, String serverUri, String type, HttpServletRequest req) { + String url = getUrl("resource/res/item", req); + + RegisterEntity entity = new RegisterEntity(name, serverUri, type); + + String resid = RestHelper.postForRest(url, entity); + entity.setSerialnum(resid); + + return entity; + } + + /** + * d.鏈嶅姟鐢宠 + */ + public void serverApply(String id, Integer pubid, HttpServletRequest req) { + String url = getUrl("resource/res/request", req) + "&resourceid=" + id; + + RegisterEntity entity = new RegisterEntity(pubid); + + RestHelper.postForRest(url, entity); + } + + /** + * e.鍒犻櫎璧勬簮 + */ + public void deleteRes(String id, HttpServletRequest req) { + String url = getUrl("resource/res/hashid", req) + "&hashid=" + id; + + RestHelper.deleteForRest(url); + } + + /** + * 鑾峰彇Url + */ + public String getUrl(String subUrl, HttpServletRequest req) { + String token = WebHelper.getToken(req); + + return fmeUrl + subUrl + "?token=" + token; + } + + /** + * 鑾峰彇鍚嶇О鍊煎闆嗗悎 + */ + public List<NameValueEntity> getKeyValues(String name) { + List<NameValueEntity> list = new ArrayList<>(); + list.add(new NameValueEntity("_name", String.format("%s_%s", name, StringHelper.YMDHMS2_FORMAT.format(new Date())))); + list.add(new NameValueEntity("_priority", 100)); + list.add(new NameValueEntity("_terminate_on_error", false)); + list.add(new NameValueEntity("IID", "")); + list.add(new NameValueEntity("FANOUT_DIR", "$(OrgResultStorage)")); + list.add(new NameValueEntity("IID_JL", "$(ZJPZWJ)\\IID璁板綍琛�.xlsx")); + list.add(new NameValueEntity("S_ZJXZ", "$(ZJPZWJ)\\璐ㄦ缁嗗垯鎬�.xlsx")); + list.add(new NameValueEntity("S_BZPZB", "$(ZJPZWJ)\\璐ㄦ閰嶇疆琛ㄦ��.xlsx")); + + return list; + } +} diff --git a/src/main/java/com/moon/server/service/data/LayerService.java b/src/main/java/com/moon/server/service/data/LayerService.java new file mode 100644 index 0000000..38c2c12 --- /dev/null +++ b/src/main/java/com/moon/server/service/data/LayerService.java @@ -0,0 +1,73 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.data.LayerEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.data.LayerMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鍥惧眰 + * @author WWW + */ +@Service +public class LayerService implements LayerMapper { + @Autowired + LayerMapper layerMapper; + + @Override + public Integer selectCount(String cnName) { + cnName = StringHelper.getLikeUpperStr(cnName); + + return layerMapper.selectCount(cnName); + } + + @Override + public List<LayerEntity> selectByPage(String cnName, Integer limit, Integer offset) { + cnName = StringHelper.getLikeUpperStr(cnName); + + return layerMapper.selectByPage(cnName, limit, offset); + } + + @Override + public List<LayerEntity> selectAll() { + return layerMapper.selectAll(); + } + + @Override + public LayerEntity selectById(int id) { + return layerMapper.selectById(id); + } + + @Override + public Integer insert(LayerEntity entity) { + return layerMapper.insert(entity); + } + + @Override + public Integer inserts(List<LayerEntity> list) { + return layerMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return layerMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return layerMapper.deletes(ids); + } + + @Override + public Integer update(LayerEntity entity) { + return layerMapper.update(entity); + } + + @Override + public Integer updates(List<LayerEntity> list) { + return layerMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/data/MetaService.java b/src/main/java/com/moon/server/service/data/MetaService.java new file mode 100644 index 0000000..6c3d997 --- /dev/null +++ b/src/main/java/com/moon/server/service/data/MetaService.java @@ -0,0 +1,631 @@ +package com.moon.server.service.data; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.DownloadReqEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.sys.AttachEntity; +import com.moon.server.entity.sys.MetaDownEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.mapper.all.GeomBaseMapper; +import com.moon.server.mapper.data.MetaMapper; +import com.moon.server.service.all.BaseQueryService; +import com.moon.server.service.sys.MetaDownService; +import com.moon.server.helper.*; +import net.lingala.zip4j.ZipFile; +import net.lingala.zip4j.model.FileHeader; +import net.lingala.zip4j.model.ZipParameters; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.util.*; + +/** + * 鍏冩暟鎹� + * @author WWW + */ +@Service +public class MetaService implements MetaMapper { + @Autowired + PathHelper pathHelper; + + @Autowired + MetaMapper metaMapper; + + @Autowired + MetaDownService metaDownService; + + @Autowired + DownloadService downloadService; + + private final static Log log = LogFactory.getLog(MetaService.class); + + @Override + public Integer selectCount(String depcode, String dircode, Integer verid, String name) { + depcode = StringHelper.getRightLike(depcode); + dircode = StringHelper.getRightLike(dircode); + name = StringHelper.getLikeUpperStr(name); + + return metaMapper.selectCount(depcode, dircode, verid, name); + } + + @Override + public List<MetaEntity> selectByPage(String depcode, String dircode, Integer verid, String name, Integer limit, Integer offset) { + depcode = StringHelper.getRightLike(depcode); + dircode = StringHelper.getRightLike(dircode); + name = StringHelper.getLikeUpperStr(name); + + return metaMapper.selectByPage(depcode, dircode, verid, name, limit, offset); + } + + @Override + public Integer selectMetasForCount(String depcode, String dirs, String name) { + depcode = StringHelper.getRightLike(depcode); + name = StringHelper.getLikeUpperStr(name); + + return metaMapper.selectMetasForCount(depcode, dirs, name); + } + + @Override + public List<MetaEntity> selectMetasForPage(String depcode, String dirs, String name, Integer limit, Integer offset) { + depcode = StringHelper.getRightLike(depcode); + name = StringHelper.getLikeUpperStr(name); + + return metaMapper.selectMetasForPage(depcode, dirs, name, limit, offset); + } + + @Override + public Integer selectCountForUpload(String name, Integer createUser, String types) { + name = StringHelper.getLikeUpperStr(name); + + return metaMapper.selectCountForUpload(name, createUser, types); + } + + @Override + public List<MetaEntity> selectByPageForUpload(String name, Integer createUser, String types, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return metaMapper.selectByPageForUpload(name, createUser, types, limit, offset); + } + + @Override + public Integer selectCountByPid(Integer metaid, String name) { + name = StringHelper.getLikeUpperStr(name); + + return metaMapper.selectCountByPid(metaid, name); + } + + @Override + public List<MetaEntity> selectPageByPid(Integer metaid, String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return metaMapper.selectPageByPid(metaid, name, limit, offset); + } + + @Override + public MetaEntity selectById(int id) { + return metaMapper.selectById(id); + } + + @Override + public MetaEntity selectByGuid(String guid, String dircode, String tab) { + return metaMapper.selectByGuid(guid, dircode, tab); + } + + @Override + public List<MetaEntity> selectByIdsForTab(String ids) { + return metaMapper.selectByIdsForTab(ids); + } + + @Override + public List<MetaEntity> selectMetaFiles(List<Integer> ids) { + return metaMapper.selectMetaFiles(ids); + } + + @Override + public List<MetaEntity> selectXlsAnnex(Integer[] ids, String tabs) { + return metaMapper.selectXlsAnnex(ids, tabs); + } + + @Override + public List<MetaEntity> selectMetasByDirCode(String dircode) { + dircode = StringHelper.getRightLike(dircode); + + return metaMapper.selectMetasByDirCode(dircode); + } + + @Override + public List<String> selectMetaOverflowDep(String ids, String depcode) { + depcode = StringHelper.getRightLike(depcode); + + return metaMapper.selectMetaOverflowDep(ids, depcode); + } + + @Override + public Integer insert(MetaEntity entity) { + return metaMapper.insert(entity); + } + + @Override + public Integer inserts(List<MetaEntity> list) { + return metaMapper.inserts(list); + } + + @Override + public Integer deletes(String sql, String ids) { + return metaMapper.deletes(sql, ids); + } + + @Override + public Integer update(MetaEntity entity) { + return metaMapper.update(entity); + } + + @Override + public Integer updates(List<MetaEntity> list) { + return metaMapper.updates(list); + } + + /** + * 鍒犻櫎鍏冩暟鎹� + */ + public Integer deletes(List<Integer> list) { + String ids = StringHelper.join(list, ","); + + String sql = null; + List<MetaEntity> metas = selectByIdsForTab(ids); + if (null != metas && metas.size() > 0) { + sql = getDelTabsSql(metas); + } + + return deletes(sql, ids); + } + + /** + * 鑾峰彇鍒犻櫎琛ㄨ褰昐QL + */ + public String getDelTabsSql(List<MetaEntity> metas) { + List<String> list = getTabDeletes(metas, metas.get(0).getTab()); + addCascadDeletes(list); + addAttachDeletes(list); + Collections.reverse(list); + + return StringHelper.join(list, ";"); + } + + /** + * 鑾峰彇鍒犻櫎琛ㄨ褰昐QL + */ + private List<String> getTabDeletes(List<MetaEntity> metas, String tab) { + List<String> list = new ArrayList<>(); + + List<String> pids = new ArrayList<>(); + for (MetaEntity me : metas) { + if (tab.equals(me.getTab())) { + pids.add("'" + me.getEventid() + "'"); + } else { + list.add(String.format("delete from %s where parentid in (%s)", tab, StringHelper.join(pids, ","))); + + pids.clear(); + tab = me.getTab(); + pids.add("'" + me.getEventid() + "'"); + } + } + if (pids.size() > 0) { + list.add(String.format("delete from %s where parentid in (%s)", tab, StringHelper.join(pids, ","))); + } + + return list; + } + + /** + * 娣诲姞绾ц仈鍒犻櫎 + */ + private void addCascadDeletes(List<String> list) { + int i = 0, c = list.size(); + while (i < c) { + String str = list.get(i); + if (str.contains("bs.m_pipelinepoint ")) { + list.add(str.replace("bs.m_pipelinepoint ", "bs.m_pipesegment ")); + list.add(str.replace("bs.m_pipelinepoint ", "bs.m_pipeline ")); + } + if (str.contains("bs.s_explorationpoint ")) { + list.add(str.replace("bs.s_explorationpoint ", "bs.s_surveyworksite ")); + } + + i++; + } + } + + /** + * 娣诲姞闄勪欢鍒犻櫎 + */ + private void addAttachDeletes(List<String> list) { + int i = 0, c = list.size(); + while (i < c) { + String str = list.get(i); + String tab = str.substring("delete from ".length(), str.indexOf(" where ")); + String select = str.replace("delete ", "select eventid "); + + list.add(String.format("delete from lf.sys_attach where tab='%s' and tab_guid in (%s)", tab, select)); + + i++; + } + } + + /** + * 鏌ョ湅鏂囦欢 + */ + public void downloadForView(String guid, boolean inline, HttpServletResponse res) { + try { + if (StringHelper.isEmpty(guid)) { + WebHelper.writeStr2Page(res, StaticData.NO_FILE); + return; + } + + MetaEntity me = selectByGuid(guid, null, null); + if (me == null) { + WebHelper.writeStr2Page(res, StaticData.NO_FILE); + return; + } + + String filePath = pathHelper.getConfig().getUploadPath() + File.separator + me.getPath(); + File file = new File(filePath); + if (!file.exists() || file.isDirectory()) { + WebHelper.writeJson2Page(res, "鏂囦欢涓嶅瓨鍦�"); + } + + WebHelper.download(filePath, me.getName(), inline, res); + } catch (Exception ex) { + WebHelper.writeJson2Page(res, "鏂囦欢涓嬭浇鍑洪敊"); + log.error(ex.getMessage(), ex); + } + } + + /** + * 鏌ヨ鍏冩暟鎹腑婧㈠嚭鐨勫崟浣岻D + */ + public List<String> selectMetaOverflowDep(UserEntity ue, DownloadReqEntity dr) { + String ids = StringHelper.join(dr.getIds(), ","); + + return selectMetaOverflowDep(ids, ue.getDepcode()); + } + + /** + * 璇锋眰鍏冩暟鎹笅杞� + * + * @param ue 鐢ㄦ埛瀹炰綋 + * @param dr 璇锋眰涓嬭浇瀹炰綋 + * @return 涓嬭浇鏂囦欢GUID + * @throws Exception 寮傚父 + */ + public String downloadMeteReq(UserEntity ue, DownloadReqEntity dr) throws Exception { + List<MetaEntity> list = selectMetaFiles(dr.getIds()); + if (null == list || list.isEmpty()) { + return null; + } + + Map<String, List<String>> tabs = getTabs(list); + rmRepeatMetas(list); + + Map<String, List<?>> dataMap = new HashMap<>(2); + Map<String, List<AttachEntity>> annexMap = new HashMap<>(2); + queryData(tabs, dataMap, annexMap); + + String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); + String tempPath = pathHelper.getTempPath(tempName); + String gdbPath = tempPath + File.separator + "tabs.gdb"; + + File gdbFile = new File(gdbPath); + if (gdbFile.exists() && gdbFile.isDirectory()) { + FileHelper.deleteDir(gdbPath); + } + if (dataMap.size() > 0) { + GdbHelper.createGdb(gdbPath, dataMap); + } + + String zipFile = pathHelper.getDownloadFullPath() + File.separator + tempName + ".zip"; + ZipFile zip = Zip4jHelper.createZipFile(zipFile, dr.getPwd()); + ZipParameters params = Zip4jHelper.getZipParams(true); + addMetaFiles(zip, params, list); + if (dataMap.size() > 0) { + zip.addFolder(new File(gdbPath), params); + addAnnex(zip, params, annexMap); + } + + String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd())); + DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd); + int rows = downloadService.insert(de); + if (de.getId() > 0) { + insertMetaDown(ue, list, de); + } + + return rows > 0 ? de.getGuid() : null; + } + + /** + * 鑾峰彇鏁版嵁琛� + */ + private Map<String, List<String>> getTabs(List<MetaEntity> list) { + Map<String, List<String>> tabs = new HashMap<>(2); + for (MetaEntity meta : list) { + if (StringHelper.isEmpty(meta.getTab()) || meta.getRows() == 0 || StringHelper.isEmpty(meta.getEventid())) { + continue; + } + + if (!tabs.containsKey(meta.getTab())) { + tabs.put(meta.getTab(), new ArrayList<>()); + } + + List<String> ids = tabs.get(meta.getTab()); + if (!ids.contains(meta.getEventid())) { + ids.add(meta.getEventid()); + } + } + + return tabs; + } + + /** + * 绉婚櫎閲嶅鐨勫厓鏁版嵁鏂囦欢 + */ + private void rmRepeatMetas(List<MetaEntity> list) { + List<String> guidList = new ArrayList<>(); + + int i = 0; + while (i < list.size()) { + MetaEntity entity = list.get(i); + if (guidList.contains(entity.getGuid())) { + list.remove(i); + continue; + } + + guidList.add(entity.getGuid()); + i++; + } + } + + /** + * 鏌ヨ鏁版嵁 + */ + private void queryData(Map<String, List<String>> tabs, Map<String, List<?>> dataMap, Map<String, List<AttachEntity>> annexMap) { + for (String tab : tabs.keySet()) { + try { + String entity = tab.toLowerCase().replace("_", "").split("\\.")[1]; + BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); + if (null == baseMapper) { + continue; + } + + QueryWrapper wrapper = createQueryWrapper(baseMapper, tabs.get(tab)); + addData(entity, baseMapper, wrapper, dataMap, annexMap); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } + + /** + * 娣诲姞鏁版嵁 + */ + public void addData(String entity, BasicMapper baseMapper, QueryWrapper wrapper, Map<String, List<?>> dataMap, Map<String, List<AttachEntity>> annexMap) { + List list = baseMapper.selectList(wrapper); + if (null == list || list.size() == 0) { + return; + } + + if (!dataMap.containsKey(entity)) { + dataMap.put(entity, list); + } else { + dataMap.get(entity).addAll(list); + } + if (wrapper.isEmptyOfWhere()) { + wrapper.apply("1 = 1"); + } + if (StaticData.BBOREHOLE.equals(entity)) { + wrapper.last("limit 100"); + } + + String tab = BaseQueryService.getTabName(baseMapper); + List<AttachEntity> annex = baseMapper.selectAnnex(tab, wrapper); + if (null == annex || annex.isEmpty()) { + return; + } + + if (!annexMap.containsKey(entity)) { + annexMap.put(tab.replace(StaticData.POINT, "_"), annex); + } else { + annexMap.get(tab.replace(StaticData.POINT, "_")).addAll(annex); + } + } + + /** + * 鍒涘缓鏌ヨ鍖呰鍣� + */ + private <T> QueryWrapper<T> createQueryWrapper(BasicMapper baseMapper, List<String> ids) { + for (int i = 0, c = ids.size(); i < c; i++) { + ids.set(i, "'" + ids.get(i) + "'"); + } + String filter = String.format("parentid in (%s)", StringHelper.join(ids, ",")); + + QueryWrapper<T> wrapper = new QueryWrapper<T>(); + if (baseMapper instanceof GeomBaseMapper) { + wrapper.select("ST_AsText(geom) as geom, *"); + } + wrapper.apply(filter); + + return wrapper; + } + + /** + * 娣诲姞闄勪欢 + */ + public void addAnnex(ZipFile zip, ZipParameters params, Map<String, List<AttachEntity>> annexMap) { + List<String> files = new ArrayList<>(); + String uploadPath = pathHelper.getConfig().getUploadPath(); + for (String key : annexMap.keySet()) { + for (AttachEntity ae : annexMap.get(key)) { + try { + File srcFile = new File(uploadPath + File.separator + ae.getPath()); + if (!srcFile.exists() || srcFile.isDirectory()) { + continue; + } + if (files.contains(srcFile.getPath())) { + continue; + } + + files.add(srcFile.getPath()); + params.setFileNameInZip("annex" + File.separator + key + File.separator + ae.getName()); + zip.addStream(new FileInputStream(srcFile), params); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } + } + + /** + * 娣诲姞鍏冩暟鎹枃浠惰嚦Zip鍖� + */ + private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaEntity> list) { + List<String> names = new ArrayList<>(); + String uploadPath = pathHelper.getConfig().getUploadPath(); + for (MetaEntity mf : list) { + if (names.contains(mf.getName())) { + mf.setName(mf.getId() + "_" + mf.getName()); + } else { + names.add(mf.getName()); + } + + try { + switch ("." + mf.getType()) { + case StaticData.MPT: + addMultiFile(uploadPath, mf, zip, params, StaticData.MPT_EXT); + break; + case StaticData.JPG: + addMultiFile(uploadPath, mf, zip, params, StaticData.JPG_EXT); + case StaticData.IMG: + addMultiFile(uploadPath, mf, zip, params, StaticData.IMG_EXT); + break; + case StaticData.TIF: + addMultiFile(uploadPath, mf, zip, params, StaticData.TIF_EXT); + break; + case StaticData.TIFF: + addMultiFile(uploadPath, mf, zip, params, StaticData.TIFF_EXT); + break; + case StaticData.SHP: + addMultiFile(uploadPath, mf, zip, params, StaticData.SHP_EXT); + break; + case StaticData.GDB: + addFolderFile(uploadPath, mf, zip, params); + break; + default: + addSingleFile(uploadPath, mf, zip, params); + break; + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } + + /** + * 娣诲姞鐩綍鏂囦欢 + */ + private void addFolderFile(String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params) throws Exception { + File file = new File(uploadPath + File.separator + mf.getPath()); + if (!file.exists() || !file.isDirectory()) { + return; + } + zip.addFolder(file, params); + + String fileName = FileHelper.getFileName(file.getPath()); + FileHeader header = zip.getFileHeader(fileName); + if (null != header) { + zip.renameFile(header, mf.getName()); + } + } + + /** + * 娣诲姞澶氭枃浠� + */ + private void addMultiFile(String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params, List<String> extList) throws Exception { + addSingleFile(uploadPath, mf, zip, params); + + for (String ext : extList) { + File file = new File(uploadPath + File.separator + mf.getPath().replace("." + mf.getType(), ext)); + if (!file.exists() || file.isDirectory()) { + continue; + } + zip.addFile(file, params); + + String fileName = FileHelper.getFileName(file.getPath()); + FileHeader header = zip.getFileHeader(fileName); + if (null != header) { + zip.renameFile(header, mf.getName().replace("." + mf.getType(), ext)); + } + } + } + + /** + * 娣诲姞鍗曟枃浠� + */ + private void addSingleFile(String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params) throws Exception { + File file = new File(uploadPath + File.separator + mf.getPath()); + if (!file.exists() || file.isDirectory()) { + return; + } + zip.addFile(file, params); + + String fileName = FileHelper.getFileName(file.getPath()); + FileHeader header = zip.getFileHeader(fileName); + if (null != header) { + zip.renameFile(header, mf.getName()); + } + } + + /** + * 鑾峰彇涓嬭浇瀹炰綋绫� + */ + private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { + DownloadEntity de = new DownloadEntity(); + de.setName(FileHelper.getFileName(file)); + // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 + de.setType(3); + de.setSizes(FileHelper.sizeToMb(new File(file).length())); + de.setDepid(ue.getDepid()); + de.setDcount(0); + de.setPwd(pwd); + de.setUrl(FileHelper.getRelativePath(file)); + de.setDescr("鍏冩暟鎹枃浠�"); + de.setGuid(FileHelper.getFileMd5(file)); + de.setCreateUser(ue.getId()); + // de.setGeom(null) + + return de; + } + + /** + * 鎻掑叆鍏冩暟鎹�-涓嬭浇琛� + */ + private void insertMetaDown(UserEntity ue, List<MetaEntity> metas, DownloadEntity de) { + List<MetaDownEntity> list = new ArrayList<>(); + for (MetaEntity me : metas) { + MetaDownEntity md = new MetaDownEntity(); + md.setMetaid(me.getId()); + md.setDownid(de.getId()); + md.setCreateUser(ue.getId()); + + list.add(md); + } + + metaDownService.inserts(list); + } +} diff --git a/src/main/java/com/moon/server/service/data/PublishService.java b/src/main/java/com/moon/server/service/data/PublishService.java new file mode 100644 index 0000000..f3fae53 --- /dev/null +++ b/src/main/java/com/moon/server/service/data/PublishService.java @@ -0,0 +1,248 @@ +package com.moon.server.service.data; + +import com.alibaba.fastjson.JSON; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.PubEntity; +import com.moon.server.entity.ctrl.RegisterEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.data.PublishEntity; +import com.moon.server.helper.RestHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.data.PublishMapper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鏁版嵁鍙戝竷 + * @author WWW + */ +@Service +public class PublishService implements PublishMapper { + @Value("${sys.exportServer}") + private String exportServer; + + @Value("${sys.iisHost}") + private String iisHost; + + @Autowired + PublishMapper publishMapper; + + @Autowired + FmeService fmeService; + + private final static Log log = LogFactory.getLog(PublishService.class); + + @Override + public Integer selectCount(String name) { + name = StringHelper.getLikeUpperStr(name); + + return publishMapper.selectCount(name); + } + + @Override + public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return publishMapper.selectByPage(name, limit, offset); + } + + @Override + public List<PublishEntity> selectAll() { + return publishMapper.selectAll(); + } + + @Override + public PublishEntity selectById(int id) { + return publishMapper.selectById(id); + } + + @Override + public List<PublishEntity> selectByIds(String ids) { + return publishMapper.selectByIds(ids); + } + + @Override + public Integer insert(PublishEntity entity) { + return publishMapper.insert(entity); + } + + @Override + public Integer inserts(List<PublishEntity> list) { + return publishMapper.inserts(list); + } + + @Override + public Integer insertPubDown(Integer pubid, Integer downid, Integer createUser) { + return publishMapper.insertPubDown(pubid, downid, createUser); + } + + @Override + public Integer delete(int id) { + return publishMapper.delete(id); + } + + @Override + public Integer deletes(String ids) { + return publishMapper.deletes(ids); + } + + @Override + public Integer update(PublishEntity entity) { + return publishMapper.update(entity); + } + + @Override + public Integer updates(List<PublishEntity> list) { + return publishMapper.updates(list); + } + + @Override + public Integer selectMetasByCount(String depcode, String dircode, Integer verid, String types, String name) { + depcode = StringHelper.getRightLike(depcode); + dircode = StringHelper.getRightLike(dircode); + name = StringHelper.getLikeUpperStr(name); + + return publishMapper.selectMetasByCount(depcode, dircode, verid, types, name); + } + + @Override + public List<MetaEntity> selectMetasByPage(String depcode, String dircode, Integer verid, String types, String name, Integer limit, Integer offset) { + depcode = StringHelper.getRightLike(depcode); + dircode = StringHelper.getRightLike(dircode); + name = StringHelper.getLikeUpperStr(name); + + return publishMapper.selectMetasByPage(depcode, dircode, verid, types, name, limit, offset); + } + + /** + * 鍙戦�佸彂甯冭姹� + */ + public long postForPub(PubEntity entity, String method, HttpServletRequest req) { + Map<String, Object> map = getMapData(entity); + + String str = RestHelper.postForRest(exportServer + method, map); + if (StringHelper.isEmpty(str)) { + return 0; + } + + ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class); + if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) { + return 0; + } + + if (msg.getCount() > 0) { + serverRegister(msg.getResult(), req); + } + + return msg.getCount(); + } + + /** + * 鑾峰彇Map鏁版嵁 + */ + private Map<String, Object> getMapData(PubEntity entity) { + Map<String, Object> map = new HashMap<>(3); + + Field[] fields = entity.getClass().getDeclaredFields(); + for (Field field : fields) { + try { + if ("serialVersionUID".equals(field.getName())) { + continue; + } + + field.setAccessible(true); + Object obj = field.get(entity); + + map.put(field.getName(), obj); + } catch (Exception ex) { + // + } + } + + return map; + } + + /** + * 鏈嶅姟娉ㄥ唽 + */ + private void serverRegister(String ids, HttpServletRequest req) { + List<PublishEntity> list = selectByIds(ids); + if (null == list || list.isEmpty()) { + return; + } + + for (PublishEntity entity : list) { + String url = entity.getUrl().replace("{host}", iisHost); + String type = getServerType(entity); + + RegisterEntity reg = fmeService.serverRegister(entity.getName(), url, type, req); + if (null == reg || StringHelper.isEmpty(reg.getSerialnum())) { + continue; + } + + fmeService.serverApply(reg.getSerialnum(), entity.getId(), req); + + entity.setRegid(reg.getHashid()); + update(entity); + } + } + + /** + * 鑾峰彇鏈嶅姟绫诲瀷 + */ + private String getServerType(PublishEntity entity) { + switch (entity.getType()) { + case "DOM": + return "TMS鏈嶅姟"; + case "DEM": + return "涓夌淮鍦板舰鏈嶅姟"; + case "mpt": + return "涓夌淮鍦烘櫙鏈嶅姟"; + default: + return "涓夌淮妯″瀷鏈嶅姟"; + } + } + + /** + * 鍒犻櫎澶氭潯 + */ + public Integer deletes(List<Integer> idList, HttpServletRequest req) { + String ids = StringHelper.join(idList, ","); + + deleteRes(ids, req); + + return deletes(ids); + } + + /** + * 鍒犻櫎璧勬簮 + */ + private void deleteRes(String ids, HttpServletRequest req) { + List<PublishEntity> list = selectByIds(ids); + if (null == list || list.isEmpty()) { + return; + } + + for (PublishEntity entity : list) { + if (StringHelper.isEmpty(entity.getRegid())) { + continue; + } + + try { + fmeService.deleteRes(entity.getRegid(), req); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } +} diff --git a/src/main/java/com/moon/server/service/data/StyleService.java b/src/main/java/com/moon/server/service/data/StyleService.java new file mode 100644 index 0000000..fb20a72 --- /dev/null +++ b/src/main/java/com/moon/server/service/data/StyleService.java @@ -0,0 +1,70 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.data.StyleEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.data.StyleMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鏍峰紡绠$悊 + * @author sws + * @date 2022-09-26 + */ +@Service +public class StyleService implements StyleMapper { + @Autowired + StyleMapper styleMapper; + + @Override + public Integer selectCount(String name) { + name = StringHelper.getLikeUpperStr(name); + + return styleMapper.selectCount(name); + } + + @Override + public List<StyleEntity> selectByPage(String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return styleMapper.selectByPage(name, limit, offset); + } + + @Override + public Integer insertStyle(StyleEntity styleEntity) { + return styleMapper.insertStyle(styleEntity); + } + + @Override + public Integer insertStyles(List<StyleEntity> styleEntity) { + return styleMapper.insertStyles(styleEntity); + } + + @Override + public Integer deleteStyle(int id) { + return styleMapper.deleteStyle(id); + } + + @Override + public Integer deleteStyles(List<Integer> ids) { + return styleMapper.deleteStyles(ids); + } + + @Override + public Integer updateStyle(StyleEntity styleEntity) { + return styleMapper.updateStyle(styleEntity); + } + + + @Override + public StyleEntity selectStyle(int id) { + return styleMapper.selectStyle(id); + } + + @Override + public List<StyleEntity> selectStyleAll() { + return styleMapper.selectStyleAll(); + } +} \ No newline at end of file diff --git a/src/main/java/com/moon/server/service/data/UploadService.java b/src/main/java/com/moon/server/service/data/UploadService.java new file mode 100644 index 0000000..bb5e2b4 --- /dev/null +++ b/src/main/java/com/moon/server/service/data/UploadService.java @@ -0,0 +1,576 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.all.BaseEntity; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.mapper.data.UploadMapper; +import com.moon.server.service.all.BaseQueryService; +import com.moon.server.service.all.BaseUploadService; +import com.moon.server.service.sys.DepService; +import com.moon.server.entity.data.*; +import com.moon.server.helper.*; +import org.apache.commons.io.FileUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +/** + * 鏁版嵁涓婁紶鏈嶅姟绫� + * + * @author WWW + */ +@Service +public class UploadService extends BaseUploadService implements UploadMapper { + @Autowired + UploadMapper uploadMapper; + + @Autowired + FmeService fmeService; + + @Autowired + MetaService metaService; + + @Autowired + DepService depService; + + @Autowired + DirService dirService; + + @Override + public List<CoordEntity> selectCoords(String zoning) { + return uploadMapper.selectCoords(zoning); + } + + @Override + public Integer selectCount4Coord(String epsgCode) { + return uploadMapper.selectCount4Coord(epsgCode); + } + + @Override + public List<DirEntity> selectProject() { + return uploadMapper.selectProject(); + } + + @Override + public List<FmeLogEntity> selectFmeLog(String parentid) { + return uploadMapper.selectFmeLog(parentid); + } + + /** + * 鎻掑叆鏂囦欢 + */ + public void insertFiles(UserEntity ue, List<MetaFileEntity> list, HttpServletRequest req) { + checkMetaFiles(ue, list); + List<MetaFileEntity> xlsList = getExcelFiles(list); + loadData(list); + copyFiles(list); + insertMetas(list); + if (xlsList.size() > 0) { + String guid = excelLoader(xlsList, req); + } + } + + /** + * 妫�鏌ュ厓鏁版嵁鏂囦欢 + */ + private void checkMetaFiles(UserEntity ue, List<MetaFileEntity> list) { + Timestamp createTime = WebHelper.getCurrentTimestamp(); + String tempPath = pathHelper.getConfig().getTempPath(); + + for (MetaFileEntity mf : list) { + mf.setCreateUser(ue.getId()); + mf.setCreateTime(createTime); + mf.setDepcode(ue.getDepcode()); + mf.setPath(tempPath + File.separator + mf.getPath()); + mf.setMsg(null); + + File f = new File(mf.getPath()); + if (!f.exists()) { + mf.setMsg("鏂囦欢涓㈠け"); + } + + MetaEntity old = metaService.selectByGuid(mf.getGuid(), getDirCode(mf), null); + if (null != old) { + mf.setMsg("宸插瓨鍦�"); + } + } + } + + /** + * 鑾峰彇鐩綍缂栫爜 + */ + private String getDirCode(MetaFileEntity mf) { + if (StringHelper.isEmpty(mf.getDircode())) { + return null; + } + + return StringHelper.getRightLike(mf.getDircode().substring(0, 2)); + } + + /** + * 鑾峰彇Excel鍏冩暟鎹枃浠� + */ + private List<MetaFileEntity> getExcelFiles(List<MetaFileEntity> list) { + List<MetaFileEntity> xlsList = new ArrayList<>(); + for (MetaFileEntity mf : list) { + if (null == mf.getMsg() && isExcel(mf)) { + xlsList.add(mf); + } + } + if (xlsList.isEmpty()) { + return xlsList; + } + + String xlsBasePath = getXlsPath(xlsList.get(0).getPath()); + for (int i = 0, c = xlsList.size(); i < c; i++) { + MetaFileEntity mf = xlsList.get(i); + String xlsPath = copyXlsFile(xlsBasePath, i, mf); + mf.setXlsPath(xlsPath); + } + + return xlsList; + } + + /** + * 鏄�/鍚︿负Excel + */ + private boolean isExcel(MetaFileEntity mf) { + return StaticData.XLS.equals(mf.getExtName()) || StaticData.XLSX.equals(mf.getExtName()); + } + + /** + * 鑾峰彇Xls鐩綍 + */ + private String getXlsPath(String filePath) { + String tempPath = pathHelper.getConfig().getTempPath() + File.separator; + String subPath = filePath.substring(tempPath.length()); + subPath = tempPath + subPath.substring(0, subPath.indexOf(File.separator)).replace("_zip", "") + "_xls"; + + File f = new File(subPath); + if (!f.exists() || !f.isDirectory()) { + f.mkdirs(); + } + + return subPath; + } + + /** + * 澶嶅埗Xls鏂囦欢 + */ + private String copyXlsFile(String xlsBasePath, int i, MetaFileEntity mf) { + try { + String xlsPath = xlsBasePath + File.separator + i; + + File file = new File(xlsPath); + if (!file.exists() || !file.isDirectory()) { + file.mkdirs(); + } + file = new File(mf.getPath()); + + File newFile = new File(xlsPath + File.separator + FileHelper.getFileName(file.getPath())); + FileUtils.copyFile(file, newFile); + + return newFile.getPath(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return null; + } + } + + /** + * 鍔犺浇鏁版嵁 + */ + private void loadData(List<MetaFileEntity> list) { + for (MetaFileEntity mf : list) { + if (null != mf.getMsg() || StringHelper.isEmpty(mf.getEntity())) { + continue; + } + if (StaticData.SHP.equals(mf.getExtName()) || StaticData.GDB.equals(mf.getExtName())) { + loadSpatialData(mf); + } + } + } + + /** + * 鍔犺浇绌洪棿鏁版嵁 + */ + public void loadSpatialData(MetaFileEntity mf) { + BasicMapper basicMapper = ClassHelper.getBasicMapper(mf.getEntity()); + if (null == basicMapper) { + return; + } + + String tabName = BaseQueryService.getTabName(basicMapper); + String className = ClassHelper.getClassName(basicMapper); + Class clazz = ClassHelper.getEntityClass(className); + if (null == clazz || null == tabName) { + return; + } + + File file = new File(mf.getPath()); + if (!file.exists()) { + mf.setMsg("鏂囦欢涓㈠け"); + return; + } + + MetaEntity old = metaService.selectByGuid(mf.getGuid(), getDirCode(mf), tabName); + if (null != old) { + mf.setMsg("宸插瓨鍦�"); + return; + } + + List<?> list; + if (StaticData.SHP.equals(mf.getExtName())) { + list = ShpHelper.readData(clazz, mf.getPath()); + } else { + list = GdbHelper.readData(clazz, mf.getPath(), mf.getTab()); + } + if (null == list || list.isEmpty()) { + return; + } + setCreateInfo(list, mf); + + int rows = basicMapper.insertBatch(list); + if (rows > 0) { + mf.setEntity(mf.getTab()); + mf.setTab(tabName); + mf.setRows(rows); + } + } + + /** + * 璁剧疆鍒涘缓淇℃伅 + */ + private <T> void setCreateInfo(List<T> list, MetaFileEntity mf) { + try { + if (!(list.get(0) instanceof BaseEntity)) { + return; + } + + for (T t : list) { + BaseEntity be = (BaseEntity) t; + be.setEventid(StringHelper.getGuid()); + be.setParentid(mf.getEventid()); + be.setDirid(mf.getDircode()); + be.setDepid(mf.getDepcode()); + be.setVerid(mf.getVerid()); + be.setCreateuser(mf.getCreateUser()); + be.setCreatetime(mf.getCreateTime()); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 澶嶅埗鏂囦欢 + */ + private void copyFiles(List<MetaFileEntity> list) { + List<String> gdbList = new ArrayList<>(); + for (MetaFileEntity mf : list) { + if (null != mf.getMsg()) { + continue; + } + + switch (mf.getExtName()) { + case StaticData.MPT: + copyMultiFile(mf, StaticData.MPT_EXT); + break; + case StaticData.JPG: + copyMultiFile(mf, StaticData.JPG_EXT); + break; + case StaticData.IMG: + copyMultiFile(mf, StaticData.IMG_EXT); + break; + case StaticData.TIF: + copyMultiFile(mf, StaticData.TIF_EXT); + break; + case StaticData.TIFF: + copyMultiFile(mf, StaticData.TIFF_EXT); + break; + case StaticData.SHP: + copyMultiFile(mf, StaticData.SHP_EXT); + break; + case StaticData.GDB: + if (gdbList.contains(mf.getPath())) { + String path = findPathByGuid(list, mf); + if (null != path) { + mf.setPath(path); + continue; + } + } + + gdbList.add(mf.getPath()); + copyFolderFile(mf); + break; + default: + copySingleFile(mf); + break; + } + } + } + + /** + * 澶嶅埗鍗曚釜鏂囦欢 + */ + private int copySingleFile(MetaFileEntity mf) { + File file = new File(mf.getPath()); + if (!file.exists()) { + mf.setMsg("鏂囦欢涓㈠け"); + return -1; + } + + MetaEntity old = metaService.selectByGuid(mf.getGuid(), null, null); + if (null != old) { + // mf.setMsg("宸插瓨鍦�") + setOldMeta(mf, old); + file.delete(); + return 0; + } + + String uploadPath = pathHelper.getUploadFullPath(); + String targetPath = uploadPath + File.separator + mf.getGuid() + mf.getExtName(); + String subPath = FileHelper.getRelativePath(targetPath); + + File newFile = new File(targetPath); + if (newFile.exists()) { + mf.setPath(subPath); + file.delete(); + return 0; + } + + file.renameTo(newFile); + mf.setPath(subPath); + + return 1; + } + + /** + * 璁剧疆鏃у厓鏁版嵁淇℃伅 + */ + private void setOldMeta(MetaFileEntity mf, MetaEntity old) { + mf.setPath(old.getPath()); + mf.setTab(old.getTab()); + mf.setRows(old.getRows()); + mf.setEntity(old.getEventid()); + } + + /** + * 澶嶅埗澶氫釜鏂囦欢 + */ + private void copyMultiFile(MetaFileEntity mf, List<String> extList) { + String path = mf.getPath(); + int status = copySingleFile(mf); + if (status < 1) { + for (int i = 0, c = extList.size(); i < c; i++) { + String subPath = path.replace(mf.getExtName(), extList.get(i)); + File file = new File(subPath); + if (file.exists()) { + file.delete(); + } + } + return; + } + + String uploadPath = pathHelper.getConfig().getUploadPath(); + for (int i = 0, c = extList.size(); i < c; i++) { + String sourcePath = path.replace(mf.getExtName(), extList.get(i)); + File file = new File(sourcePath); + if (!file.exists()) { + continue; + } + + String targetPath = uploadPath + File.separator + mf.getPath().replace(mf.getExtName(), extList.get(i)); + File newFile = new File(targetPath); + if (newFile.exists()) { + continue; + } + + file.renameTo(newFile); + } + } + + /** + * 澶嶅埗鏂囦欢澶规枃浠� + */ + private void copyFolderFile(MetaFileEntity mf) { + File file = new File(mf.getPath()); + if (!file.exists()) { + mf.setMsg("鏂囦欢涓㈠け"); + return; + } + + MetaEntity old = metaService.selectByGuid(mf.getGuid(), null, null); + if (null != old) { + // mf.setMsg("宸插瓨鍦�") + setOldMeta(mf, old); + FileHelper.deleteFiles(file); + return; + } + + String uploadPath = pathHelper.getUploadFullPath(); + String targetPath = uploadPath + File.separator + mf.getGuid() + mf.getExtName(); + String subPath = FileHelper.getRelativePath(targetPath); + + File newFile = new File(targetPath); + if (newFile.exists() && newFile.isDirectory()) { + mf.setPath(subPath); + FileHelper.deleteFiles(file); + return; + } + + newFile.mkdirs(); + File[] files = file.listFiles(); + if (null == files || files.length == 0) { + return; + } + + for (File f : files) { + String subFile = targetPath + File.separator + FileHelper.getFileName(f.getPath()); + f.renameTo(new File(subFile)); + } + mf.setPath(subPath); + } + + /** + * 鏍规嵁GUID鏌ユ壘璺緞 + */ + private String findPathByGuid(List<MetaFileEntity> list, MetaFileEntity mf) { + for (MetaFileEntity meta : list) { + if (meta.getGuid().equals(mf.getGuid()) && !meta.getPath().equals(mf.getPath())) { + return meta.getPath(); + } + } + + return null; + } + + /** + * 鍒涘缓鏂囦欢閾炬帴 + */ + private void createFileLink(String source, String target) { + String cmd = String.format("cmd /c mklink \"%s\" \"%s\"", target, source); + WebHelper.exec(cmd); + } + + /** + * 鎻掑叆鍏冩暟鎹� + */ + private void insertMetas(List<MetaFileEntity> list) { + int metaId = insertParentMeta(list); + for (MetaFileEntity mf : list) { + if (null != mf.getMsg()) { + continue; + } + + MetaEntity me = createMeta(mf, metaId); + metaService.insert(me); + + mf.setMsg(me.getId() > 0 ? "鎴愬姛" : "澶辫触"); + } + } + + /** + * 鍒涘缓鍏冩暟鎹� + */ + private MetaEntity createMeta(MetaFileEntity mf, int metaId) { + MetaEntity me = new MetaEntity(); + me.setMetaid(metaId); + me.setEventid(mf.getEventid()); + me.setDircode(mf.getDircode()); + me.setDepcode(mf.getDepcode()); + me.setVerid(mf.getVerid()); + me.setName(mf.getName()); + me.setType(mf.getType()); + me.setGuid(mf.getGuid()); + me.setPath(mf.getPath()); + me.setSizes(mf.getSizes()); + if (mf.getRows() > 0) { + me.setTab(mf.getTab()); + } + if (!StringHelper.isEmpty(mf.getEntity())) { + me.setLayer(mf.getEntity()); + } + me.setRows(mf.getRows()); + me.setCreateUser(mf.getCreateUser()); + me.setCreateTime(mf.getCreateTime()); + + return me; + } + + /** + * 鎻掑叆鐖跺厓鏁版嵁 + */ + private int insertParentMeta(List<MetaFileEntity> list) { + for (MetaFileEntity mf : list) { + if (null != mf.getMsg() || !mf.getIsMeta()) { + continue; + } + + MetaEntity me = createMeta(mf, 0); + me.setIsmeta((short) 1); + metaService.insert(me); + mf.setMsg(me.getId() > 0 ? "鎴愬姛" : "澶辫触"); + + return me.getId(); + } + + return 0; + } + + /** + * Excel鍏ュ簱 + */ + private String excelLoader(List<MetaFileEntity> xlsList, HttpServletRequest req) { + try { + MetaFileEntity xlsMeta = getExcelMeta(xlsList); + if (null != xlsMeta) { + return fmeService.excelLoader(xlsMeta, req); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + + return null; + } + + /** + * 鑾峰彇Excel鐨勫厓鏁版嵁 + */ + private MetaFileEntity getExcelMeta(List<MetaFileEntity> xlsList) { + if (null == xlsList || xlsList.isEmpty()) { + return null; + } + + List<String> pathList = new ArrayList<>(); + List<String> dirList = new ArrayList<>(); + List<String> pidList = new ArrayList<>(); + + for (int i = 0, c = xlsList.size(); i < c; i++) { + MetaFileEntity mf = xlsList.get(i); + if ("鎴愬姛".equals(mf.getMsg()) && null != mf.getXlsPath()) { + pathList.add(mf.getXlsPath()); + dirList.add(mf.getDircode()); + pidList.add(mf.getEventid()); + } + } + + MetaFileEntity first = xlsList.get(0); + MetaFileEntity meta = new MetaFileEntity(); + meta.setPath(StringHelper.join(pathList, ",")); + meta.setEpsgCode(first.getEpsgCode()); + meta.setName(StringHelper.join(dirList, ";")); + meta.setDepcode(first.getDepcode()); + meta.setVerid(first.getVerid()); + meta.setCreateUser(first.getCreateUser()); + meta.setEventid(StringHelper.join(pidList, ";")); + + return meta; + } +} diff --git a/src/main/java/com/moon/server/service/data/VerService.java b/src/main/java/com/moon/server/service/data/VerService.java new file mode 100644 index 0000000..d3ae84c --- /dev/null +++ b/src/main/java/com/moon/server/service/data/VerService.java @@ -0,0 +1,74 @@ +package com.moon.server.service.data; + +import com.moon.server.entity.data.VerEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.data.VerMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鐗堟湰琛� + * @author sws + * @date 2022-09-29 + */ +@Service +public class VerService implements VerMapper { + @Autowired + VerMapper verMapper; + + @Override + public Integer selectCount(Integer dirid, String name) { + name = StringHelper.getLikeUpperStr(name); + + return verMapper.selectCount(dirid, name); + } + + @Override + public List<VerEntity> selectByPage(Integer dirid, String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return verMapper.selectByPage(dirid, name, limit, offset); + } + + @Override + public List<VerEntity> selectByDirid(Integer dirid) { + return verMapper.selectByDirid(dirid); + } + + @Override + public Integer insertVersion(VerEntity verEntity) { + return verMapper.insertVersion(verEntity); + } + + @Override + public Integer insertVersions(List<VerEntity> verEntity) { + return verMapper.insertVersions(verEntity); + } + + @Override + public Integer deleteVersion(int id) { + return verMapper.deleteVersion(id); + } + + @Override + public Integer deleteVersions(List<Integer> ids) { + return verMapper.deleteVersions(ids); + } + + @Override + public Integer updateVersion(VerEntity verEntity) { + return verMapper.updateVersion(verEntity); + } + + @Override + public VerEntity selectVersion(int id) { + return verMapper.selectVersion(id); + } + + @Override + public List<VerEntity> selectVersionAll() { + return verMapper.selectVersionAll(); + } +} diff --git a/src/main/java/com/moon/server/service/show/ApplyService.java b/src/main/java/com/moon/server/service/show/ApplyService.java new file mode 100644 index 0000000..282614d --- /dev/null +++ b/src/main/java/com/moon/server/service/show/ApplyService.java @@ -0,0 +1,276 @@ +package com.moon.server.service.show; + +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.DownloadReqEntity; +import com.moon.server.entity.data.MetaEntity; +import com.moon.server.entity.show.ApplyEntity; +import com.moon.server.entity.show.FlowEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.AesHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.show.ApplyMapper; +import com.moon.server.service.data.MetaService; +import com.moon.server.service.sys.UserService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 鏁版嵁鐢宠 + * @author WWW + */ +@Service +public class ApplyService implements ApplyMapper { + @Autowired + ApplyMapper applyMapper; + + @Autowired + FlowService flowService; + + @Autowired + UserService userService; + + @Autowired + MetaService metaService; + + @Autowired + DataLibService dataLibService; + + private final static Log log = LogFactory.getLog(ApplyService.class); + + @Override + public Integer selectCount(String uname, Integer status, Timestamp start, Timestamp end) { + uname = StringHelper.getLikeUpperStr(uname); + + return applyMapper.selectCount(uname, status, start, end); + } + + @Override + public List<ApplyEntity> selectByPage(Integer userid, String uname, Integer status, Timestamp start, Timestamp end, Integer limit, Integer offset) { + uname = StringHelper.getLikeUpperStr(uname); + + return applyMapper.selectByPage(userid, uname, status, start, end, limit, offset); + } + + @Override + public List<ApplyEntity> selectAll() { + return applyMapper.selectAll(); + } + + @Override + public ApplyEntity selectById(int id) { + return applyMapper.selectById(id); + } + + @Override + public UserEntity selectUserByDepcode(String depcode) { + return applyMapper.selectUserByDepcode(depcode); + } + + @Override + public Integer selectSubmits(Integer userid) { + return applyMapper.selectSubmits(userid); + } + + @Override + public List<FlowEntity> selectFlows(Integer applyid) { + return applyMapper.selectFlows(applyid); + } + + @Override + public Integer insert(ApplyEntity entity) { + return applyMapper.insert(entity); + } + + @Override + public Integer inserts(List<ApplyEntity> list) { + return applyMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return applyMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return applyMapper.deletes(ids); + } + + @Override + public Integer update(ApplyEntity entity) { + return applyMapper.update(entity); + } + + @Override + public Integer updates(List<ApplyEntity> list) { + return applyMapper.updates(list); + } + + @Override + public Integer updateForDiscard(Integer userid, Integer id) { + return applyMapper.updateForDiscard(userid, id); + } + + @Override + public Integer updateForResubmit(Integer userid, Integer id) { + return applyMapper.updateForResubmit(userid, id); + } + + @Override + public Integer updateForSubmit(Integer userid, Integer applyid, Integer flowId) { + return applyMapper.updateForSubmit(userid, applyid, flowId); + } + + @Override + public Integer updateForReject(Integer userid, Integer applyid, Integer flowId) { + return applyMapper.updateForReject(userid, applyid, flowId); + } + + /** + * 鎻掑叆鏁版嵁鐢宠 + */ + public Integer insertApply(UserEntity ue, DownloadReqEntity dr) throws Exception { + ApplyEntity apply = getApplyEntity(ue, dr); + int rows = applyMapper.insert(apply); + if (0 == rows) { + return 0; + } + + List<FlowEntity> list = getFlowEntities(apply.getId(), ue, dr); + if (list.isEmpty()) { + applyMapper.delete(apply.getId()); + throw new Exception("鎵句笉鍒板緟瀹℃牳浜�"); + } + + return flowService.inserts(list); + } + + /** + * 鑾峰彇鏁版嵁鐢宠瀹炰綋绫� + */ + private ApplyEntity getApplyEntity(UserEntity ue, DownloadReqEntity dr) throws Exception { + // String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd())) + String aesPwd = AesHelper.encrypt(dr.getPwd()); + String gids = null == dr.getIds() || dr.getIds().isEmpty() ? null : StringHelper.join(dr.getIds(), ","); + + ApplyEntity apply = new ApplyEntity(); + apply.setUserid(ue.getId()); + apply.setDepids(StringHelper.join(dr.getDepcodes(), ",")); + apply.setTabs(getTabs(dr)); + apply.setEntities(StringHelper.join(dr.getEntities(), ",")); + apply.setWkt(dr.getWkt()); + apply.setPwd(aesPwd); + apply.setStatus(0); + apply.setCount(dr.getDepcodes().size()); + apply.setDescr(dr.getDescr()); + apply.setCreateUser(ue.getId()); + apply.setDepcode(dr.getDepcode()); + apply.setDircodes(dr.getDirs()); + apply.setGids(gids); + apply.setFilters(dr.getFilter()); + + return apply; + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + private String getTabs(DownloadReqEntity dr) { + if (!StaticData.SYS_META.equals(dr.getEntities().get(0))) { + return StringHelper.join(dr.getTabs(), ","); + } + + List<MetaEntity> list = metaService.selectMetaFiles(dr.getIds()); + if (null == list || list.isEmpty()) { + return "鍏冩暟鎹〃"; + } + + StringBuilder sb = new StringBuilder(); + for (MetaEntity me : list) { + sb.append(me.getName()).append(","); + if (sb.length() > StaticData.I1000) { + break; + } + } + if (sb.length() > 1) { + sb.deleteCharAt(sb.length() - 1); + } + + return sb.toString(); + } + + /** + * 鑾峰彇鐢宠娴佺▼瀹炰綋绫婚泦鍚� + */ + private List<FlowEntity> getFlowEntities(Integer applyId, UserEntity ue, DownloadReqEntity dr) { + List<FlowEntity> list = new ArrayList<>(); + for (String depcode : dr.getDepcodes()) { + UserEntity user = selectUserByDepcode(depcode); + if (null == user) { + user = userService.selectByUid(StaticData.ADMIN); + } + + FlowEntity flow = new FlowEntity(); + flow.setApplyid(applyId); + flow.setDepcode(depcode); + flow.setUserid(user.getId()); + flow.setStatus(0); + flow.setDescr(null); + flow.setCreateUser(ue.getId()); + + list.add(flow); + } + + return list; + } + + /** + * 鎵撳寘DB鏁版嵁 + */ + public void zipDbData(UserEntity ue, ApplyEntity entity) { + try { + List<String> entities = Arrays.asList(entity.getEntities().split(StaticData.COMMA)); + String pwd = AesHelper.decrypt(entity.getPwd()); + + DownloadReqEntity dr = new DownloadReqEntity(); + dr.setEntities(entities); + dr.setWkt(dr.getWkt()); + dr.setPwd(pwd); + dr.setDepcode(entity.getDepcode()); + dr.setDirs(entity.getDircodes()); + dr.setIds(getIds(entity.getGids())); + dr.setFilter(entity.getFilters()); + + String guid = StaticData.SYS_META.equals(entity.getEntities()) ? metaService.downloadMeteReq(ue, dr) : dataLibService.downloadDbReq(ue, dr); + if (!StringHelper.isEmpty(guid)) { + entity.setGuid(guid); + update(entity); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + + /** + * 鑾峰彇ID闆嗗悎 + */ + private List<Integer> getIds(String gids) { + if (StringHelper.isEmpty(gids)) { + return null; + } + + List<Integer> list = new ArrayList<>(); + for (String str : gids.split(StaticData.COMMA)) { + list.add(Integer.parseInt(str)); + } + + return list; + } +} diff --git a/src/main/java/com/moon/server/service/show/DataLibService.java b/src/main/java/com/moon/server/service/show/DataLibService.java new file mode 100644 index 0000000..c763e10 --- /dev/null +++ b/src/main/java/com/moon/server/service/show/DataLibService.java @@ -0,0 +1,346 @@ +package com.moon.server.service.show; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.moon.server.entity.ctrl.DownloadReqEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.sys.AttachEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.mapper.all.GeomBaseMapper; +import com.moon.server.mapper.data.DownloadMapper; +import com.moon.server.service.all.BaseQueryService; +import com.moon.server.service.data.MetaService; +import com.moon.server.helper.*; +import net.lingala.zip4j.ZipFile; +import net.lingala.zip4j.model.ZipParameters; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.*; + +/** + * 璧勬枡棣� + * @author WWW + */ +@Service +public class DataLibService { + @Autowired + PathHelper pathHelper; + + @Autowired + MetaService metaService; + + @Autowired + DownloadMapper downloadMapper; + + @Autowired + BaseQueryService baseQueryService; + + private final static Log log = LogFactory.getLog(DataLibService.class); + + /** + * 鏌ヨDB涓孩鍑虹殑鍗曚綅缂栫爜 + */ + public List<String> selectDbOverflowDep(UserEntity ue, DownloadReqEntity dr) { + if (!StringHelper.isEmpty(dr.getWkt())) { + return selectDbOverflowDep4Wkt(ue, dr); + } + + return selectDbOverflowDep4Prop(ue, dr); + } + + /** + * 鏌ヨDB涓孩鍑虹殑鍗曚綅缂栫爜-绌洪棿鏌ヨ + */ + public List<String> selectDbOverflowDep4Wkt(UserEntity ue, DownloadReqEntity dr) { + List<String> rs = new ArrayList<>(); + for (String entity : dr.getEntities()) { + GeomBaseMapper<?> baseMapper = ClassHelper.getGeoBaseMapper(entity); + if (null == baseMapper) { + continue; + } + + QueryWrapper wrapper = getWrapper4DbOverflow(ue, dr); + Integer srid = baseQueryService.getSrid(baseMapper); + wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", dr.getWkt(), srid)); + + List<String> ids = baseMapper.selectObjs(wrapper); + addDepCodes(rs, ids); + } + + return rs; + } + + /** + * 鏌ヨDB涓孩鍑虹殑鍗曚綅缂栫爜-灞炴�ф煡璇� + */ + public List<String> selectDbOverflowDep4Prop(UserEntity ue, DownloadReqEntity dr) { + List<String> rs = new ArrayList<>(); + BasicMapper<?> baseMapper = ClassHelper.getBasicMapper(dr.getEntities().get(0)); + if (null == baseMapper) { + return rs; + } + + QueryWrapper wrapper = getWrapper4DbOverflow(ue, dr); + List<String> ids = baseMapper.selectObjs(wrapper); + addDepCodes(rs, ids); + + return rs; + } + + /** + * 鏌ヨDB涓孩鍑哄崟浣嶇紪鐮佺殑鏌ヨ鍖呰鍣� + */ + private <T> QueryWrapper<T> getWrapper4DbOverflow(UserEntity ue, DownloadReqEntity dr) { + QueryWrapper<T> wrapper = new QueryWrapper<T>(); + wrapper.select("depid"); + wrapper.groupBy("depid"); + wrapper.apply("depid is not null and depid not like '" + ue.getDepcode() + "%'"); + + if (null != dr.getIds() && dr.getIds().size() > 0) { + wrapper.apply(String.format("gid in (%s)", StringHelper.join(dr.getIds(), ","))); + } else { + baseQueryService.addFilterWrapper(wrapper, dr.getFilter()); + } + + String dirs = copeCodes(dr.getDirs(), "dirid"); + if (!StringHelper.isEmpty(dirs)) { + wrapper.apply(dirs); + } + if (!StringHelper.isEmpty(dr.getDepcode())) { + wrapper.likeRight("depid", dr.getDepcode()); + } + + return wrapper; + } + + /** + * 娣诲姞鍗曚綅缂栫爜 + */ + private void addDepCodes(List<String> rs, List<String> ids) { + if (null == ids || ids.isEmpty()) { + return; + } + + for (String id : ids) { + if (StringHelper.isEmpty(id)) { + continue; + } + if (!rs.contains(id)) { + rs.add(id); + } + } + } + + /** + * 璇锋眰DB鏁版嵁涓嬭浇 + */ + public String downloadDbReq(UserEntity ue, DownloadReqEntity dr) throws Exception { + Map<String, List<?>> dataMap = new HashMap<>(2); + Map<String, List<AttachEntity>> annexMap = new HashMap<>(2); + queryData(dr, dataMap, annexMap); + if (dataMap.size() == 0) { + return null; + } + + String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); + String tempPath = pathHelper.getTempPath(tempName); + String gdbPath = tempPath + File.separator + "tabs.gdb"; + + File gdbFile = new File(gdbPath); + if (gdbFile.exists() && gdbFile.isDirectory()) { + FileHelper.deleteDir(gdbPath); + } + GdbHelper.createGdb(gdbPath, dataMap); + + String zipFile = pathHelper.getDownloadFullPath() + File.separator + tempName + ".gdb.zip"; + ZipFile zip = Zip4jHelper.createZipFile(zipFile, dr.getPwd()); + ZipParameters params = Zip4jHelper.getZipParams(true); + zip.addFolder(new File(gdbPath), params); + // zip.addFolder(new File(annexPath), params) + metaService.addAnnex(zip, params, annexMap); + + String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd())); + DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd); + int rows = downloadMapper.insert(de); + + return rows > 0 ? de.getGuid() : null; + } + + /** + * 鏌ヨ鏁版嵁+闄勪欢 + */ + private void queryData(DownloadReqEntity dr, Map<String, List<?>> dataMap, Map<String, List<AttachEntity>> annexMap) { + for (String entity : dr.getEntities()) { + try { + BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); + if (null == baseMapper) { + continue; + } + + QueryWrapper wrapper = createQueryWrapper(baseMapper, dr); + metaService.addData(entity, baseMapper, wrapper, dataMap, annexMap); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } + + /** + * 鍒涘缓鏌ヨ鍖呰鍣� + */ + private <T> QueryWrapper<T> createQueryWrapper(BasicMapper baseMapper, DownloadReqEntity dr) { + QueryWrapper<T> wrapper = new QueryWrapper<T>(); + + String dirs = copeCodes(dr.getDirs(), "dirid"); + if (!StringHelper.isEmpty(dirs)) { + wrapper.apply(dirs); + } + if (!StringHelper.isEmpty(dr.getDepcode())) { + // wrapper.apply(String.format("depid like '%s'", StringHelper.getRightLike(dr.getDepcode()))) + wrapper.likeRight("depid", dr.getDepcode()); + } + if (baseMapper instanceof GeomBaseMapper) { + wrapper.select("ST_AsText(geom) as geom, *"); + if (!StringHelper.isEmpty(dr.getWkt())) { + Integer srid = baseQueryService.getSrid((GeomBaseMapper) baseMapper); + wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", dr.getWkt(), srid)); + } + } + if (null != dr.getIds() && dr.getIds().size() > 0) { + wrapper.apply(String.format("gid in (%s)", StringHelper.join(dr.getIds(), ","))); + } else { + baseQueryService.addFilterWrapper(wrapper, dr.getFilter()); + } + + return wrapper; + } + + /** + * 鍒涘缓闄勪欢 * + */ + private void createAnnex(String annexPath, Map<String, List<AttachEntity>> annexMap) { + if (annexMap.size() == 0) { + return; + } + + String uploadPath = pathHelper.getConfig().getUploadPath(); + for (String key : annexMap.keySet()) { + String targetPath = annexPath + File.separator + key; + File targetFile = new File(targetPath); + if (!targetFile.exists() || !targetFile.isDirectory()) { + targetFile.mkdirs(); + } + + for (AttachEntity ae : annexMap.get(key)) { + try { + File srcFile = new File(uploadPath + File.separator + ae.getPath()); + if (!srcFile.exists() || srcFile.isDirectory()) { + continue; + } + + File destFile = new File(targetPath + File.separator + ae.getName()); + if (destFile.exists() && !destFile.isDirectory()) { + continue; + } + + FileHelper.copyFile(srcFile, destFile); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } + } + + /** + * 鑾峰彇涓嬭浇瀹炰綋绫� + */ + private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { + DownloadEntity de = new DownloadEntity(); + de.setName(FileHelper.getFileName(file)); + // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 + de.setType(4); + de.setSizes(FileHelper.sizeToMb(new File(file).length())); + de.setDepid(ue.getDepid()); + de.setDcount(0); + de.setPwd(pwd); + de.setUrl(FileHelper.getRelativePath(file)); + de.setDescr("涓氬姟鏁版嵁鏂囦欢"); + de.setGuid(FileHelper.getFileMd5(file)); + de.setCreateUser(ue.getId()); + // de.setGeom(null) + + return de; + } + + /** + * 澶勭悊缂栫爜 + */ + public static String copeCodes(String codes, String field) { + if (StringHelper.isEmpty(codes) || StringHelper.isSqlInjection(codes)) { + return null; + } + + List<String> list = codesAsList(codes); + removeDuplicate(list); + setRightLike(list, field); + + return "(" + StringHelper.join(list, " or ") + ")"; + } + + /** + * 鍗曚綅缂栫爜杞泦鍚� + */ + private static List<String> codesAsList(String codes) { + List<String> list = Arrays.asList(codes.split(",")); + Set set = new HashSet(list); + + List<String> newList = new ArrayList<>(set); + Collections.sort(newList); + + return newList; + } + + /** + * 鍘婚櫎閲嶅 + */ + private static void removeDuplicate(List<String> list) { + int i = 0; + while (i < list.size()) { + int j = findStr(list, i); + if (j > -1) { + list.remove(j); + continue; + } + + i++; + } + } + + /** + * 鏌ユ壘瀛楃涓� + */ + private static int findStr(List<String> list, int i) { + String source = list.get(i); + for (int j = i + 1, c = list.size(); j < c; j++) { + if (list.get(j).startsWith(source)) { + return j; + } + } + + return -1; + } + + /** + * 璁剧疆 鍙砽ike + */ + private static void setRightLike(List<String> list, String field) { + for (int i = 0, c = list.size(); i < c; i++) { + String str = String.format("%s like '%s%%'", field, list.get(i)); + list.set(i, str); + } + } +} diff --git a/src/main/java/com/moon/server/service/show/ExportService.java b/src/main/java/com/moon/server/service/show/ExportService.java new file mode 100644 index 0000000..2b26972 --- /dev/null +++ b/src/main/java/com/moon/server/service/show/ExportService.java @@ -0,0 +1,118 @@ +package com.moon.server.service.show; + +import com.alibaba.fastjson.JSON; +import com.moon.server.entity.all.ResponseMsg; +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.show.ExportEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.FileHelper; +import com.moon.server.helper.PathHelper; +import com.moon.server.helper.RestHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.service.data.DownloadService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; + +/** + * 鍦ㄧ嚎鍒跺浘 + * @author WWW + */ +@Service +public class ExportService { + @Value("${sys.exportServer}") + private String exportServer; + + @Autowired + PathHelper pathHelper; + + @Autowired + DownloadService downloadService; + + /** + * POST璇锋眰鍑哄浘鏈嶅姟 + * + * @param ue 鐢ㄦ埛绫� + * @param entity 鍦ㄧ嚎鍒跺浘绫� + * @return 鎴愬姛 + * @throws Exception + */ + public String post(UserEntity ue, ExportEntity entity) throws Exception { + Map<String, Object> map = getMapData(entity); + String url = exportServer + "/Export/Start"; + + String str = RestHelper.postForRest(url, map); + if (StringHelper.isEmpty(str)) { + return null; + } + + ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class); + if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) { + return null; + } + + String file = pathHelper.getConfig().getDownloadPath() + File.separator + msg.getResult(); + File f = new File(file); + if (!f.exists() && !f.isDirectory()) { + return null; + } + + DownloadEntity de = getDownloadEntity(ue, entity, file); + int rows = downloadService.insert(de); + + return rows > 0 ? de.getGuid() : null; + } + + /** + * 鑾峰彇Map鏁版嵁 + */ + private Map<String, Object> getMapData(ExportEntity entity) { + Map<String, Object> map = new HashMap<String, Object>(3); + + Field[] fields = entity.getClass().getDeclaredFields(); + for (Field field : fields) { + try { + if ("serialVersionUID".equals(field.getName())) { + continue; + } + + field.setAccessible(true); + Object obj = field.get(entity); + + map.put(field.getName(), obj); + } catch (Exception ex) { + // + } + } + + return map; + } + + /** + * 鑾峰彇涓嬭浇瀹炰綋绫� + */ + private DownloadEntity getDownloadEntity(UserEntity ue, ExportEntity entity, String file) throws Exception { + DownloadEntity de = new DownloadEntity(); + de.setName(FileHelper.getFileName(file)); + // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 + de.setType(2); + de.setSizes(FileHelper.sizeToMb(new File(file).length())); + de.setDepid(ue.getDepid()); + de.setDcount(0); + // de.setPwd(null) + de.setUrl(FileHelper.getRelativePath(file)); + // de.setDescr("涓撻鍥炬枃浠�") + de.setDescr(StringHelper.isEmpty(entity.getTitle()) ? "涓撻鍥炬枃浠�" : entity.getTitle().trim()); + de.setGuid(FileHelper.getFileMd5(file)); + de.setCreateUser(ue.getId()); + // de.setGeom(null) + + return de; + } +} diff --git a/src/main/java/com/moon/server/service/show/FlowService.java b/src/main/java/com/moon/server/service/show/FlowService.java new file mode 100644 index 0000000..6e2100f --- /dev/null +++ b/src/main/java/com/moon/server/service/show/FlowService.java @@ -0,0 +1,68 @@ +package com.moon.server.service.show; + +import com.moon.server.entity.show.FlowEntity; +import com.moon.server.mapper.show.FlowMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鐢宠娴佺▼ + * @author WWW + */ +@Service +public class FlowService implements FlowMapper { + @Autowired + FlowMapper flowMapper; + + @Override + public Integer selectCount(Integer userid) { + return flowMapper.selectCount(userid); + } + + @Override + public List<FlowEntity> selectByPage(Integer userid, Integer limit, Integer offset) { + return flowMapper.selectByPage(userid, limit, offset); + } + + @Override + public List<FlowEntity> selectAll() { + return flowMapper.selectAll(); + } + + @Override + public FlowEntity selectById(int id) { + return flowMapper.selectById(id); + } + + @Override + public Integer insert(FlowEntity entity) { + return flowMapper.insert(entity); + } + + @Override + public Integer inserts(List<FlowEntity> list) { + return flowMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return flowMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return flowMapper.deletes(ids); + } + + @Override + public Integer update(FlowEntity entity) { + return flowMapper.update(entity); + } + + @Override + public Integer updates(List<FlowEntity> list) { + return flowMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/show/InquiryService.java b/src/main/java/com/moon/server/service/show/InquiryService.java new file mode 100644 index 0000000..d9c8e1b --- /dev/null +++ b/src/main/java/com/moon/server/service/show/InquiryService.java @@ -0,0 +1,206 @@ +package com.moon.server.service.show; + +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.DownloadTileEntity; +import com.moon.server.entity.ctrl.ShpRecordEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.data.MetaFileEntity; +import com.moon.server.entity.data.PublishEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.data.DownloadService; +import com.moon.server.service.data.PublishService; +import com.moon.server.helper.*; +import net.lingala.zip4j.ZipFile; +import net.lingala.zip4j.model.ZipParameters; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.File; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 鏌ヨ鏈嶅姟绫� + * @author WWW + */ +@Service +public class InquiryService { + @Resource + PathHelper pathHelper; + + @Resource + PublishService publishService; + + @Resource + DownloadService downloadService; + + private final static Log log = LogFactory.getLog(InquiryService.class); + + /** + * 璇诲彇Shp绗竴鏉¤褰曠殑WKT + */ + public ShpRecordEntity readShpFirstRecord(List<MetaFileEntity> list) { + String fileName = null; + for (MetaFileEntity mf : list) { + if (mf.getName().toLowerCase().contains(".shp")) { + fileName = mf.getPath(); + break; + } + } + if (StringHelper.isEmpty(fileName)) { + return null; + } + + ShpRecordEntity sr = ShpHelper.readShpFirstRecord(fileName); + FileHelper.deleteFiles(list); + + return sr; + } + + /** + * 鎵撳寘鐡︾墖 + */ + public String zipTiles(DownloadTileEntity dt, PublishEntity pub, UserEntity ue) { + if (!isTilePathExist(pub)) { + return null; + } + + List<File> list = findTiles(dt, pub); + if (list.isEmpty()) { + return null; + } + + String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); + String zipFile = pathHelper.getDownloadFullPath() + File.separator + tempName + ".zip"; + + ZipFile zip = Zip4jHelper.createZipFile(zipFile, dt.getPwd()); + ZipParameters params = Zip4jHelper.getZipParams(true); + addFiles(zip, params, list, pub.getPath() + File.separator); + + String dbPwd = Md5Helper.reverse(Md5Helper.generate(dt.getPwd())); + DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd); + int rows = downloadService.insert(de); + if (de.getId() > 0) { + insertPubDown(pub, de, ue); + } + + return rows > 0 ? de.getGuid() : null; + } + + /** + * 鐡︾墖璺緞鏄惁瀛樺湪 + */ + private boolean isTilePathExist(PublishEntity pub) { + String tilePath = pathHelper.getConfig().getTilePath().replace("2d\\tiles", "") + pub.getPath(); + + File f = new File(tilePath); + if (!f.exists() || !f.isDirectory()) { + return false; + } + + pub.setPath(tilePath); + + return true; + } + + /** + * 鏌ユ壘鐡︾墖 + */ + private List<File> findTiles(DownloadTileEntity dt, PublishEntity pub) { + List<File> list = new ArrayList<>(); + for (int i = 0; i < StaticData.I23; i++) { + List<File> files = findTilesByZoom(dt, pub, i); + if (files.size() > 0) { + list.addAll(files); + } + } + + return list; + } + + /** + * 鏍规嵁灞傛鏌ユ壘鐡︾墖 + */ + private List<File> findTilesByZoom(DownloadTileEntity dt, PublishEntity pub, int zoom) { + List<File> list = new ArrayList<>(); + File f = new File(pub.getPath() + File.separator + zoom); + if (!f.exists() || !f.isDirectory()) { + return list; + } + + int[] leftTop = deg2num(zoom, dt.getXmin(), dt.getYmax()); + int[] rightBottom = deg2num(zoom, dt.getXmax(), dt.getYmin()); + + for (int x = leftTop[0]; x <= rightBottom[0]; x++) { + for (int y = leftTop[1]; y <= rightBottom[1]; y++) { + String pngPath = String.format("%s\\%d\\%d\\%d.png", pub.getPath(), zoom, x, y); + + File pngFile = new File(pngPath); + if (pngFile.exists()) { + list.add(pngFile); + } + } + } + + return list; + } + + /** + * 瑙掑害杞暟鍊� + */ + private int[] deg2num(int zoom, double x, double y) { + double yRad = Math.toRadians(y); + double n = Math.pow(2.0, zoom); + + int xTile = (int) ((x + 180.0) / 360.0 * n); + int yTile = (int) ((1.0 - Math.log(Math.tan(yRad) + (1 / Math.cos(yRad))) / Math.PI) / 2.0 * n); + + return new int[]{xTile, yTile}; + } + + /** + * 娣诲姞鏂囦欢鑷冲帇缂╁寘 + */ + private void addFiles(ZipFile zip, ZipParameters params, List<File> list, String basePath) { + for (File f : list) { + try { + params.setFileNameInZip(f.getPath().replace(basePath, "")); + zip.addStream(new FileInputStream(f), params); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } + + /** + * 鑾峰彇涓嬭浇瀹炰綋绫� + */ + private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { + DownloadEntity de = new DownloadEntity(); + de.setName(FileHelper.getFileName(file)); + // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 + de.setType(8); + de.setSizes(FileHelper.sizeToMb(new File(file).length())); + de.setDepid(ue.getDepid()); + de.setDcount(0); + de.setPwd(pwd); + de.setUrl(FileHelper.getRelativePath(file)); + de.setDescr("鐡︾墖鏂囦欢"); + de.setGuid(FileHelper.getFileMd5(file)); + de.setCreateUser(ue.getId()); + // de.setGeom(null) + + return de; + } + + /** + * 鎻掑叆鏁版嵁鍙戝竷-涓嬭浇琛� + */ + private void insertPubDown(PublishEntity pub, DownloadEntity de, UserEntity ue) { + publishService.insertPubDown(pub.getId(), de.getId(), ue.getId()); + } +} diff --git a/src/main/java/com/moon/server/service/show/MarkService.java b/src/main/java/com/moon/server/service/show/MarkService.java new file mode 100644 index 0000000..d20e573 --- /dev/null +++ b/src/main/java/com/moon/server/service/show/MarkService.java @@ -0,0 +1,231 @@ +package com.moon.server.service.show; + +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.MarkJsonEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.data.MetaFileEntity; +import com.moon.server.entity.show.MarkEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.mapper.show.MarkMapper; +import com.moon.server.service.data.DownloadService; +import com.moon.server.helper.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 鏍囩粯 + * @author WWW + */ +@Service +public class MarkService implements MarkMapper { + @Autowired + MarkMapper markMapper; + + @Autowired + PathHelper pathHelper; + + @Autowired + DownloadService downloadService; + + @Override + public Integer selectCount(Integer uid) { + return markMapper.selectCount(uid); + } + + @Override + public List<MarkEntity> selectByPage(Integer uid, Integer limit, Integer offset) { + return markMapper.selectByPage(uid, limit, offset); + } + + @Override + public List<MarkEntity> selectAll() { + return markMapper.selectAll(); + } + + @Override + public MarkEntity selectById(int id) { + return markMapper.selectById(id); + } + + @Override + public Integer insert(MarkEntity entity) { + return markMapper.insert(entity); + } + + @Override + public Integer inserts(List<MarkEntity> list) { + return markMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return markMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return markMapper.deletes(ids); + } + + @Override + public Integer update(MarkEntity entity) { + return markMapper.update(entity); + } + + @Override + public Integer updates(List<MarkEntity> list) { + return markMapper.updates(list); + } + + /** + * 涓嬭浇ShapeFile鏂囦欢 + * + * @param ue 鐢ㄦ埛瀹炰綋 + * @param list 鏍囩粯JSON瀹炰綋绫婚泦鍚� + * @return GUID + * @throws Exception 寮傚父 + */ + public String downloadShp(UserEntity ue, List<MarkJsonEntity> list) throws Exception { + String path = pathHelper.getTempPath(); + createShapeFiles(ue, list, path); + + File[] files = new File(path).listFiles(); + if (files == null || files.length == 0) { + return null; + } + + String zip = getZipPath(); + ZipHelper.zip(zip, path); + FileHelper.deleteDir(path); + + String guid = FileHelper.getFileMd5(zip); + DownloadEntity entity = downloadService.selectByGuid(guid); + if (entity != null) { + return entity.getGuid(); + } + + DownloadEntity de = getDownloadEntity(ue, zip); + int rows = downloadService.insert(de); + + return rows > 0 ? de.getGuid() : null; + } + + /** + * 鍒涘缓shp鏂囦欢 + */ + private String createShapeFiles(UserEntity ue, List<MarkJsonEntity> list, String path) { + List<MarkJsonEntity> points = getMarkByType(list, "POINT"); + if (points.size() > 0) { + ShpHelper.createShp(points, path, "POINT"); + } + List<MarkJsonEntity> lines = getMarkByType(list, "LINESTRING"); + if (lines.size() > 0) { + ShpHelper.createShp(lines, path, "LINESTRING"); + } + List<MarkJsonEntity> polygons = getMarkByType(list, "POLYGON"); + if (polygons.size() > 0) { + ShpHelper.createShp(polygons, path, "POLYGON"); + } + + return path; + } + + /** + * 鑾峰彇shp鐩綍 + */ + private String getShpDir(UserEntity ue, String parent) { + String path = parent + File.separator + StringHelper.YMDHMS2_FORMAT.format(new Date()); + + File file = new File(path); + if (!file.exists() && !file.isDirectory()) { + file.mkdirs(); + } + + return path; + } + + /** + * 鑾峰彇鏍囩粯绫诲瀷 + */ + private List<MarkJsonEntity> getMarkByType(List<MarkJsonEntity> list, String type) { + List<MarkJsonEntity> rs = new ArrayList<>(); + for (MarkJsonEntity mark : list) { + if (StringHelper.isEmpty(mark.getWkt())) { + continue; + } + if (mark.getWkt().contains(type)) { + rs.add(mark); + } + } + + return rs; + } + + /** + * 鑾峰彇zip璺緞 + */ + private String getZipPath() { + String path = pathHelper.getDownloadFullPath() + File.separator + StringHelper.YMDHMS2_FORMAT.format(new Date()) + ".zip"; + + File file = new File(path); + if (file.exists() && !file.isDirectory()) { + file.delete(); + } + + return path; + } + + /** + * 鑾峰彇涓嬭浇瀹炰綋绫� + */ + private DownloadEntity getDownloadEntity(UserEntity ue, String file) throws Exception { + DownloadEntity de = new DownloadEntity(); + de.setName(FileHelper.getFileName(file)); + // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 + de.setType(1); + de.setSizes(FileHelper.sizeToMb(new File(file).length())); + de.setDepid(ue.getDepid()); + de.setDcount(0); + // de.setPwd(null) + de.setUrl(FileHelper.getRelativePath(file)); + de.setDescr("Shp鏂囦欢"); + de.setGuid(FileHelper.getFileMd5(file)); + de.setCreateUser(ue.getId()); + // de.setGeom(null) + + return de; + } + + /** + * 鑾峰彇涓嬭浇鏂囦欢璺緞 + */ + public String getDownloadFilePath(DownloadEntity de) { + return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); + } + + /** + * 璇诲彇ShapeFile鏂囦欢鑾峰彇Mark瀹炰綋绫� + */ + public List<MarkJsonEntity> readShpForMarks(List<MetaFileEntity> list) { + String fileName = null; + for (MetaFileEntity mf : list) { + if (mf.getName().toLowerCase().contains(StaticData.SHP)) { + fileName = mf.getPath(); + break; + } + } + if (StringHelper.isEmpty(fileName)) { + return null; + } + + List<MarkJsonEntity> mjeList = ShpHelper.readShpForMarks(fileName); + FileHelper.deleteFiles(list); + + return mjeList; + } +} diff --git a/src/main/java/com/moon/server/service/show/ModelService.java b/src/main/java/com/moon/server/service/show/ModelService.java new file mode 100644 index 0000000..63b55e2 --- /dev/null +++ b/src/main/java/com/moon/server/service/show/ModelService.java @@ -0,0 +1,73 @@ +package com.moon.server.service.show; + +import com.moon.server.entity.show.ModelEntity; +import com.moon.server.mapper.show.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 妯″瀷 + * @author WWW + */ +@Service +public class ModelService implements ModelMapper { + @Autowired + ModelMapper modelMapper; + + @Override + public Integer selectCount(Integer layerid) { + return modelMapper.selectCount(layerid); + } + + @Override + public List<ModelEntity> selectByPage(Integer layerid, Integer limit, Integer offset) { + return modelMapper.selectByPage(layerid, limit, offset); + } + + @Override + public List<ModelEntity> selectAll() { + return modelMapper.selectAll(); + } + + @Override + public ModelEntity selectById(int id) { + return modelMapper.selectById(id); + } + + @Override + public ModelEntity selectModelByGuid(int layerid, String modelid) { + return modelMapper.selectModelByGuid(layerid, modelid); + } + + @Override + public Integer insert(ModelEntity entity) { + return modelMapper.insert(entity); + } + + @Override + public Integer inserts(List<ModelEntity> list) { + return modelMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return modelMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return modelMapper.deletes(ids); + } + + @Override + public Integer update(ModelEntity entity) { + return modelMapper.update(entity); + } + + @Override + public Integer updates(List<ModelEntity> list) { + return modelMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/show/OneMapService.java b/src/main/java/com/moon/server/service/show/OneMapService.java new file mode 100644 index 0000000..226e34d --- /dev/null +++ b/src/main/java/com/moon/server/service/show/OneMapService.java @@ -0,0 +1,360 @@ +package com.moon.server.service.show; + +import com.moon.server.entity.show.OneMapEntity; +import com.moon.server.mapper.show.OneMapMapper; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * 绠$綉涓�寮犲浘Service + * + * @author 閭㈤敠鍙� + */ +@Service +public class OneMapService implements OneMapMapper { + @Resource + OneMapMapper aMapOfPipelineMapper; + + /** + * 娴嬬粯 + */ + private static final String MEASUREMENT = "娴嬬粯锛圗SV锛�"; + /** + * 璋冩煡 + */ + private static final String TOINVESTIGATE = "鍕樺療锛圗GE锛�"; + /** + * 鍦扮伨 + */ + private static final String DISASTER = "鍦扮伨锛圗GD锛�"; + /** + * 鍦颁笅缁撴瀯娲炲簱 + */ + private static final String UNDERGROUNDSTRUCTURE = "娲炲簱锛圗GD锛�"; + + /** + * 椤圭洰绫诲埆conut + */ + @Override + public List<String> projectCategoryCount() { + return aMapOfPipelineMapper.projectCategoryCount(); + } + + /** + * 椤圭洰浣嶇疆conut + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> projectLocationCount() { + return aMapOfPipelineMapper.projectLocationCount(); + } + + /** + * 鍥藉缁村害conut + */ + @Override + public List<String> countryDimensionCount() { + return aMapOfPipelineMapper.countryDimensionCount(); + } + + /** + * 鐪佺淮conut + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> provinceDimensionCount() { + return aMapOfPipelineMapper.provinceDimensionCount(); + } + + /** + * 鍏ㄥ浗缁村害-鎸夌収椤硅嚜绫诲瀷缁熻涓嶅悓椤圭洰涓暟 + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countProjectTypeNumber() { + return aMapOfPipelineMapper.countProjectTypeNumber(); + } + + /** + * 鏁版嵁瀛樺偍conut + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> dataStorageCount() { + return aMapOfPipelineMapper.dataStorageCount(); + } + + /** + * 缁熻鏁版嵁绫诲埆 + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> statisticalDataCategories() { + return aMapOfPipelineMapper.statisticalDataCategories(); + } + + /** + * 缁熻鏁版嵁鏈嶅姟绫诲瀷 + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> statisticalDataServiceType() { + return aMapOfPipelineMapper.statisticalDataServiceType(); + } + + /** + * 鐧诲綍浜烘暟缁熻 + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> loginNumberStatistics() { + return aMapOfPipelineMapper.loginNumberStatistics(); + } + + /** + * 鏂囦欢鏍煎紡conut + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> fileFormatCount() { + return aMapOfPipelineMapper.fileFormatCount(); + } + + /** + * 鏁版嵁鐢宠conut + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> dataApplyCount() { + return aMapOfPipelineMapper.dataApplyCount(); + } + + /** + * 鏁版嵁璁块棶鏁� + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> dataVisitCount() { + return aMapOfPipelineMapper.dataVisitCount(); + } + + /** + * 涓嬭浇鏁扮粺璁� + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countDownloads() { + return aMapOfPipelineMapper.countDownloads(); + } + + /** + * 缁熻椤圭洰鏄剧ず + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countProjectDisplay() { + return aMapOfPipelineMapper.countProjectDisplay(); + } + + /** + * 閫夋嫨椤圭洰鍙傝鍒楄〃 + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> selectProjectTour() { + return aMapOfPipelineMapper.selectProjectTour(); + } + + /** + * 閫夋嫨椤圭洰绫诲瀷 + * + * @return {@link List}<{@link OneMapEntity}> + */ + @Override + public List<OneMapEntity> selectProjectType1() { + List<OneMapEntity> resList = new ArrayList<>(); + List<OneMapEntity> resInfo = aMapOfPipelineMapper.selectProjectType1(); + for (OneMapEntity oneMapEntity : resInfo) { + if (MEASUREMENT.equals(oneMapEntity.getValue())) { + resList.addAll(queryDirectory(oneMapEntity)); + } else if (TOINVESTIGATE.equals(oneMapEntity.getValue())) { + resList.addAll(queryDirectory(oneMapEntity)); + } else if (DISASTER.equals(oneMapEntity.getValue())) { + resList.addAll(queryDirectory(oneMapEntity)); + } else if (UNDERGROUNDSTRUCTURE.equals(oneMapEntity.getValue())) { + resList.addAll(queryDirectory(oneMapEntity)); + } + } + return resList; + } + + /** + * 鏌ヨ鐩綍 + * + * @return {@link List}<{@link OneMapEntity}> + */ + public List<OneMapEntity> queryDirectory(OneMapEntity oneMapEntity) { + String valueStr = oneMapEntity.getKey(); + System.out.println(oneMapEntity.getValue() + " == value == " + valueStr); + String endSql = null; + String sqlQur; + if (valueStr.length() > 0) { + String[] arrStr = valueStr.split(","); + StringBuilder one = new StringBuilder(); + if (arrStr.length > 0) { + System.out.println("arrStr = " + arrStr.length); + } + for (String s : arrStr) { + sqlQur = "'" + s + "%' " + "or dircode like"; + one.append(sqlQur); + } + endSql = " where dircode like " + one.substring(0, one.toString().length() - 15); + System.out.println("endSql = " + endSql); + } + return aMapOfPipelineMapper.selectProjectTypeOne(endSql); + } + + /** + * 閫夋嫨椤圭洰绫诲瀷涓� + * + * @param sqlQur sql + * @return {@link List}<{@link OneMapEntity}> + */ + @Override + public List<OneMapEntity> selectProjectTypeOne(String sqlQur) { + return null; + } + + + /** + * 鏌ヨ琛ㄤ俊鎭� + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> queryTableInfo(String tableName) { + return aMapOfPipelineMapper.queryTableInfo(tableName); + } + + /** + * 璁$畻鍏ㄧ悆绠¢亾鍥� + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countGlobalPipeMap() { + return aMapOfPipelineMapper.countGlobalPipeMap(); + } + + /** + * 璁$畻鍏ㄥ浗绠¢亾鍥� + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countNationalPipeMap() { + return aMapOfPipelineMapper.countNationalPipeMap(); + } + + /** + * 鍏ㄥ浗绠$綉鍥捐緭閫佷粙璐ㄩ暱搴� + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countZhPipeMapLenByMed() { + return aMapOfPipelineMapper.countZhPipeMapLenByMed(); + } + + /** + * 鍏ㄥ浗绔欏満搴ф暟銆侀榾瀹ゃ�佺閬撴暟绛� + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countZhPipeStations() { + return aMapOfPipelineMapper.countZhPipeStations(); + } + + /** + * 鎸夐」鐩粺璁¢」鐩瓨鍌ㄩ噺 + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countStorageByProject() { + return aMapOfPipelineMapper.countStorageByProject(); + } + + /** + * 閫夋嫨椤圭洰淇℃伅 + * 鏌ヨ椤圭洰淇℃伅 + * + * @param projectCode 椤圭洰缂栫爜 + * @return {@link List}<{@link String}> + */ + @Override + public List<String> selectProjectInfo(String projectCode) { + return aMapOfPipelineMapper.selectProjectInfo(projectCode); + } + + /** + * 閫夋嫨椤圭洰鏂囦欢鍒楄〃 + * + * @return {@link List}<{@link String}> + */ + @Override + public List<String> selectProjectFileList() { + return aMapOfPipelineMapper.selectProjectFileList(); + } + + /** + * 璁$畻瀛樺偍椤圭洰 + * + * @param projectCode 椤圭洰浠g爜 + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countProjectStorage(String projectCode) { + return aMapOfPipelineMapper.countProjectStorage(projectCode); + } + + /** + * 鍗曚釜椤圭洰鏂囦欢鏁伴噺 + * + * @param projectCode 椤圭洰浠g爜 + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countProjectType(String projectCode) { + return aMapOfPipelineMapper.countProjectType(projectCode); + } + + /** + * 缁熻椤圭洰涓� + * + * @param projectCode 椤圭洰浠g爜 + * @return {@link List}<{@link String}> + */ + @Override + public List<String> countProjectDown(String projectCode) { + return aMapOfPipelineMapper.countProjectDown(projectCode); + } + +} diff --git a/src/main/java/com/moon/server/service/show/PipelineService.java b/src/main/java/com/moon/server/service/show/PipelineService.java new file mode 100644 index 0000000..0d358f8 --- /dev/null +++ b/src/main/java/com/moon/server/service/show/PipelineService.java @@ -0,0 +1,231 @@ +package com.moon.server.service.show; + +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.show.PipelineEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.mapper.data.DownloadMapper; +import com.moon.server.mapper.show.PipelineMapper; +import com.moon.server.helper.*; +import net.lingala.zip4j.ZipFile; +import net.lingala.zip4j.model.ZipParameters; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.gdal.ogr.*; +import org.gdal.osr.SpatialReference; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 绠¢亾鍒嗘瀽鏈嶅姟绫� + * @author WWW + */ +@Service +public class PipelineService implements PipelineMapper { + @Autowired + PathHelper pathHelper; + + @Autowired + DownloadMapper downloadMapper; + + @Autowired + PipelineMapper pipelineMapper; + + private final static Log log = LogFactory.getLog(PipelineService.class); + + @Override + public List<PipelineEntity> selectPipelines(String name) { + name = StringHelper.getLikeUpperStr(name); + + return pipelineMapper.selectPipelines(name); + } + + @Override + public List<PipelineEntity> selectSegNames() { + return pipelineMapper.selectSegNames(); + } + + @Override + public List<PipelineEntity> selectPipeAnalysis(String tab, Integer gid) { + return pipelineMapper.selectPipeAnalysis(tab, gid); + } + + /** + * 鍒涘缓Zip鍖� + * + * @param ue 鐢ㄦ埛瀹炰綋 + * @param map 绠¢亾鍒嗘瀽鏁版嵁闆嗗悎 + * @param pwd 瀵嗙爜 + * @return 涓嬭浇鏂囦欢GUID + */ + public String createZipFile(UserEntity ue, Map<String, List<PipelineEntity>> map, String pwd) throws Exception { + String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); + String tempPath = pathHelper.getTempPath(tempName); + String filePath = tempPath + File.separator + tempName + ".gdb"; + + File file = new File(filePath); + if (file.exists() && file.isDirectory()) { + FileHelper.deleteDir(filePath); + } + createGdb(filePath, map); + + String zipName = tempName + ".gdb.zip"; + String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName; + + ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd); + ZipParameters params = Zip4jHelper.getZipParams(true); + addZipFiles(zip, params, file.listFiles()); + + String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); + DownloadEntity downloadEntity = getDownloadEntity(ue, zipFile, dbPwd); + int rows = downloadMapper.insert(downloadEntity); + + return rows > 0 ? downloadEntity.getGuid() : null; + } + + /** + * 鍒涘缓GDB + */ + public static void createGdb(String filePath, Map<String, List<PipelineEntity>> map) throws Exception { + Driver driver = null; + DataSource dataSource = null; + try { + driver = ogr.GetDriverByName("FileGDB"); + if (null == driver) { + log.error("PipelineService.createGdb.driver(FileGDB) is null."); + return; + } + dataSource = driver.CreateDataSource(filePath, null); + if (null == dataSource) { + log.error("PipelineService.createGdb.dataSource is null. " + filePath); + return; + } + + for (String key : map.keySet()) { + Layer layer = null; + try { + List<PipelineEntity> list = map.get(key); + layer = createLayer(dataSource, key.replace(".", "_"), list.get(0)); + + List<Field> fields = new ArrayList<>(); + getFields(PipelineEntity.class, fields); + + GdbHelper.addLayerField(layer, fields); + setLayerData(layer, fields, list); + } finally { + if (null != layer) { + layer.delete(); + } + } + } + + dataSource.SyncToDisk(); + dataSource.FlushCache(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + throw ex; + } finally { + GdbHelper.delete(dataSource, driver); + } + } + + /** + * 鍒涘缓鍥惧眰 + */ + private static Layer createLayer(DataSource dataSource, String tab, PipelineEntity pe) { + int geomType = pe.getWkt().contains("POINT") ? ogr.wkbMultiPoint : ogr.wkbMultiLineString; + + SpatialReference sr = new SpatialReference(); + sr.ImportFromEPSG(4490); + + return dataSource.CreateLayer(tab, sr, geomType, null); + } + + /** + * 鑾峰彇瀛楁 + */ + private static void getFields(Class clazz, List<Field> list) { + try { + Field[] fields = clazz.getDeclaredFields(); + for (Field f : fields) { + if (StaticData.PIPE_EXCLUDE_FIELDS.contains(f.getName())) { + continue; + } + + f.setAccessible(true); + list.add(f); + } + + if (!StaticData.OBJECT.equals(clazz.getSuperclass().getName())) { + getFields(clazz.getSuperclass(), list); + } + } catch (Exception ex) { + // + } + } + + /** + * 璁剧疆鍥惧眰鏁版嵁 + */ + private static void setLayerData(Layer layer, List<Field> fields, List<PipelineEntity> list) throws Exception { + for (PipelineEntity t : list) { + Feature f = new Feature(layer.GetLayerDefn()); + + String wkt = t.getWkt(); + if (!wkt.contains("MULTI")) { + wkt = wkt.replace("POINT", "MULTIPOINT").replace("LINESTRING", "MULTILINESTRING(") + (wkt.contains("LINESTRING") ? ")" : ""); + } + + Geometry geom = Geometry.CreateFromWkt(wkt); + f.SetGeometry(geom); + + GdbHelper.setFeatureData(f, fields, t); + layer.CreateFeature(f); + } + } + + /** + * 娣诲姞Zip鏂囦欢 + */ + private void addZipFiles(ZipFile zip, ZipParameters params, File[] files) { + if (null == files || files.length == 0) { + return; + } + + for (File f : files) { + try { + zip.addFile(f, params); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } + } + + /** + * 鑾峰彇涓嬭浇瀹炰綋绫� + */ + private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) throws Exception { + DownloadEntity de = new DownloadEntity(); + de.setName(FileHelper.getFileName(file)); + // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 + de.setType(5); + de.setSizes(FileHelper.sizeToMb(new File(file).length())); + de.setDepid(ue.getDepid()); + de.setDcount(0); + de.setPwd(pwd); + de.setUrl(FileHelper.getRelativePath(file)); + de.setDescr("绠¢亾鍒嗘瀽鏂囦欢"); + de.setGuid(FileHelper.getFileMd5(file)); + de.setCreateUser(ue.getId()); + // de.setGeom(null) + + return de; + } +} diff --git a/src/main/java/com/moon/server/service/sys/ArgsService.java b/src/main/java/com/moon/server/service/sys/ArgsService.java new file mode 100644 index 0000000..82d7435 --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/ArgsService.java @@ -0,0 +1,103 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.all.SettingData; +import com.moon.server.entity.sys.ArgsEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.sys.ArgsMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.lang.reflect.Field; +import java.util.List; + +/** + * 鍙傛暟璁剧疆 + * @author WWW + */ +@Service +public class ArgsService implements ArgsMapper { + @Autowired + ArgsMapper argsMapper; + + @Override + public Integer selectCount(String name) { + name = StringHelper.getLikeUpperStr(name); + + return argsMapper.selectCount(name); + } + + @Override + public List<ArgsEntity> selectByPage(String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return argsMapper.selectByPage(name, limit, offset); + } + + @Override + public List<ArgsEntity> selectAll() { + return argsMapper.selectAll(); + } + + @Override + public ArgsEntity selectById(int id) { + return argsMapper.selectById(id); + } + + @Override + public Integer insert(ArgsEntity entity) { + return argsMapper.insert(entity); + } + + @Override + public Integer inserts(List<ArgsEntity> list) { + return argsMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return argsMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return argsMapper.deletes(ids); + } + + @Override + public Integer update(ArgsEntity entity) { + return argsMapper.update(entity); + } + + @Override + public Integer updateForValue(ArgsEntity entity) { + return argsMapper.updateForValue(entity); + } + + @Override + public Integer updates(List<ArgsEntity> list) { + return argsMapper.updates(list); + } + + /** + * 鍒濆鍖栬缃�� + */ + public void initSettingData() throws Exception { + List<ArgsEntity> list = selectAll(); + if (list == null || list.isEmpty()) { + return; + } + + for (ArgsEntity entity : list) { + updateSettingData(entity); + } + } + + /** + * 鏇存柊璁剧疆鍊� + */ + public void updateSettingData(ArgsEntity entity) throws Exception { + Field field = SettingData.class.getField(entity.getMark()); + // field.setAccessible(true) + field.set(null, entity.getCvalue() * entity.getTimes()); + } +} diff --git a/src/main/java/com/moon/server/service/sys/AttachService.java b/src/main/java/com/moon/server/service/sys/AttachService.java new file mode 100644 index 0000000..61d4aac --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/AttachService.java @@ -0,0 +1,196 @@ +package com.moon.server.service.sys; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.moon.server.entity.all.BaseEntity; +import com.moon.server.entity.data.FmeLogEntity; +import com.moon.server.entity.sys.AttachEntity; +import com.moon.server.helper.ClassHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.all.BasicMapper; +import com.moon.server.mapper.sys.AttachMapper; +import com.moon.server.service.all.UploadAttachService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.lang.reflect.Field; +import java.util.List; + +/** + * 闄勪欢 + * @author WWW + */ +@Service +public class AttachService implements AttachMapper { + @Autowired + AttachMapper attachMapper; + + private static String tabs; + + @Override + public Integer selectCount(String name) { + name = StringHelper.getLikeUpperStr(name); + + return attachMapper.selectCount(name); + } + + @Override + public List<AttachEntity> selectByPage(String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return attachMapper.selectByPage(name, limit, offset); + } + + @Override + public List<AttachEntity> selectAll() { + return attachMapper.selectAll(); + } + + @Override + public AttachEntity selectById(int id) { + return attachMapper.selectById(id); + } + + @Override + public AttachEntity selectByGuid(String guid) { + return attachMapper.selectByGuid(guid); + } + + @Override + public List<AttachEntity> selectByGuids(List<String> guids) { + return attachMapper.selectByGuids(guids); + } + + @Override + public AttachEntity selectByTabAndGuid(String tab, String tabGuid, String guid) { + return attachMapper.selectByTabAndGuid(tab, tabGuid, guid); + } + + @Override + public List<AttachEntity> selectByTabGuids(String tab, List<String> guids) { + return attachMapper.selectByTabGuids(tab, guids); + } + + @Override + public List<AttachEntity> selectByTab(String tab, String guid) { + return attachMapper.selectByTab(tab, guid); + } + + @Override + public Integer insert(AttachEntity entity) { + return attachMapper.insert(entity); + } + + @Override + public Integer inserts(List<AttachEntity> list) { + return attachMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return attachMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return attachMapper.deletes(ids); + } + + @Override + public Integer update(AttachEntity entity) { + return attachMapper.update(entity); + } + + @Override + public Integer updates(List<AttachEntity> list) { + return attachMapper.updates(list); + } + + @Override + public List<FmeLogEntity> selectFmeLogs(String tabs) { + return attachMapper.selectFmeLogs(tabs); + } + + /** + * 鏌ヨFME鏃ュ織 + */ + public List<FmeLogEntity> selectFmeLogs() { + if (StringHelper.isEmpty(tabs)) { + tabs = UploadAttachService.getTabs().replace("'", ""); + } + + return attachMapper.selectFmeLogs(tabs); + } + + @Override + public Integer updateFmeLog(Integer id) { + return attachMapper.updateFmeLog(id); + } + + @Override + public Integer insertAttachByMeta(String tab, String tabGuid, String metaName, String dirid) { + return attachMapper.insertAttachByMeta(tab, tabGuid, metaName, dirid); + } + + /** + * 鍚屾闄勪欢 + */ + public void syncAttaches(FmeLogEntity entity) { + String tab = entity.getPgNs() + "." + entity.getTcdm(); + String fieldName = UploadAttachService.ATTACH_TABS.get(tab); + + List<?> list = selectRowsByParentid(entity.getTcdm().replace("_", ""), entity.getParentid(), fieldName); + if (null == list || list.isEmpty()) { + return; + } + + Field field = UploadAttachService.getAnnexField(list.get(0), tab); + if (null == field) { + return; + } + + for (Object obj : list) { + String[] names = UploadAttachService.getNames(UploadAttachService.getAnnexName(obj, field)); + if (null == names || names.length == 0) { + continue; + } + + BaseEntity be = (BaseEntity) obj; + String dirid = getDirid(be); + for (String name : names) { + if (StringHelper.isEmpty(name)) { + continue; + } + insertAttachByMeta(tab, be.getEventid(), name.trim(), dirid); + } + } + } + + /** + * 鑾峰彇鐩綍缂栫爜 + */ + private String getDirid(BaseEntity be) { + if (StringHelper.isEmpty(be.getDirid())) { + return null; + } + + String dirid = be.getDirid().substring(0, 2); + + return StringHelper.getRightLike(dirid); + } + + /** + * 鏍规嵁鐖禝D鏌ヨ璁板綍 + */ + private List<?> selectRowsByParentid(String entity, String parentid, String field) { + BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); + if (null == baseMapper) { + return null; + } + + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("parentid", parentid); + wrapper.apply(field + " is not null"); + + return baseMapper.selectList(wrapper); + } +} diff --git a/src/main/java/com/moon/server/service/sys/AuthService.java b/src/main/java/com/moon/server/service/sys/AuthService.java new file mode 100644 index 0000000..d14d8b2 --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/AuthService.java @@ -0,0 +1,74 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.AuthEntity; +import com.moon.server.mapper.sys.AuthMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鏉冮檺琛� + * @author sws + * @date 2022-09-28 + */ +@Service +public class AuthService implements AuthMapper { + @Autowired + AuthMapper authMapper; + + @Override + public Integer selectCount(String name) { + return authMapper.selectCount(name); + } + + @Override + public List<AuthEntity> selectByPage(String name, Integer limit, Integer offset) { + return authMapper.selectByPage(name, limit, offset); + } + + @Override + public Integer selectCountForMenu(Integer menuid) { + return authMapper.selectCountForMenu(menuid); + } + + @Override + public List<AuthEntity> selectByPageForMenu(Integer menuid, Integer limit, Integer offset) { + return authMapper.selectByPageForMenu(menuid, limit, offset); + } + + @Override + public Integer insertAuth(AuthEntity authEntity) { + return authMapper.insertAuth(authEntity); + } + + @Override + public Integer insertAuths(List<AuthEntity> authEntity) { + return authMapper.insertAuths(authEntity); + } + + @Override + public Integer deleteAuth(int id) { + return authMapper.deleteAuth(id); + } + + @Override + public Integer deleteAuths(List<Integer> ids) { + return authMapper.deleteAuths(ids); + } + + @Override + public Integer updateAuth(AuthEntity authEntity) { + return authMapper.updateAuth(authEntity); + } + + @Override + public AuthEntity selectAuth(int id) { + return authMapper.selectAuth(id); + } + + @Override + public List<AuthEntity> selectAuthAll() { + return authMapper.selectAuthAll(); + } +} diff --git a/src/main/java/com/moon/server/service/sys/BlacklistService.java b/src/main/java/com/moon/server/service/sys/BlacklistService.java new file mode 100644 index 0000000..0f51ba9 --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/BlacklistService.java @@ -0,0 +1,109 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.all.RedisCacheKey; +import com.moon.server.entity.all.SettingData; +import com.moon.server.entity.sys.BlacklistEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.sys.BlacklistMapper; +import com.moon.server.service.all.RedisService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * 榛戝悕鍗� + * @author WWW + */ +@Service +public class BlacklistService implements BlacklistMapper { + @Autowired + BlacklistMapper blacklistMapper; + + @Autowired + RedisService redisService; + + private final static int TWO = 2; + + @Override + public Integer selectCount(String ip, Integer type) { + ip = StringHelper.getLikeUpperStr(ip); + + return blacklistMapper.selectCount(ip, type); + } + + @Override + public List<BlacklistEntity> selectByPage(String ip, Integer type, Integer limit, Integer offset) { + ip = StringHelper.getLikeUpperStr(ip); + + return blacklistMapper.selectByPage(ip, type, limit, offset); + } + + @Override + public List<BlacklistEntity> selectAll() { + return blacklistMapper.selectAll(); + } + + @Override + public BlacklistEntity selectById(int id) { + return blacklistMapper.selectById(id); + } + + @Override + public List<String> selectIpList(Integer type) { + if (type == null || type < 1 || type > TWO) { + return null; + } + + String key = RedisCacheKey.blacklistKey(type.toString()); + Object obj = redisService.get(key); + if (obj instanceof List<?>) { + return (List<String>) obj; + } + + List<String> list = blacklistMapper.selectIpList(type); + if (list != null && list.size() > 0) { + redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); + } + + return list; + } + + /** + * 娓呯┖缂撳瓨 + */ + public void clearCache() { + redisService.clearKeys(RedisCacheKey.blacklistKey("")); + } + + @Override + public Integer insert(BlacklistEntity entity) { + return blacklistMapper.insert(entity); + } + + @Override + public Integer inserts(List<BlacklistEntity> list) { + return blacklistMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return blacklistMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return blacklistMapper.deletes(ids); + } + + @Override + public Integer update(BlacklistEntity entity) { + return blacklistMapper.update(entity); + } + + @Override + public Integer updates(List<BlacklistEntity> list) { + return blacklistMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/sys/DepService.java b/src/main/java/com/moon/server/service/sys/DepService.java new file mode 100644 index 0000000..0e19411 --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/DepService.java @@ -0,0 +1,71 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.ctrl.IdNameEntity; +import com.moon.server.entity.sys.DepEntity; +import com.moon.server.mapper.sys.DepMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 缁勭粐鏈烘瀯 + * @author sws + * @date 2022-09-23 + */ +@Service +public class DepService implements DepMapper { + @Autowired + DepMapper depMapper; + + @Override + public Integer insertDep(DepEntity depEntity) { + return depMapper.insertDep(depEntity); + } + + @Override + public Integer insertDeps(List<DepEntity> depEntity) { + return depMapper.insertDeps(depEntity); + } + + @Override + public Integer deleteDep(int id) { + return depMapper.deleteDep(id); + } + + @Override + public Integer deleteDeps(List<Integer> ids) { + return depMapper.deleteDeps(ids); + } + + @Override + public Integer updateDep(DepEntity depEntity) { + return depMapper.updateDep(depEntity); + } + + + @Override + public DepEntity selectDep(int id) { + return depMapper.selectDep(id); + } + + @Override + public List<IdNameEntity> selectDepsByCodes(String[] codes) { + return depMapper.selectDepsByCodes(codes); + } + + @Override + public List<DepEntity> selectDepAll() { + return depMapper.selectDepAll(); + } + + @Override + public Integer updateDeps(List<DepEntity> list) { + return depMapper.updateDeps(list); + } + + @Override + public List<DepEntity> selectDepRecursive(String name) { + return depMapper.selectDepRecursive(name); + } +} \ No newline at end of file diff --git a/src/main/java/com/moon/server/service/sys/DownlogService.java b/src/main/java/com/moon/server/service/sys/DownlogService.java new file mode 100644 index 0000000..99f963d --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/DownlogService.java @@ -0,0 +1,98 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.sys.DownlogEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.mapper.sys.DownlogMapper; +import com.moon.server.service.data.DownloadService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.sql.Timestamp; +import java.util.List; + +/** + * 涓嬭浇鏃ュ織 + * @author WWW + */ +@Service +public class DownlogService implements DownlogMapper { + @Autowired + DownlogMapper downlogMapper; + + @Autowired + DownloadService downloadService; + + @Override + public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) { + uname = StringHelper.getLikeUpperStr(uname); + + return downlogMapper.selectCount(uname, type, start, end); + } + + @Override + public List<DownlogEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { + uname = StringHelper.getLikeUpperStr(uname); + + return downlogMapper.selectByPage(uname, type, start, end, limit, offset); + } + + @Override + public List<DownlogEntity> selectAll() { + return downlogMapper.selectAll(); + } + + @Override + public DownlogEntity selectById(int id) { + return downlogMapper.selectById(id); + } + + @Override + public Integer insert(DownlogEntity entity) { + return downlogMapper.insert(entity); + } + + @Override + public Integer inserts(List<DownlogEntity> list) { + return downlogMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return downlogMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return downlogMapper.deletes(ids); + } + + @Override + public Integer update(DownlogEntity entity) { + return downlogMapper.update(entity); + } + + @Override + public Integer updates(List<DownlogEntity> list) { + return downlogMapper.updates(list); + } + + /** + * 鏇存柊涓嬭浇淇℃伅 + */ + public void updateInfos(UserEntity ue, DownloadEntity de, HttpServletRequest req) { + de.setDcount(de.getDcount() + 1); + de.setDownloadUser(ue.getId()); + int rows = downloadService.update(de); + + DownlogEntity entity = new DownlogEntity(); + entity.setDownid(de.getId()); + entity.setCreateUser(ue.getId()); + entity.setIp(WebHelper.getIpAddress(req)); + + rows = downlogMapper.insert(entity); + } +} diff --git a/src/main/java/com/moon/server/service/sys/LoginService.java b/src/main/java/com/moon/server/service/sys/LoginService.java new file mode 100644 index 0000000..176b98d --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/LoginService.java @@ -0,0 +1,96 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.LoginEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.mapper.sys.LoginMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.sql.Timestamp; +import java.util.List; + +/** + *鐧诲綍鏃ュ織 + * @author sws + * @date 2022-09-28 + */ +@Service +public class LoginService implements LoginMapper { + @Autowired + LoginMapper loginMapper; + + @Override + public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) { + uname = StringHelper.getLikeUpperStr(uname); + + return loginMapper.selectCount(uname, type, start, end); + } + + @Override + public List<LoginEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { + uname = StringHelper.getLikeUpperStr(uname); + + return loginMapper.selectByPage(uname, type, start, end, limit, offset); + } + + @Override + public Integer insertLogin(LoginEntity loginEntity) { + return loginMapper.insertLogin(loginEntity); + } + + @Override + public Integer insertLogins(List<LoginEntity> loginEntity) { + return loginMapper.insertLogins(loginEntity); + } + + @Override + public Integer deleteLogin(int id) { + return loginMapper.deleteLogin(id); + } + + @Override + public Integer deleteLogins(List<Integer> ids) { + return loginMapper.deleteLogins(ids); + } + + @Override + public Integer updateLogin(LoginEntity loginEntity) { + return loginMapper.updateLogin(loginEntity); + } + + @Override + public LoginEntity selectLogin(int id) { + return loginMapper.selectLogin(id); + } + + @Override + public List<LoginEntity> selectLoginAll() { + return loginMapper.selectLoginAll(); + } + + /** + * 鑾峰彇鏂扮殑鐧诲綍瀹炰綋绫� + */ + public LoginEntity getNewLogin(int userid, int appId, int type, int status, HttpServletRequest req) { + LoginEntity le = new LoginEntity(); + le.setUserid(userid); + le.setAppid(appId); + le.setIp(WebHelper.getIpAddress(req)); + le.setType(type); + le.setStatus(status); + le.setOptime(WebHelper.getCurrentTimestamp()); + + return le; + } + + /** + * 鐢ㄦ埛鐧诲綍鐘舵�� + * @return + */ + @Override + public List<LoginEntity> selectLoginCounts(){ + return loginMapper.selectLoginCounts(); + } +} diff --git a/src/main/java/com/moon/server/service/sys/MenuAuthService.java b/src/main/java/com/moon/server/service/sys/MenuAuthService.java new file mode 100644 index 0000000..10640a8 --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/MenuAuthService.java @@ -0,0 +1,78 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.MenuAuthEntity; +import com.moon.server.mapper.sys.MenuAuthMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鑿滃崟-鏉冮檺 + * @author WWW + */ +@Service +public class MenuAuthService implements MenuAuthMapper { + @Autowired + MenuAuthMapper menuAuthMapper; + + @Override + public Integer selectCount(Integer menuid) { + return menuAuthMapper.selectCount(menuid); + } + + @Override + public List<MenuAuthEntity> selectByPage(Integer menuid, Integer limit, Integer offset) { + return menuAuthMapper.selectByPage(menuid, limit, offset); + } + + @Override + public Integer selectCountForRole(Integer roleid, Integer menuid) { + return menuAuthMapper.selectCountForRole(roleid, menuid); + } + + @Override + public List<MenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset) { + return menuAuthMapper.selectByPageForRole(roleid, menuid, limit, offset); + } + + @Override + public List<MenuAuthEntity> selectAll() { + return menuAuthMapper.selectAll(); + } + + @Override + public MenuAuthEntity selectById(int id) { + return menuAuthMapper.selectById(id); + } + + @Override + public Integer insert(MenuAuthEntity entity) { + return menuAuthMapper.insert(entity); + } + + @Override + public Integer inserts(List<MenuAuthEntity> list) { + return menuAuthMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return menuAuthMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return menuAuthMapper.deletes(ids); + } + + @Override + public Integer update(MenuAuthEntity entity) { + return menuAuthMapper.update(entity); + } + + @Override + public Integer updates(List<MenuAuthEntity> list) { + return menuAuthMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/sys/MenuService.java b/src/main/java/com/moon/server/service/sys/MenuService.java new file mode 100644 index 0000000..471e785 --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/MenuService.java @@ -0,0 +1,64 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.MenuEntity; +import com.moon.server.mapper.sys.MenuMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鑿滃崟 + * @author sws + * @date 2022-09-24 + */ +@Service +public class MenuService implements MenuMapper { + @Autowired + MenuMapper menuMapper; + + @Override + public Integer insertMenu(MenuEntity menuEntity) { + return menuMapper.insertMenu(menuEntity); + } + + @Override + public Integer insertMenus(List<MenuEntity> menuEntity) { + return menuMapper.insertMenus(menuEntity); + } + + @Override + public Integer deleteMenu(int id) { + return menuMapper.deleteMenu(id); + } + + @Override + public Integer deleteMenus(List<Integer> ids) { + return menuMapper.deleteMenus(ids); + } + + @Override + public Integer updateMenu(MenuEntity menuEntity) { + return menuMapper.updateMenu(menuEntity); + } + + @Override + public Integer updateMenus(List<MenuEntity> menuEntity) { + return menuMapper.updateMenus(menuEntity); + } + + @Override + public MenuEntity selectMenu(int id) { + return menuMapper.selectMenu(id); + } + + @Override + public List<MenuEntity> selectMenuAll() { + return menuMapper.selectMenuAll(); + } + + @Override + public List<MenuEntity> selectMenuRecursive(String name) { + return menuMapper.selectMenuRecursive(name); + } +} \ No newline at end of file diff --git a/src/main/java/com/moon/server/service/sys/MetaDownService.java b/src/main/java/com/moon/server/service/sys/MetaDownService.java new file mode 100644 index 0000000..e02841a --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/MetaDownService.java @@ -0,0 +1,68 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.MetaDownEntity; +import com.moon.server.mapper.sys.MetaDownMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鍏冩暟鎹�-涓嬭浇 + * @author WWW + */ +@Service +public class MetaDownService implements MetaDownMapper { + @Autowired + MetaDownMapper metaDownMapper; + + @Override + public Integer selectCount(Integer metaid) { + return metaDownMapper.selectCount(metaid); + } + + @Override + public List<MetaDownEntity> selectByPage(Integer metaid, Integer limit, Integer offset) { + return metaDownMapper.selectByPage(metaid, limit, offset); + } + + @Override + public List<MetaDownEntity> selectAll() { + return metaDownMapper.selectAll(); + } + + @Override + public MetaDownEntity selectById(int id) { + return metaDownMapper.selectById(id); + } + + @Override + public Integer insert(MetaDownEntity entity) { + return metaDownMapper.insert(entity); + } + + @Override + public Integer inserts(List<MetaDownEntity> list) { + return metaDownMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return metaDownMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return metaDownMapper.deletes(ids); + } + + @Override + public Integer update(MetaDownEntity entity) { + return metaDownMapper.update(entity); + } + + @Override + public Integer updates(List<MetaDownEntity> list) { + return metaDownMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/sys/OperateService.java b/src/main/java/com/moon/server/service/sys/OperateService.java new file mode 100644 index 0000000..c78b2f5 --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/OperateService.java @@ -0,0 +1,75 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.OperateEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.sys.OperateMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 鎿嶄綔鏃ュ織 + * @author sws + * @date 2022-09-28 + */ +@Service +public class OperateService implements OperateMapper { + @Autowired + OperateMapper operateMapper; + + @Override + public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) { + uname = StringHelper.getLikeUpperStr(uname); + + return operateMapper.selectCount(uname, type, start, end); + } + + @Override + public List<OperateEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { + uname = StringHelper.getLikeUpperStr(uname); + + return operateMapper.selectByPage(uname, type, start, end, limit, offset); + } + + @Override + public Integer insertOperate(OperateEntity operateEntity) { + return operateMapper.insertOperate(operateEntity); + } + + @Override + public Integer insertOperates(List<OperateEntity> operateEntity) { + return operateMapper.insertOperates(operateEntity); + } + + @Override + public Integer deleteOperate(int id) { + return operateMapper.deleteOperate(id); + } + + @Override + public Integer deleteOperates(List<Integer> ids) { + return operateMapper.deleteOperates(ids); + } + + @Override + public Integer updateOperate(OperateEntity operateEntity) { + return operateMapper.updateOperate(operateEntity); + } + + @Override + public OperateEntity selectOperate(int id) { + return operateMapper.selectOperate(id); + } + + @Override + public List<OperateEntity> selectOperateAll() { + return operateMapper.selectOperateAll(); + } + + @Override + public List<OperateEntity> operateCount() { + return operateMapper.operateCount(); + } +} diff --git a/src/main/java/com/moon/server/service/sys/ReportService.java b/src/main/java/com/moon/server/service/sys/ReportService.java new file mode 100644 index 0000000..8cafc99 --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/ReportService.java @@ -0,0 +1,310 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.all.StaticData; +import com.moon.server.entity.ctrl.CountEntity; +import com.moon.server.entity.data.DownloadEntity; +import com.moon.server.entity.sys.AttachEntity; +import com.moon.server.entity.sys.ReportEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.mapper.sys.ReportMapper; +import com.moon.server.service.data.DownloadService; +import com.moon.server.helper.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.util.*; + +/** + * 鎶ュ憡妯℃澘 + * @author WWW + */ +@Service +public class ReportService implements ReportMapper { + @Autowired + ReportMapper reportMapper; + + @Autowired + AttachService attachService; + + @Autowired + PathHelper pathHelper; + + @Autowired + DownloadService downloadService; + + @Override + public Integer selectCount(String name, String code) { + name = StringHelper.getLikeUpperStr(name); + + return reportMapper.selectCount(name, code); + } + + @Override + public List<ReportEntity> selectByPage(String name, String code, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return reportMapper.selectByPage(name, code, limit, offset); + } + + @Override + public List<ReportEntity> selectAll() { + return reportMapper.selectAll(); + } + + @Override + public ReportEntity selectById(int id) { + return reportMapper.selectById(id); + } + + @Override + public Integer insert(ReportEntity entity) { + return reportMapper.insert(entity); + } + + @Override + public Integer inserts(List<ReportEntity> list) { + return reportMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return reportMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return reportMapper.deletes(ids); + } + + @Override + public Integer update(ReportEntity entity) { + return reportMapper.update(entity); + } + + @Override + public Integer updates(List<ReportEntity> list) { + return reportMapper.updates(list); + } + + @Override + public List<CountEntity> countSizes() { + return reportMapper.countSizes(); + } + + @Override + public List<CountEntity> countServices() { + return reportMapper.countServices(); + } + + @Override + public List<CountEntity> countOperates() { + return reportMapper.countOperates(); + } + + /** + * 鍒涘缓鎶ュ憡 + */ + public void createReport(UserEntity ue, ReportEntity re, HttpServletResponse res) throws Exception { + AttachEntity ae = attachService.selectByGuid(re.getGuid()); + if (null == ae) { + return; + } + + String source = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); + String targetName = StringHelper.YMDHMS2_FORMAT.format(new Date()) + FileHelper.getExtension(ae.getName()); + String target = pathHelper.getDownloadFullPath() + File.separator + targetName; + + File sourceFile = new File(source); + if (!sourceFile.exists() || sourceFile.isDirectory()) { + return; + } + generateReport(source, target, re); + + File targetFile = new File(target); + if (!targetFile.exists() || sourceFile.isDirectory()) { + return; + } + + DownloadEntity de = getDownloadEntity(ue, target); + int rows = downloadService.insert(de); + if (rows > 0) { + WebHelper.download(target, targetName, res); + } + } + + /** + * 鐢熸垚鎶ュ憡 + */ + private void generateReport(String source, String target, ReportEntity re) { + if (StaticData.S1.equals(re.getType())) { + switch (re.getCode()) { + case "countOperates": + createCountOperatesWord(source, target); + break; + case "countSizes": + createCountSizesWord(source, target); + break; + case "countServices": + createCountServicesWord(source, target); + break; + default: + break; + } + } else { + switch (re.getCode()) { + case "countOperates": + createCountOperatesExcel(source, target); + break; + case "countSizes": + createCountSizesExcel(source, target); + break; + case "countServices": + createCountServicesExcel(source, target); + break; + default: + break; + } + } + } + + /** + * 鍒涘缓 鐢ㄦ埛娴侀噺缁熻 Word + */ + public void createCountOperatesWord(String source, String target) { + List<CountEntity> list = countOperates(); + if (null == list || list.isEmpty()) { + return; + } + + int rows = 1; + ArrayList<String[]> addList = new ArrayList<>(); + for (CountEntity ce : list) { + String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getM2(), ce.getCount().toString()}; + addList.add(strs); + } + + WordHelper.generateWord(source, target, null, addList); + } + + /** + * 鍒涘缓 鏈嶅姟璋冪敤閲忕粺璁� Word + */ + public void createCountServicesWord(String source, String target) { + List<CountEntity> list = countServices(); + if (null == list || list.isEmpty()) { + return; + } + + int rows = 1; + ArrayList<String[]> addList = new ArrayList<>(); + for (CountEntity ce : list) { + String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getCount().toString()}; + addList.add(strs); + } + + WordHelper.generateWord(source, target, null, addList); + } + + /** + * 鍒涘缓 鏁版嵁閲忕粺璁� Word + */ + public void createCountSizesWord(String source, String target) { + List<CountEntity> list = countSizes(); + if (null == list || list.isEmpty()) { + return; + } + + int rows = 1; + ArrayList<String[]> addList = new ArrayList<>(); + for (CountEntity ce : list) { + String[] strs = new String[]{"" + rows++, ce.getM1(), FileHelper.getSizes(ce.getSizes())}; + addList.add(strs); + } + + WordHelper.generateWord(source, target, null, addList); + } + + /** + * 鍒涘缓 鐢ㄦ埛娴侀噺缁熻 Excel + */ + public void createCountOperatesExcel(String source, String target) { + List<CountEntity> list = countOperates(); + if (null == list || list.isEmpty()) { + return; + } + + int rows = 1; + for (CountEntity ce : list) { + ce.setNo(rows++); + } + + Map<String, List<CountEntity>> map = new HashMap<>(1); + map.put("data", list); + + ExcelHelper.writeToTemplate(source, target, map); + } + + /** + * 鍒涘缓 鏈嶅姟璋冪敤閲忕粺璁� Excel + */ + public void createCountServicesExcel(String source, String target) { + List<CountEntity> list = countServices(); + if (null == list || list.isEmpty()) { + return; + } + + int rows = 1; + for (CountEntity ce : list) { + ce.setNo(rows++); + } + + Map<String, List<CountEntity>> map = new HashMap<>(1); + map.put("data", list); + + ExcelHelper.writeToTemplate(source, target, map); + } + + /** + * 鍒涘缓 鏁版嵁閲忕粺璁� Excel + */ + public void createCountSizesExcel(String source, String target) { + List<CountEntity> list = countSizes(); + if (null == list || list.isEmpty()) { + return; + } + + int rows = 1; + for (CountEntity ce : list) { + ce.setNo(rows++); + ce.setM2(FileHelper.getSizes(ce.getSizes())); + } + + Map<String, List<CountEntity>> map = new HashMap<>(1); + map.put("data", list); + + ExcelHelper.writeToTemplate(source, target, map); + } + + /** + * 鑾峰彇涓嬭浇瀹炰綋绫� + */ + private DownloadEntity getDownloadEntity(UserEntity ue, String file) { + DownloadEntity de = new DownloadEntity(); + de.setName(FileHelper.getFileName(file)); + // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 + de.setType(6); + de.setSizes(FileHelper.sizeToMb(new File(file).length())); + de.setDepid(ue.getDepid()); + de.setDcount(1); + de.setPwd(null); + de.setUrl(FileHelper.getRelativePath(file)); + de.setDescr("缁熻鎶ュ憡"); + de.setGuid(FileHelper.getFileMd5(file)); + de.setCreateUser(ue.getId()); + // de.setGeom(null) + + return de; + } +} diff --git a/src/main/java/com/moon/server/service/sys/ResOpService.java b/src/main/java/com/moon/server/service/sys/ResOpService.java new file mode 100644 index 0000000..2ec8c0c --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/ResOpService.java @@ -0,0 +1,70 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.ResOpEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.sys.ResOpMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 璧勬簮鎿嶄綔琛� + * @author sws + * @date 2022-09-28 + */ +@Service +public class ResOpService implements ResOpMapper { + @Autowired + ResOpMapper resOpMapper; + + @Override + public Integer selectCount(String name, Integer type, Timestamp start, Timestamp end) { + name = StringHelper.getLikeUpperStr(name); + + return resOpMapper.selectCount(name, type, start, end); + } + + @Override + public List<ResOpEntity> selectByPage(String name, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return resOpMapper.selectByPage(name, type, start, end, limit, offset); + } + + @Override + public Integer insertResOp(ResOpEntity resOpEntity) { + return resOpMapper.insertResOp(resOpEntity); + } + + @Override + public Integer insertResOps(List<ResOpEntity> resOpEntity) { + return resOpMapper.insertResOps(resOpEntity); + } + + @Override + public Integer deleteResOp(int id) { + return resOpMapper.deleteResOp(id); + } + + @Override + public Integer deleteResOps(List<Integer> ids) { + return resOpMapper.deleteResOps(ids); + } + + @Override + public Integer updateResOp(ResOpEntity resOpEntity) { + return resOpMapper.updateResOp(resOpEntity); + } + + @Override + public ResOpEntity selectResOp(int id) { + return resOpMapper.selectResOp(id); + } + + @Override + public List<ResOpEntity> selectResOpAll() { + return resOpMapper.selectResOpAll(); + } +} diff --git a/src/main/java/com/moon/server/service/sys/ResService.java b/src/main/java/com/moon/server/service/sys/ResService.java new file mode 100644 index 0000000..e6cf0e7 --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/ResService.java @@ -0,0 +1,80 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.ResEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.sys.ResMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 浠ょ墝琛� + * @author sws + * @date 2022-09-28 + */ +@Service +public class ResService implements ResMapper { + @Autowired + ResMapper resMapper; + + @Override + public Integer selectCount(String name) { + name = StringHelper.getLikeUpperStr(name); + + return resMapper.selectCount(name); + } + + @Override + public List<ResEntity> selectByPage(String name, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return resMapper.selectByPage(name, limit, offset); + } + + @Override + public Integer selectCountForRole(Integer roleid) { + return resMapper.selectCountForRole(roleid); + } + + @Override + public List<ResEntity> selectByPageForRole(Integer roleid, Integer limit, Integer offset) { + return resMapper.selectByPageForRole(roleid, limit, offset); + } + + @Override + public Integer insertRes(ResEntity resEntity) { + return resMapper.insertRes(resEntity); + } + + @Override + public Integer insertRess(List<ResEntity> resEntity) { + return resMapper.insertRess(resEntity); + } + + @Override + public Integer deleteRes(int id) { + return resMapper.deleteRes(id); + } + + @Override + public Integer deleteRess(List<Integer> ids) { + return resMapper.deleteRess(ids); + } + + @Override + public Integer updateRes(ResEntity resEntity) { + return resMapper.updateRes(resEntity); + } + + @Override + public ResEntity selectRes(int id) { + return resMapper.selectRes(id); + } + + @Override + public List<ResEntity> selectResAll() { + return resMapper.selectResAll(); + } + +} diff --git a/src/main/java/com/moon/server/service/sys/RoleMenuAuthService.java b/src/main/java/com/moon/server/service/sys/RoleMenuAuthService.java new file mode 100644 index 0000000..6a7041a --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/RoleMenuAuthService.java @@ -0,0 +1,78 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.RoleMenuAuthEntity; +import com.moon.server.mapper.sys.RoleMenuAuthMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 瑙掕壊-鑿滃崟 + * @author WWW + */ +@Service +public class RoleMenuAuthService implements RoleMenuAuthMapper { + @Autowired + RoleMenuAuthMapper roleMenuAuthMapper; + + @Override + public Integer selectCount(Integer roleid) { + return roleMenuAuthMapper.selectCount(roleid); + } + + @Override + public List<RoleMenuAuthEntity> selectByPage(Integer roleid, Integer limit, Integer offset) { + return roleMenuAuthMapper.selectByPage(roleid, limit, offset); + } + + @Override + public Integer selectCountForRole(Integer roleid, Integer menuid) { + return roleMenuAuthMapper.selectCountForRole(roleid, menuid); + } + + @Override + public List<RoleMenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset) { + return roleMenuAuthMapper.selectByPageForRole(roleid, menuid, limit, offset); + } + + @Override + public List<RoleMenuAuthEntity> selectAll() { + return roleMenuAuthMapper.selectAll(); + } + + @Override + public RoleMenuAuthEntity selectById(int id) { + return roleMenuAuthMapper.selectById(id); + } + + @Override + public Integer insert(RoleMenuAuthEntity entity) { + return roleMenuAuthMapper.insert(entity); + } + + @Override + public Integer inserts(List<RoleMenuAuthEntity> list) { + return roleMenuAuthMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return roleMenuAuthMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return roleMenuAuthMapper.deletes(ids); + } + + @Override + public Integer update(RoleMenuAuthEntity entity) { + return roleMenuAuthMapper.update(entity); + } + + @Override + public Integer updates(List<RoleMenuAuthEntity> list) { + return roleMenuAuthMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/sys/RoleResService.java b/src/main/java/com/moon/server/service/sys/RoleResService.java new file mode 100644 index 0000000..de4900a --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/RoleResService.java @@ -0,0 +1,68 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.RoleResEntity; +import com.moon.server.mapper.sys.RoleResMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 瑙掕壊-璧勬簮 + * @author WWW + */ +@Service +public class RoleResService implements RoleResMapper { + @Autowired + RoleResMapper roleResMapper; + + @Override + public Integer selectCount(Integer roleid) { + return roleResMapper.selectCount(roleid); + } + + @Override + public List<RoleResEntity> selectByPage(Integer roleid, Integer limit, Integer offset) { + return roleResMapper.selectByPage(roleid, limit, offset); + } + + @Override + public List<RoleResEntity> selectAll() { + return roleResMapper.selectAll(); + } + + @Override + public RoleResEntity selectById(int id) { + return roleResMapper.selectById(id); + } + + @Override + public Integer insert(RoleResEntity entity) { + return roleResMapper.insert(entity); + } + + @Override + public Integer inserts(List<RoleResEntity> list) { + return roleResMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return roleResMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return roleResMapper.deletes(ids); + } + + @Override + public Integer update(RoleResEntity entity) { + return roleResMapper.update(entity); + } + + @Override + public Integer updates(List<RoleResEntity> list) { + return roleResMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/sys/RoleService.java b/src/main/java/com/moon/server/service/sys/RoleService.java new file mode 100644 index 0000000..0efdaac --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/RoleService.java @@ -0,0 +1,69 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.RoleEntity; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.sys.RoleMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 瑙掕壊琛� + * @author sws + * @date 2022-09-29 + */ +@Service +public class RoleService implements RoleMapper { + @Autowired + RoleMapper roleMapper; + + @Override + public Integer selectCount(String name, Integer depid) { + name = StringHelper.getLikeUpperStr(name); + + return roleMapper.selectCount(name, depid); + } + + @Override + public List<RoleEntity> selectByPage(String name, Integer depid, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return roleMapper.selectByPage(name, depid, limit, offset); + } + + @Override + public Integer insertRole(RoleEntity roleEntity) { + return roleMapper.insertRole(roleEntity); + } + + @Override + public Integer insertRoles(List<RoleEntity> roleEntity) { + return roleMapper.insertRoles(roleEntity); + } + + @Override + public Integer deleteRole(int id) { + return roleMapper.deleteRole(id); + } + + @Override + public Integer deleteRoles(List<Integer> ids) { + return roleMapper.deleteRoles(ids); + } + + @Override + public Integer updateRole(RoleEntity roleEntity) { + return roleMapper.updateRole(roleEntity); + } + + @Override + public RoleEntity selectRole(int id) { + return roleMapper.selectRole(id); + } + + @Override + public List<RoleEntity> selectRoleAll() { + return roleMapper.selectRoleAll(); + } +} diff --git a/src/main/java/com/moon/server/service/sys/RoleUserService.java b/src/main/java/com/moon/server/service/sys/RoleUserService.java new file mode 100644 index 0000000..010f65f --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/RoleUserService.java @@ -0,0 +1,68 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.RoleUserEntity; +import com.moon.server.mapper.sys.RoleUserMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 瑙掕壊-鐢ㄦ埛 + * @author WWW + */ +@Service +public class RoleUserService implements RoleUserMapper { + @Autowired + RoleUserMapper roleUserMapper; + + @Override + public Integer selectCount(Integer roleid) { + return roleUserMapper.selectCount(roleid); + } + + @Override + public List<RoleUserEntity> selectByPage(Integer roleid, Integer limit, Integer offset) { + return roleUserMapper.selectByPage(roleid, limit, offset); + } + + @Override + public List<RoleUserEntity> selectAll() { + return roleUserMapper.selectAll(); + } + + @Override + public RoleUserEntity selectById(int id) { + return roleUserMapper.selectById(id); + } + + @Override + public Integer insert(RoleUserEntity entity) { + return roleUserMapper.insert(entity); + } + + @Override + public Integer inserts(List<RoleUserEntity> list) { + return roleUserMapper.inserts(list); + } + + @Override + public Integer delete(int id) { + return roleUserMapper.delete(id); + } + + @Override + public Integer deletes(List<Integer> ids) { + return roleUserMapper.deletes(ids); + } + + @Override + public Integer update(RoleUserEntity entity) { + return roleUserMapper.update(entity); + } + + @Override + public Integer updates(List<RoleUserEntity> list) { + return roleUserMapper.updates(list); + } +} diff --git a/src/main/java/com/moon/server/service/sys/TokenService.java b/src/main/java/com/moon/server/service/sys/TokenService.java new file mode 100644 index 0000000..748733b --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/TokenService.java @@ -0,0 +1,285 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.all.SettingData; +import com.moon.server.entity.sys.LoginEntity; +import com.moon.server.entity.sys.TokenEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.entity.all.RedisCacheKey; +import com.moon.server.helper.StringHelper; +import com.moon.server.helper.WebHelper; +import com.moon.server.mapper.sys.TokenMapper; +import com.moon.server.service.all.RedisService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * 浠ょ墝琛� + * @author sws + * @date 2022-09-28 + */ + +@Service +public class TokenService implements TokenMapper { + @Autowired + TokenMapper tokenMapper; + + @Autowired + UserService usersService; + + @Autowired + LoginService loginService; + + @Autowired + RedisService redisService; + + @Override + public Integer selectCount(String name, Integer type) { + name = StringHelper.getLikeUpperStr(name); + + return tokenMapper.selectCount(name, type); + } + + @Override + public List<TokenEntity> selectByPage(String name, Integer type, Integer limit, Integer offset) { + name = StringHelper.getLikeUpperStr(name); + + return tokenMapper.selectByPage(name, type, limit, offset); + } + + @Override + public TokenEntity selectToken(int id) { + return tokenMapper.selectToken(id); + } + + @Override + public TokenEntity selectOneByToken(String token) { + return tokenMapper.selectOneByToken(token); + } + + @Override + public List<TokenEntity> selectTokenAll() { + return tokenMapper.selectTokenAll(); + } + + @Override + public Integer insertToken(TokenEntity tokenEntity) { + return tokenMapper.insertToken(tokenEntity); + } + + @Override + public Integer insertTokens(List<TokenEntity> tokenEntity) { + return tokenMapper.insertTokens(tokenEntity); + } + + @Override + public Integer deleteToken(int id) { + return tokenMapper.deleteToken(id); + } + + @Override + public Integer deleteTokens(List<Integer> ids) { + return tokenMapper.deleteTokens(ids); + } + + @Override + public Integer updateToken(TokenEntity tokenEntity) { + return tokenMapper.updateToken(tokenEntity); + } + + @Override + public Integer updateTokenExpire(TokenEntity tokenEntity) { + return tokenMapper.updateTokenExpire(tokenEntity); + } + + /** + * 鑾峰彇鏂扮殑浠ょ墝瀹炰綋绫� + */ + public TokenEntity getNewToken(UserEntity ue, HttpServletRequest req) { + TokenEntity te = new TokenEntity(); + te.setToken(WebHelper.getGuid()); + te.setDuration(SettingData.TOKEN_EXPIRE); + te.setExpire(WebHelper.getTimestamp(SettingData.TOKEN_EXPIRE)); + te.setType(0); + te.setIp(WebHelper.getIpAddress(req)); + te.setCreateUser(ue.getId()); + te.setUname(ue.getUname()); + + return te; + } + + /** + * 鏄�/鍚︾櫥褰� + */ + public Boolean isLogin(HttpServletRequest req, HttpServletResponse res) { + String token = WebHelper.getToken(req); + if (StringHelper.isNull(token)) { + return false; + } + + // redis + String tokenKey = RedisCacheKey.signTokenKey(token); + if (redisService.hasKey(tokenKey)) { + return true; + } + + // db + TokenEntity te = selectOneByToken(token); + if (te != null) { + redisService.put(tokenKey, te, te.getDuration(), TimeUnit.MINUTES); + return true; + } + + return false; + } + + /** + * 鐧诲嚭 + */ + public Boolean logout(String token, HttpServletRequest req, HttpServletResponse res) { + TokenEntity te = getEntityByToken(token); + if (te == null) { + return false; + } + + // 娓呴櫎Cookie + WebHelper.deleteCookies(req, res); + + // 鑾峰彇褰撳墠鐢ㄦ埛 + UserEntity ue = getCurrentUser(req); + if (ue == null) { + return false; + } + + // 娓呴櫎缂撳瓨 + String tokenKey = RedisCacheKey.signTokenKey(token); + if (redisService.hasKey(tokenKey)) { + redisService.delete(tokenKey); + } + String userKey = RedisCacheKey.signUserKey(te.getToken()); + if (redisService.hasKey(userKey)) { + redisService.delete(userKey); + } + + // db锛岃缃护鐗岃繃鏈� + te.setUpdateUser(ue.getId()); + Integer rows = updateTokenExpire(te); + if (rows == 0) { + return false; + } + + // 鍐欐棩蹇� + LoginEntity le = loginService.getNewLogin(ue.getId(), 1, 3, 1, req); + rows = loginService.insertLogin(le); + + return rows > 0; + } + + /** + * 鏍规嵁浠ょ墝鑾峰彇瀹炰綋 + */ + public TokenEntity getEntityByToken(String token) { + if (StringHelper.isNull(token)) { + return null; + } + + String tokenKey = RedisCacheKey.signTokenKey(token); + + // redis + Object obj = redisService.get(tokenKey); + if (obj instanceof TokenEntity) { + return (TokenEntity) obj; + } + + // db + TokenEntity te = selectOneByToken(token); + if (te != null) { + redisService.put(tokenKey, te, te.getDuration(), TimeUnit.MINUTES); + } + + return te; + } + + /** + * 淇濆瓨token + */ + public void saveToken(UserEntity ue, TokenEntity te, HttpServletRequest req, HttpServletResponse res) { + // 淇濆瓨鑷矯ookie + WebHelper.saveToken2Cookie(te.getToken(), req, res); + + // 浠ょ墝淇濆瓨鑷砇edis + String tokenKey = RedisCacheKey.signTokenKey(te.getToken()); + redisService.put(tokenKey, te, te.getDuration(), TimeUnit.MINUTES); + + String userKey = RedisCacheKey.signUserKey(te.getToken()); + ue.setBak(StringHelper.YMDHMS_FORMAT.format(new Date())); + redisService.put(userKey, ue, te.getDuration(), TimeUnit.MINUTES); + } + + /** + * 鑾峰彇褰撳墠鐢ㄦ埛 + */ + public UserEntity getCurrentUser(HttpServletRequest req) { + String token = WebHelper.getToken(req); + if (StringHelper.isNull(token)) { + return null; + } + + String userKey = RedisCacheKey.signUserKey(token); + + // redis + Object obj = redisService.get(userKey); + if (obj instanceof UserEntity) { + return (UserEntity) obj; + } + + // db + UserEntity ue = usersService.selectByToken(token); + if (ue != null) { + TokenEntity te = getEntityByToken(token); + if (te != null) { + redisService.put(userKey, ue, te.getDuration(), TimeUnit.MINUTES); + } + } + + return ue; + } + + /** + * 璁剧疆瀵嗙爜閿欒缂撳瓨 + */ + public void setPwdErrCache(UserEntity ue) { + String key = RedisCacheKey.signPwdError(ue.getUid()); + Object objCount = redisService.get(key); + + int count = objCount == null ? 1 : (int) objCount + 1; + redisService.put(key, count, SettingData.PWD_ERR_TIME, TimeUnit.MINUTES); + + // 璁板綍鏃ュ織 + HttpServletRequest req = WebHelper.getRequest(); + LoginEntity le = loginService.getNewLogin(ue.getId(), 1, 1, 0, req); + le.setDescr("瀵嗙爜涓嶆纭�"); + loginService.insertLogin(le); + + if (count >= SettingData.PWD_ERR_COUNT) { + String token = WebHelper.getToken(req); + HttpServletResponse res = WebHelper.getResponse(); + logout(token, req, res); + } + } + + /** + * 鐢ㄦ埛ID鏄�/鍚︾鐢� + */ + public boolean isUidDisable(UserEntity ue) { + String key = RedisCacheKey.signPwdError(ue.getUid()); + Object objCount = redisService.get(key); + + return objCount != null && (int) objCount >= SettingData.PWD_ERR_COUNT; + } +} diff --git a/src/main/java/com/moon/server/service/sys/UserService.java b/src/main/java/com/moon/server/service/sys/UserService.java new file mode 100644 index 0000000..323fedd --- /dev/null +++ b/src/main/java/com/moon/server/service/sys/UserService.java @@ -0,0 +1,303 @@ +package com.moon.server.service.sys; + +import com.moon.server.entity.sys.RoleEntity; +import com.moon.server.entity.sys.UserEntity; +import com.moon.server.helper.Md5Helper; +import com.moon.server.helper.RsaHelper; +import com.moon.server.helper.StringHelper; +import com.moon.server.mapper.sys.UserMapper; +import com.moon.server.service.all.RedisService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 鐢ㄦ埛琛� + * @author sws + * @date 2022-09-27 + */ + +@Service +public class UserService implements UserMapper { + @Autowired + UserMapper userMapper; + + @Autowired + RedisService redisService; + + @Autowired + LoginService loginService; + + @Autowired + TokenService tokenService; + + private final static Log log = LogFactory.getLog(UserService.class); + + @Override + public Integer selectCount(String uname, String depcode) { + uname = StringHelper.getLikeUpperStr(uname); + depcode = StringHelper.getRightLike(depcode); + + return userMapper.selectCount(uname, depcode); + } + + @Override + public UserEntity selectUser(int id) { + return userMapper.selectUser(id); + } + + @Override + public UserEntity selectByUid(String uid) { + return userMapper.selectByUid(uid); + } + + @Override + public List<UserEntity> selectUserAll() { + return userMapper.selectUserAll(); + } + + @Override + public List<UserEntity> selectByPage(String uname, String depcode, Integer limit, Integer offset) { + uname = StringHelper.getLikeUpperStr(uname); + depcode = StringHelper.getRightLike(depcode); + + return userMapper.selectByPage(uname, depcode, limit, offset); + } + + @Override + public UserEntity selectByToken(String token) { + return userMapper.selectByToken(token); + } + + @Override + public Integer selectForIsAdmin(Integer id) { + return userMapper.selectForIsAdmin(id); + } + + @Override + public List<UserEntity> selectAdminUsers(Integer type) { + return userMapper.selectAdminUsers(type); + } + + @Override + public List<RoleEntity> selectRoleByUserId(Integer id) { + return userMapper.selectRoleByUserId(id); + } + + @Override + public List<UserEntity> selectUserByRoleId(Integer roleId) { + return userMapper.selectUserByRoleId(roleId); + } + + @Override + public Integer insertUser(UserEntity userEntity) { + return userMapper.insertUser(userEntity); + } + + @Override + public Integer insertUsers(List<UserEntity> userEntity) { + return userMapper.insertUsers(userEntity); + } + + @Override + public Integer deleteUser(int id) { + return userMapper.deleteUser(id); + } + + @Override + public Integer deleteUsers(List<Integer> ids) { + return userMapper.deleteUsers(ids); + } + + @Override + public Integer updateUser(UserEntity userEntity) { + return userMapper.updateUser(userEntity); + } + + @Override + public Integer selectCountForRole(String uname, Integer roleid, String depcode) { + uname = StringHelper.getLikeUpperStr(uname); + depcode = StringHelper.getRightLike(depcode); + + return userMapper.selectCountForRole(uname, roleid, depcode); + } + + @Override + public List<UserEntity> selectByPageForRole(String uname, Integer roleid, String depcode, Integer limit, Integer offset) { + uname = StringHelper.getLikeUpperStr(uname); + depcode = StringHelper.getRightLike(depcode); + + return userMapper.selectByPageForRole(uname, roleid, depcode, limit, offset); + } + + @Override + public Integer updateUsersPwd(Integer updateUser, String pwd, List<Integer> ids) { + return userMapper.updateUsersPwd(updateUser, pwd, ids); + } + + /** + * 楠岃瘉鐢ㄦ埛瀹炰綋绫� + */ + public String validateUserEntity(UserEntity entity) { + if (entity == null) { + return "娌℃湁鎵惧埌鐢ㄦ埛"; + } + if (StringHelper.isEmpty(entity.getUid())) { + return "鐢ㄦ埛ID涓嶈兘涓虹┖"; + } + if (StringHelper.isEmpty(entity.getPwd())) { + return "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖"; + } + + return null; + } + + /** + * 楠岃瘉鐧诲綍鐢ㄦ埛瀵嗙爜 + */ + public String validateLoginPwd(UserEntity entity) { + try { + String str = validateUserEntity(entity); + if (str != null) { + return str; + } + + // 瑙e瘑 + String uid = RsaHelper.decrypt(entity.getUid()); + String pwd = RsaHelper.decrypt(entity.getPwd()); + + entity.setUid(uid); + entity.setPwd(pwd); + + if (tokenService.isUidDisable(entity)) { + return "鐢ㄦ埛ID宸茬鐢�"; + } + + return null; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return "瑙e瘑澶辫触"; + } + } + + /** + * 楠岃瘉鏂扮敤鎴峰瘑鐮� + */ + @SuppressWarnings("AlibabaRemoveCommentedCode") + public String validateNewPwd(UserEntity entity) { + try { + String str = validateUserEntity(entity); + if (str != null) { + return str; + } + + // 瑙e瘑 + String uid = RsaHelper.decrypt(entity.getUid()); + /*String pwd = RsaHelper.decrypt(entity.getPwd()); + if (!StringHelper.isPwdValid(pwd)) { + return "瀵嗙爜涓嶇鍚堣姹�"; + } + + String newPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); + entity.setPwd(newPwd);*/ + entity.setUid(uid); + + return null; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return "瑙e瘑澶辫触"; + } + } + + /** + * 楠岃瘉鑰佺敤鎴峰瘑鐮� + */ + public String validateOldPwd(UserEntity entity) { + try { + String str = validateUserEntity(entity); + if (str != null) { + return str; + } + if (StringHelper.isEmpty(entity.getSalt())) { + return "鏂板瘑鐮佷笉鑳戒负绌�"; + } + + String uid = RsaHelper.decrypt(entity.getUid()); + String pwd = RsaHelper.decrypt(entity.getPwd()); + String salt = RsaHelper.decrypt(entity.getSalt()); + + UserEntity ue = selectByUid(uid); + if (ue == null) { + return "娌℃湁鎵惧埌鐢ㄦ埛"; + } + if (!Md5Helper.validatePassword(pwd, ue.getPwd())) { + tokenService.setPwdErrCache(ue); + return "鏃у瘑鐮佷笉姝g‘"; + } + if (StringHelper.isPwdInvalid(salt)) { + return "瀵嗙爜涓嶇鍚堣姹�"; + } + + String newPwd = Md5Helper.reverse(Md5Helper.generate(salt)); + entity.setPwd(newPwd); + entity.setSalt(null); + entity.setUid(uid); + + return null; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return "瑙e瘑澶辫触"; + } + } + + /** + * 楠岃瘉绠$悊鍛樺瘑鐮� + */ + public String validateAdminPwd(UserEntity ue, String adminPwd) { + if (ue == null) { + return "娌℃湁鐧诲綍鎴栬秴鏃�"; + } + if (StringHelper.isEmpty(adminPwd)) { + return "绠$悊鍛樺瘑鐮佷笉鑳戒负绌�"; + } + + try { + String pwd = RsaHelper.decrypt(adminPwd); + if (!Md5Helper.validatePassword(pwd, ue.getPwd())) { + tokenService.setPwdErrCache(ue); + return "绠$悊鍛樺瘑鐮佷笉姝g‘"; + } + + return null; + } catch (Exception ex) { + return "瑙e瘑澶辫触"; + } + } + + /** + * 楠岃瘉鏂板瘑鐮� + */ + public String validateNewPwd(UserEntity ue, String newPwd) { + if (StringHelper.isEmpty(newPwd)) { + return "鏂板瘑鐮佷笉鑳戒负绌�"; + } + + try { + String pwd = RsaHelper.decrypt(newPwd); + if (StringHelper.isPwdInvalid(pwd)) { + return "瀵嗙爜涓嶇鍚堣姹�"; + } + + String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); + ue.setSalt(dbPwd); + + return null; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return "瑙e瘑澶辫触"; + } + } +} diff --git a/src/main/resources/mapper/all/BaseQueryMapper.xml b/src/main/resources/mapper/all/BaseQueryMapper.xml index 6b11f5d..cd273f0 100644 --- a/src/main/resources/mapper/all/BaseQueryMapper.xml +++ b/src/main/resources/mapper/all/BaseQueryMapper.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.all.BaseQueryMapper"> - <select id="selectUserFuzzy" resultType="com.lf.server.entity.ctrl.IdNameEntity"> +<mapper namespace="com.moon.server.mapper.all.BaseQueryMapper"> + <select id="selectUserFuzzy" resultType="com.moon.server.entity.ctrl.IdNameEntity"> select id,uname "name" from lf.sys_user <where> <if test="name != null"> @@ -11,7 +11,7 @@ order by uname limit 10 </select> - <select id="selectDepFuzzy" resultType="com.lf.server.entity.ctrl.IdNameEntity"> + <select id="selectDepFuzzy" resultType="com.moon.server.entity.ctrl.IdNameEntity"> select id,name from lf.sys_dep <where> <if test="name != null"> @@ -31,7 +31,7 @@ </where> </select> - <select id="selectTabsByPage" resultType="com.lf.server.entity.ctrl.TabEntity"> + <select id="selectTabsByPage" resultType="com.moon.server.entity.ctrl.TabEntity"> select ns, tab, tab_desc, fn_get_entity(tab) entity, tableType, bak, fn_tab_count(a.ns, a.tab, #{filters}) "rows" from lf.sys_dict a <where> @@ -44,11 +44,11 @@ limit #{limit} offset #{offset}; </select> - <select id="selectFields" resultType="com.lf.server.entity.data.DictEntity"> + <select id="selectFields" resultType="com.moon.server.entity.data.DictEntity"> select * from lf.sys_dict where ns = #{ns} and tab = #{tab} order by order_num </select> - <select id="selectDomains" resultType="com.lf.server.entity.data.DomainEntity"> + <select id="selectDomains" resultType="com.moon.server.entity.data.DomainEntity"> select a.* from lf.sys_domain a inner join lf.sys_dict b on a.dom_name = b.domain_na where b.ns = #{ns} and b.tab = #{tab} and b.domain_na is not null </select> @@ -57,7 +57,7 @@ select ST_astext(ST_Union(geom)) as route from pgr_fromAtoB('lrdl'::text, #{x1}, #{y1}, #{x2}, #{y2}); </select> - <select id="selectLocation" resultType="com.lf.server.entity.ctrl.KeyValueEntity"> + <select id="selectLocation" resultType="com.moon.server.entity.ctrl.KeyValueEntity"> select '鍥�' "key", cname "value" from bs.th_globe_country where ST_Intersects(ST_PointFromText(#{wkt}, 4490), geom) union all select '鐪�' "key", cname "value" from bs.th_province_area where ST_Intersects(ST_PointFromText(#{wkt}, 4490), geom) @@ -67,7 +67,7 @@ select '鍘�' "key", cname "value" from bs.th_county_area where ST_Intersects(ST_PointFromText(#{wkt}, 4490), geom); </select> - <select id="selectDirTypes" resultType="com.lf.server.entity.ctrl.KeyValueEntity"> + <select id="selectDirTypes" resultType="com.moon.server.entity.ctrl.KeyValueEntity"> select (select string_agg(code, ',') from lf.sys_dir where name = a.name) "key", name "value" from lf.sys_dir a <where> @@ -80,7 +80,7 @@ order by key </select> - <select id="selectAnnexByTab" resultType="com.lf.server.entity.sys.AttachEntity"> + <select id="selectAnnexByTab" resultType="com.moon.server.entity.sys.AttachEntity"> select a.* from lf.sys_attach a <where> tab = #{tab} diff --git a/src/main/resources/mapper/all/PermsMapper.xml b/src/main/resources/mapper/all/PermsMapper.xml index e304fd8..75eb93f 100644 --- a/src/main/resources/mapper/all/PermsMapper.xml +++ b/src/main/resources/mapper/all/PermsMapper.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.all.PermsMapper"> - <select id="selectRes" resultType="com.lf.server.entity.all.ResAuthEntity"> +<mapper namespace="com.moon.server.mapper.all.PermsMapper"> + <select id="selectRes" resultType="com.moon.server.entity.all.ResAuthEntity"> select distinct d.id,d.name,d.server from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid @@ -15,7 +15,7 @@ order by d.id </select> - <select id="selectMenus" resultType="com.lf.server.entity.all.MenusAuthEntity"> + <select id="selectMenus" resultType="com.moon.server.entity.all.MenusAuthEntity"> select distinct e.id,e.pid,e.cn_name,e.en_name,e.url,e.perms,e.type,e.css,e.icon,e.level,e.order_num,e.is_show from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid @@ -47,7 +47,7 @@ order by perms </select> - <select id="selectPermsEntity" resultType="com.lf.server.entity.all.PermsAuthEntity"> + <select id="selectPermsEntity" resultType="com.moon.server.entity.all.PermsAuthEntity"> select distinct e.id,e.pid,e.order_num,e.cn_name,e.en_name,f.name,e.perms,f.tag from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid @@ -68,7 +68,7 @@ inner join lf.sys_user c on b.userid = c.id where c.uid = #{uid} </select> - <select id="selectMenuRecursive" resultType="com.lf.server.entity.sys.MenuEntity"> + <select id="selectMenuRecursive" resultType="com.moon.server.entity.sys.MenuEntity"> with recursive rs as ( select a.* from lf.sys_menu a where a.id = #{id} union diff --git a/src/main/resources/mapper/data/DictMapper.xml b/src/main/resources/mapper/data/DictMapper.xml index b8be40f..a98a7b6 100644 --- a/src/main/resources/mapper/data/DictMapper.xml +++ b/src/main/resources/mapper/data/DictMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.DictMapper"> +<mapper namespace="com.moon.server.mapper.data.DictMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_dict <where> @@ -14,7 +14,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.data.DictEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.data.DictEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_dict a <where> status = 0 @@ -29,11 +29,11 @@ limit #{limit} offset #{offset} </select> - <select id="selectById" resultType="com.lf.server.entity.data.DictEntity"> + <select id="selectById" resultType="com.moon.server.entity.data.DictEntity"> select * from lf.sys_dict where status = 0 and id = #{id} </select> - <select id="selectDictTab" resultType="com.lf.server.entity.ctrl.TabEntity"> + <select id="selectDictTab" resultType="com.moon.server.entity.ctrl.TabEntity"> select ns, tab, tab_desc, fn_get_entity(tab) entity, tableType, bak from lf.sys_dict <where> @@ -45,7 +45,7 @@ order by id; </select> - <insert id="insert" parameterType="com.lf.server.entity.data.DictEntity"> + <insert id="insert" parameterType="com.moon.server.entity.data.DictEntity"> insert into lf.sys_dict (ns,tab,tab_desc,field,alias,type,len,precision,order_num,create_user,create_time,tabletype,unit,domain_na,showtype,editable,bak) values diff --git a/src/main/resources/mapper/data/DirMapper.xml b/src/main/resources/mapper/data/DirMapper.xml index 27ba5d6..89253c9 100644 --- a/src/main/resources/mapper/data/DirMapper.xml +++ b/src/main/resources/mapper/data/DirMapper.xml @@ -1,25 +1,25 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.DirMapper"> - <select id="selectDir" resultType="com.lf.server.entity.data.DirEntity"> +<mapper namespace="com.moon.server.mapper.data.DirMapper"> + <select id="selectDir" resultType="com.moon.server.entity.data.DirEntity"> select a.*, fn_get_fullname(a.code, 2) fullName from lf.sys_dir a where id = #{id} </select> - <select id="selectByCode" resultType="com.lf.server.entity.data.DirEntity"> + <select id="selectByCode" resultType="com.moon.server.entity.data.DirEntity"> select a.*, fn_get_fullname(a.code, 2) fullName from lf.sys_dir a where code = #{code} </select> - <select id="selectDirAll" resultType="com.lf.server.entity.data.DirEntity"> + <select id="selectDirAll" resultType="com.moon.server.entity.data.DirEntity"> select a.*, fn_get_fullname(a.code, 2) fullName from lf.sys_dir a order by order_num; </select> - <select id="selectDirRoot" resultType="com.lf.server.entity.data.DirEntity"> + <select id="selectDirRoot" resultType="com.moon.server.entity.data.DirEntity"> select a.*, fn_get_fullname(a.code, 2) fullName from lf.sys_dir a where pid = 0 order by code; </select> - <select id="selectProject" resultType="com.lf.server.entity.data.DirEntity"> + <select id="selectProject" resultType="com.moon.server.entity.data.DirEntity"> select a.*, fn_get_fullname(a.code, 2) fullName from lf.sys_dir a <where> @@ -31,7 +31,7 @@ order by code; </select> - <select id="selectDirRecursive" resultType="com.lf.server.entity.data.DirEntity"> + <select id="selectDirRecursive" resultType="com.moon.server.entity.data.DirEntity"> with recursive rs as( select a.*, fn_get_fullname(a.code, 2) fullName from lf.sys_dir a where name = #{name} union @@ -40,7 +40,7 @@ order by order_num; </select> - <select id="selectRecursiveById" resultType="com.lf.server.entity.data.DirEntity"> + <select id="selectRecursiveById" resultType="com.moon.server.entity.data.DirEntity"> with recursive rs as( select a.*, fn_get_fullname(a.code, 2) fullName from lf.sys_dir a where id = #{id} union @@ -49,12 +49,12 @@ order by code; </select> - <select id="selectDirsForPrj" resultType="com.lf.server.entity.data.DirEntity"> + <select id="selectDirsForPrj" resultType="com.moon.server.entity.data.DirEntity"> select a.* from lf.sys_dir a where code not like '00%' order by code; </select> <!-- 鎻掑叆涓�鏉� --> - <insert id="insert" parameterType="com.lf.server.entity.data.DirEntity"> + <insert id="insert" parameterType="com.moon.server.entity.data.DirEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> select currval('lf.sys_dir_id_seq'::regclass) as id </selectKey> diff --git a/src/main/resources/mapper/data/DomainMapper.xml b/src/main/resources/mapper/data/DomainMapper.xml index ef43900..bd58eca 100644 --- a/src/main/resources/mapper/data/DomainMapper.xml +++ b/src/main/resources/mapper/data/DomainMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.DomainMapper"> +<mapper namespace="com.moon.server.mapper.data.DomainMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(a.*) from lf.sys_domain a inner join lf.sys_dict b on a.dom_name = b.domain_na where b.status = 0 @@ -15,7 +15,7 @@ </if> </select> - <select id="selectByPage" resultType="com.lf.server.entity.data.DomainEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.data.DomainEntity"> select a.* from lf.sys_domain a inner join lf.sys_dict b on a.dom_name = b.domain_na where b.status = 0 <if test="ns != null"> @@ -31,11 +31,11 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.data.DomainEntity"> + <select id="selectAll" resultType="com.moon.server.entity.data.DomainEntity"> select * from lf.sys_domain order by dom_name,dom_code </select> - <select id="selectById" resultType="com.lf.server.entity.data.DomainEntity"> + <select id="selectById" resultType="com.moon.server.entity.data.DomainEntity"> select * from lf.sys_domain where id = #{id} </select> @@ -46,7 +46,7 @@ group by domain_na </select> - <insert id="insert" parameterType="com.lf.server.entity.data.DomainEntity"> + <insert id="insert" parameterType="com.moon.server.entity.data.DomainEntity"> insert into lf.sys_domain (dom_desc,dom_name,dom_code,code_desc,level,orderid,bsm,create_user,create_time,bak) values diff --git a/src/main/resources/mapper/data/DownloadMapper.xml b/src/main/resources/mapper/data/DownloadMapper.xml index b830ce4..9b7ec89 100644 --- a/src/main/resources/mapper/data/DownloadMapper.xml +++ b/src/main/resources/mapper/data/DownloadMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.DownloadMapper"> +<mapper namespace="com.moon.server.mapper.data.DownloadMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_download <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.data.DownloadEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.data.DownloadEntity"> select * from lf.sys_download <where> <if test="name != null"> @@ -31,7 +31,7 @@ </where> </select> - <select id="selectByPageForUser" resultType="com.lf.server.entity.data.DownloadEntity"> + <select id="selectByPageForUser" resultType="com.moon.server.entity.data.DownloadEntity"> select *, fn_uname(create_user) createName from lf.sys_download <where> create_user = #{createUser} and type in (${types}) @@ -43,19 +43,19 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.data.DownloadEntity"> + <select id="selectAll" resultType="com.moon.server.entity.data.DownloadEntity"> select * from lf.sys_download order by id desc; </select> - <select id="selectById" resultType="com.lf.server.entity.data.DownloadEntity"> + <select id="selectById" resultType="com.moon.server.entity.data.DownloadEntity"> select * from lf.sys_download where id = #{id} </select> - <select id="selectByGuid" resultType="com.lf.server.entity.data.DownloadEntity"> + <select id="selectByGuid" resultType="com.moon.server.entity.data.DownloadEntity"> select * from lf.sys_download where guid = #{guid} limit 1 </select> - <insert id="insert" parameterType="com.lf.server.entity.data.DownloadEntity"> + <insert id="insert" parameterType="com.moon.server.entity.data.DownloadEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> select currval('lf.sys_download_id_seq'::regclass) as id </selectKey> diff --git a/src/main/resources/mapper/data/LayerMapper.xml b/src/main/resources/mapper/data/LayerMapper.xml index 45c9b88..31d7d43 100644 --- a/src/main/resources/mapper/data/LayerMapper.xml +++ b/src/main/resources/mapper/data/LayerMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.LayerMapper"> +<mapper namespace="com.moon.server.mapper.data.LayerMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_layer <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.data.LayerEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.data.LayerEntity"> select * from lf.sys_layer <where> <if test="cnName != null"> @@ -21,17 +21,17 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.data.LayerEntity"> + <select id="selectAll" resultType="com.moon.server.entity.data.LayerEntity"> select (select ns from lf.sys_dict b where b.field = 'gid' and b.tab = a.en_name) "ns", a.* from lf.sys_layer a order by id; </select> - <select id="selectById" resultType="com.lf.server.entity.data.LayerEntity"> + <select id="selectById" resultType="com.moon.server.entity.data.LayerEntity"> select * from lf.sys_layer where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.data.LayerEntity"> + <insert id="insert" parameterType="com.moon.server.entity.data.LayerEntity"> insert into lf.sys_layer (pid,cn_name,en_name,url,test_url,type,icon,level,order_num,is_show,create_user,create_time,bak,serve_type,data_type,elev,is_project) values diff --git a/src/main/resources/mapper/data/MetaMapper.xml b/src/main/resources/mapper/data/MetaMapper.xml index 37c3e97..bbec10c 100644 --- a/src/main/resources/mapper/data/MetaMapper.xml +++ b/src/main/resources/mapper/data/MetaMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.MetaMapper"> +<mapper namespace="com.moon.server.mapper.data.MetaMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_meta <where> @@ -20,7 +20,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.data.MetaEntity"> select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName from lf.sys_meta a <where> @@ -58,7 +58,7 @@ </where> </select> - <select id="selectMetasForPage" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectMetasForPage" resultType="com.moon.server.entity.data.MetaEntity"> select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName, (select coalesce(sum(dcount), 0) from lf.sys_download b inner join lf.sys_meta_down c on b.id = c.downid where c.metaid = a.id) "downCount", (select fn_uname(download_user) from lf.sys_download b inner join lf.sys_meta_down c on b.id = c.downid where c.metaid = a.id order by download_time desc limit 1) "lastUser", @@ -93,7 +93,7 @@ </where> </select> - <select id="selectByPageForUpload" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectByPageForUpload" resultType="com.moon.server.entity.data.MetaEntity"> select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName from lf.sys_meta a <where> @@ -119,7 +119,7 @@ </where> </select> - <select id="selectPageByPid" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectPageByPid" resultType="com.moon.server.entity.data.MetaEntity"> select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName from lf.sys_meta a <where> @@ -132,12 +132,12 @@ limit #{limit} offset #{offset} </select> - <select id="selectById" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectById" resultType="com.moon.server.entity.data.MetaEntity"> select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName from lf.sys_meta a where id = #{id} </select> - <select id="selectByGuid" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectByGuid" resultType="com.moon.server.entity.data.MetaEntity"> select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName from lf.sys_meta a where guid = #{guid} @@ -150,13 +150,13 @@ limit 1 </select> - <select id="selectByIdsForTab" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectByIdsForTab" resultType="com.moon.server.entity.data.MetaEntity"> select a.* from lf.sys_meta a where id in (${ids}) and a.tab is not null and a.rows > 0 order by a.tab; </select> - <select id="selectMetaFiles" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectMetaFiles" resultType="com.moon.server.entity.data.MetaEntity"> select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName from lf.sys_meta a where id in @@ -166,7 +166,7 @@ order by a.id desc </select> - <select id="selectXlsAnnex" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectXlsAnnex" resultType="com.moon.server.entity.data.MetaEntity"> select * from lf.sys_meta where type in ('xls', 'xlsx') and eventid is not null and tab is not null and rows > 0 and id in <foreach item="id" collection="ids" index="index" open="(" separator="," close=")"> @@ -177,7 +177,7 @@ </if> </select> - <select id="selectMetasByDirCode" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectMetasByDirCode" resultType="com.moon.server.entity.data.MetaEntity"> select a.*, fn_uname(a.create_user) uname, fn_get_fullname(a.depcode, 1) depName, fn_ver(a.verid) verName, fn_get_fullname(a.dircode, 2) dirName from lf.sys_meta a where dircode like #{dircode} and @@ -193,7 +193,7 @@ order by depcode; </select> - <insert id="insert" parameterType="com.lf.server.entity.data.MetaEntity"> + <insert id="insert" parameterType="com.moon.server.entity.data.MetaEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> select currval('lf.sys_meta_id_seq'::regclass) as id </selectKey> diff --git a/src/main/resources/mapper/data/StyleMapper.xml b/src/main/resources/mapper/data/StyleMapper.xml index 66c5522..45eea20 100644 --- a/src/main/resources/mapper/data/StyleMapper.xml +++ b/src/main/resources/mapper/data/StyleMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.StyleMapper"> +<mapper namespace="com.moon.server.mapper.data.StyleMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_style <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.data.StyleEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.data.StyleEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName, fn_rec_query(a.depid,'dep') depName, fn_rec_query(a.dirid,'dir') dirName from lf.sys_style a <where> @@ -22,17 +22,17 @@ limit #{limit} offset #{offset} </select> - <select id="selectStyleAll" resultType="com.lf.server.entity.data.StyleEntity"> + <select id="selectStyleAll" resultType="com.moon.server.entity.data.StyleEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName, fn_rec_query(a.depid,'dep') depName, fn_rec_query(a.dirid,'dir') dirName from lf.sys_style a order by a.id desc </select> - <select id="selectStyle" resultType="com.lf.server.entity.data.StyleEntity"> + <select id="selectStyle" resultType="com.moon.server.entity.data.StyleEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName, fn_rec_query(a.depid,'dep') depName, fn_rec_query(a.dirid,'dir') dirName from lf.sys_style a where a.id = #{id} </select> - <insert id="insertStyle" parameterType="com.lf.server.entity.data.StyleEntity"> + <insert id="insertStyle" parameterType="com.moon.server.entity.data.StyleEntity"> insert into lf.sys_style (name,type,dirid,depid,ver,status,precision,descr,fname,vname,file_guid,view_guid,create_user,create_time,bak) values diff --git a/src/main/resources/mapper/data/UploadMapper.xml b/src/main/resources/mapper/data/UploadMapper.xml index 93b7776..e446f7f 100644 --- a/src/main/resources/mapper/data/UploadMapper.xml +++ b/src/main/resources/mapper/data/UploadMapper.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.UploadMapper"> - <select id="selectCoords" resultType="com.lf.server.entity.data.CoordEntity"> +<mapper namespace="com.moon.server.mapper.data.UploadMapper"> + <select id="selectCoords" resultType="com.moon.server.entity.data.CoordEntity"> select * from lf.sys_coord <where> 1 = 1 @@ -16,11 +16,11 @@ select count(*) from lf.sys_coord where epsgcode = #{epsgCode} </select> - <select id="selectProject" resultType="com.lf.server.entity.data.DirEntity"> + <select id="selectProject" resultType="com.moon.server.entity.data.DirEntity"> select * from lf.sys_dir where pid = 0 and id > 1 </select> - <select id="selectFmeLog" resultType="com.lf.server.entity.data.FmeLogEntity"> + <select id="selectFmeLog" resultType="com.moon.server.entity.data.FmeLogEntity"> select * from lf.sys_fme_log where parentid = #{parentid}; </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/data/VerMapper.xml b/src/main/resources/mapper/data/VerMapper.xml index f2fbcd4..c1f9fca 100644 --- a/src/main/resources/mapper/data/VerMapper.xml +++ b/src/main/resources/mapper/data/VerMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.VerMapper"> +<mapper namespace="com.moon.server.mapper.data.VerMapper"> <!-- 缁熻琛屾暟 --> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_ver a @@ -16,7 +16,7 @@ </select> <!-- 鍒嗛〉鏌ヨ --> - <select id="selectByPage" resultType="com.lf.server.entity.data.VerEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.data.VerEntity"> select a.*, fn_rec_query(a.dirid, 'dir') depName, fn_uname(create_user) createName from lf.sys_ver a <where> 1=1 @@ -31,19 +31,19 @@ limit #{limit} offset #{offset} </select> - <select id="selectVersionAll" resultType="com.lf.server.entity.data.VerEntity"> + <select id="selectVersionAll" resultType="com.moon.server.entity.data.VerEntity"> select * from lf.sys_ver order by id desc </select> - <select id="selectVersion" resultType="com.lf.server.entity.data.VerEntity"> + <select id="selectVersion" resultType="com.moon.server.entity.data.VerEntity"> select * from lf.sys_ver where id = #{id} </select> - <select id="selectByDirid" resultType="com.lf.server.entity.data.VerEntity"> + <select id="selectByDirid" resultType="com.moon.server.entity.data.VerEntity"> select * from lf.sys_ver where dirid = 0 or dirid = #{dirid} </select> - <insert id="insertVersion" parameterType="com.lf.server.entity.data.VerEntity"> + <insert id="insertVersion" parameterType="com.moon.server.entity.data.VerEntity"> insert into lf.sys_ver (dirid,name,descr,create_user,create_time) values diff --git a/src/main/resources/mapper/show/ApplyMapper.xml b/src/main/resources/mapper/show/ApplyMapper.xml index cd1f032..fff9377 100644 --- a/src/main/resources/mapper/show/ApplyMapper.xml +++ b/src/main/resources/mapper/show/ApplyMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.show.ApplyMapper"> +<mapper namespace="com.moon.server.mapper.show.ApplyMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_apply a inner join lf.sys_user b on a.userid = b.id <where> @@ -25,7 +25,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.show.ApplyEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.show.ApplyEntity"> select case a.userid when #{userid} then guid else null end "guid", a.*, b.uname, (select count(*) from lf.sys_flow c where c.applyid = a.id and c.status = 0 and c.userid = #{userid}) isVerify @@ -54,15 +54,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.show.ApplyEntity"> + <select id="selectAll" resultType="com.moon.server.entity.show.ApplyEntity"> select * from lf.sys_apply order by id desc </select> - <select id="selectById" resultType="com.lf.server.entity.show.ApplyEntity"> + <select id="selectById" resultType="com.moon.server.entity.show.ApplyEntity"> select * from lf.sys_apply where id = #{id} </select> - <select id="selectUserByDepcode" resultType="com.lf.server.entity.sys.UserEntity"> + <select id="selectUserByDepcode" resultType="com.moon.server.entity.sys.UserEntity"> select c.* from lf.sys_role a inner join lf.sys_role_user b on a.id = b.roleid inner join lf.sys_user c on b.userid = c.id where a.is_admin = 2 and c.depcode = #{depcode} @@ -74,13 +74,13 @@ where a.status between 0 and 9 and b.status = 0 and b.userid = #{userid} </select> - <select id="selectFlows" resultType="com.lf.server.entity.show.FlowEntity"> + <select id="selectFlows" resultType="com.moon.server.entity.show.FlowEntity"> select a.*, b.uname, fn_get_fullname(a.depcode, 1) depName from lf.sys_flow a inner join lf.sys_user b on a.userid = b.id where a.applyid = #{applyid} </select> - <insert id="insert" parameterType="com.lf.server.entity.show.ApplyEntity"> + <insert id="insert" parameterType="com.moon.server.entity.show.ApplyEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> select currval('lf.sys_apply_id_seq'::regclass) as id </selectKey> diff --git a/src/main/resources/mapper/show/FlowMapper.xml b/src/main/resources/mapper/show/FlowMapper.xml index 48db4bb..20d05ae 100644 --- a/src/main/resources/mapper/show/FlowMapper.xml +++ b/src/main/resources/mapper/show/FlowMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.show.FlowMapper"> +<mapper namespace="com.moon.server.mapper.show.FlowMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_flow <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.show.FlowEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.show.FlowEntity"> select * from lf.sys_flow <where> <if test="userid != null"> @@ -21,15 +21,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.show.FlowEntity"> + <select id="selectAll" resultType="com.moon.server.entity.show.FlowEntity"> select * from lf.sys_flow order by id desc </select> - <select id="selectById" resultType="com.lf.server.entity.show.FlowEntity"> + <select id="selectById" resultType="com.moon.server.entity.show.FlowEntity"> select * from lf.sys_flow where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.show.FlowEntity"> + <insert id="insert" parameterType="com.moon.server.entity.show.FlowEntity"> insert into lf.sys_flow (applyid,depcode,userid,status,descr,create_user,create_time) values diff --git a/src/main/resources/mapper/show/MarkMapper.xml b/src/main/resources/mapper/show/MarkMapper.xml index 228b5cf..989ac27 100644 --- a/src/main/resources/mapper/show/MarkMapper.xml +++ b/src/main/resources/mapper/show/MarkMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.show.MarkMapper"> +<mapper namespace="com.moon.server.mapper.show.MarkMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_mark <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.show.MarkEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.show.MarkEntity"> select * from lf.sys_mark <where> <if test="userid != null"> @@ -21,15 +21,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.show.MarkEntity"> + <select id="selectAll" resultType="com.moon.server.entity.show.MarkEntity"> select * from lf.sys_mark order by id desc </select> - <select id="selectById" resultType="com.lf.server.entity.show.MarkEntity"> + <select id="selectById" resultType="com.moon.server.entity.show.MarkEntity"> select * from lf.sys_mark where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.show.MarkEntity"> + <insert id="insert" parameterType="com.moon.server.entity.show.MarkEntity"> insert into lf.sys_mark (name,wkt,create_user,create_time) values diff --git a/src/main/resources/mapper/show/ModelMapper.xml b/src/main/resources/mapper/show/ModelMapper.xml index a2f69c2..5e2e680 100644 --- a/src/main/resources/mapper/show/ModelMapper.xml +++ b/src/main/resources/mapper/show/ModelMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.show.ModelMapper"> +<mapper namespace="com.moon.server.mapper.show.ModelMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_model <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.show.ModelEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.show.ModelEntity"> select * from lf.sys_model <where> <if test="layerid != null"> @@ -21,19 +21,19 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.show.ModelEntity"> + <select id="selectAll" resultType="com.moon.server.entity.show.ModelEntity"> select * from lf.sys_model order by id desc; </select> - <select id="selectById" resultType="com.lf.server.entity.show.ModelEntity"> + <select id="selectById" resultType="com.moon.server.entity.show.ModelEntity"> select * from lf.sys_model where id = #{id} </select> - <select id="selectModelByGuid" resultType="com.lf.server.entity.show.ModelEntity"> + <select id="selectModelByGuid" resultType="com.moon.server.entity.show.ModelEntity"> select * from lf.sys_model where layerid = #{layerid} and modelid = #{modelid} limit 1; </select> - <insert id="insert" parameterType="com.lf.server.entity.show.ModelEntity"> + <insert id="insert" parameterType="com.moon.server.entity.show.ModelEntity"> insert into lf.sys_model (layerid,modelid,guid,name,type,info,url,icon,create_user,create_time,bak) values diff --git a/src/main/resources/mapper/show/OneMapMapper.xml b/src/main/resources/mapper/show/OneMapMapper.xml index 3803030..8c6c43a 100644 --- a/src/main/resources/mapper/show/OneMapMapper.xml +++ b/src/main/resources/mapper/show/OneMapMapper.xml @@ -2,9 +2,9 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.show.OneMapMapper"> +<mapper namespace="com.moon.server.mapper.show.OneMapMapper"> - <resultMap type="com.lf.server.entity.show.OneMapEntity" id="OneMapResult"> + <resultMap type="com.moon.server.entity.show.OneMapEntity" id="OneMapResult"> <result property="value" column="value" /> <result property="key" column="key" /> </resultMap> @@ -154,12 +154,12 @@ </select> <!-- 缁熻椤圭洰绫诲瀷 2 --> - <select id="selectProjectTypeOne" resultType="com.lf.server.entity.show.OneMapEntity"> + <select id="selectProjectTypeOne" resultType="com.moon.server.entity.show.OneMapEntity"> select * from lf.sys_meta ${endSql} </select> <!-- 缁熻椤圭洰绫诲瀷 2 --> - <select id="selectProjectType2" resultType="com.lf.server.entity.show.OneMapEntity"> + <select id="selectProjectType2" resultType="com.moon.server.entity.show.OneMapEntity"> select modular1,count(*) from lf.sys_operate group by modular1 order by modular1; </select> diff --git a/src/main/resources/mapper/show/PipelineMapper.xml b/src/main/resources/mapper/show/PipelineMapper.xml index 3e67c63..a85e382 100644 --- a/src/main/resources/mapper/show/PipelineMapper.xml +++ b/src/main/resources/mapper/show/PipelineMapper.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.show.PipelineMapper"> - <select id="selectPipelines" resultType="com.lf.server.entity.show.PipelineEntity"> +<mapper namespace="com.moon.server.mapper.show.PipelineMapper"> + <select id="selectPipelines" resultType="com.moon.server.entity.show.PipelineEntity"> select gid, pipename, segname, ST_AsText(ST_LineMerge(geom)) "wkt" from bs.m_pipesegment <where> @@ -13,11 +13,11 @@ order by pipename, segname; </select> - <select id="selectSegNames" resultType="com.lf.server.entity.show.PipelineEntity"> + <select id="selectSegNames" resultType="com.moon.server.entity.show.PipelineEntity"> select gid, pipename, segname from bs.m_pipesegment order by pipename, segname; </select> - <select id="selectPipeAnalysis" resultType="com.lf.server.entity.show.PipelineEntity"> + <select id="selectPipeAnalysis" resultType="com.moon.server.entity.show.PipelineEntity"> select row_number() over() as gid, a.name as acrossName, b.segname as segName, b.remarks, b.pipename as pipeName, cast( st_length( st_geographyfromtext( st_astext( st_intersection(ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) as decimal(12, 2) ) AS acrossLength, st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) as wkt diff --git a/src/main/resources/mapper/show/PublishMapper.xml b/src/main/resources/mapper/show/PublishMapper.xml index 70e49d6..e0a72ac 100644 --- a/src/main/resources/mapper/show/PublishMapper.xml +++ b/src/main/resources/mapper/show/PublishMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.data.PublishMapper"> +<mapper namespace="com.moon.server.mapper.data.PublishMapper"> <select id="selectMetasByCount" resultType="java.lang.Integer"> select count(*) from lf.sys_meta <where> @@ -20,7 +20,7 @@ </where> </select> - <select id="selectMetasByPage" resultType="com.lf.server.entity.data.MetaEntity"> + <select id="selectMetasByPage" resultType="com.moon.server.entity.data.MetaEntity"> select (select c.url from lf.sys_meta_pub b inner join lf.sys_publish c on b.pubid = c.id where b.metaid = a.id limit 1) "url", (select ST_AsText(c.geom) from lf.sys_meta_pub b inner join lf.sys_publish c on b.pubid = c.id where b.metaid = a.id limit 1) "geom", @@ -54,7 +54,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.data.PublishEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.data.PublishEntity"> select ST_AsText(geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_publish a <where> @@ -66,21 +66,21 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.data.PublishEntity"> + <select id="selectAll" resultType="com.moon.server.entity.data.PublishEntity"> select * from lf.sys_publish order by id desc; </select> - <select id="selectById" resultType="com.lf.server.entity.data.PublishEntity"> + <select id="selectById" resultType="com.moon.server.entity.data.PublishEntity"> select ST_AsText(geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_publish a where id = #{id} </select> - <select id="selectByIds" resultType="com.lf.server.entity.data.PublishEntity"> + <select id="selectByIds" resultType="com.moon.server.entity.data.PublishEntity"> select * from lf.sys_publish where id in (${ids}) order by id desc; </select> - <insert id="insert" parameterType="com.lf.server.entity.data.PublishEntity"> + <insert id="insert" parameterType="com.moon.server.entity.data.PublishEntity"> insert into lf.sys_publish (regid,name,url,path,type,status,dirid,depid,min,max,json,create_user,create_time,bak) values diff --git a/src/main/resources/mapper/sys/ArgsMapper.xml b/src/main/resources/mapper/sys/ArgsMapper.xml index 7416549..572d2a9 100644 --- a/src/main/resources/mapper/sys/ArgsMapper.xml +++ b/src/main/resources/mapper/sys/ArgsMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.ArgsMapper"> +<mapper namespace="com.moon.server.mapper.sys.ArgsMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_args <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.ArgsEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.ArgsEntity"> select * from lf.sys_args <where> <if test="name != null"> @@ -21,15 +21,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.ArgsEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.ArgsEntity"> select * from lf.sys_args order by id; </select> - <select id="selectById" resultType="com.lf.server.entity.sys.ArgsEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.ArgsEntity"> select * from lf.sys_args where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.ArgsEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.ArgsEntity"> insert into lf.sys_args (name,cvalue,dvalue,descr,create_user,create_time) values diff --git a/src/main/resources/mapper/sys/AttachMapper.xml b/src/main/resources/mapper/sys/AttachMapper.xml index 2b4cc40..c31a8c3 100644 --- a/src/main/resources/mapper/sys/AttachMapper.xml +++ b/src/main/resources/mapper/sys/AttachMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.AttachMapper"> +<mapper namespace="com.moon.server.mapper.sys.AttachMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_attach <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.AttachEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.AttachEntity"> select * from lf.sys_attach <where> <if test="name != null"> @@ -21,30 +21,30 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.AttachEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.AttachEntity"> select * from lf.sys_attach order by id desc; </select> - <select id="selectById" resultType="com.lf.server.entity.sys.AttachEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.AttachEntity"> select * from lf.sys_attach where id = #{id} </select> - <select id="selectByGuid" resultType="com.lf.server.entity.sys.AttachEntity"> + <select id="selectByGuid" resultType="com.moon.server.entity.sys.AttachEntity"> select * from lf.sys_attach where guid = #{guid} limit 1 </select> - <select id="selectByGuids" resultType="com.lf.server.entity.sys.AttachEntity"> + <select id="selectByGuids" resultType="com.moon.server.entity.sys.AttachEntity"> select * from lf.sys_attach where guid in <foreach item="guid" collection="guids" index="index" open="(" separator="," close=")"> #{guid} </foreach> </select> - <select id="selectByTabAndGuid" resultType="com.lf.server.entity.sys.AttachEntity"> + <select id="selectByTabAndGuid" resultType="com.moon.server.entity.sys.AttachEntity"> select * from lf.sys_attach where tab = #{tab} and tab_guid = #{tabGuid} and guid = #{guid} limit 1 </select> - <select id="selectByTabGuids" resultType="com.lf.server.entity.sys.AttachEntity"> + <select id="selectByTabGuids" resultType="com.moon.server.entity.sys.AttachEntity"> select * from lf.sys_attach <where> tab = #{tab} @@ -57,11 +57,11 @@ </where> </select> - <select id="selectByTab" resultType="com.lf.server.entity.sys.AttachEntity"> + <select id="selectByTab" resultType="com.moon.server.entity.sys.AttachEntity"> select * from lf.sys_attach where tab = #{tab} and tab_guid = #{guid} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.AttachEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.AttachEntity"> insert into lf.sys_attach (name,tab,tab_guid,guid,path,sizes,create_user,create_time) values @@ -104,7 +104,7 @@ </foreach> </update> - <select id="selectFmeLogs" resultType="com.lf.server.entity.data.FmeLogEntity"> + <select id="selectFmeLogs" resultType="com.moon.server.entity.data.FmeLogEntity"> select * from lf.sys_fme_log where count > 0 and update_time is null and create_time > now()::timestamp + '-5 min' and position(tcdm in '${tabs}') > 0; </select> diff --git a/src/main/resources/mapper/sys/AuthMapper.xml b/src/main/resources/mapper/sys/AuthMapper.xml index a323b94..d55329d 100644 --- a/src/main/resources/mapper/sys/AuthMapper.xml +++ b/src/main/resources/mapper/sys/AuthMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.AuthMapper"> +<mapper namespace="com.moon.server.mapper.sys.AuthMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_auth <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.AuthEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.AuthEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_auth a <where> <if test="name != null"> @@ -32,7 +32,7 @@ ) </select> - <select id="selectByPageForMenu" resultType="com.lf.server.entity.sys.AuthEntity"> + <select id="selectByPageForMenu" resultType="com.moon.server.entity.sys.AuthEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_auth a where not exists (select b.id from lf.sys_menu_auth b <where> @@ -46,19 +46,19 @@ limit #{limit} offset #{offset} </select> - <select id="selectAuthAll" resultType="com.lf.server.entity.sys.AuthEntity"> + <select id="selectAuthAll" resultType="com.moon.server.entity.sys.AuthEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_auth a order by id </select> - <select id="selectAuth" resultType="com.lf.server.entity.sys.AuthEntity"> + <select id="selectAuth" resultType="com.moon.server.entity.sys.AuthEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_auth a where id = #{id} </select> - <insert id="insertAuth" parameterType="com.lf.server.entity.sys.AuthEntity"> + <insert id="insertAuth" parameterType="com.moon.server.entity.sys.AuthEntity"> insert into lf.sys_auth (name,tag,create_user,create_time,bak) values diff --git a/src/main/resources/mapper/sys/BlacklistMapper.xml b/src/main/resources/mapper/sys/BlacklistMapper.xml index e249adb..3839133 100644 --- a/src/main/resources/mapper/sys/BlacklistMapper.xml +++ b/src/main/resources/mapper/sys/BlacklistMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.BlacklistMapper"> +<mapper namespace="com.moon.server.mapper.sys.BlacklistMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_blacklist <where> @@ -14,7 +14,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.BlacklistEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.BlacklistEntity"> select a.*,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_blacklist a <where> 1 = 1 @@ -29,11 +29,11 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.BlacklistEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.BlacklistEntity"> select a.*,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_blacklist a order by a.id desc </select> - <select id="selectById" resultType="com.lf.server.entity.sys.BlacklistEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.BlacklistEntity"> select a.*,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_blacklist a where a.id = #{id} </select> @@ -41,7 +41,7 @@ select ip from lf.sys_blacklist where type = #{type} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.BlacklistEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.BlacklistEntity"> insert into lf.sys_blacklist (ip,type,visit,descr,create_user,create_time) values diff --git a/src/main/resources/mapper/sys/DepMapper.xml b/src/main/resources/mapper/sys/DepMapper.xml index a784c83..06c1246 100644 --- a/src/main/resources/mapper/sys/DepMapper.xml +++ b/src/main/resources/mapper/sys/DepMapper.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.DepMapper"> - <resultMap id="resultMap" type="com.lf.server.entity.sys.DepEntity"> +<mapper namespace="com.moon.server.mapper.sys.DepMapper"> + <resultMap id="resultMap" type="com.moon.server.entity.sys.DepEntity"> <id property="id" column="id"></id> <result property="orderNum" column="order_num"></result> <result property="createUser" column="create_user"></result> @@ -9,11 +9,11 @@ <result property="updateUser" column="update_user"></result> <result property="updateTime" column="update_time"></result> </resultMap> - <select id="selectDepAll" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity"> + <select id="selectDepAll" resultMap="resultMap" resultType="com.moon.server.entity.sys.DepEntity"> select * from lf.sys_dep order by order_num; </select> - <select id="selectDepRecursive" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity"> + <select id="selectDepRecursive" resultMap="resultMap" resultType="com.moon.server.entity.sys.DepEntity"> with recursive rs as( select * from lf.sys_dep where name=#{name} union @@ -22,18 +22,18 @@ select * FROM rs order by order_num; </select> - <select id="selectDep" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity"> + <select id="selectDep" resultMap="resultMap" resultType="com.moon.server.entity.sys.DepEntity"> select * from lf.sys_dep where id = #{id} </select> - <select id="selectDepsByCodes" resultType="com.lf.server.entity.ctrl.IdNameEntity"> + <select id="selectDepsByCodes" resultType="com.moon.server.entity.ctrl.IdNameEntity"> select id "id",fn_get_fullname(code, 1) "name" from lf.sys_dep where code in <foreach item="code" collection="codes" index="index" open="(" separator="," close=")"> #{code} </foreach> </select> - <insert id="insertDep" parameterType="com.lf.server.entity.sys.DepEntity"> + <insert id="insertDep" parameterType="com.moon.server.entity.sys.DepEntity"> insert into lf.sys_dep (pid,name,sname,code,uncode,addr,contact,fax,email,post,website,level,order_num,create_user,create_time,bak) values diff --git a/src/main/resources/mapper/sys/DownlogMapper.xml b/src/main/resources/mapper/sys/DownlogMapper.xml index 3eb448d..fdeadec 100644 --- a/src/main/resources/mapper/sys/DownlogMapper.xml +++ b/src/main/resources/mapper/sys/DownlogMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.DownlogMapper"> +<mapper namespace="com.moon.server.mapper.sys.DownlogMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_downlog a inner join lf.sys_user b on a.create_user = b.id inner join lf.sys_download c on a.downid = c.id @@ -21,7 +21,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.DownlogEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.DownlogEntity"> select a.*,b.uname,c.name,c.type,c.sizes from lf.sys_downlog a inner join lf.sys_user b on a.create_user = b.id inner join lf.sys_download c on a.downid = c.id <where> @@ -43,15 +43,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.DownlogEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.DownlogEntity"> select * from lf.sys_downlog order by id desc </select> - <select id="selectById" resultType="com.lf.server.entity.sys.DownlogEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.DownlogEntity"> select * from lf.sys_downlog where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.DownlogEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.DownlogEntity"> insert into lf.sys_downlog (downid,ip,create_user,create_time) values diff --git a/src/main/resources/mapper/sys/LoginMapper.xml b/src/main/resources/mapper/sys/LoginMapper.xml index 4f96ef3..2befac9 100644 --- a/src/main/resources/mapper/sys/LoginMapper.xml +++ b/src/main/resources/mapper/sys/LoginMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.LoginMapper"> +<mapper namespace="com.moon.server.mapper.sys.LoginMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_login a inner join lf.sys_user b on a.userid = b.id <where> @@ -20,7 +20,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.LoginEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.LoginEntity"> select a.*,b.uname from lf.sys_login a inner join lf.sys_user b on a.userid = b.id <where> 1 = 1 @@ -41,15 +41,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectLoginAll" resultType="com.lf.server.entity.sys.LoginEntity"> + <select id="selectLoginAll" resultType="com.moon.server.entity.sys.LoginEntity"> select * from lf.sys_login order by id desc </select> - <select id="selectLogin" resultType="com.lf.server.entity.sys.LoginEntity"> + <select id="selectLogin" resultType="com.moon.server.entity.sys.LoginEntity"> select * from lf.sys_login where id = #{id} </select> - <insert id="insertLogin" parameterType="com.lf.server.entity.sys.LoginEntity"> + <insert id="insertLogin" parameterType="com.moon.server.entity.sys.LoginEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> select currval('lf.sys_login_id_seq'::regclass) as id </selectKey> @@ -84,7 +84,7 @@ update lf.sys_login set appid=#{appid},ip=#{ip},type=#{type},status=#{status},descr=#{descr},userid=#{userid},optime=now() where id=#{id} </update> - <select id="selectLoginCounts" resultType="com.lf.server.entity.sys.LoginEntity"> + <select id="selectLoginCounts" resultType="com.moon.server.entity.sys.LoginEntity"> select to_char(optime,'yyyy-mm-dd') as optime,count(*) from lf.sys_login where optime between (select optime - interval '30 day') and optime group by to_char(optime, 'yyyy-mm-dd') order by to_char(optime, 'yyyy-mm-dd') asc </select> diff --git a/src/main/resources/mapper/sys/MenuAuthMapper.xml b/src/main/resources/mapper/sys/MenuAuthMapper.xml index f08a442..da4b3cc 100644 --- a/src/main/resources/mapper/sys/MenuAuthMapper.xml +++ b/src/main/resources/mapper/sys/MenuAuthMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.MenuAuthMapper"> +<mapper namespace="com.moon.server.mapper.sys.MenuAuthMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_menu_auth <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.MenuAuthEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.MenuAuthEntity"> select a.*,b.name as authName from lf.sys_menu_auth a inner join lf.sys_auth b on a.authid = b.id <where> @@ -34,7 +34,7 @@ </if> </select> - <select id="selectByPageForRole" resultType="com.lf.server.entity.sys.MenuAuthEntity"> + <select id="selectByPageForRole" resultType="com.moon.server.entity.sys.MenuAuthEntity"> select a.*,c.name from lf.sys_menu_auth a inner join lf.sys_auth c on a.authid = c.id where not exists (select b.id from lf.sys_role_menu_auth b where b.menu_auth_id = a.id <if test="roleid != null"> @@ -48,15 +48,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.MenuAuthEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.MenuAuthEntity"> select * from lf.sys_menu_auth order by id; </select> - <select id="selectById" resultType="com.lf.server.entity.sys.MenuAuthEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.MenuAuthEntity"> select * from lf.sys_menu_auth where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.MenuAuthEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.MenuAuthEntity"> insert into lf.sys_menu_auth (menuid,authid,create_user,create_time) values diff --git a/src/main/resources/mapper/sys/MenuMapper.xml b/src/main/resources/mapper/sys/MenuMapper.xml index 24ab186..1daa3ed 100644 --- a/src/main/resources/mapper/sys/MenuMapper.xml +++ b/src/main/resources/mapper/sys/MenuMapper.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.MenuMapper"> - <resultMap id="resultMap" type="com.lf.server.entity.sys.MenuEntity"> +<mapper namespace="com.moon.server.mapper.sys.MenuMapper"> + <resultMap id="resultMap" type="com.moon.server.entity.sys.MenuEntity"> <id property="id" column="id"></id> <result property="cnName" column="cn_name"></result> <result property="enName" column="en_name"></result> @@ -12,11 +12,11 @@ <result property="updateUser" column="update_user"></result> <result property="updateTime" column="update_time"></result> </resultMap> - <select id="selectMenuAll" resultMap="resultMap" resultType="com.lf.server.entity.sys.MenuEntity"> + <select id="selectMenuAll" resultMap="resultMap" resultType="com.moon.server.entity.sys.MenuEntity"> select * from lf.sys_menu order by order_num; </select> - <select id="selectMenuRecursive" resultMap="resultMap" resultType="com.lf.server.entity.sys.MenuEntity"> + <select id="selectMenuRecursive" resultMap="resultMap" resultType="com.moon.server.entity.sys.MenuEntity"> with recursive rs as( select * from lf.sys_menu where cn_name=#{name} union @@ -25,11 +25,11 @@ select * FROM rs order by order_num; </select> - <select id="selectMenu" resultMap="resultMap" resultType="com.lf.server.entity.sys.MenuEntity"> + <select id="selectMenu" resultMap="resultMap" resultType="com.moon.server.entity.sys.MenuEntity"> select * from lf.sys_menu where id = #{id} </select> - <insert id="insertMenu" parameterType="com.lf.server.entity.sys.MenuEntity"> + <insert id="insertMenu" parameterType="com.moon.server.entity.sys.MenuEntity"> insert into lf.sys_menu (pid,cn_name,en_name,url,perms,type,css,icon,level,order_num,is_show, create_user,create_time,bak) values diff --git a/src/main/resources/mapper/sys/MetaDownMapper.xml b/src/main/resources/mapper/sys/MetaDownMapper.xml index c64a5e2..667ed39 100644 --- a/src/main/resources/mapper/sys/MetaDownMapper.xml +++ b/src/main/resources/mapper/sys/MetaDownMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.MetaDownMapper"> +<mapper namespace="com.moon.server.mapper.sys.MetaDownMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_meta_down <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.MetaDownEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.MetaDownEntity"> select * from lf.sys_meta_down <where> <if test="metaid != null"> @@ -21,15 +21,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.MetaDownEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.MetaDownEntity"> select * from lf.sys_meta_down order by id desc; </select> - <select id="selectById" resultType="com.lf.server.entity.sys.MetaDownEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.MetaDownEntity"> select * from lf.sys_meta_down where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.MetaDownEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.MetaDownEntity"> insert into lf.sys_meta_down (metaid,downid,create_user,create_time) values diff --git a/src/main/resources/mapper/sys/OperateMapper.xml b/src/main/resources/mapper/sys/OperateMapper.xml index 8dd6cc6..12543fd 100644 --- a/src/main/resources/mapper/sys/OperateMapper.xml +++ b/src/main/resources/mapper/sys/OperateMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.OperateMapper"> +<mapper namespace="com.moon.server.mapper.sys.OperateMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_operate a inner join lf.sys_user b on a.userid = b.id <where> @@ -20,7 +20,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.OperateEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.OperateEntity"> select a.*,b.uname from lf.sys_operate a inner join lf.sys_user b on a.userid = b.id <where> 1 = 1 @@ -41,15 +41,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectOperateAll" resultType="com.lf.server.entity.sys.OperateEntity"> + <select id="selectOperateAll" resultType="com.moon.server.entity.sys.OperateEntity"> select * from lf.sys_operate order by id desc </select> - <select id="selectOperate" resultType="com.lf.server.entity.sys.OperateEntity"> + <select id="selectOperate" resultType="com.moon.server.entity.sys.OperateEntity"> select * from lf.sys_operate where id = #{id} </select> - <insert id="insertOperate" parameterType="com.lf.server.entity.sys.OperateEntity"> + <insert id="insertOperate" parameterType="com.moon.server.entity.sys.OperateEntity"> insert into lf.sys_operate (modular1,modular2,url,ip,exec,clazz,type,userid,optime,bak) values @@ -78,7 +78,7 @@ update lf.sys_operate set modular1=#{modular1},modular2=#{modular2},url=#{url},ip=#{ip},exec=#{exec},clazz=#{clazz},type=#{type},userid=#{userid},optime=now(),bak=#{bak} where id=#{id} </update> - <select id="operateCount" resultType="com.lf.server.entity.sys.OperateEntity"> + <select id="operateCount" resultType="com.moon.server.entity.sys.OperateEntity"> select modular2,count(*) from lf.sys_operate group by modular2 </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/sys/ReportMapper.xml b/src/main/resources/mapper/sys/ReportMapper.xml index 93e50bc..dc7d636 100644 --- a/src/main/resources/mapper/sys/ReportMapper.xml +++ b/src/main/resources/mapper/sys/ReportMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.ReportMapper"> +<mapper namespace="com.moon.server.mapper.sys.ReportMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_report <where> @@ -13,7 +13,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.ReportEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.ReportEntity"> select a.*,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_report a <where> <if test="name != null"> @@ -27,15 +27,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.ReportEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.ReportEntity"> select * from lf.sys_report order by id desc; </select> - <select id="selectById" resultType="com.lf.server.entity.sys.ReportEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.ReportEntity"> select * from lf.sys_report where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.ReportEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.ReportEntity"> insert into lf.sys_report (name,type,fname,guid,code,create_user,create_time,bak) values @@ -79,7 +79,7 @@ </update> <!-- 鏁版嵁閲忕粺璁� --> - <select id="countSizes" resultType="com.lf.server.entity.ctrl.CountEntity"> + <select id="countSizes" resultType="com.moon.server.entity.ctrl.CountEntity"> select fn_get_fullname(depcode, 1) "m1", cast(sum(sizes) as decimal(18, 3)) "sizes" from lf.sys_meta group by depcode @@ -87,7 +87,7 @@ </select> <!-- 鏈嶅姟璋冪敤閲忕粺璁� --> - <select id="countServices" resultType="com.lf.server.entity.ctrl.CountEntity"> + <select id="countServices" resultType="com.moon.server.entity.ctrl.CountEntity"> select name "m1", count(*) "count" from lf.sys_serve_log group by name @@ -95,7 +95,7 @@ </select> <!-- 鐢ㄦ埛娴侀噺缁熻 --> - <select id="countOperates" resultType="com.lf.server.entity.ctrl.CountEntity"> + <select id="countOperates" resultType="com.moon.server.entity.ctrl.CountEntity"> select modular1 "m1", modular2 "m2", count(*) "count" from lf.sys_operate group by modular1,modular2 diff --git a/src/main/resources/mapper/sys/ResMapper.xml b/src/main/resources/mapper/sys/ResMapper.xml index ee92178..c111b38 100644 --- a/src/main/resources/mapper/sys/ResMapper.xml +++ b/src/main/resources/mapper/sys/ResMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.ResMapper"> +<mapper namespace="com.moon.server.mapper.sys.ResMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_res <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.ResEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.ResEntity"> select a.*,fn_rec_query(a.depid, 'dep') depName,fn_rec_query(a.dirid, 'dir') dirName,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_res a <where> <if test="name != null"> @@ -32,7 +32,7 @@ ) </select> - <select id="selectByPageForRole" resultType="com.lf.server.entity.sys.ResEntity"> + <select id="selectByPageForRole" resultType="com.moon.server.entity.sys.ResEntity"> select a.* from lf.sys_res a where not exists (select b.id from lf.sys_role_res b <where> b.resid = a.id @@ -45,15 +45,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectResAll" resultType="com.lf.server.entity.sys.ResEntity"> + <select id="selectResAll" resultType="com.moon.server.entity.sys.ResEntity"> select * from lf.sys_res order by id desc </select> - <select id="selectRes" resultType="com.lf.server.entity.sys.ResEntity"> + <select id="selectRes" resultType="com.moon.server.entity.sys.ResEntity"> select * from lf.sys_res where id = #{id} </select> - <insert id="insertRes" parameterType="com.lf.server.entity.data.DictEntity"> + <insert id="insertRes" parameterType="com.moon.server.entity.data.DictEntity"> insert into lf.sys_res (name,server,source,depid,dirid,code,descr,img,create_user,create_time,bak) values diff --git a/src/main/resources/mapper/sys/ResOpMapper.xml b/src/main/resources/mapper/sys/ResOpMapper.xml index da98015..797065b 100644 --- a/src/main/resources/mapper/sys/ResOpMapper.xml +++ b/src/main/resources/mapper/sys/ResOpMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.ResOpMapper"> +<mapper namespace="com.moon.server.mapper.sys.ResOpMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_res_op a inner join lf.sys_user b on a.userid = b.id inner join lf.sys_res c on a.resid=c.id <where> @@ -20,7 +20,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.ResOpEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.ResOpEntity"> select a.*,b.uname,c.name from lf.sys_res_op a inner join lf.sys_user b on a.userid = b.id inner join lf.sys_res c on a.resid=c.id <where> 1 = 1 @@ -41,15 +41,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectResOpAll" resultType="com.lf.server.entity.sys.ResOpEntity"> + <select id="selectResOpAll" resultType="com.moon.server.entity.sys.ResOpEntity"> select * from lf.sys_res_op order by id desc; </select> - <select id="selectResOp" resultType="com.lf.server.entity.sys.ResOpEntity"> + <select id="selectResOp" resultType="com.moon.server.entity.sys.ResOpEntity"> select * from lf.sys_res_op where id = #{id} </select> - <insert id="insertResOp" parameterType="com.lf.server.entity.sys.ResOpEntity"> + <insert id="insertResOp" parameterType="com.moon.server.entity.sys.ResOpEntity"> insert into lf.sys_res_op (resid,type,ip,userid,optime) values diff --git a/src/main/resources/mapper/sys/RoleMapper.xml b/src/main/resources/mapper/sys/RoleMapper.xml index 34d6b54..d751c79 100644 --- a/src/main/resources/mapper/sys/RoleMapper.xml +++ b/src/main/resources/mapper/sys/RoleMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.RoleMapper"> +<mapper namespace="com.moon.server.mapper.sys.RoleMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_role a <where> @@ -15,7 +15,7 @@ </select> <!-- 鍒嗛〉鏌ヨ --> - <select id="selectByPage" resultType="com.lf.server.entity.sys.RoleEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.RoleEntity"> select a.*,fn_rec_query(a.depid, 'dep') depName,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_role a <where> 1=1 @@ -30,15 +30,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectRoleAll" resultType="com.lf.server.entity.sys.RoleEntity"> + <select id="selectRoleAll" resultType="com.moon.server.entity.sys.RoleEntity"> select a.*,fn_rec_query(a.depid, 'dep') depName,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_role a order by a.id desc </select> - <select id="selectRole" resultType="com.lf.server.entity.sys.RoleEntity"> + <select id="selectRole" resultType="com.moon.server.entity.sys.RoleEntity"> select a.*,fn_rec_query(a.depid, 'dep') depName,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_role a where a.id = #{id} </select> - <insert id="insertRole" parameterType="com.lf.server.entity.sys.RoleEntity"> + <insert id="insertRole" parameterType="com.moon.server.entity.sys.RoleEntity"> insert into lf.sys_role (depid,name,descr,is_admin,create_user,create_time,bak) values diff --git a/src/main/resources/mapper/sys/RoleMenuAuthMapper.xml b/src/main/resources/mapper/sys/RoleMenuAuthMapper.xml index 78a6637..4e0929c 100644 --- a/src/main/resources/mapper/sys/RoleMenuAuthMapper.xml +++ b/src/main/resources/mapper/sys/RoleMenuAuthMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.RoleMenuAuthMapper"> +<mapper namespace="com.moon.server.mapper.sys.RoleMenuAuthMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_role_menu_auth <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.RoleMenuAuthEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.RoleMenuAuthEntity"> select * from lf.sys_role_menu_auth <where> <if test="roleid != null"> @@ -34,7 +34,7 @@ </where> </select> - <select id="selectByPageForRole" resultType="com.lf.server.entity.sys.RoleMenuAuthEntity"> + <select id="selectByPageForRole" resultType="com.moon.server.entity.sys.RoleMenuAuthEntity"> select a.*,b.menuid,c.name from lf.sys_role_menu_auth a inner join lf.sys_menu_auth b on a.menu_auth_id = b.id inner join lf.sys_auth c on b.authid = c.id <where> 1 = 1 @@ -49,15 +49,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.RoleMenuAuthEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.RoleMenuAuthEntity"> select * from lf.sys_role_menu_auth order by id; </select> - <select id="selectById" resultType="com.lf.server.entity.sys.RoleMenuAuthEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.RoleMenuAuthEntity"> select * from lf.sys_role_menu_auth where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.RoleMenuAuthEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.RoleMenuAuthEntity"> insert into lf.sys_role_menu_auth (roleid,menu_auth_id,create_user,create_time) values diff --git a/src/main/resources/mapper/sys/RoleResMapper.xml b/src/main/resources/mapper/sys/RoleResMapper.xml index b34f830..2084631 100644 --- a/src/main/resources/mapper/sys/RoleResMapper.xml +++ b/src/main/resources/mapper/sys/RoleResMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.RoleResMapper"> +<mapper namespace="com.moon.server.mapper.sys.RoleResMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_role_res <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.RoleResEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.RoleResEntity"> select a.*,b.name as resName from lf.sys_role_res a inner join lf.sys_res b on a.resid = b.id <where> @@ -22,15 +22,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.RoleResEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.RoleResEntity"> select * from lf.sys_role_res order by id; </select> - <select id="selectById" resultType="com.lf.server.entity.sys.RoleResEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.RoleResEntity"> select * from lf.sys_role_res where id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.RoleResEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.RoleResEntity"> insert into lf.sys_role_res (roleid,resid,create_user,create_time) values diff --git a/src/main/resources/mapper/sys/RoleUserMapper.xml b/src/main/resources/mapper/sys/RoleUserMapper.xml index 6beaf45..506a5bf 100644 --- a/src/main/resources/mapper/sys/RoleUserMapper.xml +++ b/src/main/resources/mapper/sys/RoleUserMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.RoleUserMapper"> +<mapper namespace="com.moon.server.mapper.sys.RoleUserMapper"> <select id="selectCount" resultType="java.lang.Integer"> select count(*) from lf.sys_role_user a <where> @@ -10,7 +10,7 @@ </where> </select> - <select id="selectByPage" resultType="com.lf.server.entity.sys.RoleUserEntity"> + <select id="selectByPage" resultType="com.moon.server.entity.sys.RoleUserEntity"> select a.*,fn_uname(a.userid) uname from lf.sys_role_user a <where> <if test="roleid != null"> @@ -21,15 +21,15 @@ limit #{limit} offset #{offset} </select> - <select id="selectAll" resultType="com.lf.server.entity.sys.RoleUserEntity"> + <select id="selectAll" resultType="com.moon.server.entity.sys.RoleUserEntity"> select a.*,fn_uname(a.userid) uname from lf.sys_role_user a order by a.id </select> - <select id="selectById" resultType="com.lf.server.entity.sys.RoleUserEntity"> + <select id="selectById" resultType="com.moon.server.entity.sys.RoleUserEntity"> select a.*,fn_uname(a.userid) uname from lf.sys_role_user a where a.id = #{id} </select> - <insert id="insert" parameterType="com.lf.server.entity.sys.RoleUserEntity"> + <insert id="insert" parameterType="com.moon.server.entity.sys.RoleUserEntity"> insert into lf.sys_role_user (roleid,userid,create_user,create_time) values diff --git a/src/main/resources/mapper/sys/TokenMapper.xml b/src/main/resources/mapper/sys/TokenMapper.xml index 6202595..2a89c58 100644 --- a/src/main/resources/mapper/sys/TokenMapper.xml +++ b/src/main/resources/mapper/sys/TokenMapper.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.TokenMapper"> - <resultMap id="resultMap" type="com.lf.server.entity.sys.TokenEntity"> +<mapper namespace="com.moon.server.mapper.sys.TokenMapper"> + <resultMap id="resultMap" type="com.moon.server.entity.sys.TokenEntity"> <id property="id" column="id"></id> <result property="createUser" column="create_user"></result> <result property="createTime" column="create_time"></result> @@ -24,7 +24,7 @@ </select> <!-- 鍒嗛〉鏌ヨ --> - <select id="selectByPage" resultMap="resultMap" resultType="com.lf.server.entity.sys.TokenEntity"> + <select id="selectByPage" resultMap="resultMap" resultType="com.moon.server.entity.sys.TokenEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_token a <where> @@ -41,19 +41,19 @@ limit #{limit} offset #{offset} </select> - <select id="selectToken" resultMap="resultMap" resultType="com.lf.server.entity.sys.TokenEntity"> + <select id="selectToken" resultMap="resultMap" resultType="com.moon.server.entity.sys.TokenEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_token a where id = #{id} </select> - <select id="selectOneByToken" resultType="com.lf.server.entity.sys.TokenEntity"> + <select id="selectOneByToken" resultType="com.moon.server.entity.sys.TokenEntity"> select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_token a where token = #{token} and expire > now() limit 1 </select> - <insert id="insertToken" parameterType="com.lf.server.entity.sys.TokenEntity"> + <insert id="insertToken" parameterType="com.moon.server.entity.sys.TokenEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> select currval('lf.sys_token_id_seq'::regclass) as id </selectKey> diff --git a/src/main/resources/mapper/sys/UserMapper.xml b/src/main/resources/mapper/sys/UserMapper.xml index eeda846..8df042b 100644 --- a/src/main/resources/mapper/sys/UserMapper.xml +++ b/src/main/resources/mapper/sys/UserMapper.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.lf.server.mapper.sys.UserMapper"> - <resultMap id="resultMap" type="com.lf.server.entity.sys.UserEntity"> +<mapper namespace="com.moon.server.mapper.sys.UserMapper"> + <resultMap id="resultMap" type="com.moon.server.entity.sys.UserEntity"> <id property="id" column="id"></id> <result property="natives" column="native"></result> <result property="createUser" column="create_user"></result> @@ -23,7 +23,7 @@ </where> </select> - <select id="selectByPage" resultMap="resultMap" resultType="com.lf.server.entity.sys.UserEntity"> + <select id="selectByPage" resultMap="resultMap" resultType="com.moon.server.entity.sys.UserEntity"> select a.*,fn_get_fullname(a.depcode, 1) depName from lf.sys_user a <where> 1 = 1 @@ -55,7 +55,7 @@ </where> </select> - <select id="selectByPageForRole" resultMap="resultMap" resultType="com.lf.server.entity.sys.UserEntity"> + <select id="selectByPageForRole" resultMap="resultMap" resultType="com.moon.server.entity.sys.UserEntity"> select a.*,fn_get_fullname(a.depcode, 1) depName from lf.sys_user a <where> not exists (select b.id from lf.sys_role_user b where b.userid = a.id @@ -74,19 +74,19 @@ limit #{limit} offset #{offset} </select> - <select id="selectUserAll" resultMap="resultMap" resultType="com.lf.server.entity.sys.UserEntity"> + <select id="selectUserAll" resultMap="resultMap" resultType="com.moon.server.entity.sys.UserEntity"> select a.*, fn_get_fullname(a.depcode, 1) depName from lf.sys_user a order by a.id desc </select> - <select id="selectUser" resultMap="resultMap" resultType="com.lf.server.entity.sys.UserEntity"> + <select id="selectUser" resultMap="resultMap" resultType="com.moon.server.entity.sys.UserEntity"> select a.*, fn_get_fullname(a.depcode, 1) depName from lf.sys_user a where a.id = #{id} </select> - <select id="selectByUid" resultMap="resultMap" resultType="com.lf.server.entity.sys.UserEntity"> + <select id="selectByUid" resultMap="resultMap" resultType="com.moon.server.entity.sys.UserEntity"> select * from lf.sys_user where uid = #{uid} </select> - <select id="selectByToken" resultType="com.lf.server.entity.sys.UserEntity"> + <select id="selectByToken" resultType="com.moon.server.entity.sys.UserEntity"> select * from lf.sys_user where id = ( select create_user from lf.sys_token where token=#{token} and expire > now() limit 1) </select> @@ -98,27 +98,27 @@ where c.is_admin = 1 and a.id = #{id} </select> - <select id="selectAdminUsers" resultType="com.lf.server.entity.sys.UserEntity"> + <select id="selectAdminUsers" resultType="com.moon.server.entity.sys.UserEntity"> select c.*, fn_get_fullname(b.depcode, 1) depName from lf.sys_role_user a inner join lf.sys_user b on a.userid = b.id inner join lf.sys_role c on a.roleid = a.id where c.is_admin = #{type} </select> - <select id="selectRoleByUserId" resultType="com.lf.server.entity.sys.RoleEntity"> + <select id="selectRoleByUserId" resultType="com.moon.server.entity.sys.RoleEntity"> select c.*, fn_get_fullname(a.depcode, 1) depName,fn_uname(c.create_user) createName,fn_uname(c.update_user) updateName from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid inner join lf.sys_role c on b.roleid = c.id where a.id = #{id} </select> - <select id="selectUserByRoleId" resultType="com.lf.server.entity.sys.RoleEntity"> + <select id="selectUserByRoleId" resultType="com.moon.server.entity.sys.RoleEntity"> select a.*, fn_get_fullname(a.depcode, 1) depName from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid inner join lf.sys_role c on b.roleid = c.id where c.id = #{roleId} </select> - <insert id="insertUser" parameterType="com.lf.server.entity.sys.UserEntity"> + <insert id="insertUser" parameterType="com.moon.server.entity.sys.UserEntity"> insert into lf.sys_user (depid,depcode,uid,uname,salt,sex,native,contact,job,email,addr,edu,idcard,status,create_user,create_time,bak) values -- Gitblit v1.9.3