From c9abb90c97c7542cb9efed26778300f5f64b1867 Mon Sep 17 00:00:00 2001 From: songjinsheng Date: Wed, 22 Jun 2022 08:38:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 24 + pom.xml | 240 ++++++++ readme.md | 8 + .../microservice/MicroserviceApplication.java | 17 + .../common/account/AccountCredentials.java | 36 ++ .../account/CustomAuthenticationProvider.java | 109 ++++ .../common/account/GrantedAuthorityImpl.java | 25 + .../account/JwtAuthenticationFilter.java | 28 + .../common/account/JwtLoginFilter.java | 135 +++++ .../account/TokenAuthenticationService.java | 123 ++++ .../common/config/ConfigConstant.java | 36 ++ .../common/config/CorsConfig.java | 32 ++ .../microservice/common/config/MvcConfig.java | 37 ++ .../config/RedisCacheAutoConfiguration.java | 30 + .../common/config/RedisConfig.java | 188 ++++++ .../microservice/common/config/RedisUtil.java | 533 ++++++++++++++++++ .../common/config/WebSecurityConfig.java | 66 +++ .../encapsulation/EncapsulationObject.java | 59 ++ .../encapsulation/OutputEncapsulation.java | 94 +++ .../encapsulation/PromptMessageEnum.java | 64 +++ .../common/schedule/SaticScheduleTask.java | 59 ++ .../common/tool/CrawlingWeather7Day.java | 246 ++++++++ .../common/tool/CrawlingWeatherNew.java | 259 +++++++++ .../common/tool/FileServerTool.java | 91 +++ .../microservice/common/tool/JackSonTool.java | 174 ++++++ .../microservice/common/tool/PageBean.java | 84 +++ .../common/tool/Precipitation.java | 418 ++++++++++++++ .../microservice/common/tool/TokenUtil.java | 52 ++ .../microservice/common/tool/WeatherGet.java | 97 ++++ .../controller/AppManageController.java | 101 ++++ .../controller/CacheController.java | 38 ++ .../CropClassifyRecordController.java | 109 ++++ .../DicBusinessServiceController.java | 61 ++ .../controller/FarmingInfoController.java | 108 ++++ .../controller/FileDocumentController.java | 82 +++ .../controller/FileServerController.java | 119 ++++ .../controller/HelloController.java | 34 ++ .../HydrologicalStationController.java | 74 +++ .../IndependentCheckController.java | 87 +++ .../controller/IrrigationCheckController.java | 117 ++++ .../IrrigationRecordController.java | 109 ++++ .../IrrigationSarRecordController.java | 123 ++++ .../controller/ShpAdmController.java | 93 +++ .../controller/SysManageController.java | 56 ++ .../controller/SysUserController.java | 195 +++++++ .../controller/TifProductController.java | 110 ++++ .../controller/TypicalFarmerController.java | 128 +++++ .../controller/TypicalPlotController.java | 139 +++++ .../TypicalPlotIrrigationController.java | 131 +++++ .../controller/WcsRecordController.java | 111 ++++ .../controller/WeatherController.java | 92 +++ .../controller/WeatherStationController.java | 53 ++ .../com/xkrs/microservice/dao/AppFileDao.java | 19 + .../dao/CropClassifyRecordDao.java | 49 ++ .../microservice/dao/DicCropClassifyDao.java | 12 + .../dao/DicDroughtClassifyDao.java | 12 + .../microservice/dao/DicLandClassifyDao.java | 12 + .../xkrs/microservice/dao/DicProductDao.java | 12 + .../microservice/dao/DicSoilClassifyDao.java | 12 + .../xkrs/microservice/dao/FarmingInfoDao.java | 51 ++ .../microservice/dao/FileDocumentDao.java | 12 + .../dao/HydrologicalStationDao.java | 31 + .../microservice/dao/IndependentCheckDao.java | 26 + .../microservice/dao/IrrigationCheckDao.java | 52 ++ .../microservice/dao/IrrigationRecordDao.java | 39 ++ .../dao/IrrigationSarRecordDao.java | 52 ++ .../dao/MeteorologicalStationDao.java | 19 + .../com/xkrs/microservice/dao/ShpCityDao.java | 46 ++ .../xkrs/microservice/dao/ShpCountyDao.java | 59 ++ .../microservice/dao/SysAuthorityDao.java | 26 + .../com/xkrs/microservice/dao/SysRoleDao.java | 61 ++ .../com/xkrs/microservice/dao/SysUserDao.java | 105 ++++ .../xkrs/microservice/dao/TifProductDao.java | 71 +++ .../microservice/dao/TypicalFarmerDao.java | 42 ++ .../xkrs/microservice/dao/TypicalPlotDao.java | 49 ++ .../dao/TypicalPlotIrrigationDao.java | 69 +++ .../xkrs/microservice/dao/WcsRecordDao.java | 64 +++ .../com/xkrs/microservice/dao/WeatherDao.java | 21 + .../entity/CropClassifyRecordEntity.java | 169 ++++++ .../model/entity/DicCropClassifyEntity.java | 73 +++ .../entity/DicDroughtClassifyEntity.java | 73 +++ .../model/entity/DicLandClassifyEntity.java | 73 +++ .../model/entity/DicProductEntity.java | 97 ++++ .../model/entity/DicSoilClassifyEntity.java | 97 ++++ .../model/entity/FarmingInfoEntity.java | 145 +++++ .../model/entity/FileAppEntity.java | 134 +++++ .../model/entity/FileDocumentEntity.java | 132 +++++ .../entity/HydrologicalStationEntity.java | 151 +++++ .../model/entity/IndependentCheckEntity.java | 243 ++++++++ .../model/entity/IrrigationCheckEntity.java | 168 ++++++ .../model/entity/IrrigationRecordEntity.java | 157 ++++++ .../entity/IrrigationSarRecordEntity.java | 180 ++++++ .../entity/MeteorologicalStationEntity.java | 174 ++++++ .../model/entity/MonitoringStationEntity.java | 73 +++ .../model/entity/RelRoleAuthorityEntity.java | 60 ++ .../model/entity/RelUserRoleEntity.java | 60 ++ .../model/entity/ShpCityEntity.java | 142 +++++ .../model/entity/ShpCountyEntity.java | 177 ++++++ .../model/entity/ShpProvinceEntity.java | 118 ++++ .../model/entity/StationRecordEntity.java | 169 ++++++ .../model/entity/SysAuthorityEntity.java | 72 +++ .../model/entity/SysRoleEntity.java | 72 +++ .../model/entity/SysUserEntity.java | 288 ++++++++++ .../model/entity/TifProductEntity.java | 192 +++++++ .../model/entity/TypicalFarmerEntity.java | 204 +++++++ .../model/entity/TypicalPlotEntity.java | 400 +++++++++++++ .../entity/TypicalPlotIrrigationEntity.java | 286 ++++++++++ .../model/entity/WcsRecordEntity.java | 180 ++++++ .../model/entity/WeatherEntity.java | 349 ++++++++++++ .../xkrs/microservice/model/qo/AppFileQo.java | 100 ++++ .../model/qo/CropClassifyRecordQo.java | 129 +++++ .../microservice/model/qo/FarmingInfoQo.java | 105 ++++ .../microservice/model/qo/FileDocumentQo.java | 107 ++++ .../model/qo/HydrologicalStationQo.java | 98 ++++ .../model/qo/IndependentCheckQo.java | 172 ++++++ .../model/qo/IrrigationCheckQo.java | 126 +++++ .../model/qo/IrrigationRecordQo.java | 117 ++++ .../model/qo/IrrigationSarRecordQo.java | 138 +++++ .../xkrs/microservice/model/qo/SysUserQo.java | 217 +++++++ .../microservice/model/qo/TifProductQo.java | 151 +++++ .../model/qo/TypicalFarmerQo.java | 164 ++++++ .../model/qo/TypicalPlotIrrigationQo.java | 232 ++++++++ .../microservice/model/qo/TypicalPlotQo.java | 314 +++++++++++ .../microservice/model/qo/WcsRecordQo.java | 140 +++++ .../model/validation/AppFileQoInsert.java | 9 + .../model/validation/AppFileQoUpdate.java | 9 + .../CropClassifyRecordQoInsert.java | 9 + .../CropClassifyRecordQoUpdate.java | 9 + .../model/validation/FarmingInfoQoInsert.java | 9 + .../model/validation/FarmingInfoQoUpdate.java | 9 + .../validation/FileDocumentQoInsert.java | 8 + .../validation/FileDocumentQoUpdate.java | 8 + .../HydrologicalStationQoInsert.java | 9 + .../HydrologicalStationQoUpdate.java | 9 + .../validation/IndependentCheckQoInsert.java | 9 + .../validation/IndependentCheckQoUpdate.java | 9 + .../validation/IrrigationCheckQoInsert.java | 8 + .../validation/IrrigationCheckQoUpdate.java | 9 + .../validation/IrrigationRecordQoInsert.java | 9 + .../validation/IrrigationRecordQoUpdate.java | 9 + .../IrrigationSarRecordQoInsert.java | 9 + .../IrrigationSarRecordQoUpdate.java | 9 + .../model/validation/SysUserQoInsert.java | 8 + .../model/validation/SysUserQoUpdate.java | 8 + .../model/validation/TifProductQoInsert.java | 9 + .../model/validation/TifProductQoUpdate.java | 9 + .../validation/TypicalFarmerQoInsert.java | 9 + .../validation/TypicalFarmerQoUpdate.java | 9 + .../TypicalPlotIrrigationQoInsert.java | 9 + .../TypicalPlotIrrigationQoUpdate.java | 9 + .../model/validation/TypicalPlotQoInsert.java | 9 + .../model/validation/TypicalPlotQoUpdate.java | 9 + .../model/validation/WcsRecordQoInsert.java | 9 + .../model/validation/WcsRecordQoUpdate.java | 9 + .../model/vo/FileServerResultVo.java | 67 +++ .../model/vo/ForecastWeather7DayVo.java | 103 ++++ .../model/vo/MonitoringStationResultVo.java | 70 +++ .../model/vo/MonitoringStationReturnVo.java | 61 ++ .../model/vo/RealTimeWeatherVo.java | 256 +++++++++ .../xkrs/microservice/model/vo/ShpCityVo.java | 109 ++++ .../microservice/model/vo/ShpCountyVo.java | 145 +++++ .../microservice/model/vo/ShpProvinceVo.java | 84 +++ .../xkrs/microservice/model/vo/SysUserVo.java | 252 +++++++++ .../AdministrativeDivisionService.java | 59 ++ .../service/AppManageService.java | 55 ++ .../microservice/service/CacheService.java | 22 + .../service/CropClassifyRecordService.java | 66 +++ .../service/DicBusinessService.java | 41 ++ .../service/FarmingInfoService.java | 76 +++ .../service/FileDocumentService.java | 45 ++ .../service/FileServerService.java | 53 ++ .../service/HydrologicalStationService.java | 41 ++ .../service/IndependentCheckService.java | 54 ++ .../service/IrrigationCheckService.java | 78 +++ .../service/IrrigationRecordService.java | 66 +++ .../service/IrrigationSarRecordService.java | 75 +++ .../service/MeteorologicalService.java | 28 + .../service/SysAuthorityService.java | 19 + .../microservice/service/SysRoleService.java | 19 + .../microservice/service/SysUserService.java | 98 ++++ .../service/TifProductService.java | 93 +++ .../service/TypicalFarmerService.java | 74 +++ .../service/TypicalPlotIrrigationService.java | 89 +++ .../service/TypicalPlotService.java | 82 +++ .../service/WcsRecordService.java | 91 +++ .../microservice/service/WeatherService.java | 29 + .../AdministrativeDivisionServiceImpl.java | 108 ++++ .../service/impl/AppManageServiceImpl.java | 136 +++++ .../service/impl/CacheServiceImpl.java | 36 ++ .../impl/CropClassifyRecordServiceImpl.java | 133 +++++ .../impl/DicBusinessServiceServiceImpl.java | 89 +++ .../service/impl/FarmingInfoServiceImpl.java | 142 +++++ .../service/impl/FileDocumentServiceImpl.java | 97 ++++ .../service/impl/FileServerServiceImpl.java | 115 ++++ .../impl/HydrologicalStationServiceImpl.java | 103 ++++ .../impl/IndependentCheckServiceImpl.java | 108 ++++ .../impl/IrrigationCheckServiceImpl.java | 157 ++++++ .../impl/IrrigationRecordServiceImpl.java | 132 +++++ .../impl/IrrigationSarRecordServiceImpl.java | 146 +++++ .../impl/MeteorologicalServiceImpl.java | 69 +++ .../service/impl/SysAuthorityServiceImpl.java | 29 + .../service/impl/SysRoleServiceImpl.java | 29 + .../service/impl/SysUserServiceImpl.java | 226 ++++++++ .../service/impl/TifProductServiceImpl.java | 162 ++++++ .../impl/TypicalFarmerServiceImpl.java | 184 ++++++ .../TypicalPlotIrrigationServiceImpl.java | 163 ++++++ .../service/impl/TypicalPlotServiceImpl.java | 164 ++++++ .../service/impl/WcsRecordServiceImpl.java | 162 ++++++ .../service/impl/WeatherServiceImpl.java | 103 ++++ .../xkrs/microservice/util/AliMsgUtil.java | 42 ++ .../microservice/util/CopyPropertiesUtil.java | 52 ++ .../xkrs/microservice/util/DateTimeUtil.java | 211 +++++++ .../microservice/util/EncryptDecryptUtil.java | 67 +++ .../com/xkrs/microservice/util/HashUtil.java | 40 ++ .../com/xkrs/microservice/util/IpUtil.java | 43 ++ .../com/xkrs/microservice/util/IterUtil.java | 53 ++ .../microservice/util/MagicAlgorithm.java | 22 + .../xkrs/microservice/util/NumberUtil.java | 89 +++ .../xkrs/microservice/util/OpenGeoUtil.java | 31 + .../xkrs/microservice/util/RandomUtil.java | 61 ++ .../xkrs/microservice/util/RequestUtil.java | 269 +++++++++ .../xkrs/microservice/util/SnowFlakeUtil.java | 124 ++++ .../com/xkrs/microservice/util/TiffUtil.java | 120 ++++ .../microservice/util/VersionNumberUtil.java | 34 ++ src/main/resources/application.properties | 83 +++ src/main/resources/banner.txt | 6 + src/main/resources/i18n/messages.properties | 233 ++++++++ .../resources/i18n/messages_en_US.properties | 233 ++++++++ .../resources/i18n/messages_zh_CN.properties | 233 ++++++++ src/main/resources/log4j2.xml | 97 ++++ .../MicroserviceApplicationTest.java | 31 + .../com/xkrs/util/MyFirstTestCaseTest.java | 53 ++ 232 files changed, 21660 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 readme.md create mode 100644 src/main/java/com/xkrs/microservice/MicroserviceApplication.java create mode 100644 src/main/java/com/xkrs/microservice/common/account/AccountCredentials.java create mode 100644 src/main/java/com/xkrs/microservice/common/account/CustomAuthenticationProvider.java create mode 100644 src/main/java/com/xkrs/microservice/common/account/GrantedAuthorityImpl.java create mode 100644 src/main/java/com/xkrs/microservice/common/account/JwtAuthenticationFilter.java create mode 100644 src/main/java/com/xkrs/microservice/common/account/JwtLoginFilter.java create mode 100644 src/main/java/com/xkrs/microservice/common/account/TokenAuthenticationService.java create mode 100644 src/main/java/com/xkrs/microservice/common/config/ConfigConstant.java create mode 100644 src/main/java/com/xkrs/microservice/common/config/CorsConfig.java create mode 100644 src/main/java/com/xkrs/microservice/common/config/MvcConfig.java create mode 100644 src/main/java/com/xkrs/microservice/common/config/RedisCacheAutoConfiguration.java create mode 100644 src/main/java/com/xkrs/microservice/common/config/RedisConfig.java create mode 100644 src/main/java/com/xkrs/microservice/common/config/RedisUtil.java create mode 100644 src/main/java/com/xkrs/microservice/common/config/WebSecurityConfig.java create mode 100644 src/main/java/com/xkrs/microservice/common/encapsulation/EncapsulationObject.java create mode 100644 src/main/java/com/xkrs/microservice/common/encapsulation/OutputEncapsulation.java create mode 100644 src/main/java/com/xkrs/microservice/common/encapsulation/PromptMessageEnum.java create mode 100644 src/main/java/com/xkrs/microservice/common/schedule/SaticScheduleTask.java create mode 100644 src/main/java/com/xkrs/microservice/common/tool/CrawlingWeather7Day.java create mode 100644 src/main/java/com/xkrs/microservice/common/tool/CrawlingWeatherNew.java create mode 100644 src/main/java/com/xkrs/microservice/common/tool/FileServerTool.java create mode 100644 src/main/java/com/xkrs/microservice/common/tool/JackSonTool.java create mode 100644 src/main/java/com/xkrs/microservice/common/tool/PageBean.java create mode 100644 src/main/java/com/xkrs/microservice/common/tool/Precipitation.java create mode 100644 src/main/java/com/xkrs/microservice/common/tool/TokenUtil.java create mode 100644 src/main/java/com/xkrs/microservice/common/tool/WeatherGet.java create mode 100644 src/main/java/com/xkrs/microservice/controller/AppManageController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/CacheController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/CropClassifyRecordController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/DicBusinessServiceController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/FarmingInfoController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/FileDocumentController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/FileServerController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/HelloController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/HydrologicalStationController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/IndependentCheckController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/IrrigationCheckController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/IrrigationRecordController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/IrrigationSarRecordController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/ShpAdmController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/SysManageController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/SysUserController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/TifProductController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/TypicalFarmerController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/TypicalPlotController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/TypicalPlotIrrigationController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/WcsRecordController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/WeatherController.java create mode 100644 src/main/java/com/xkrs/microservice/controller/WeatherStationController.java create mode 100644 src/main/java/com/xkrs/microservice/dao/AppFileDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/CropClassifyRecordDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/DicCropClassifyDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/DicDroughtClassifyDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/DicLandClassifyDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/DicProductDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/DicSoilClassifyDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/FarmingInfoDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/FileDocumentDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/HydrologicalStationDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/IndependentCheckDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/IrrigationCheckDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/IrrigationRecordDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/IrrigationSarRecordDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/MeteorologicalStationDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/ShpCityDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/ShpCountyDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/SysAuthorityDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/SysRoleDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/SysUserDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/TifProductDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/TypicalFarmerDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/TypicalPlotDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/TypicalPlotIrrigationDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/WcsRecordDao.java create mode 100644 src/main/java/com/xkrs/microservice/dao/WeatherDao.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/CropClassifyRecordEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/DicCropClassifyEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/DicDroughtClassifyEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/DicLandClassifyEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/DicProductEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/DicSoilClassifyEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/FarmingInfoEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/FileAppEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/FileDocumentEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/HydrologicalStationEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/IndependentCheckEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/IrrigationCheckEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/IrrigationRecordEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/IrrigationSarRecordEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/MeteorologicalStationEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/MonitoringStationEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/RelRoleAuthorityEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/RelUserRoleEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/ShpCityEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/ShpCountyEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/ShpProvinceEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/StationRecordEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/SysAuthorityEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/SysRoleEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/SysUserEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/TifProductEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/TypicalFarmerEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/TypicalPlotEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/TypicalPlotIrrigationEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/WcsRecordEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/entity/WeatherEntity.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/AppFileQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/CropClassifyRecordQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/FarmingInfoQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/FileDocumentQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/HydrologicalStationQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/IndependentCheckQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/IrrigationCheckQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/IrrigationRecordQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/IrrigationSarRecordQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/SysUserQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/TifProductQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/TypicalFarmerQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/TypicalPlotIrrigationQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/TypicalPlotQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/qo/WcsRecordQo.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/AppFileQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/AppFileQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/CropClassifyRecordQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/CropClassifyRecordQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/FarmingInfoQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/FarmingInfoQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/FileDocumentQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/FileDocumentQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/HydrologicalStationQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/HydrologicalStationQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/IndependentCheckQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/IndependentCheckQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/IrrigationCheckQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/IrrigationCheckQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/IrrigationRecordQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/IrrigationRecordQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/IrrigationSarRecordQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/IrrigationSarRecordQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/SysUserQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/SysUserQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/TifProductQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/TifProductQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/TypicalFarmerQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/TypicalFarmerQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/TypicalPlotIrrigationQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/TypicalPlotIrrigationQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/TypicalPlotQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/TypicalPlotQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/WcsRecordQoInsert.java create mode 100644 src/main/java/com/xkrs/microservice/model/validation/WcsRecordQoUpdate.java create mode 100644 src/main/java/com/xkrs/microservice/model/vo/FileServerResultVo.java create mode 100644 src/main/java/com/xkrs/microservice/model/vo/ForecastWeather7DayVo.java create mode 100644 src/main/java/com/xkrs/microservice/model/vo/MonitoringStationResultVo.java create mode 100644 src/main/java/com/xkrs/microservice/model/vo/MonitoringStationReturnVo.java create mode 100644 src/main/java/com/xkrs/microservice/model/vo/RealTimeWeatherVo.java create mode 100644 src/main/java/com/xkrs/microservice/model/vo/ShpCityVo.java create mode 100644 src/main/java/com/xkrs/microservice/model/vo/ShpCountyVo.java create mode 100644 src/main/java/com/xkrs/microservice/model/vo/ShpProvinceVo.java create mode 100644 src/main/java/com/xkrs/microservice/model/vo/SysUserVo.java create mode 100644 src/main/java/com/xkrs/microservice/service/AdministrativeDivisionService.java create mode 100644 src/main/java/com/xkrs/microservice/service/AppManageService.java create mode 100644 src/main/java/com/xkrs/microservice/service/CacheService.java create mode 100644 src/main/java/com/xkrs/microservice/service/CropClassifyRecordService.java create mode 100644 src/main/java/com/xkrs/microservice/service/DicBusinessService.java create mode 100644 src/main/java/com/xkrs/microservice/service/FarmingInfoService.java create mode 100644 src/main/java/com/xkrs/microservice/service/FileDocumentService.java create mode 100644 src/main/java/com/xkrs/microservice/service/FileServerService.java create mode 100644 src/main/java/com/xkrs/microservice/service/HydrologicalStationService.java create mode 100644 src/main/java/com/xkrs/microservice/service/IndependentCheckService.java create mode 100644 src/main/java/com/xkrs/microservice/service/IrrigationCheckService.java create mode 100644 src/main/java/com/xkrs/microservice/service/IrrigationRecordService.java create mode 100644 src/main/java/com/xkrs/microservice/service/IrrigationSarRecordService.java create mode 100644 src/main/java/com/xkrs/microservice/service/MeteorologicalService.java create mode 100644 src/main/java/com/xkrs/microservice/service/SysAuthorityService.java create mode 100644 src/main/java/com/xkrs/microservice/service/SysRoleService.java create mode 100644 src/main/java/com/xkrs/microservice/service/SysUserService.java create mode 100644 src/main/java/com/xkrs/microservice/service/TifProductService.java create mode 100644 src/main/java/com/xkrs/microservice/service/TypicalFarmerService.java create mode 100644 src/main/java/com/xkrs/microservice/service/TypicalPlotIrrigationService.java create mode 100644 src/main/java/com/xkrs/microservice/service/TypicalPlotService.java create mode 100644 src/main/java/com/xkrs/microservice/service/WcsRecordService.java create mode 100644 src/main/java/com/xkrs/microservice/service/WeatherService.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/AdministrativeDivisionServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/AppManageServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/CacheServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/CropClassifyRecordServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/DicBusinessServiceServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/FarmingInfoServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/FileDocumentServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/FileServerServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/HydrologicalStationServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/IndependentCheckServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/IrrigationCheckServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/IrrigationRecordServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/IrrigationSarRecordServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/MeteorologicalServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/SysAuthorityServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/SysRoleServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/SysUserServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/TifProductServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/TypicalFarmerServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/TypicalPlotIrrigationServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/TypicalPlotServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/WcsRecordServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/service/impl/WeatherServiceImpl.java create mode 100644 src/main/java/com/xkrs/microservice/util/AliMsgUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/CopyPropertiesUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/DateTimeUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/EncryptDecryptUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/HashUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/IpUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/IterUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/MagicAlgorithm.java create mode 100644 src/main/java/com/xkrs/microservice/util/NumberUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/OpenGeoUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/RandomUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/RequestUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/SnowFlakeUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/TiffUtil.java create mode 100644 src/main/java/com/xkrs/microservice/util/VersionNumberUtil.java create mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/banner.txt create mode 100644 src/main/resources/i18n/messages.properties create mode 100644 src/main/resources/i18n/messages_en_US.properties create mode 100644 src/main/resources/i18n/messages_zh_CN.properties create mode 100644 src/main/resources/log4j2.xml create mode 100644 src/test/java/com/xkrs/microservice/MicroserviceApplicationTest.java create mode 100644 src/test/java/com/xkrs/util/MyFirstTestCaseTest.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2af7cef --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..079e18e --- /dev/null +++ b/pom.xml @@ -0,0 +1,240 @@ + + + 4.0.0 + + com.xkrs.microservice + shandong_hydrology_new + 1.0.0 + jar + + shandong_hydrology_new + 山东省水文局项目_新 + + + org.springframework.boot + spring-boot-starter-parent + 2.5.8 + + + + + 6.6 + 0.11.2 + 2.17.1 + 4.5.13 + 7.0.2.Final + 5.6.3.Final + 3.4.4 + 1.14.3 + 2.0.8 + UTF-8 + UTF-8 + 11 + 11 + 11 + + + + + org.springframework.boot + spring-boot-starter-log4j2 + + + org.apache.logging.log4j + log4j-web + ${log4j-web.version} + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-logging + + + + + + + + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-webflux + + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-test + + + + org.springframework.boot + spring-boot-starter-logging + + + test + + + org.springframework.boot + spring-boot-devtools + true + + + org.apache.commons + commons-pool2 + + + org.postgresql + postgresql + + + mysql + mysql-connector-java + + + io.jsonwebtoken + jjwt-api + ${jjwt.version} + + + io.jsonwebtoken + jjwt-impl + ${jjwt.version} + runtime + + + io.jsonwebtoken + jjwt-jackson + ${jjwt.version} + runtime + + + nl.basjes.parse.useragent + yauaa + ${yauaa.version} + + + org.apache.httpcomponents + httpmime + ${httpmime.version} + + + org.hibernate.validator + hibernate-validator + ${hibernate-validator.version} + + + org.hibernate + hibernate-spatial + ${hibernate-spatial.version} + + + com.lmax + disruptor + ${disruptor.version} + + + org.jsoup + jsoup + ${jsoup.version} + + + com.aliyun + dysmsapi20170525 + ${dysmsapi20170525.version} + + + + + + + src/main/java + + **/*.properties + **/*.xml + + false + + + src/main/resources + + **/*.properties + **/*.xml + **/*.txt + + false + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + + + + + + diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..13720b5 --- /dev/null +++ b/readme.md @@ -0,0 +1,8 @@ +# 简介 +山东省水文局项目后端 + +## 提交说明 +🐞 bug修复 +⚡ 安全问题 +🌟 功能增强 +🎈 性能优化 \ No newline at end of file diff --git a/src/main/java/com/xkrs/microservice/MicroserviceApplication.java b/src/main/java/com/xkrs/microservice/MicroserviceApplication.java new file mode 100644 index 0000000..2ab51aa --- /dev/null +++ b/src/main/java/com/xkrs/microservice/MicroserviceApplication.java @@ -0,0 +1,17 @@ +package com.xkrs.microservice; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * 微服务入口 + * @author tajochen + */ +@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class}) +public class MicroserviceApplication { + + public static void main(String[] args) { + SpringApplication.run(MicroserviceApplication.class, args); + } + +} diff --git a/src/main/java/com/xkrs/microservice/common/account/AccountCredentials.java b/src/main/java/com/xkrs/microservice/common/account/AccountCredentials.java new file mode 100644 index 0000000..bec0a7d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/account/AccountCredentials.java @@ -0,0 +1,36 @@ +package com.xkrs.microservice.common.account; + +/** + * 账户实体 + * @author tajochen + */ +public class AccountCredentials { + + private String userName; + private String password; + private boolean remember; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public boolean isRemember() { + return remember; + } + + public void setRemember(boolean remember) { + this.remember = remember; + } +} diff --git a/src/main/java/com/xkrs/microservice/common/account/CustomAuthenticationProvider.java b/src/main/java/com/xkrs/microservice/common/account/CustomAuthenticationProvider.java new file mode 100644 index 0000000..46d64b9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/account/CustomAuthenticationProvider.java @@ -0,0 +1,109 @@ +package com.xkrs.microservice.common.account; + +import com.xkrs.microservice.model.entity.SysAuthorityEntity; +import com.xkrs.microservice.model.entity.SysUserEntity; +import com.xkrs.microservice.service.SysAuthorityService; +import com.xkrs.microservice.service.SysRoleService; +import com.xkrs.microservice.service.SysUserService; +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.DisabledException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +import static com.xkrs.microservice.util.EncryptDecryptUtil.encrypt256; + +/** + * 自定义认证Provider + * @author tajochen + */ +@Component +public class CustomAuthenticationProvider implements AuthenticationProvider { + + @Resource + private SysUserService sysUserService; + + @Resource + private SysRoleService sysRoleService; + + @Resource + private SysAuthorityService sysAuthorityService; + + /** + * 初使化时将已静态化的Service实例化 + */ + protected static CustomAuthenticationProvider customAuthenticationProvider; + + /** + * 通过@PostConstruct实现初始化bean之前进行的操作 + */ + @PostConstruct + public void init() { + customAuthenticationProvider = this; + customAuthenticationProvider.sysUserService = this.sysUserService; + customAuthenticationProvider.sysRoleService = this.sysRoleService; + customAuthenticationProvider.sysAuthorityService = this.sysAuthorityService; + } + + /** + * 用户认证授权 + * @param authentication 认证类 + */ + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + // 获取认证的用户名 & 密码 + String userName = authentication.getName(); + String password = authentication.getCredentials().toString(); + + SysUserEntity userEntity = customAuthenticationProvider.sysUserService.getSysUserByUserName(userName); + + // 检查用户是否存在 + if(userEntity == null){ + throw new BadCredentialsException("user don't exist"); + } + + // 检查用户是否激活 + if(userEntity.getActiveFlag() != 0){ + throw new DisabledException("user not activated"); + } + + //检查用户状态是否正常 + if(userEntity.getStatusCode() != 0){ + throw new DisabledException("user state exception"); + } + + // 认证逻辑 + String encryptPassword = encrypt256(password + userEntity.getSalt()); + if (encryptPassword.equals(userEntity.getPassword())) { + // 设置权限列表 + ArrayList permissions = new ArrayList<>(); + List permissionList = customAuthenticationProvider.sysAuthorityService. + getSysAuthorityListByUserName(userName); + for(SysAuthorityEntity sysAuthorityEntity : permissionList) { + permissions.add(new GrantedAuthorityImpl(sysAuthorityEntity.getAuthorityName())); + } + // 生成令牌 + return new UsernamePasswordAuthenticationToken(userName, encryptPassword, permissions); + } + else { + throw new BadCredentialsException("user password error"); + } + } + + /** + * 是否可以提供输入类型的认证服务 + * @param authentication 认证类 + */ + @Override + public boolean supports(Class authentication) { + return authentication.equals(UsernamePasswordAuthenticationToken.class); + } +} diff --git a/src/main/java/com/xkrs/microservice/common/account/GrantedAuthorityImpl.java b/src/main/java/com/xkrs/microservice/common/account/GrantedAuthorityImpl.java new file mode 100644 index 0000000..057e0b5 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/account/GrantedAuthorityImpl.java @@ -0,0 +1,25 @@ +package com.xkrs.microservice.common.account; + +import org.springframework.security.core.GrantedAuthority; + +/** + * 权限认证服务 + * @author tajochen + */ +public class GrantedAuthorityImpl implements GrantedAuthority { + + private String authority; + + public GrantedAuthorityImpl(String authority) { + this.authority = authority; + } + + public void setAuthority(String authority) { + this.authority = authority; + } + + @Override + public String getAuthority() { + return this.authority; + } +} diff --git a/src/main/java/com/xkrs/microservice/common/account/JwtAuthenticationFilter.java b/src/main/java/com/xkrs/microservice/common/account/JwtAuthenticationFilter.java new file mode 100644 index 0000000..0b9fffd --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/account/JwtAuthenticationFilter.java @@ -0,0 +1,28 @@ +package com.xkrs.microservice.common.account; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.web.filter.GenericFilterBean; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +/** + * 拦截所有需要JWT的请求,然后调用TokenAuthenticationService类的静态方法去做JWT验证 + * @author tajochen + */ +public class JwtAuthenticationFilter extends GenericFilterBean { + + @Override + public void doFilter(ServletRequest request, + ServletResponse response, + FilterChain filterChain) throws IOException, ServletException { + Authentication authentication = TokenAuthenticationService.getAuthentication((HttpServletRequest)request); + SecurityContextHolder.getContext().setAuthentication(authentication); + filterChain.doFilter(request,response); + } +} diff --git a/src/main/java/com/xkrs/microservice/common/account/JwtLoginFilter.java b/src/main/java/com/xkrs/microservice/common/account/JwtLoginFilter.java new file mode 100644 index 0000000..e2e0deb --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/account/JwtLoginFilter.java @@ -0,0 +1,135 @@ +package com.xkrs.microservice.common.account; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.service.SysUserService; +import com.xkrs.microservice.util.IpUtil; +import com.xkrs.microservice.common.encapsulation.OutputEncapsulation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +import javax.annotation.Resource; +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.util.Locale; + +/** + * jwt登录过滤器 + * @author tajochen + */ +public class JwtLoginFilter extends AbstractAuthenticationProcessingFilter { + + private static final Logger logger = LoggerFactory.getLogger(JwtLoginFilter.class); + + + @Resource + private SysUserService sysUserService; + + public JwtLoginFilter(String url, AuthenticationManager authManager) { + super(new AntPathRequestMatcher(url)); + setAuthenticationManager(authManager); + } + + /** + * 登录时验证 + * @param req 请求 + * @param res 响应 + */ + @Override + public Authentication attemptAuthentication(HttpServletRequest req, HttpServletResponse res) { + try { + req.setCharacterEncoding("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + logger.error(String.valueOf(e)); + } + res.setHeader("Access-Control-Allow-Origin","*"); + res.setHeader("Access-Control-Allow-Credentials", "false"); + AccountCredentials cred = new AccountCredentials(); + //获取表单数据 + String userName = req.getParameter("userName"); + String password = req.getParameter("password"); + String rememberMe = req.getParameter("remember"); + //如果用户名密码为空 + if(userName == null||password == null|| userName.trim().isEmpty()||password.trim().isEmpty()){ + throw new BadCredentialsException("user or password is null"); + } + if(rememberMe == null||rememberMe.isEmpty()){ + rememberMe = "false"; + } + cred.setUserName(userName.trim()); + cred.setPassword(password.trim()); + cred.setRemember(Boolean.parseBoolean(rememberMe)); + // 返回一个验证令牌 + return getAuthenticationManager().authenticate( + new UsernamePasswordAuthenticationToken( + cred.getUserName(), + cred.getPassword() + ) + ); + } + + /** + * 验证成功后调用 + * @param req 请求 + * @param response 响应 + * @param chain 过滤器声明 + * @param auth 认证 + */ + @Override + protected void successfulAuthentication( + HttpServletRequest req, HttpServletResponse response, FilterChain chain, Authentication auth) { + if(sysUserService==null){ + ServletContext servletContext = req.getServletContext(); + WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext); + assert webApplicationContext != null; + sysUserService = webApplicationContext.getBean(SysUserService.class); + } + //更新用户登录信息 + sysUserService.updateSysUserLogin(auth.getName(), IpUtil.getIpAddr(req)); + response.setHeader("Access-Control-Allow-Origin", "*"); + response.setHeader("Access-Control-Allow-Credentials", "false"); + response.setContentType("application/json"); + response.setCharacterEncoding("UTF-8"); + TokenAuthenticationService.addAuthentication(response, auth.getName(),auth.getAuthorities()); + } + + /** + * 验证失败后调用 + * @param request 请求 + * @param response 响应 + * @param failed 失败 + */ + @Override + protected void unsuccessfulAuthentication(HttpServletRequest request, + HttpServletResponse response, + AuthenticationException failed) { + Locale locale = LocaleContextHolder.getLocale(); + response.setHeader("Access-Control-Allow-Origin", "*"); + response.setHeader("Access-Control-Allow-Credentials", "false"); + response.setContentType("application/json"); + response.setCharacterEncoding("UTF-8"); + // 将 JWT 写入 body + PrintWriter out = null; + try { + out = response.getWriter(); + } catch (IOException e) { + e.printStackTrace(); + logger.warn(String.valueOf(e)); + } + assert out != null; + out.append(OutputEncapsulation.outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, failed.getLocalizedMessage(), locale)); + response.setStatus(HttpServletResponse.SC_OK); + } +} diff --git a/src/main/java/com/xkrs/microservice/common/account/TokenAuthenticationService.java b/src/main/java/com/xkrs/microservice/common/account/TokenAuthenticationService.java new file mode 100644 index 0000000..18cf69f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/account/TokenAuthenticationService.java @@ -0,0 +1,123 @@ +package com.xkrs.microservice.common.account; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.common.encapsulation.OutputEncapsulation; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.security.Keys; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.AuthorityUtils; + +import javax.crypto.SecretKey; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.*; + +/** + * token认证服务 + * @author tajochen + */ +public class TokenAuthenticationService { + + private static final Logger logger = LoggerFactory.getLogger(TokenAuthenticationService.class); + /** + * 过期时间6小时 + */ + static public final long EXPIRATIONTIME = 21_600_000; + /** + * 加密密钥 + */ + static public final String SECRET_KEY = "0Y9H364Q9Y908262F25LMXGIKIN5N858XM3674GWL2DD8X1DS4W6I722IRY8PS4XPNB6U303" + + "45HBVCUL94STG8C3Z53T7A09JJ100I56YE9894CI11PX9J71HIZ8L5Y2O504C4E2K8276425UA8734833F45K36878FXAG799QV9LXU" + + "JOI3XA2046UPG8TB2OT84R5T6ZB127N9ZPJ7AJMC41JVHB2WK2B6H8NL45LZNAZ666KHZH3QUT65UX6F8"; + /** + * Token前缀 + */ + static public final String TOKEN_PREFIX = "Bearer"; + + /** + * 存放Token的Header Key + */ + static final String HEADER_STRING = "Authorization"; + static SecretKey key = Keys.hmacShaKeyFor(SECRET_KEY.getBytes()); + + /** + * JWT生成方法 + * @param response 响应 + * @param userName 用户名 + * @param authorities 认证 + */ + static void addAuthentication(HttpServletResponse response, String userName, + Collection authorities) { + + Locale locale = new Locale("zh", "CN"); + StringBuffer auths = new StringBuffer(); + String authsList = ""; + for(GrantedAuthority r : authorities) { + auths.append(",").append(r.getAuthority()); + } + authsList = auths.toString(); + if(authsList.length()>1){ + authsList=authsList.substring(1,authsList.length()); + }else{ + logger.warn(userName +" has no permission!"); + } + // 生成JWT + String jwt = Jwts.builder() + .setSubject(userName) + .setIssuer("https://www.microservice.com") + .setAudience(userName) + // 保存权限 + .claim("auths", authsList) + // 有效期设置 + .setExpiration(new Date(System.currentTimeMillis() + EXPIRATIONTIME)) + // 签名设置 + .signWith(key) + .compact(); + // 将 JWT 写入 body + PrintWriter out = null; + response.setStatus(HttpServletResponse.SC_OK); + try { + out = response.getWriter(); + out.append(OutputEncapsulation.outputEncapsulationObject(PromptMessageEnum.SUCCESS, jwt, locale)); + } + catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * JWT验证方法 + * @param request 请求体 + */ + static Authentication getAuthentication(HttpServletRequest request) { + // 从Header中拿到token + String token = request.getHeader(HEADER_STRING); + if (token != null) { + try { + // 解析 Token + Claims claims = Jwts.parserBuilder() + .setSigningKey(key).build() + // 去掉 Bearer + .parseClaimsJws(token.replace(TOKEN_PREFIX, "")) + .getBody(); + // 获取用户名 + String userName = claims.getSubject(); + // 获取权限 + List authorities = AuthorityUtils.commaSeparatedStringToAuthorityList((String) claims.get("auths")); + return new UsernamePasswordAuthenticationToken(userName, null, authorities); + } catch(Exception e) { + // the sub field was missing or did not have a value + return null; + } + } else { + return null; + } + } +} diff --git a/src/main/java/com/xkrs/microservice/common/config/ConfigConstant.java b/src/main/java/com/xkrs/microservice/common/config/ConfigConstant.java new file mode 100644 index 0000000..48fd05c --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/config/ConfigConstant.java @@ -0,0 +1,36 @@ +package com.xkrs.microservice.common.config; + +import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.util.Objects; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; + +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +/** + * spring 静态工具类里读取配置文件 + * @author tajochen + */ +@Component +public class ConfigConstant { + + @Resource + private Environment env; + + @PostConstruct + public void readConfig() throws Exception { + String prefix = "my."; + Field[] fields = ConfigConstant.class.getFields(); + for(Field field : fields ){ + field.set(null, getProperty(prefix + field.getName())); + } + } + + private String getProperty(String key) { + return new String(Objects.requireNonNull(env.getProperty(key)).getBytes(StandardCharsets.ISO_8859_1), + StandardCharsets.UTF_8); + } +} diff --git a/src/main/java/com/xkrs/microservice/common/config/CorsConfig.java b/src/main/java/com/xkrs/microservice/common/config/CorsConfig.java new file mode 100644 index 0000000..f5f908b --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/config/CorsConfig.java @@ -0,0 +1,32 @@ +package com.xkrs.microservice.common.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +/** + * 跨域配置 + * @author tajochen + */ +public class CorsConfig { + + private CorsConfiguration buildConfig() { + CorsConfiguration corsConfiguration = new CorsConfiguration(); + // 允许任何域名 + corsConfiguration.addAllowedOrigin("*"); + // 允许任何头 + corsConfiguration.addAllowedHeader("*"); + // 允许任何方法 + corsConfiguration.addAllowedMethod("*"); + return corsConfiguration; + } + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + // 注册 + source.registerCorsConfiguration("/**", buildConfig()); + return new CorsFilter(source); + } +} diff --git a/src/main/java/com/xkrs/microservice/common/config/MvcConfig.java b/src/main/java/com/xkrs/microservice/common/config/MvcConfig.java new file mode 100644 index 0000000..e3b4618 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/config/MvcConfig.java @@ -0,0 +1,37 @@ +package com.xkrs.microservice.common.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.TaskScheduler; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * WebMVC配置 + * @author Tajochen + */ +@Configuration +public class MvcConfig implements WebMvcConfigurer { + + /** + * 放行跨域请求 + */ + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("*"); + } + + /** + * 定时任务线程池更改,防止多个任务并行 + */ + @Bean + public TaskScheduler taskScheduler() { + final ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); + scheduler.setPoolSize(5); + return scheduler; + } +} diff --git a/src/main/java/com/xkrs/microservice/common/config/RedisCacheAutoConfiguration.java b/src/main/java/com/xkrs/microservice/common/config/RedisCacheAutoConfiguration.java new file mode 100644 index 0000000..e1980d8 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/config/RedisCacheAutoConfiguration.java @@ -0,0 +1,30 @@ +package com.xkrs.microservice.common.config; + +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import java.io.Serializable; + +/** + * Redis 缓存自动配置 + * @author tajochen + */ +@Configuration +@AutoConfigureAfter(RedisAutoConfiguration.class) +public class RedisCacheAutoConfiguration { + + @Bean + public RedisTemplate redisCacheTemplate(LettuceConnectionFactory redisConnectionFactory) { + RedisTemplate template = new RedisTemplate<>(); + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(new GenericJackson2JsonRedisSerializer()); + template.setConnectionFactory(redisConnectionFactory); + return template; + } +} diff --git a/src/main/java/com/xkrs/microservice/common/config/RedisConfig.java b/src/main/java/com/xkrs/microservice/common/config/RedisConfig.java new file mode 100644 index 0000000..6b2cf12 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/config/RedisConfig.java @@ -0,0 +1,188 @@ +package com.xkrs.microservice.common.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.interceptor.CacheErrorHandler; +import org.springframework.cache.interceptor.CacheResolver; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.*; + +import javax.annotation.Resource; +import java.io.IOException; +import java.time.Duration; + +/** + * redis配置 + * @author tajochen + */ +@Configuration +@EnableCaching +public class RedisConfig extends CachingConfigurerSupport{ + + private static final Logger logger = LoggerFactory.getLogger(RedisConfig.class); + + @Resource + private LettuceConnectionFactory lettuceConnectionFactory; + + private static final Duration TIME_TO_LIVE = Duration.ofSeconds(3600*6); + + @Bean + @Override + public KeyGenerator keyGenerator() { + + // 设置自动key的生成规则,配置spring boot的注解,进行方法级别的缓存 + return (target, method, params) -> { + StringBuilder sb = new StringBuilder(); + sb.append(target.getClass().getName()); + sb.append(":"); + sb.append(method.getName()); + for (Object obj : params) { + sb.append(":").append(obj); + } + // logger.info("自动生成Redis Key -> [{}]", rsToUse); + return String.valueOf(sb); + }; + } + + @Bean + @Override + public CacheManager cacheManager() { + // 关键点,spring cache的注解使用的序列化都从这来,没有这个配置的话使用的jdk自己的序列化 + RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() + //key序列化方式 + .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(keySerializer())) + //value序列化方式 + .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(valueSerializer())) + .disableCachingNullValues() + .entryTtl(TIME_TO_LIVE); + + RedisCacheManager.RedisCacheManagerBuilder builder = RedisCacheManager.RedisCacheManagerBuilder + .fromConnectionFactory(lettuceConnectionFactory) + .cacheDefaults(config) + .transactionAware(); + + return builder.build(); + } + + + /** + * RedisTemplate配置 在单独使用redisTemplate的时候 重新定义序列化方式 + */ + @Bean(name = "redisTemplate") + public RedisTemplate redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) { + // 设置序列化 + Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); + ObjectMapper om = new ObjectMapper(); + // 配置null值序列化成空字符串 + om.getSerializerProvider().setNullValueSerializer(new JsonSerializer<>() { + @Override + public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + jsonGenerator.writeString(""); + } + }); + // 解决jackson无法反序列化LocalDateTime的问题,引入jsr310标准 + JavaTimeModule javaTimeModule = new JavaTimeModule(); + om.registerModule(javaTimeModule); + om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + // 其他设置 + om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance , + ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); + jackson2JsonRedisSerializer.setObjectMapper(om); + // 配置redisTemplate + RedisTemplate redisTemplate = new RedisTemplate<>(); + redisTemplate.setConnectionFactory(lettuceConnectionFactory); + RedisSerializer stringSerializer = new StringRedisSerializer(); + redisTemplate.setKeySerializer(stringSerializer); + redisTemplate.setValueSerializer(jackson2JsonRedisSerializer); + redisTemplate.setHashKeySerializer(stringSerializer); + redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer); + redisTemplate.afterPropertiesSet(); + return redisTemplate; + } + + private RedisSerializer keySerializer() { + return new StringRedisSerializer(); + } + + private RedisSerializer valueSerializer() { + // 设置序列化 + Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>( + Object.class); + ObjectMapper om = new ObjectMapper(); + // 解决jackson无法反序列化LocalDateTime的问题,引入jsr310标准 + JavaTimeModule javaTimeModule = new JavaTimeModule(); + om.registerModule(javaTimeModule); + om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + // 其他设置 + om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance , + ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); + jackson2JsonRedisSerializer.setObjectMapper(om); + return jackson2JsonRedisSerializer; + } + + @Override + public CacheResolver cacheResolver() { + return null; + } + + /** + * 设置数据存入 redis 的序列化方式,并开启事务 + * + * @param redisTemplate + * @param factory + */ + private void initRedisTemplate(RedisTemplate redisTemplate, RedisConnectionFactory factory) { + //如果不配置Serializer,那么存储的时候缺省使用String,如果用User类型存储,那么会提示错误User can't cast to String! + redisTemplate.setKeySerializer(new StringRedisSerializer()); + redisTemplate.setHashKeySerializer(new StringRedisSerializer()); + redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer()); + redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer()); + // 开启事务 + redisTemplate.setEnableTransactionSupport(true); + redisTemplate.setConnectionFactory(factory); + } + + /** + * 注入封装RedisTemplate 给RedisUtil提供操作类 + * @param redisTemplate + * @return RedisUtil + */ + @Bean(name = "redisUtil") + public RedisUtil redisUtil(RedisTemplate redisTemplate) { + RedisUtil redisUtil = new RedisUtil(); + redisUtil.setRedisTemplate(redisTemplate); + return redisUtil; + } + + @Override + @Bean + public CacheErrorHandler errorHandler() { + // 异常处理,当Redis发生异常时,打印日志,但是程序正常走 + logger.info("初始化 -> [{}]", "Redis CacheErrorHandler"); + return null; + } + +} diff --git a/src/main/java/com/xkrs/microservice/common/config/RedisUtil.java b/src/main/java/com/xkrs/microservice/common/config/RedisUtil.java new file mode 100644 index 0000000..912cf45 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/config/RedisUtil.java @@ -0,0 +1,533 @@ +package com.xkrs.microservice.common.config; + +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.util.CollectionUtils; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +/** + * redis工具类 + * @author tajochen + */ +public class RedisUtil { + + private RedisTemplate redisTemplate; + + public void setRedisTemplate(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + /** + * 指定缓存失效时间 + * @param key 键 + * @param time 时间(秒) + * @return + */ + public boolean expire(String key,long time){ + try { + if(time>0){ + redisTemplate.expire(key, time, TimeUnit.SECONDS); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 根据key 获取过期时间 + * @param key 键 不能为null + * @return 时间(秒) 返回0 代表为永久有效 + */ + public long getExpire(String key){ + return redisTemplate.getExpire(key,TimeUnit.SECONDS); + } + + /** + * 判断key是否存在 + * @param key 键 + * @return true 存在 false不存在 + */ + public boolean hasKey(String key){ + try { + return redisTemplate.hasKey(key); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 删除缓存 + * @param key 可以传一个值 或多个 + */ + @SuppressWarnings("unchecked") + public void del(String ... key){ + if(key!=null&&key.length>0){ + if(key.length==1){ + redisTemplate.delete(key[0]); + }else{ + redisTemplate.delete(String.valueOf(CollectionUtils.arrayToList(key))); + } + } + } + + //============================String============================= + /** + * 普通缓存获取 + * @param key 键 + * @return 值 + */ + public Object get(String key){ + return key==null?null:redisTemplate.opsForValue().get(key); + } + + /** + * 普通缓存放入 + * @param key 键 + * @param value 值 + * @return true成功 false失败 + */ + public boolean set(String key,Object value) { + try { + redisTemplate.opsForValue().set(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + } + + /** + * 普通缓存放入并设置时间 + * @param key 键 + * @param value 值 + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 + * @return true成功 false 失败 + */ + public boolean set(String key,Object value,long time){ + try { + if(time>0){ + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); + } else { + set(key, value); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 递增 + * @param key 键 + * @param delta 要增加几(大于0) + * @return + */ + public long incr(String key, long delta){ + if(delta<0){ + throw new RuntimeException("递增因子必须大于0"); + } + return redisTemplate.opsForValue().increment(key, delta); + } + + /** + * 递减 + * @param key 键 + * @param delta 要减少几(小于0) + * @return + */ + public long decr(String key, long delta){ + if(delta<0){ + throw new RuntimeException("递减因子必须大于0"); + } + return redisTemplate.opsForValue().increment(key, -delta); + } + + //================================Map================================= + /** + * HashGet + * @param key 键 不能为null + * @param item 项 不能为null + * @return 值 + */ + public Object hget(String key,String item){ + return redisTemplate.opsForHash().get(key, item); + } + + /** + * 获取hashKey对应的所有键值 + * @param key 键 + * @return 对应的多个键值 + */ + public Map hmget(String key){ + return redisTemplate.opsForHash().entries(key); + } + + /** + * HashSet + * @param key 键 + * @param map 对应多个键值 + * @return true 成功 false 失败 + */ + public boolean hmset(String key, Map map){ + try { + redisTemplate.opsForHash().putAll(key, map); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * HashSet 并设置时间 + * @param key 键 + * @param map 对应多个键值 + * @param time 时间(秒) + * @return true成功 false失败 + */ + public boolean hmset(String key, Map map, long time){ + try { + redisTemplate.opsForHash().putAll(key, map); + if(time>0){ + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * @param key 键 + * @param item 项 + * @param value 值 + * @return true 成功 false失败 + */ + public boolean hset(String key,String item,Object value) { + try { + redisTemplate.opsForHash().put(key, item, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * @param key 键 + * @param item 项 + * @param value 值 + * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 + * @return true 成功 false失败 + */ + public boolean hset(String key,String item,Object value,long time) { + try { + redisTemplate.opsForHash().put(key, item, value); + if(time>0){ + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 删除hash表中的值 + * @param key 键 不能为null + * @param item 项 可以使多个 不能为null + */ + public void hdel(String key, Object... item){ + redisTemplate.opsForHash().delete(key,item); + } + + /** + * 判断hash表中是否有该项的值 + * @param key 键 不能为null + * @param item 项 不能为null + * @return true 存在 false不存在 + */ + public boolean hHasKey(String key, String item){ + return redisTemplate.opsForHash().hasKey(key, item); + } + + /** + * hash递增 如果不存在,就会创建一个 并把新增后的值返回 + * @param key 键 + * @param item 项 + * @param by 要增加几(大于0) + * @return + */ + public double hincr(String key, String item,double by){ + return redisTemplate.opsForHash().increment(key, item, by); + } + + /** + * hash递减 + * @param key 键 + * @param item 项 + * @param by 要减少记(小于0) + * @return + */ + public double hdecr(String key, String item,double by){ + return redisTemplate.opsForHash().increment(key, item,-by); + } + + //============================set============================= + /** + * 根据key获取Set中的所有值 + * @param key 键 + * @return + */ + public Set sGet(String key){ + try { + return redisTemplate.opsForSet().members(key); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 根据value从一个set中查询,是否存在 + * @param key 键 + * @param value 值 + * @return true 存在 false不存在 + */ + public boolean sHasKey(String key,Object value){ + try { + return Boolean.TRUE.equals(redisTemplate.opsForSet().isMember(key, value)); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 将数据放入set缓存 + * @param key 键 + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sSet(String key, Object...values) { + try { + return redisTemplate.opsForSet().add(key, values); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 将set数据放入缓存 + * @param key 键 + * @param time 时间(秒) + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sSetAndTime(String key,long time,Object...values) { + try { + Long count = redisTemplate.opsForSet().add(key, values); + if(time>0) + {expire(key, time);} + return count; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 获取set缓存的长度 + * @param key 键 + * @return + */ + public long sGetSetSize(String key){ + try { + return redisTemplate.opsForSet().size(key); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 移除值为value的 + * @param key 键 + * @param values 值 可以是多个 + * @return 移除的个数 + */ + public long setRemove(String key, Object ...values) { + try { + Long count = redisTemplate.opsForSet().remove(key, values); + return count; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + //===============================list================================= + + /** + * 获取list缓存的内容 + * @param key 键 + * @param start 开始 + * @param end 结束 0 到 -1代表所有值 + * @return + */ + public List lGet(String key, long start, long end){ + try { + return redisTemplate.opsForList().range(key, start, end); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 获取list缓存的长度 + * @param key 键 + * @return + */ + public long lGetListSize(String key){ + try { + return redisTemplate.opsForList().size(key); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 通过索引 获取list中的值 + * @param key 键 + * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 + * @return + */ + public Object lGetIndex(String key,long index){ + try { + return redisTemplate.opsForList().index(key, index); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 将list放入缓存 + * @param key 键 + * @param value 值 + * @return + */ + public boolean lSet(String key, Object value) { + try { + redisTemplate.opsForList().rightPush(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 将list放入缓存 + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lSet(String key, Object value, long time) { + try { + redisTemplate.opsForList().rightPush(key, value); + if (time > 0) + {expire(key, time);} + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 将list放入缓存 + * @param key 键 + * @param value 值 + * @return + */ + public boolean lSet(String key, List value) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 将list放入缓存 + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lSet(String key, List value, long time) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 根据索引修改list中的某条数据 + * @param key 键 + * @param index 索引 + * @param value 值 + * @return + */ + public boolean lUpdateIndex(String key, long index,Object value) { + try { + redisTemplate.opsForList().set(key, index, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 移除N个值为value + * @param key 键 + * @param count 移除多少个 + * @param value 值 + * @return 移除的个数 + */ + public long lRemove(String key,long count,Object value) { + try { + Long remove = redisTemplate.opsForList().remove(key, count, value); + return remove; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } +} + diff --git a/src/main/java/com/xkrs/microservice/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/microservice/common/config/WebSecurityConfig.java new file mode 100644 index 0000000..d196079 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/config/WebSecurityConfig.java @@ -0,0 +1,66 @@ +package com.xkrs.microservice.common.config; + +import com.xkrs.microservice.common.account.CustomAuthenticationProvider; +import com.xkrs.microservice.common.account.JwtAuthenticationFilter; +import com.xkrs.microservice.common.account.JwtLoginFilter; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +@Configuration +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled=true) +class WebSecurityConfig extends WebSecurityConfigurerAdapter { + + /** + * 设置 HTTP 验证规则 + * @param http http隐私认证 + * @throws Exception + */ + @Override + protected void configure(HttpSecurity http) throws Exception { + // 关闭csrf验证 + http.csrf().disable() + // 对请求进行认证 + .authorizeRequests() + // 所有 / 的所有请求 都放行 + .antMatchers("/").permitAll() + // 所有OPTIONS请求都放行 + .antMatchers(HttpMethod.OPTIONS).permitAll() + // 所有 /user/add 用户注册 的POST请求 都放行 + .antMatchers(HttpMethod.POST, "/api/user/add").permitAll() + // 所有 /user/check/duplicate 检查用户名是否重复 的POST请求 都放行 + .antMatchers(HttpMethod.GET, "/api/user/check/duplicate").permitAll() + // 所有 /login 用户登录 的POST请求 都放行 + .antMatchers(HttpMethod.POST, "/api/login").permitAll() + // 所有 app 农户用户注册 的POST请求 都放行 + .antMatchers(HttpMethod.POST, "/api/typical-farmer/add").permitAll() + // 所有 水文站点数据 相关操作 都放行 + .antMatchers(HttpMethod.GET, "/api/hydrological-station/get/all").permitAll() + .antMatchers(HttpMethod.GET, "/api/hydrological-station/get/time").permitAll() + .antMatchers(HttpMethod.POST, "/api/hydrological-station/add").permitAll() + // 所有 app 检查版本更新 的GET请求 都放行 + .antMatchers(HttpMethod.GET, "/api/app-file/get/new-version").permitAll() + // 所有其它请求需要身份认证 + .anyRequest().authenticated() + .and() + // 添加一个过滤器 所有访问 /login 的请求交给 JWTLoginFilter 来处理 这个类处理所有的JWT相关内容 + .addFilterBefore(new JwtLoginFilter("/api/login", authenticationManager()), + UsernamePasswordAuthenticationFilter.class) + // 添加一个过滤器验证其他请求的Token是否合法 + .addFilterBefore(new JwtAuthenticationFilter(), + UsernamePasswordAuthenticationFilter.class); + } + + @Override + protected void configure(AuthenticationManagerBuilder auth) { + // 使用自定义身份验证组件 + auth.authenticationProvider(new CustomAuthenticationProvider()); + } +} + diff --git a/src/main/java/com/xkrs/microservice/common/encapsulation/EncapsulationObject.java b/src/main/java/com/xkrs/microservice/common/encapsulation/EncapsulationObject.java new file mode 100644 index 0000000..67ac342 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/encapsulation/EncapsulationObject.java @@ -0,0 +1,59 @@ +package com.xkrs.microservice.common.encapsulation; + +import java.io.Serializable; + +/** + * 输出信息对象 + * @author tajochen + * @param + */ +public class EncapsulationObject implements Serializable { + + /** + * 状态码 + */ + int status; + + /** + * 提示信息 + */ + String msg; + + /** + * 数据 + */ + T data; + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + @Override + public String toString() { + return "EncapsulationObejct{" + + "status=" + status + + ", msg='" + msg + '\'' + + ", data=" + data + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/common/encapsulation/OutputEncapsulation.java b/src/main/java/com/xkrs/microservice/common/encapsulation/OutputEncapsulation.java new file mode 100644 index 0000000..4ef30cd --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/encapsulation/OutputEncapsulation.java @@ -0,0 +1,94 @@ +package com.xkrs.microservice.common.encapsulation; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.MessageSource; +import org.springframework.context.support.ResourceBundleMessageSource; +import org.springframework.stereotype.Component; +import org.springframework.validation.FieldError; + +import java.io.IOException; +import java.io.InputStream; +import java.util.*; + +/** + * 输出信息封装 + * @author tajochen + */ +@Component +public class OutputEncapsulation { + + private static final Logger logger = LoggerFactory.getLogger(OutputEncapsulation.class); + + /** + * 读取多国语言文件 + */ + public static MessageSource messageSource() { + + // 使用ClassLoader加载properties配置文件生成对应的输入流 + InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties"); + // 使用properties对象加载输入流 + try { + Properties properties = new Properties(); + properties.load(in); + } catch (IOException e) { + e.printStackTrace(); + } + ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); + messageSource.setBasename("i18n/messages"); + messageSource.setDefaultEncoding("UTF-8"); + return messageSource; + } + + /** + * 封装输出数据 + * @param promptMessageEnum 封装枚举 + * @param obj 对象 + * @param locale 本地语言 + */ + public static String outputEncapsulationObject(PromptMessageEnum promptMessageEnum, Object obj, Locale locale) { + + EncapsulationObject encapsulationObject = new EncapsulationObject<>(); + encapsulationObject.setStatus(promptMessageEnum.getCode()); + encapsulationObject.setMsg(messageSource().getMessage(promptMessageEnum.getText(),null,locale)); + encapsulationObject.setData(obj); + + ObjectMapper objectMapper = new ObjectMapper(); + // 忽略无法转换的对象 + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false); + // 忽略json字符串中不识别的属性 + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + // 解决jackson无法反序列化LocalDateTime的问题,引入jsr310标准 + JavaTimeModule javaTimeModule = new JavaTimeModule(); + objectMapper.registerModule(javaTimeModule); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + String strByEo = ""; + try { + strByEo = objectMapper.writeValueAsString(encapsulationObject); + } catch (JsonProcessingException e) { + e.printStackTrace(); + logger.warn(e.toString()); + } + return strByEo; + } + + /** + * 输出请求值检验错误信息 + * @param fieldErrors 错误列表 + * @param locale 本地语言 + */ + public static String outputEncapsulationErrorList(List fieldErrors, Locale locale){ + List errorMsg = new ArrayList<>(); + for (FieldError fieldError : fieldErrors) { + String errMessage = Objects.requireNonNull(fieldError.getDefaultMessage()). + subSequence(1,fieldError.getDefaultMessage().length()-1).toString(); + errorMsg.add(messageSource().getMessage(errMessage,null,locale)); + } + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,errorMsg,locale); + } +} diff --git a/src/main/java/com/xkrs/microservice/common/encapsulation/PromptMessageEnum.java b/src/main/java/com/xkrs/microservice/common/encapsulation/PromptMessageEnum.java new file mode 100644 index 0000000..5d6b18e --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/encapsulation/PromptMessageEnum.java @@ -0,0 +1,64 @@ +package com.xkrs.microservice.common.encapsulation; + +/** + * 提示信息枚举 + * @author tajochen + */ +public enum PromptMessageEnum{ + + // 执行成功 + SUCCESS(0, "sys.message.success"), + + // 用户权限错误或非法操作: 1001-1999 + USER_NOT_LOGGED(1001, "sys.message.user.not_logged_in"), + USER_LOGIN_ERROR(1002, "sys.message.user.login_error"), + USER_ACCOUNT_FORBIDDEN(1003, "sys.message.user.account_forbidden"), + USER_ACCOUNT_NOT_ACTIVATED(1004, "sys.message.user.account_not_activated"), + USER_HAS_OVERTIME(1005, "sys.message.user.overtime"), + USER_NO_PERMISSION(1006,"sys.message.user.no_permission"), + USER_ALREADY_LOGGED(1007, "sys.message.user.already_logged"), + USER_ALREADY_EXIST(1008, "sys.message.user.already_exist"), + + // 请求参数错误或非法:2001-2999 + PARAM_NULL(2001, "sys.message.param.null"), + PARAM_ILLEGAL(2002, "sys.message.param.illegal"), + + // 数据返回错误:3001-3999 + DATA_NONE(3001, "sys.message.data.none"), + DATA_WRONG(3002, "sys.message.data.wrong"), + DATA_REPEAT(3003, "sys.message.data.repeat"), + + // 操作失败:4001-4999 + PROCESS_FAIL(4001,"sys.message.process.fail"), + PROCESS_OVERTIME(4002,"sys.message.process.overtime"), + FILE_EXISTS(4003,"sys.message.file.exists"), + FILE_WRITE_ERROR(4004,"sys.message.file.write.error"), + FILE_READ_ERROR(4005,"sys.message.file.read.error"), + + // 系统内部错误或异常:5001-5999 + SYSTEM_INNER_ERROR(5001,"sys.message.system.inner_error"), + SYSTEM_ABNORMAL(5002,"sys.message.system.abnormal"), + SYSTEM_BUSY(5003,"sys.message.system.busy"), + SYSTEM_MAINTAIN(5004,"sys.message.system.maintain"), + + // 数据库错误:6001-6999 + DATABASE_ERROR(6001,"sys.message.database.error"); + + private int code; + + private String text; + + PromptMessageEnum(int code,String text) { + this.code = code; + this.text = text; + } + + public String getText() { + return this.text; + } + + public int getCode() { + return this.code; + } + +} diff --git a/src/main/java/com/xkrs/microservice/common/schedule/SaticScheduleTask.java b/src/main/java/com/xkrs/microservice/common/schedule/SaticScheduleTask.java new file mode 100644 index 0000000..e821b86 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/schedule/SaticScheduleTask.java @@ -0,0 +1,59 @@ +package com.xkrs.microservice.common.schedule; + +import com.xkrs.microservice.common.tool.JackSonTool; +import com.xkrs.microservice.common.tool.WeatherGet; +import com.xkrs.microservice.model.vo.MonitoringStationReturnVo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; + +import javax.annotation.Resource; +import java.time.*; +import java.util.*; + +import static com.xkrs.microservice.util.RequestUtil.getStandard; + +/** + * 定时任务 + * @author tajochen + */ +@Configuration +@EnableScheduling +public class SaticScheduleTask { + + Logger logger = LoggerFactory.getLogger(SaticScheduleTask.class); + + @Resource + private WeatherGet weatherGet; + +// /** +// * 定时获取数据,每天9:31 触发 +// */ +// @Scheduled(cron = "00 31 9 ? * *") +// private void dailyReportFireLastTasks() { +// LocalDate pdfStartDate = LocalDate.of(2021, 5, 20); +// String url = "http://47.105.215.208:8005/intfa/queryData/16079680"; +// Map postParam = new HashMap<>(8); +// +// } + + /** + * 定时获取气象站数据 每 5 分钟触发 + */ + @Scheduled(cron = "0 0/5 * * * ?") + private void configureTasks() { + logger.info("执行静态定时任务时间: " + LocalDateTime.now()); + weatherGet.findWeather(); + } + + public static void main(String[] args) { + String url = "http://47.105.215.208:8005/intfa/queryData/16079680"; + Map postParam = new HashMap<>(8); + String res = getStandard(url, postParam); + MonitoringStationReturnVo de = JackSonTool.decode(res, MonitoringStationReturnVo.class); + System.out.println(res); + } + +} diff --git a/src/main/java/com/xkrs/microservice/common/tool/CrawlingWeather7Day.java b/src/main/java/com/xkrs/microservice/common/tool/CrawlingWeather7Day.java new file mode 100644 index 0000000..a831604 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/tool/CrawlingWeather7Day.java @@ -0,0 +1,246 @@ +package com.xkrs.microservice.common.tool; + +import com.xkrs.microservice.model.vo.ForecastWeather7DayVo; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.time.LocalDate; +import java.util.HashMap; +import java.util.Map; + +import static com.xkrs.microservice.util.DateTimeUtil.dateToStringNoLine; + +/** + * 爬取静态页面 新版中国天气网7天 + * @author wd + */ + +public class CrawlingWeather7Day { + + private static final Logger log = LoggerFactory.getLogger(CrawlingWeather7Day.class); + + /** + * 获取7天的天气预报和昨天的历史数据 + * {d0:昨天 。。。。。 d7:第七天} + * @param cityCode 城市编码 + * @param stationId 气象站点id + */ + public static ForecastWeather7DayVo getReptileWeather7Day(String cityCode, String stationId) { + // 城市 + String city = null; + // 天气 + String[] weather = new String[8]; + // 风向 + String[] wd = new String[8]; + // 风力 + String[] ws = new String[8]; + // 最高温数组 + String[] tempMax = new String[8]; + // 最低温数组 + String[] tempMin = new String[8]; + // 天气数组 + Map weatherMap = new HashMap<>(8); + // 昨天天气 + Map weatherYesterMap = new HashMap<>(8); + // 7天预报和昨天数据 + Map> weatherMap7Day = new HashMap<>(8); + + // 爬取成功标志 + boolean isSuccess = false; + + // 重复次数 + int retryTimes = 5; + + // 时间 + LocalDate localDate = LocalDate.now(); + + // 降水数据 + Map rainForecast =getRainForecast(stationId); + + String url = "http://www.weather.com.cn/weathern/" + cityCode + ".shtml"; + while (!isSuccess && retryTimes > 0) { + try { + // 获得连接 + Document doc = Jsoup.connect(url).timeout(10000).get(); + // 获得地址 + Elements localEle = doc.getElementsByClass("webox"); + + StringBuffer sb = new StringBuffer(); + for (Element e : localEle) { + sb.append(e.getElementsByTag("a").text().substring(0, 2)); + sb.append(">"); + } + String citySb = sb.toString(); + if (citySb.trim().isEmpty()) { + log.info("city 为空"); + } else { + city = citySb.substring(0, citySb.length() - 1); + weatherYesterMap.put("city", city); + } + + + Elements conEle = doc.getElementsByClass("blueFor-container"); + for (Element e : conEle) { + + // 获得气温数组 + Document eDoc = Jsoup.parse(e.toString()); + // script有两个,一个是7天、15天的气温,一个是小时预报 + Elements scripts = eDoc.getElementsByTag("script"); + //拿到气温数据 + Elements eq = scripts.eq(0); + + for (Element ele : + eq) { + String[] datas = ele.data().split("var"); + for (String data : + datas) { + // 数据不为空,包含"=" + if (data.contains("=")) { + String[] datass = data.split("="); + if ("eventDay".equals(datass[0].trim())) { + String dataSquare = data.split("=")[1]; + + tempMax = getTemp(dataSquare); + } + if ("eventNight".equals(datass[0].trim())) { + String dataSquare = data.split("=")[1]; + tempMin = getTemp(dataSquare); + } + } + } + weatherYesterMap.put("tempMax", tempMax[0]); + weatherYesterMap.put("tempMin", tempMin[0]); + + // 昨天天气 + Elements yestEle = eDoc.select("li[class^=blue-item yesterday]"); + // 获得天气 + weather[0] = yestEle.select("p[class^=weather-info info-style]").text(); + weatherYesterMap.put("weather", weather[0]); + + // 获得风气 + Elements winds = yestEle.select("i[class^=wind-icon]"); + + StringBuffer sbb = new StringBuffer(); + for (Element wind : + winds) { + sbb.append(wind.getElementsByTag("i").attr("title")); + sbb.append(">"); + } + String sbbs = sbb.toString(); + wd[0] = sbbs.substring(0, sbbs.length() - 1); + weatherYesterMap.put("wd", wd[0]); + // 风力 + ws[0] = yestEle.select("p[class^=wind-info info-style]").text(); + + weatherYesterMap.put("ws", ws[0]); + weatherYesterMap.put("rain", null); + + weatherMap7Day.put("d0", weatherYesterMap); + + + // 7天天气预报 + Elements forecasts = eDoc.select("li[class^=blue-item lv]"); + + int i = 1; + for (Element e1 : + forecasts) { + // 时间 + LocalDate date = localDate.plusDays(i - 1); + // 天气数组 + weatherMap = new HashMap<>(7); + + String day = "d" + i; + // 天气 + weather[i] = e1.select("p[class^=weather-info]").get(0).text(); + weatherMap.put("weather", weather[i]); + // 获得风气 + Elements winds7Day = e1.select("i[class^=wind-icon]"); + + sbb.setLength(0); + sbb.delete(0, sbb.length()); + for (Element wind : + winds7Day) { + sbb.append(wind.getElementsByTag("i").attr("title")); + sbb.append(">"); + } + sbbs = sbb.toString(); + wd[i] = sbbs.substring(0, sbbs.length() - 1); + weatherMap.put("wd", wd[i]); + // 风力 + ws[i] = e1.select("p[class^=wind-info]").text(); + weatherMap.put("ws", ws[i]); + weatherMap.put("tempMax", tempMax[i]); + weatherMap.put("tempMin", tempMin[i]); + weatherMap.put("city",city); + + // 三天内的数据又降水预报,站点数据 + if (i < 4){ + weatherMap.put("rain",rainForecast.get(dateToStringNoLine(date))); + }else{ + weatherMap.put("rain","null"); + } + weatherMap7Day.put(day, weatherMap); + i++; + } + } + } + isSuccess = true; + } catch (IOException e) { + log.info("连接超时"); + retryTimes--; + try { + Thread.sleep(2000); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } + } + log.info("天气查询完毕"); + ForecastWeather7DayVo forecastWeather7DayVo = new ForecastWeather7DayVo(); + forecastWeather7DayVo.setCity(city); + forecastWeather7DayVo.setTempMax(tempMax); + forecastWeather7DayVo.setTempMin(tempMin); + forecastWeather7DayVo.setWd(wd); + forecastWeather7DayVo.setWs(ws); + forecastWeather7DayVo.setWeather(weather); + forecastWeather7DayVo.setWeatherMap7Day(weatherMap7Day); + return forecastWeather7DayVo; + } + + /** + * 气温数据存储 + * @param data 气温字符串 + */ + private static String[] getTemp(String data) { + String[] temps = data.substring(1, data.length() - 3).split(","); + String[] temp = new String[8]; + for (int i = 0; i < temps.length; i++) { + temp[i] = temps[i].substring(1, temps[i].length() - 1); + } + return temp; + } + + /** + * 获取降水量预报 + * @param cityStationId 城市站点id + */ + public static Map getRainForecast(String cityStationId) { + Map map = new HashMap<>(3); + + map.put("staId",cityStationId); + map.put("funitemmenuid","1150101020"); + map.put("typeCode","NWST"); + map.put("url", Precipitation.FORECAST_PERCIPITION_URL); + return Precipitation.forecastDataHandler(map); + } + + public static void main(String[] args) { + ForecastWeather7DayVo res = getReptileWeather7Day("101121304","54861"); + System.out.println(res); + } +} diff --git a/src/main/java/com/xkrs/microservice/common/tool/CrawlingWeatherNew.java b/src/main/java/com/xkrs/microservice/common/tool/CrawlingWeatherNew.java new file mode 100644 index 0000000..a59f6ac --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/tool/CrawlingWeatherNew.java @@ -0,0 +1,259 @@ +package com.xkrs.microservice.common.tool; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.xkrs.microservice.model.vo.RealTimeWeatherVo; +import org.apache.http.HttpEntity; +import org.apache.http.HttpStatus; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.time.LocalDateTime; + +import static com.xkrs.microservice.util.DateTimeUtil.dateTimeToString; + + +/** + * 得到实时数据 + * @author wd + */ +public class CrawlingWeatherNew { + + private static final Logger log = LoggerFactory.getLogger(CrawlingWeatherNew.class); + + private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36"; + private static final String COOKIE = "f_city=%E9%83%91%E5%B7%9E%7C101180101%7C; Hm_lvt_080dabacb001ad3dc8b9b9049b36d43b=1546482322; Hm_lpvt_080dabacb001a"; + public static final String REFERER = "http://www.weather.com.cn/"; + + public static RealTimeWeatherVo handlerWeatherData(String cityCode){ + RealTimeWeatherVo realTimeWeather = new RealTimeWeatherVo(); + // 时间 + LocalDateTime localDateTime = LocalDateTime.now(); + // 拿到数据 + String data = getRealTimeWeather(cityCode); + // 建立treeJson + try { + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(data); + // 根据路径获取数据 + String cityName = jsonNode.path("cityname").asText(); + String weather = jsonNode.path("weather").asText(); + String temp = jsonNode.path("temp").asText(); + String tempf = jsonNode.path("tempf").asText(); + String wd = jsonNode.path("WD").asText(); + String ws = jsonNode.path("WS").asText(); + String sd = jsonNode.path("SD").asText(); + String wse = jsonNode.path("wse").asText(); + String qy = jsonNode.path("qy").asText(); + String njd = jsonNode.path("njd").asText(); + String rain = jsonNode.path("rain").asText(); + String rain24 = jsonNode.path("rain24h").asText(); + String aqi = jsonNode.path("aqi").asText(); + String aqiPm25 = jsonNode.path("aqi_pm25").asText(); + realTimeWeather.setWeather(weather); + realTimeWeather.setTemp(temp); + realTimeWeather.setTempf(tempf); + realTimeWeather.setWd(wd); + realTimeWeather.setWs(ws); + realTimeWeather.setSd(sd); + realTimeWeather.setWse(wse); + realTimeWeather.setQy(qy); + realTimeWeather.setNjd(njd); + realTimeWeather.setRain(rain); + realTimeWeather.setRain24(rain24); + realTimeWeather.setAqi(aqi); + realTimeWeather.setAqiPm25(aqiPm25); + realTimeWeather.setRealTime(dateTimeToString(localDateTime)); + return realTimeWeather; + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 获取实时天气 + * @param cityCode 城市代码 + * @return + *{"nameen":"qingdao","cityname":"青岛","city":"101120201","temp":"18","tempf":"64","WD":"东南风 ","wde":"SE","WS":"4级","wse":"16-24km/h", + * "SD":"98%","time":"09:15","weather":"雨","weathere":"rain","weathercode":"d301","qy":"999","njd":"3.6km","sd":"98%","rain":"0","rain24h":"0", + * "aqi":"16","limitnumber":"","aqi_pm25":"16","date":"11月18日(星期三)"} + */ + public static String getRealTimeWeather(String cityCode){ + + // 读取成功标志 + boolean isSuccess = false; + + // 重复次数 + int count = 10; + + // 创建http对象 + RequestConfig defaultRequestConfig = RequestConfig.custom() + .setSocketTimeout(60000).setConnectTimeout(60000) + .setConnectionRequestTimeout(60000) + .build(); + CloseableHttpClient client = HttpClients.custom() + .setDefaultRequestConfig(defaultRequestConfig).build(); + + // 创建并设置URI + URIBuilder uri = null; + // 创建Get请求 + HttpGet get = null; + String url = ""; + + try { + url = "http://d1.weather.com.cn/sk_2d/" + cityCode + ".html?_=" + System.currentTimeMillis(); + uri = new URIBuilder(url); + get = new HttpGet(uri.build()); + // 设置请求头 + get.setHeader("Accept" + , "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + get.setHeader("Accept-Encoding" + , "gzip, deflate"); + get.setHeader("Accept-Language" + , "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6"); + get.setHeader("Connection" + , "keep-alive"); + get.setHeader("Cache-Control" + , "no-cache"); + get.setHeader("Host" + , "d1.weather.com.cn"); + get.setHeader("Upgrade-Insecure-Requests" + , "1"); + get.setHeader("Cookie", COOKIE); + get.setHeader("User-Agent", USER_AGENT); + get.setHeader("Referer", REFERER); + } catch (Exception e) { + log.info("错误{}", (Object) e.getStackTrace()); + } + + //发送请求 + HttpEntity entity = null; + InputStream is = null; + BufferedReader br = null; + // 创建响应对象 + CloseableHttpResponse response = null; + String line = null; + String sLine = null; + + String json = null; + while (!isSuccess && count > 0){ + try { + response = client.execute(get); + // 获取请求结果 + if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK){ + log.info("实时天气数据未请求成功"); + count --; + continue; + } + entity = response.getEntity(); + is = entity.getContent(); + br = new BufferedReader( + new InputStreamReader(is, StandardCharsets.UTF_8) + ); + StringBuffer sb = new StringBuffer(); + while((line = br.readLine()) != null){ + sb.append(line); + sb.append("/n"); + } + sLine = sb.toString(); + sLine = sLine.substring(sLine.indexOf("{")); + sLine = sLine.substring(0,sLine.length()-2); + ObjectMapper objectMapper = new ObjectMapper(); + //使用ObjectMapper对象对 User对象进行转换 + try { + json = objectMapper.writeValueAsString(sLine); + } catch (JsonProcessingException e) { + log.info("json字符串转化异常{}", (Object) e.getStackTrace()); + } + isSuccess = true; + + } catch (ClientProtocolException e) { + // TODO Auto-generated catch block + log.info("请求超时等问题:{}", (Object) e.getStackTrace()); + + }catch (IOException e) { + log.info("I/O问题:{}", (Object) e.getStackTrace()); + }finally { + close(is,br,response,client); + } + } + return sLine; + } + +// /** +// * 获得7天天气 老版中国天气网 +// * @param cityCode 城市代码 +// */ +// public static void getWeather7d(String cityCode){ +// +// String url = "http://www.weather.com.cn/weather/" + cityCode + ".shtml"; +// try { +// Document doc = Jsoup.connect(url).get(); +// Elements content = doc.getElementsByClass("con"); +// for (Element e : content) { +// Document conDoc = Jsoup.parse(e.toString()); +// Elements cru = conDoc.getElementsByClass("crumbs"); +// Elements sky = content.select("li[class^=sky skyid lv]"); +// Elements data = content.select("li[class^=date-item]"); +// // 地点 +// System.out.println(cru.text()); +// // weather +// for (Element sk : sky) { +// System.out.println("时间" + sk.text()); +// } +// } +// } catch (Exception e) { +// log.info("未知错误{}", (Object) e.getStackTrace()); +// } +// log.info("天气查询完毕!!"); +// } + + /** + * 关闭流 + * @param is InputStream + * @param br BufferedReader + * @param response CloseableHttpResponse + * @param client CloseableHttpClient + */ + private static void close(InputStream is, BufferedReader br, CloseableHttpResponse response, CloseableHttpClient client){ + try { + if (null != is){ + is.close(); + } + if (null != br){ + br.close(); + } + if (null != response){ + response.close(); + } + if (null != client){ + client.close(); + } + } catch (IOException e) { + log.info("IO错误{}", (Object) e.getStackTrace()); + } + } + + public static void main(String[] args) { + RealTimeWeatherVo realTimeWeatherVo = handlerWeatherData("101120201"); + System.out.println(realTimeWeatherVo); + } +} diff --git a/src/main/java/com/xkrs/microservice/common/tool/FileServerTool.java b/src/main/java/com/xkrs/microservice/common/tool/FileServerTool.java new file mode 100644 index 0000000..edd9c84 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/tool/FileServerTool.java @@ -0,0 +1,91 @@ +package com.xkrs.microservice.common.tool; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.xkrs.microservice.model.vo.FileServerResultVo; +import com.xkrs.microservice.util.RequestUtil; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 文件服务器工具 + * @author tajochen + */ +public class FileServerTool { + + private static final String UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0"; + + /** + * 发送管理命令到文件服务器 + * @param url 文件服务器路径 + * @param map 命令参数集 + * @return + */ + public static FileServerResultVo postFileManage(String url, Map map){ + Logger log = LoggerFactory.getLogger(RequestUtil.class); + String body = ""; + // 创建httpclient对象 + CloseableHttpClient client = HttpClients.createDefault(); + // 创建post方式请求对象 + HttpPost httpPost = new HttpPost(url); + // 装填参数 + List nvps = new ArrayList<>(); + if(map!=null){ + for (Map.Entry entry : map.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); + } + } + try { + // 设置参数到请求对象中 + httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8")); + // 设置header报文头信息 + httpPost.setHeader("Content-type", "application/x-www-form-urlencoded"); + httpPost.setHeader("User-Agent", UA); + httpPost.setHeader("Accept", "application"); + httpPost.setHeader("Accept-Encoding", "gzip, deflate"); + // 执行请求操作,并拿到结果(同步阻塞) + CloseableHttpResponse response = client.execute(httpPost); + // 获取结果实体 + HttpEntity entity = response.getEntity(); + if (entity != null) { + // 按指定编码转换结果实体为String类型 + body = EntityUtils.toString(entity, "UTF-8"); + } + EntityUtils.consume(entity); + // 释放链接 + response.close(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + client.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + FileServerResultVo fileServerResultVo = new FileServerResultVo(); + ObjectMapper mapper = new ObjectMapper(); + try { + fileServerResultVo = mapper.readValue(body, FileServerResultVo.class); + } catch (JsonProcessingException e) { + e.printStackTrace(); + log.warn(e.toString()); + + } + return fileServerResultVo; + } +} diff --git a/src/main/java/com/xkrs/microservice/common/tool/JackSonTool.java b/src/main/java/com/xkrs/microservice/common/tool/JackSonTool.java new file mode 100644 index 0000000..2cd891f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/tool/JackSonTool.java @@ -0,0 +1,174 @@ +package com.xkrs.microservice.common.tool; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * 序列化工具 + * @author tajochen + */ +public class JackSonTool { + + private static final Logger logger = LoggerFactory.getLogger(JackSonTool.class); + + private JackSonTool() { + } + + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + static { + OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); + OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + OBJECT_MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + OBJECT_MAPPER.configure(JsonParser.Feature.ALLOW_COMMENTS, true); + OBJECT_MAPPER.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); + OBJECT_MAPPER.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); + OBJECT_MAPPER.getSerializerProvider().setNullValueSerializer(new JsonSerializer<>() { + @Override + public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + jsonGenerator.writeString(""); + } + }); + // 解决jackson无法反序列化LocalDateTime的问题,引入jsr310标准 + JavaTimeModule javaTimeModule = new JavaTimeModule(); + OBJECT_MAPPER.registerModule(javaTimeModule); + OBJECT_MAPPER.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + } + + /** + * 序列化 + * @param obj + * @param + * @return + */ + public static String encode(T obj) { + if (Objects.isNull(obj)) { + return null; + } + try { + return OBJECT_MAPPER.writeValueAsString(obj); + } catch (Exception e) { + logger.error("json encode error, obj={}", obj, e); + return null; + } + } + + /** + * 反序列化 + * @param json + * @param valueType + * @param + * @return + */ + public static T decode(String json, Class valueType) { + if (!json.isEmpty() && !Objects.isNull(valueType)) { + try { + return OBJECT_MAPPER.readValue(json, valueType); + } catch (Exception e) { + logger.error("json decode fail,jsonString={}, type={}", json, valueType.getName(), e); + } + } + return null; + } + + /** + * 反序列化成list + * @param + * @param json + * @param clazz + * @return + */ + public static List decode2List(String json, Class clazz) { + if (!json.isEmpty() && !Objects.isNull(clazz)) { + try { + return OBJECT_MAPPER.readValue(json, OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class, clazz)); + } catch (Exception var3) { + logger.error("json decode2list fail,json={},classType={}", json, clazz.getName(), var3); + } + } + return null; + } + + /** + * 字符串转换为 Map + * + * @param jsonString + * @return + * @throws Exception + */ + public static Map json2map(String jsonString) { + + try { + return OBJECT_MAPPER.readValue(jsonString, Map.class); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + } + + /** + * 字符串转换为 Map + */ + public static Map json2map(String jsonString, Class clazz) { + Map map = null; + try { + map = OBJECT_MAPPER.readValue(jsonString, new TypeReference>() { + }); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + Map result = new HashMap(128); + for (Map.Entry entry : map.entrySet()) { + result.put(entry.getKey(), OBJECT_MAPPER.convertValue(entry.getValue(), clazz)); + } + return result; + } + + /** + * 将一个JSON字符串转换为T对象 + * @param json + * @param typeReference + * @return + */ + public static T toObject(String json, TypeReference typeReference) { + try { + return OBJECT_MAPPER.readValue(json, typeReference); + } catch (Exception e) { + throw new RuntimeException("failed to convert string to object", e); + } + } + + /** + * map转clazz对象 + * @param map + * @param clazz + * @param + * @return + */ + public static T mapToObject(Map map, Class clazz) { + String json = null; + try { + json = OBJECT_MAPPER.writeValueAsString(map); + return OBJECT_MAPPER.readValue(json, clazz); + } catch (Exception e) { + logger.error("json map2object fail,map={},ClassName={}", json, clazz.getName()); + return null; + } + } + +} diff --git a/src/main/java/com/xkrs/microservice/common/tool/PageBean.java b/src/main/java/com/xkrs/microservice/common/tool/PageBean.java new file mode 100644 index 0000000..6f0f31f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/tool/PageBean.java @@ -0,0 +1,84 @@ +package com.xkrs.microservice.common.tool; + +import java.io.Serializable; +import java.util.List; + +/** + * @author XinYi Song + * 分页的封装 + */ +@SuppressWarnings({"ALL", "AlibabaAvoidCommentBehindStatement"}) +public class PageBean implements Serializable { + //要封装的list泛型集合 + private List list; + //当前页码 + private int currentPage; + //每页展示的条数 + private int pageSize; + //数据总数 + private long totalCount; + //总页数 + private int totalPage; + + public PageBean() { + } + + public PageBean(List list, int currentPage, int pageSize, long totalCount) { + this.list = list; + this.currentPage = currentPage; + this.pageSize = pageSize; + this.totalCount = totalCount; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public int getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public long getTotalCount() { + return totalCount; + } + + public void setTotalCount(long totalCount) { + this.totalCount = totalCount; + } + + //设置总页数 + public int getTotalPage() { + return (int) Math.ceil(totalCount * 1.0 / pageSize); + } + + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } + + @Override + public String toString() { + return "PageBean{" + + "list=" + list + + ", currentPage=" + currentPage + + ", pageSize=" + pageSize + + ", totalCount=" + totalCount + + ", totalPage=" + totalPage + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/common/tool/Precipitation.java b/src/main/java/com/xkrs/microservice/common/tool/Precipitation.java new file mode 100644 index 0000000..d1a8cc8 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/tool/Precipitation.java @@ -0,0 +1,418 @@ +package com.xkrs.microservice.common.tool; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.http.HttpEntity; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.util.HashMap; +import java.util.Map; + +import static com.xkrs.microservice.util.DateTimeUtil.dateToStringNoLine; + +/** + * 降水量 + * @author wd + */ +public class Precipitation { + + private static final Logger log = LoggerFactory.getLogger(Precipitation.class); + + /** + * 历史降雨量 + */ + public static final String HISTORICAL_PRECIPITION_URL = "http://data.cma.cn/dataGis/multiSource/getLiveDataInfo3"; + + /** + * 预报天气 + */ + public static final String FORECAST_PERCIPITION_URL = "http://data.cma.cn/dataGis/exhibitionData/getStationInfo"; + + private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " + + "(KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36"; + + private static final String COOKIE = "JSESSIONID=E0AF489776F9463892478C226957FB86; " + + "pgv_pvi=4137831424; " + + "userLoginKey=63730d21fa3139b077bae8a7801cf04e; " + + "trueName=snnbnoone; " + + "userName=54e05d733671bd38af26fc06640f3ba4; " + + "PHPSESSID=eqs8ocriikbhmq28lt2lvdoft0; " + + "pgv_si=s349517824; " + + "Hm_lvt_d9508cf73ee2d3c3a3f628fe26bd31ab=1604459365,1604483274,1604547634,1605764770; " + + "_pk_testcookie.6.dd70=1; " + + "login_id_chat=0; floatDc=1; " + + "Hm_lpvt_d9508cf73ee2d3c3a3f628fe26bd31ab=1606110326; " + + "_pk_ref.6.dd70=%5B%22%22%2C%22%22%2C1606110326%2C%22https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3Dvc5Gc6810ZDAhZd1006vGN0aBUYxE0Hmp1CrfAJLz2G%26wd%3D%26eqid%3Debf41e300000ebb0000000025fa3742d%22%5D; " + + "_pk_ses.6.dd70=1; _pk_ref.1.dd70=%5B%22%22%2C%22%22%2C1606110326%2C%22https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3Dvc5Gc6810ZDAhZd1006vGN0aBUYxE0Hmp1CrfAJLz2G%26wd%3D%26eqid%3Debf41e300000ebb0000000025fa3742d%22%5D; " + + "_pk_id.1.dd70=e952ffa8190db13b.1603759181.13.1606110326.1606042123.; " + + "_pk_ses.1.dd70=*; " + + "login_name_chat=0; " + + "_pk_ses.2.dd70=*; " + + "_pk_id.6.dd70=156cb08aa1aab3cc.1603759181.15.1606110674.1606110326.; " + + "_pk_id.2.dd70=3620e1ea6324ce18.1604461280.4.1606110674.1605837309."; + + public static final String REFERER = "http://data.cma.cn/dataGis/static/gridgis/"; + + /** + * 处理历史降水数据 + * @param params 参数列表 + * time:时间戳 20201127093100 + * needLSB:1 + * lat:经度 站点 + * lon:纬度 站点 + * dataType:CMPA_PRE + * url:HISTORICAL_PRECIPITION_URL + */ + public static String historyDataHandler(Map params){ + // 数据 + String data = getWeatherData(params); + + // 建立treeJson + try { + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(data); + // 根据路径获取数据 + JsonNode dsNdoe = jsonNode.path("data"); + // 获取数据 + if (dsNdoe == null){ + log.info("无数据"); + return null; + } + for (int i = 0; i < dsNdoe.size(); i++) { + JsonNode node = dsNdoe.get(i); + if ("PRE_10MIN_24HOUR".equals(node.path("fastEle").asText())){ + return node.path("value").asText(); + } + } + } catch (JsonProcessingException e) { + log.info("转化Json失败{}", (Object) e.getStackTrace()); + } + return null; + } + + /** + * 处理预报降水 + * @param params 参数列表 + * staId:站点ID + * funitemmenuid:1150101020 + * typeCode:NWST + * url:FORECAST_PERCIPITION_URL + */ + public static Map forecastDataHandler(Map params){ + + Map map = new HashMap<>(3); + + // 获取日期 + LocalDate localDate = LocalDate.now(); + // 数据 + String data = getWeatherData(params); + if (data.trim().isEmpty()){ + log.info("无数据"); + return null; + } + + // 建立treeJson + try { + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(data); + // 根据路径获取数据 + JsonNode dsNdoe = jsonNode.path("list").get(0); + final int rainDay = 3; + // 获取数据 + for (int j = 0; j < rainDay; j++) { + + String time = dateToStringNoLine(localDate.plusDays(j)); + String time1 = dateToStringNoLine(localDate.plusDays(j + 1)); + + float rain = 0; + if (dsNdoe == null){ + log.info("dsNode没有数据"); + return null; + } + for (int i = 0; i < dsNdoe.size(); i++) { + JsonNode node = dsNdoe.get(i); + if (node.get(0).asText().trim().isEmpty() || node.get(0).asText().length() != 0){ + if (node.get(0).asText().contains(time) || node.get(0).asText().contains(time1 + "000000")){ + rain += Float.parseFloat(node.get(1).asText()); + } + } + } + String rains = String.valueOf(rain); + map.put(time,rains); + } + + return map; + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 获取数据 + * @param params 数据列表 + */ + private static String getWeatherData(Map params){ + int connTimes = 5; + boolean isSuccess = false; + + String urlWithParam = urlWithParam(params); + StringBuffer data = new StringBuffer(); + + while(!isSuccess && connTimes > 0){ + try { + URL url = new URL(urlWithParam); + URLConnection conn = url.openConnection(); + + + InputStream is = conn.getInputStream(); + InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8); + BufferedReader br = new BufferedReader(isr); + String line = null; + + while((line = br.readLine()) != null){ + data.append(line); + } + String datas = data.toString(); + + is.close(); + isr.close(); + br.close(); + if (datas.contains("503 Service Temporarily Unavailable")){ + log.info("数据错误"); + connTimes --; + try { + Thread.sleep(20000); + } catch (InterruptedException ex) { + log.info("睡眠错误{}", (Object) ex.getStackTrace()); + } + } + isSuccess = true; + } catch (IOException e) { + log.info("降水连接超时"); + connTimes --; + try { + Thread.sleep(20000); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } + } + + return data.toString(); + } + + + /** + * 路径加上参数 + * @param params 参数列表 + */ + private static String urlWithParam(Map params){ + final String url = "url"; + + // 拼接字符串 + StringBuffer urlAddParam = new StringBuffer(); + urlAddParam.append(params.get("url")); + urlAddParam.append("?"); + params.forEach((k,v) ->{ + if (!url.equals(k)){ + urlAddParam.append(k); + urlAddParam.append("="); + urlAddParam.append(v); + urlAddParam.append("&"); + } + }); + String urlWithParam = urlAddParam.toString(); + final String endWith = "&"; + if (urlWithParam.endsWith(endWith)){ + urlWithParam = urlWithParam.substring(0,urlWithParam.length()-1); + } + log.info(urlWithParam); + return urlWithParam; + } + + /** + * 获取降水预报 + * @param params 参数列表 + * staId:站点ID + * funitemmenuid:1150101020 + * typeCode:NWST + * url:FORECAST_PERCIPITION_URL + */ + public static String getRealTimeRain(Map params){ + + // 成功标志 + boolean isSuccess = false; + // 尝试次数 + int connTimes = 10; + + // 创建响应对象 + CloseableHttpResponse response = null; + String line = null; + String sLine = null; + + String json = null; + + while(!isSuccess && connTimes > 0){ + // 创建http对象 + RequestConfig defaultRequestConfig = RequestConfig.custom() + .setSocketTimeout(60000).setConnectTimeout(60000) + .setConnectionRequestTimeout(60000) + .build(); + CloseableHttpClient client = HttpClients.custom() + .setDefaultRequestConfig(defaultRequestConfig).build(); + + // 创建并设置URI + URIBuilder uri = null; + // 创建Get请求 + HttpGet get = null; + String url = ""; + + try { + url = urlWithParam(params); + uri = new URIBuilder(url); + get = new HttpGet(uri.build()); + // 设置请求头 + get.setHeader("Accept" + , "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + get.setHeader("Accept-Encoding" + , "gzip, deflate"); + get.setHeader("Accept-Language" + , "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6"); + get.setHeader("Connection" + , "keep-alive"); + get.setHeader("Cache-Control" + , "no-cache"); + get.setHeader("Host" + , "data.cma.cn"); + get.setHeader("Upgrade-Insecure-Requests" + , "1"); + get.setHeader("Cookie", COOKIE); + get.setHeader("User-Agent", USER_AGENT); + get.setHeader("Referer", REFERER); + } catch (Exception e) { + log.info("{}", (Object) e.getStackTrace()); + } + + //发送请求 + HttpEntity entity = null; + InputStream is = null; + BufferedReader br = null; + try { + response = client.execute(get); + // 获取请求结果 + entity = response.getEntity(); + is = entity.getContent(); + br = new BufferedReader( + new InputStreamReader(is, StandardCharsets.UTF_8) + ); + StringBuffer sb = new StringBuffer(); + while((line = br.readLine()) != null){ + sb.append(line); + sb.append("/n"); + } + sLine = sb.toString(); + if (sLine.contains("503 Service Temporarily Unavailable")){ + log.info("数据出错"); + connTimes --; + closeConn(is,br,response,client); + Thread.sleep(30000); + continue; + } + sLine = sLine.substring(sLine.indexOf("{")); + sLine = sLine.substring(0,sLine.length()-2); + if (sLine.contains("503 Service Temporarily Unavailable")){ + return null; + } + ObjectMapper objectMapper = new ObjectMapper(); + //使用ObjectMapper对象对 User对象进行转换 + try { + json = objectMapper.writeValueAsString(sLine); + } catch (JsonProcessingException e) { + log.info("json字符串转化异常{}", (Object) e.getStackTrace()); + } + // ObjectMapper objectMapper = new ObjectMapper(); + isSuccess = true; + } catch (ClientProtocolException e) { + // TODO Auto-generated catch block + log.info("请求超时等问题{}", (Object) e.getStackTrace()); + + }catch (IOException e) { + log.info("I/O问题{}", (Object) e.getStackTrace()); + } catch (InterruptedException e) { + log.info("中断异常{}", (Object) e.getStackTrace()); + } finally { + closeConn(is,br,response,client); + } + } + return json; + } + + /** + * 关闭连接 + * @param is InputStream + * @param br BufferedReader + * @param response CloseableHttpResponse + * @param client CloseableHttpClient + */ + private static void closeConn(InputStream is, BufferedReader br, CloseableHttpResponse response, CloseableHttpClient client ){ + try { + if (null != is){ + is.close(); + } + if (null != br){ + br.close(); + } + if (null != response){ + response.close(); + } + if (null != client){ + client.close(); + } + + } catch (IOException e) { + log.info("IO异常{}", (Object) e.getStackTrace()); + } + } + + public static void main(String[] args) { + // 历史降水 + Map hisParams = new HashMap<>(6); + // 当前时间戳 + hisParams.put("time","20201127100400"); + // 站点经纬度 + hisParams.put("lat","36.9700"); + hisParams.put("lon","120.7300"); + hisParams.put("needLSB","1"); + hisParams.put("dataType","CMPA_PRE"); + hisParams.put("url",HISTORICAL_PRECIPITION_URL); + + historyDataHandler(hisParams); + // 预报降水 + Map foreParams = new HashMap<>(4); + // 站点id + foreParams.put("stationId",""); + foreParams.put("funitemmenuid","1150101020"); + foreParams.put("typeCode","NWST"); + foreParams.put("url",FORECAST_PERCIPITION_URL); + forecastDataHandler(foreParams); + + } +} diff --git a/src/main/java/com/xkrs/microservice/common/tool/TokenUtil.java b/src/main/java/com/xkrs/microservice/common/tool/TokenUtil.java new file mode 100644 index 0000000..dc0fe80 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/tool/TokenUtil.java @@ -0,0 +1,52 @@ +package com.xkrs.microservice.common.tool; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.security.Keys; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.AuthorityUtils; + +import javax.crypto.SecretKey; +import java.util.List; + +/** + * token工具 + * @author tajochen + */ +public class TokenUtil { + /** + * Token前缀 + */ + private static final String TOKEN_PREFIX = "Bearer"; + + private static final String SECRETKEY = "0Y9H364Q9Y908262F25LMXGIKIN5N858XM3674GWL2DD8X1DS4W6I722IRY8PS4XPNB6U30" + + "345HBVCUL94STG8C3Z53T7A09JJ100I56YE9894CI11PX9J71HIZ8L5Y2O504C4E2K8276425UA8734833F45K36878FXAG799QV9L" + + "XUJOI3XA2046UPG8TB2OT84R5T6ZB127N9ZPJ7AJMC41JVHB2WK2B6H8NL45LZNAZ666KHZH3QUT65UX6F8"; + + static SecretKey key = Keys.hmacShaKeyFor(SECRETKEY.getBytes()); + + public static String getTokenUserName(String token) { + String userName = ""; + if (token != null) { + try { + // 解析 Token + Claims claims = Jwts.parserBuilder() + .setSigningKey(key).build() + // 去掉 Bearer + .parseClaimsJws(token.replace(TOKEN_PREFIX, "")) + .getBody(); + // 获取用户名 + userName = claims.getSubject(); + // 获取权限 + List authorities = AuthorityUtils. + commaSeparatedStringToAuthorityList((String) claims.get("auths")); + } catch(Exception e) { + // the sub field was missing or did not have a 'jsmith' value + return null; + } + } else { + return null; + } + return userName; + } +} diff --git a/src/main/java/com/xkrs/microservice/common/tool/WeatherGet.java b/src/main/java/com/xkrs/microservice/common/tool/WeatherGet.java new file mode 100644 index 0000000..3d2dfb4 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/common/tool/WeatherGet.java @@ -0,0 +1,97 @@ +package com.xkrs.microservice.common.tool; + +import com.xkrs.microservice.dao.WeatherDao; +import com.xkrs.microservice.model.entity.WeatherEntity; +import com.xkrs.microservice.util.RequestUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author XinYi Song + */ +@Component +public class WeatherGet { + + public static Logger log = LoggerFactory.getLogger(WeatherGet.class); + + @Resource + private WeatherDao weatherDao; + + @CacheEvict(value = "WeatherServiceCache",allEntries = true) + public void findWeather(){ + // 请求登录接口拿到token + String login = "http://47.105.215.208:8005/login"; + String json1 = "{\n" + + " \"username\":\"5281652\",\n" + + " \"password\":\"123456\"\n" + + "}"; + String s = RequestUtil.doPostJson(login, json1); + Map map1 = JackSonTool.json2map(s); + String token = (String) map1.get("token"); + + String getData = "http://47.105.215.208:8005/intfa/queryData/16079680"; + Map map = new HashMap(3); + String s1 = RequestUtil.doGet(getData, map, token); + Map map2 = JackSonTool.json2map(s1); + List data1 = (List) map2.get("entity"); + if(data1 == null || data1.size() == 0){ + log.info("----+" + "结束当前方法"); + return; + }else { + log.info("-----------开始数据入库"); + WeatherEntity weatherEntity = new WeatherEntity(); + weatherEntity.setAddTime(data1.get(0).get("datetime").toString()); + // 风速 + weatherEntity.setWindSpeed(data1.get(0).get("eValue").toString()); + // 雨量累计 + weatherEntity.setRainfall(data1.get(1).get("eValue").toString()); + // 大气温度 + weatherEntity.setAtmosphericTemperature(data1.get(2).get("eValue").toString()); + // 大气湿度 + weatherEntity.setAtmosphericHumidity(data1.get(3).get("eValue").toString()); + // 数字气压 + weatherEntity.setDigitalAirPressure(data1.get(4).get("eValue").toString()); + // 太阳总辐射 + weatherEntity.setTotalSolarRadiation(data1.get(5).get("eValue").toString()); + // 风向 + weatherEntity.setWindDirection(data1.get(6).get("eValue").toString()); + // 辐射累计 + weatherEntity.setRadiationAccumulation(data1.get(7).get("eValue").toString()); + // 土温1 + weatherEntity.setSoilTemperatureOne(data1.get(8).get("eValue").toString()); + // 土湿1 + weatherEntity.setSoilWetOne(data1.get(9).get("eValue").toString()); + // 土温2 + weatherEntity.setSoilTemperatureTwo(data1.get(10).get("eValue").toString()); + // 土湿2 + weatherEntity.setSoilWetTwo(data1.get(11).get("eValue").toString()); + // 土温3 + weatherEntity.setSoilTemperatureThree(data1.get(12).get("eValue").toString()); + // 土湿3 + weatherEntity.setSoilWetThree(data1.get(13).get("eValue").toString()); + // 土温4 + weatherEntity.setSoilTemperatureFour(data1.get(14).get("eValue").toString()); + // 土湿4 + weatherEntity.setSoilWetFour(data1.get(15).get("eValue").toString()); + // ph值 + weatherEntity.setPhValue(data1.get(16).get("eValue").toString()); + // 日照时数 + weatherEntity.setSunshineHours(data1.get(17).get("eValue").toString()); + // 二氧化碳 + weatherEntity.setCarbonDioxide(data1.get(18).get("eValue").toString()); + // 盐分 + weatherEntity.setSalt(data1.get(19).get("eValue").toString()); + + weatherDao.save(weatherEntity); + } + + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/AppManageController.java b/src/main/java/com/xkrs/microservice/controller/AppManageController.java new file mode 100644 index 0000000..310dc00 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/AppManageController.java @@ -0,0 +1,101 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.FileAppEntity; +import com.xkrs.microservice.model.qo.AppFileQo; +import com.xkrs.microservice.model.validation.AppFileQoInsert; +import com.xkrs.microservice.model.vo.FileServerResultVo; +import com.xkrs.microservice.service.AppManageService; +import com.xkrs.microservice.service.FileServerService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Locale; +import java.util.Optional; +import java.util.regex.Pattern; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; + +/** + * App 管理服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/app-file") +public class AppManageController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private AppManageService appManageService; + + @Resource + private FileServerService fileServerService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + public String getAllAppFiles() { + Iterable list = appManageService.getAllFile(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/new-version",method = RequestMethod.GET) + @CrossOrigin + public String appFileGetNew(@RequestParam("versionNumber") String versionNumber){ + String pattern = "^([1-9]\\d|[1-9])(.([1-9]\\d|\\d)){2}$"; + boolean isMatch = Pattern.matches(pattern, versionNumber); + if(!isMatch){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"版本号错误",locale); + } + Iterable list = appManageService.checkLastVersionNumber(versionNumber); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String appFileAdd(@Validated({AppFileQoInsert.class}) @RequestBody AppFileQo appFileQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 检查版本号是否存在 + Iterable appFileEntityIterable = appManageService.getByVersionNumber(appFileQo.getVersionNumber()); + for (FileAppEntity o : appFileEntityIterable) { + if(o!=null){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"重复的版本号",locale); + } + } + // 获取当前用户名 + String userName = getTokenUserName(token); + appManageService.add(appFileQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String appFileDelete(@RequestParam("id") Integer id) { + Optional sf = appManageService.getById(id); + if(sf.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"指定id文件不存在",locale); + } + try { + FileServerResultVo fileServerResultVo = fileServerService.deleteFile(sf.get().getMd5(),""); + appManageService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,fileServerResultVo,locale); + } catch (Exception e) { + e.printStackTrace(); + return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"文件服务器出错",locale); + } + } +} diff --git a/src/main/java/com/xkrs/microservice/controller/CacheController.java b/src/main/java/com/xkrs/microservice/controller/CacheController.java new file mode 100644 index 0000000..8ade5a5 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/CacheController.java @@ -0,0 +1,38 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.service.CacheService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Locale; + + +/** + * 缓存测试服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/cache") +public class CacheController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private CacheService cacheService; + + @GetMapping("/get/test-name") + public String findByNickName(@RequestParam(value="testName", required=false) String testName) + { + return cacheService.findByTestName(testName); + } + + @GetMapping("/set/test-name") + public String setNickName(@RequestParam(value="testName", required=false) String testName) + { + return cacheService.setTestName(testName); + } +} diff --git a/src/main/java/com/xkrs/microservice/controller/CropClassifyRecordController.java b/src/main/java/com/xkrs/microservice/controller/CropClassifyRecordController.java new file mode 100644 index 0000000..08d992f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/CropClassifyRecordController.java @@ -0,0 +1,109 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.CropClassifyRecordEntity; +import com.xkrs.microservice.model.qo.CropClassifyRecordQo; +import com.xkrs.microservice.model.validation.CropClassifyRecordQoInsert; +import com.xkrs.microservice.service.CropClassifyRecordService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; + +/** + * 作物种植记录数据服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/crop-classify-record") +public class CropClassifyRecordController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private CropClassifyRecordService cropClassifyRecordService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + @CrossOrigin + public String getCropClassifyAllRecord() { + Iterable list = cropClassifyRecordService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/admcode",method = RequestMethod.GET) + @CrossOrigin + public String getCropClassifyByAdmCode(@RequestParam("admCode") Integer admCode) { + Iterable list = cropClassifyRecordService.getByAdmCode(admCode); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/towncode/date",method = RequestMethod.GET) + @CrossOrigin + public String getCropClassifyByTownCode(@RequestParam("townCode") String townCode, + @RequestParam("startDateTs") Long startDateTs, + @RequestParam("endDateTs") Long endDateTs) { + if(startDateTs > endDateTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDate sTime = timeMillisToDate(startDateTs); + LocalDate eTime = timeMillisToDate(endDateTs); + Iterable list = cropClassifyRecordService.getByTownCodeAndDate(townCode,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/admcode/date",method = RequestMethod.GET) + @CrossOrigin + public String getCropClassifyByAdmCodeAndDate(@RequestParam("admCode") Integer admCode, + @RequestParam("startDateTs") Long startDateTs, + @RequestParam("endDateTs") Long endDateTs) { + if(startDateTs > endDateTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDate sTime = timeMillisToDate(startDateTs); + LocalDate eTime = timeMillisToDate(endDateTs); + Iterable list = cropClassifyRecordService.getByAdmCodeAndDateTime(admCode,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String cropClassifyAdd(@Validated({CropClassifyRecordQoInsert.class}) @RequestBody CropClassifyRecordQo cropClassifyRecordQo, + BindingResult bindingResult, @RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + cropClassifyRecordService.add(cropClassifyRecordQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String cropClassifyDelete(@RequestParam("id") Integer id) { + Optional cropClassifyRecordEntity = cropClassifyRecordService.getById(id); + if(cropClassifyRecordEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + cropClassifyRecordService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/DicBusinessServiceController.java b/src/main/java/com/xkrs/microservice/controller/DicBusinessServiceController.java new file mode 100644 index 0000000..753423a --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/DicBusinessServiceController.java @@ -0,0 +1,61 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.*; +import com.xkrs.microservice.service.DicBusinessService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Locale; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; + + +/** + * 系统用户Controller + * @author tajocehn + */ +@RestController +@RequestMapping(value = "/api/data") +public class DicBusinessServiceController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private DicBusinessService dicBusinessService; + + @RequestMapping(value="/get/soil-classify/all", method = RequestMethod.GET) + public String getAllSoilClassify(){ + Iterable res = dicBusinessService.getAllSoilClassify(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + + @RequestMapping(value="/get/crop-classify/all", method = RequestMethod.GET) + public String getAllCropClassify(){ + Iterable res = dicBusinessService.getAllCropClassify(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + + @RequestMapping(value="/get/drought-classify/all", method = RequestMethod.GET) + public String getAllDroughtClassify(){ + Iterable res = dicBusinessService.getAllDroughtClassify(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + + @RequestMapping(value="/get/land-classify/all", method = RequestMethod.GET) + public String getAllLandClassify(){ + Iterable res = dicBusinessService.getAllLandClassify(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + + @RequestMapping(value="/get/product/all", method = RequestMethod.GET) + public String getAllProduct(){ + Iterable res = dicBusinessService.getAllProduct(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/FarmingInfoController.java b/src/main/java/com/xkrs/microservice/controller/FarmingInfoController.java new file mode 100644 index 0000000..bc639fa --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/FarmingInfoController.java @@ -0,0 +1,108 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.FarmingInfoEntity; +import com.xkrs.microservice.model.qo.FarmingInfoQo; +import com.xkrs.microservice.model.validation.FarmingInfoQoInsert; +import com.xkrs.microservice.service.FarmingInfoService; + +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; + +/** + * 农情信息表管理 + * @author tajochen + */ +@RestController +@RequestMapping("/api/farming-info") +public class FarmingInfoController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private FarmingInfoService farmingInfoService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + @CrossOrigin + public String getAllRecord() { + Iterable list = farmingInfoService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/dkbh",method = RequestMethod.GET) + @CrossOrigin + public String getByDkbh(@RequestParam("dkbh") String dkbh) { + Iterable list = farmingInfoService.getByDkbh(dkbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/qxbh",method = RequestMethod.GET) + @CrossOrigin + public String getByQxbh(@RequestParam("qxbh") Integer qxbh) { + Iterable list = farmingInfoService.getByQxbh(qxbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/zwdm",method = RequestMethod.GET) + @CrossOrigin + public String getByQxbhAndZwdm(@RequestParam("qxbh") Integer qxbh,@RequestParam("zwdm") Integer zwdm) { + Iterable list = farmingInfoService.getByZwdmAndQxbh(zwdm,qxbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/new",method = RequestMethod.GET) + @CrossOrigin + public String getNewByQxbh(@RequestParam("qxbh") Integer qxbh) { + Iterable list = farmingInfoService.getNewByQxbh(qxbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/user-name",method = RequestMethod.GET) + @CrossOrigin + public String getByUserName(@RequestParam("userName") String userName) { + Iterable list = farmingInfoService.getByUserName(userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor','auth_farm_user')") + @CrossOrigin + public String dataAdd(@Validated({FarmingInfoQoInsert.class}) @RequestBody FarmingInfoQo farmingInfoQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + farmingInfoService.add(farmingInfoQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String dataDelete(@RequestParam("id") Integer id) { + Optional typicalPlotEntity = farmingInfoService.getById(id); + if(typicalPlotEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + farmingInfoService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/FileDocumentController.java b/src/main/java/com/xkrs/microservice/controller/FileDocumentController.java new file mode 100644 index 0000000..43e80bc --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/FileDocumentController.java @@ -0,0 +1,82 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.FileDocumentEntity; +import com.xkrs.microservice.model.qo.FileDocumentQo; +import com.xkrs.microservice.model.validation.FileDocumentQoInsert; +import com.xkrs.microservice.model.vo.FileServerResultVo; +import com.xkrs.microservice.service.FileDocumentService; +import com.xkrs.microservice.service.FileServerService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; +import static com.xkrs.microservice.util.NumberUtil.isStrNumeric; + +/** + * 文档管理服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/document") +public class FileDocumentController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private FileDocumentService fileDocumentService; + + @Resource + private FileServerService fileServerService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + public String getAllFiles() { + Iterable list = fileDocumentService.getAllFile(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String fileUpload(@Validated({FileDocumentQoInsert.class}) @RequestBody FileDocumentQo fileDocumentQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + fileDocumentService.add(fileDocumentQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String fileDelete(@RequestParam("id") Integer id) { + Optional sf = fileDocumentService.getById(id); + if(sf.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"指定id文件不存在",locale); + } + try { + FileServerResultVo fileServerResultVo = fileServerService.deleteFile(sf.get().getMd5(),""); + fileDocumentService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,fileServerResultVo,locale); + } catch (Exception e) { + e.printStackTrace(); + return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"文件服务器出错",locale); + } + } +} diff --git a/src/main/java/com/xkrs/microservice/controller/FileServerController.java b/src/main/java/com/xkrs/microservice/controller/FileServerController.java new file mode 100644 index 0000000..d5e8f3d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/FileServerController.java @@ -0,0 +1,119 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.model.vo.FileServerResultVo; +import com.xkrs.microservice.service.FileServerService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Locale; + +/** + * 文件服务器管理服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/file") +public class FileServerController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private FileServerService fileServerService; + + /** + * 文件统计 + * @return + */ + @RequestMapping(value="/stat",method = RequestMethod.GET) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public FileServerResultVo getFileStat() { + return fileServerService.getFileStat(); + } + + /** + * 文件删除 + * @param md5 信息摘要 + * @param path 路径 + * @return + */ + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')") + @CrossOrigin + public FileServerResultVo deleteFile(@RequestParam(value = "md5",required = false) String md5, + @RequestParam(value = "path",required = false) String path) { + FileServerResultVo fileServerResultVo = new FileServerResultVo(); + boolean existed = (md5==null||md5.isEmpty())&&(path==null||path.isEmpty()); + if(existed){ + fileServerResultVo.setStatus("fail"); + fileServerResultVo.setData(""); + fileServerResultVo.setMessage("参数为空"); + return fileServerResultVo; + } + return fileServerService.deleteFile(md5,path); + } + + /** + * 获取文件信息 + * @param md5 信息摘要 + * @param path 路径 + * @return + */ + @RequestMapping(value="/get/info",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')") + @CrossOrigin + public FileServerResultVo getFileInfo(@RequestParam(value = "md5",required = false) String md5, + @RequestParam(value = "path",required = false) String path) { + boolean existed = (md5==null||md5.isEmpty())&&(path==null||path.isEmpty()); + if(existed){ + FileServerResultVo fileServerResultVo = new FileServerResultVo<>(); + fileServerResultVo.setStatus("fail"); + fileServerResultVo.setData(""); + fileServerResultVo.setMessage("参数为空"); + return fileServerResultVo; + } + return fileServerService.getFileInfo(md5,path); + } + + /** + * 获取文件列表 + * @param dir 文件夹 + * @return + */ + @RequestMapping(value="/get/list",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')") + @CrossOrigin + public FileServerResultVo getFileList(@RequestParam(value = "dir") String dir) { + return fileServerService.getFileList(dir); + } + + /** + * 修复统计信息 + * @param date 要修复的日期,格式如:20190725 + * @return + */ + @RequestMapping(value="/get/repair-stat",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')") + @CrossOrigin + public FileServerResultVo getFileRepairStat(@RequestParam(value = "date") String date) { + return fileServerService.getFileRepairStat(date); + } + + /** + * 同步失败修复 + * @param force 是否强行修复(0|1) + * @return + */ + @RequestMapping(value="/get/repair",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')") + @CrossOrigin + public FileServerResultVo getFileRepair(@RequestParam(value = "force") String force) { + return fileServerService.getFileRepair(force); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/HelloController.java b/src/main/java/com/xkrs/microservice/controller/HelloController.java new file mode 100644 index 0000000..1022dc2 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/HelloController.java @@ -0,0 +1,34 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +import java.util.Locale; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * HelloController + * @author tajochen + */ +@RestController +public class HelloController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + /** + * 返回类型为Mono + * @return + */ + @GetMapping("/hello") + public Mono hello() { + // 【改】使用Mono.just生成响应式数据 + return Mono.just(outputEncapsulationObject(PromptMessageEnum.SUCCESS,"Welcome to reactive world ~",locale)); + } +} diff --git a/src/main/java/com/xkrs/microservice/controller/HydrologicalStationController.java b/src/main/java/com/xkrs/microservice/controller/HydrologicalStationController.java new file mode 100644 index 0000000..a4d3930 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/HydrologicalStationController.java @@ -0,0 +1,74 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.HydrologicalStationEntity; +import com.xkrs.microservice.model.qo.HydrologicalStationQo; +import com.xkrs.microservice.model.validation.HydrologicalStationQoInsert; +import com.xkrs.microservice.service.HydrologicalStationService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.Locale; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToTime; + +/** + * 水文站点数据服务管理 + * @author tajochen + */ +@RestController +@RequestMapping("/api/hydrological-station") +public class HydrologicalStationController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private HydrologicalStationService hydrologicalStationService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + public String getAllFiles() { + Iterable list = hydrologicalStationService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/time",method = RequestMethod.GET) + public String getByTime(@RequestParam("sTimeTs") Long sTimeTs,@RequestParam("eTimeTs") Long eTimeTs) { + LocalDateTime sTime = timeMillisToTime(sTimeTs); + LocalDateTime eTime = timeMillisToTime(eTimeTs); + Iterable list = hydrologicalStationService.getByTime(sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @CrossOrigin + public String addRecord(@Validated({HydrologicalStationQoInsert.class}) @RequestBody HydrologicalStationQo hydrologicalStationQo, + BindingResult bindingResult) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + hydrologicalStationService.add(hydrologicalStationQo); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String deleteRecord(@RequestParam("id") Integer id) { + int res = hydrologicalStationService.delete(id); + if(res!=0){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"id 不存在",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } +} diff --git a/src/main/java/com/xkrs/microservice/controller/IndependentCheckController.java b/src/main/java/com/xkrs/microservice/controller/IndependentCheckController.java new file mode 100644 index 0000000..91decfe --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/IndependentCheckController.java @@ -0,0 +1,87 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.IndependentCheckEntity; +import com.xkrs.microservice.model.qo.IndependentCheckQo; +import com.xkrs.microservice.model.validation.IndependentCheckQoInsert; +import com.xkrs.microservice.service.IndependentCheckService; + +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; + +/** + * 自主核查表管理 + * @author tajochen + */ +@RestController +@RequestMapping("/api/independent-check") +public class IndependentCheckController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private IndependentCheckService independentCheckService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + @CrossOrigin + public String getAllRecord() { + Iterable list = independentCheckService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/qxdm",method = RequestMethod.GET) + @CrossOrigin + public String getByCountyCode(@RequestParam("qxdm") Integer qxdm) { + Iterable list = independentCheckService.getByCountyCode(qxdm); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/user-name",method = RequestMethod.GET) + @CrossOrigin + public String getByUserName(@RequestParam("userName") String userName) { + Iterable list = independentCheckService.getByUserName(userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String dataAdd(@Validated({IndependentCheckQoInsert.class}) @RequestBody IndependentCheckQo independentCheckQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + independentCheckService.add(independentCheckQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String dataDelete(@RequestParam("id") Integer id) { + Optional independentCheckEntity = independentCheckService.getById(id); + if(independentCheckEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + independentCheckService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/IrrigationCheckController.java b/src/main/java/com/xkrs/microservice/controller/IrrigationCheckController.java new file mode 100644 index 0000000..9796602 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/IrrigationCheckController.java @@ -0,0 +1,117 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.IrrigationCheckEntity; +import com.xkrs.microservice.model.qo.IrrigationCheckQo; +import com.xkrs.microservice.model.validation.IrrigationCheckQoInsert; +import com.xkrs.microservice.service.IrrigationCheckService; + +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToTime; + +/** + * 灌溉核查表管理 + * @author tajochen + */ +@RestController +@RequestMapping("/api/irrigation-check") +public class IrrigationCheckController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private IrrigationCheckService irrigationCheckService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + @CrossOrigin + public String getAllRecord() { + Iterable list = irrigationCheckService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/ggbh",method = RequestMethod.GET) + @CrossOrigin + public String getByGgbh(@RequestParam("ggbh") String ggbh) { + Optional list = irrigationCheckService.getByGgbh(ggbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/qxbh",method = RequestMethod.GET) + @CrossOrigin + public String getQxbh(@RequestParam("qxbh") Integer qxbh) { + Iterable list = irrigationCheckService.getByQxbh(qxbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/dkbh",method = RequestMethod.GET) + @CrossOrigin + public String getByDkbh(@RequestParam("dkbh") String dkbh) { + Iterable list = irrigationCheckService.getByDkbh(dkbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/time",method = RequestMethod.GET) + @CrossOrigin + public String getByQxbhAndCreateTimeBetween(@RequestParam("qxdm") Integer qxdm,@RequestParam("sTimeTs") Long sTimeTs,@RequestParam("eTimeTs") Long eTimeTs) { + if(sTimeTs > eTimeTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDateTime sTime = timeMillisToTime(sTimeTs); + LocalDateTime eTime = timeMillisToTime(eTimeTs); + Iterable list = irrigationCheckService.getByQxbhAndCreateTimeBetween(qxdm,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/user-name",method = RequestMethod.GET) + @CrossOrigin + public String getByUserName(@RequestParam("userName") String userName) { + Iterable list = irrigationCheckService.getByUserName(userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String dataAdd(@Validated({IrrigationCheckQoInsert.class}) @RequestBody IrrigationCheckQo irrigationCheckQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + irrigationCheckService.add(irrigationCheckQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String dataDelete(@RequestParam("id") Integer id) { + Optional typicalPlotIrrigationEntity = irrigationCheckService.getById(id); + if(typicalPlotIrrigationEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + irrigationCheckService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/IrrigationRecordController.java b/src/main/java/com/xkrs/microservice/controller/IrrigationRecordController.java new file mode 100644 index 0000000..ba91c0c --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/IrrigationRecordController.java @@ -0,0 +1,109 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.IrrigationRecordEntity; +import com.xkrs.microservice.model.qo.IrrigationRecordQo; +import com.xkrs.microservice.model.validation.IrrigationRecordQoInsert; +import com.xkrs.microservice.service.IrrigationRecordService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; + +/** + * 灌溉记录数据服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/irrigation-record") +public class IrrigationRecordController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private IrrigationRecordService irrigationRecordService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + @CrossOrigin + public String getIrrigationAllRecord() { + Iterable list = irrigationRecordService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/admcode",method = RequestMethod.GET) + @CrossOrigin + public String getIrrigationByAdmCode(@RequestParam("admCode") Integer admCode) { + Iterable list = irrigationRecordService.getByAdmCode(admCode); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/towncode/date",method = RequestMethod.GET) + @CrossOrigin + public String getIrrigationByTownCode(@RequestParam("townCode") String townCode, + @RequestParam("startDateTs") Long startDateTs, + @RequestParam("endDateTs") Long endDateTs) { + if(startDateTs > endDateTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDate sTime = timeMillisToDate(startDateTs); + LocalDate eTime = timeMillisToDate(endDateTs); + Iterable list = irrigationRecordService.getByTownCodeAndDate(townCode,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/admcode/date",method = RequestMethod.GET) + @CrossOrigin + public String getIrrigationByAdmCodeAndDate(@RequestParam("admCode") Integer admCode, + @RequestParam("startDateTs") Long startDateTs, + @RequestParam("endDateTs") Long endDateTs) { + if(startDateTs > endDateTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDate sTime = timeMillisToDate(startDateTs); + LocalDate eTime = timeMillisToDate(endDateTs); + Iterable list = irrigationRecordService.getByAdmCodeAndDateTime(admCode,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String irrigationAdd(@Validated({IrrigationRecordQoInsert.class}) @RequestBody IrrigationRecordQo irrigationRecordQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + irrigationRecordService.add(irrigationRecordQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String irrigationDelete(@RequestParam("id") Integer id) { + Optional irrigationRecordEntity = irrigationRecordService.getById(id); + if(irrigationRecordEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + irrigationRecordService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/IrrigationSarRecordController.java b/src/main/java/com/xkrs/microservice/controller/IrrigationSarRecordController.java new file mode 100644 index 0000000..5c86492 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/IrrigationSarRecordController.java @@ -0,0 +1,123 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.IrrigationSarRecordEntity; +import com.xkrs.microservice.model.qo.IrrigationSarRecordQo; +import com.xkrs.microservice.model.validation.IrrigationSarRecordQoInsert; +import com.xkrs.microservice.service.IrrigationSarRecordService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; + +/** + * 灌溉Sar记录数据服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/irrigation-sar-record") +public class IrrigationSarRecordController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private IrrigationSarRecordService irrigationSarRecordService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + @CrossOrigin + public String getIrrigationAllRecord() { + Iterable list = irrigationSarRecordService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/admcode",method = RequestMethod.GET) + @CrossOrigin + public String getIrrigationByAdmCode(@RequestParam("admCode") Integer admCode) { + Iterable list = irrigationSarRecordService.getByAdmCode(admCode); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/towncode/date",method = RequestMethod.GET) + @CrossOrigin + public String getIrrigationByTownCode(@RequestParam("townCode") String townCode, + @RequestParam("startDateTs") Long startDateTs, + @RequestParam("endDateTs") Long endDateTs) { + if(startDateTs > endDateTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDate sTime = timeMillisToDate(startDateTs); + LocalDate eTime = timeMillisToDate(endDateTs); + Iterable list = irrigationSarRecordService.getByTownCodeAndDate(townCode,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/condition",method = RequestMethod.GET) + @CrossOrigin + public String getCondition(@RequestParam("townCode") String townCode, + @RequestParam("startDateTs") Long startDateTs, + @RequestParam("endDateTs") Long endDateTs) { + if(startDateTs > endDateTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDate sTime = timeMillisToDate(startDateTs); + LocalDate eTime = timeMillisToDate(endDateTs); + Iterable list = irrigationSarRecordService.geAllByCondition(townCode,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/admcode/date",method = RequestMethod.GET) + @CrossOrigin + public String getIrrigationByAdmCodeAndDate(@RequestParam("admCode") Integer admCode, + @RequestParam("startDateTs") Long startDateTs, + @RequestParam("endDateTs") Long endDateTs) { + if(startDateTs > endDateTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDate sTime = timeMillisToDate(startDateTs); + LocalDate eTime = timeMillisToDate(endDateTs); + Iterable list = irrigationSarRecordService.getByAdmCodeAndDateTime(admCode,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String irrigationAdd(@Validated({IrrigationSarRecordQoInsert.class}) @RequestBody IrrigationSarRecordQo irrigationSarRecordQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + irrigationSarRecordService.add(irrigationSarRecordQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String irrigationDelete(@RequestParam("id") Integer id) { + Optional irrigationRecordEntity = irrigationSarRecordService.getById(id); + if(irrigationRecordEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + irrigationSarRecordService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/ShpAdmController.java b/src/main/java/com/xkrs/microservice/controller/ShpAdmController.java new file mode 100644 index 0000000..9349e16 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/ShpAdmController.java @@ -0,0 +1,93 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.vo.ShpCityVo; +import com.xkrs.microservice.model.vo.ShpCountyVo; +import com.xkrs.microservice.service.AdministrativeDivisionService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.Locale; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.util.NumberUtil.isStrAdmCode; + +/** + * 行政区划服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/adm") +public class ShpAdmController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private AdministrativeDivisionService administrativeDivisionService; + + @RequestMapping(value="/city/get/all",method = RequestMethod.GET) + public String getAllCity() { + Iterable list = administrativeDivisionService.getAllCity(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/city/get/province-code",method = RequestMethod.GET) + public String getAllCityByProvinceCode(@RequestParam(value="provinceCode") String provinceCode) { + if(!isStrAdmCode(provinceCode)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + Iterable list = administrativeDivisionService.getAllCityByProvinceCode(Integer.valueOf(provinceCode)); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/city/get/city-code",method = RequestMethod.GET) + public String getAllCityCityCode(@RequestParam(value="cityCode") String cityCode) { + if(!isStrAdmCode(cityCode)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + ShpCityVo res = administrativeDivisionService.getCityByCityCode(Integer.valueOf(cityCode)); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + + @RequestMapping(value="/county/get/all",method = RequestMethod.GET) + public String getAllCounty() { + Iterable list = administrativeDivisionService.getAllCounty(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/county/get/province-code",method = RequestMethod.GET) + public String getAllCountyByProvinceCode(@RequestParam(value="provinceCode") String provinceCode) { + if(!isStrAdmCode(provinceCode)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + Iterable list = administrativeDivisionService.getAllCountyByProvinceCode( + Integer.valueOf(provinceCode)); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/county/get/city-code",method = RequestMethod.GET) + public String getAllCountyByCityCode(@RequestParam(value="cityCode") String cityCode) { + if(!isStrAdmCode(cityCode)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + Iterable list = administrativeDivisionService.getAllCountyByCityCode(Integer.valueOf(cityCode)); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/county/get/county-code",method = RequestMethod.GET) + public String getAllCountyByCountyCode(@RequestParam(value="countyCode") String countyCode) { + if(!isStrAdmCode(countyCode)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + ShpCountyVo res = administrativeDivisionService.getCountyByCountyCode(Integer.valueOf(countyCode)); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/SysManageController.java b/src/main/java/com/xkrs/microservice/controller/SysManageController.java new file mode 100644 index 0000000..0d8d4a9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/SysManageController.java @@ -0,0 +1,56 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import nl.basjes.parse.useragent.UserAgent; +import nl.basjes.parse.useragent.UserAgentAnalyzer; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Locale; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * 系统管理测试服务 + * @author tajochen + */ +@RestController +@RequestMapping(value = "/api") +public class SysManageController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @RequestMapping(value="/hello/role",method = RequestMethod.GET) + @PreAuthorize("hasAnyRole('role_administor','role_system_manager')") + public String hello() { + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"hello vip",locale); + } + + @RequestMapping(value="/hello/auth",method = RequestMethod.GET) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user')") + public String world() { + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"world",locale); + } + + @RequestMapping(value="/greeting",method = RequestMethod.GET) + public String greeting(@RequestParam(required=false, defaultValue="World") String name, + @RequestHeader(value="User-Agent") String userAgent) { + System.out.println("==== in greeting ===="); + System.out.println(userAgent); + UserAgentAnalyzer uaa = UserAgentAnalyzer + .newBuilder() + .hideMatcherLoadStats() + .withCache(10000) + .build(); + + UserAgent agent = uaa.parse(userAgent); + for (String fieldName: agent.getAvailableFieldNamesSorted()) { + System.out.println(fieldName + " = " + agent.getValue(fieldName)); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,name,locale); + } +} diff --git a/src/main/java/com/xkrs/microservice/controller/SysUserController.java b/src/main/java/com/xkrs/microservice/controller/SysUserController.java new file mode 100644 index 0000000..b474b8a --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/SysUserController.java @@ -0,0 +1,195 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.SysRoleEntity; +import com.xkrs.microservice.model.qo.SysUserQo; +import com.xkrs.microservice.model.validation.SysUserQoInsert; +import com.xkrs.microservice.model.vo.SysUserVo; +import com.xkrs.microservice.service.SysRoleService; +import com.xkrs.microservice.service.SysUserService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import java.util.List; +import java.util.Locale; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; +import static com.xkrs.microservice.util.NumberUtil.isStrNumeric; + +/** + * 系统用户Controller + * @author tajocehn + */ +@RestController +@RequestMapping(value = "/api/user") +public class SysUserController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private SysUserService sysUserService; + + @Resource + private SysRoleService sysRoleService; + + /** + * 登录用户Token验证 + * @return + */ + @RequestMapping(value = "/logged/check",method = RequestMethod.POST) + public String loginUserTokenCheck(){ + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value = "/check/duplicate", method = RequestMethod.GET) + public String checkDuplicate(@RequestParam(value="userName", required=false) String userName){ + // 验证用户名是否重复 + if(!sysUserService.checkUserName(userName)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale); + } + + @RequestMapping(value = "/add", method = RequestMethod.POST) + public String addUser(@Validated({SysUserQoInsert.class}) @RequestBody SysUserQo userQo, + BindingResult bindingResult){ + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 验证用户名是否重复 + if(!sysUserService.checkUserName(userQo.getUserName())){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + // 添加新用户 + sysUserService.addUser(userQo); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale); + } + + @RequestMapping(value="/get/all", method = RequestMethod.GET) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + public String getAllSysUser(){ + Iterable sysUserDtoList = sysUserService.getAllSysUser(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,sysUserDtoList,locale); + } + + /** + * 软删除指定id的普通用户 + * @param id + * @return + */ + @RequestMapping(value = "/general/delete", method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user')") + public String deleteCustomUser(@RequestParam(value="userId", required=false) int id){ + // 验证数据合法性 + int res = sysUserService.softDeleteGeneralUser(id); + if(res==1){ + return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"",locale); + } else { + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + } + +// @RequestMapping(value = "/update", method = RequestMethod.POST) +// @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") +// public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo, +// BindingResult bindingResult){ +// // 验证数据合法性 +// if(bindingResult.hasErrors()){ +// return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); +// } +// // 修改用户 +// sysUserService.updateSysUser(userQo); +// return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale); +// } + + @RequestMapping(value = "/update/portrait", method = RequestMethod.POST) + public String updateUserPortrait(@RequestParam(value="portraitId") String portraitId, + @RequestHeader(value="Authorization") String token){ + + if(!isStrNumeric(portraitId)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + // 头像是否正确 + int res = sysUserService.updateSysUserPortrait(userName, Integer.valueOf(portraitId)); + if(res==1){ + return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale); + } + + @RequestMapping(value = "/update/password", method = RequestMethod.POST) + public String updateUserPassword(@RequestParam(value="oldPassword") String oldPassword, + @RequestParam(value="newPassword") String newPassword, + @RequestHeader(value="Authorization") String token){ + // 获取当前用户名 + String userName = getTokenUserName(token); + int res = sysUserService.updateSysUserPassword(userName,oldPassword,newPassword); + final int r1 = 1; + final int r2 = 2; + final int r3 = 3; + if(res==r1){ + return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"未知错误",locale); + } else if(res==r2){ + return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"旧密码错误",locale); + } else if(res==r3){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"新密码不符合规则",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale); + } + + @RequestMapping(value = "/get/info", method = RequestMethod.GET) + public String getUserInfo(@RequestHeader(value="Authorization") String token){ + // 获取当前用户名 + String userName = getTokenUserName(token); + SysUserVo sysUserVo = sysUserService.getSysUserVoByUserName(userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,sysUserVo,locale); + } + + @RequestMapping(value="/set/forbidden",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + public String setUserForbidden(@RequestParam(value="userName", required=true) String userName) { + String generalRole = "role_general_user"; + String farmerRole = "role_farm_user"; + if(sysUserService.checkUserName(userName)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"userName 错误",locale); + } + List list1 = sysRoleService.getSysRoleListByUserName(userName); + SysRoleEntity sysRoleEntity = list1.get(0); + if(generalRole.equals(sysRoleEntity.getRoleName()) || farmerRole.equals(sysRoleEntity.getRoleName())){ + sysUserService.disableSysUser(userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + return outputEncapsulationObject(PromptMessageEnum.USER_NO_PERMISSION,"",locale); + } + + @RequestMapping(value="/set/enable",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + public String setUserEnable(@RequestParam(value="userName", required=true) String userName) { + String generalRole = "role_general_user"; + String farmerRole = "role_farm_user"; + if(sysUserService.checkUserName(userName)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"userName 错误",locale); + } + List list1 = sysRoleService.getSysRoleListByUserName(userName); + SysRoleEntity sysRoleEntity = list1.get(0); + if(generalRole.equals(sysRoleEntity.getRoleName()) || farmerRole.equals(sysRoleEntity.getRoleName())){ + sysUserService.enableSysUser(userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + return outputEncapsulationObject(PromptMessageEnum.USER_NO_PERMISSION,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/TifProductController.java b/src/main/java/com/xkrs/microservice/controller/TifProductController.java new file mode 100644 index 0000000..cc551be --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/TifProductController.java @@ -0,0 +1,110 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.TifProductEntity; +import com.xkrs.microservice.model.qo.TifProductQo; +import com.xkrs.microservice.model.validation.TifProductQoInsert; +import com.xkrs.microservice.service.TifProductService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; + +/** + * 栅格产品管理服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/tif-product") +public class TifProductController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private TifProductService tifProductService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + public String getAllFiles() { + Iterable list = tifProductService.getAllFile(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/product-code",method = RequestMethod.GET) + public String getByProductCode(@RequestParam("productCode") String productCode) { + TifProductEntity res = tifProductService.getByProductCode(productCode); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + + @RequestMapping(value="/get/product-type",method = RequestMethod.GET) + public String getByProductType(@RequestParam("productType") String productType) { + Iterable list = tifProductService.getByProductType(productType); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/admcode/product-type",method = RequestMethod.GET) + public String getByAdmCodeAndProductType(@RequestParam("admCode") Integer admCode, + @RequestParam("productType") String productType) { + Iterable list = tifProductService.getByAdmCodeAndProductType(admCode,productType); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/admcode/product-type/date",method = RequestMethod.GET) + public String getByAdmCodeAndProductTypeAndDate(@RequestParam("admCode") Integer admCode, + @RequestParam("productType") String productType, + @RequestParam("startDateTs") Long startDateTs, + @RequestParam("endDateTs") Long endDateTs) { + if(startDateTs > endDateTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDate sTime = timeMillisToDate(startDateTs); + LocalDate eTime = timeMillisToDate(endDateTs); + Iterable list = tifProductService.getByAdmCodeAndProductTypeAndDate(admCode,productType,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String fileAdd(@Validated({TifProductQoInsert.class}) @RequestBody TifProductQo tifProductQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 验证数据是否存在 + if(tifProductService.getByProductCode(tifProductQo.getProductCode())!=null){ + return outputEncapsulationObject(PromptMessageEnum.DATA_REPEAT,"数据已存在",locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + tifProductService.add(tifProductQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String fileDelete(@RequestParam("id") Integer id) { + Optional tifProductEntity = tifProductService.getById(id); + if(tifProductEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + tifProductService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } +} diff --git a/src/main/java/com/xkrs/microservice/controller/TypicalFarmerController.java b/src/main/java/com/xkrs/microservice/controller/TypicalFarmerController.java new file mode 100644 index 0000000..0ab85f3 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/TypicalFarmerController.java @@ -0,0 +1,128 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.TypicalFarmerEntity; +import com.xkrs.microservice.model.qo.TypicalFarmerQo; +import com.xkrs.microservice.model.validation.TypicalFarmerQoInsert; +import com.xkrs.microservice.model.validation.TypicalFarmerQoUpdate; +import com.xkrs.microservice.service.SysUserService; +import com.xkrs.microservice.service.TypicalFarmerService; + +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * 典型区农户表管理 + * @author tajochen + */ +@RestController +@RequestMapping("/api/typical-farmer") +public class TypicalFarmerController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private TypicalFarmerService typicalFarmerService; + + @Resource + private SysUserService sysUserService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + @CrossOrigin + public String getAllRecord() { + Iterable list = typicalFarmerService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/xzdm",method = RequestMethod.GET) + @CrossOrigin + public String getByTownCode(@RequestParam("xzdm") String xzdm) { + Iterable list = typicalFarmerService.getByTownCode(xzdm); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/qxdm",method = RequestMethod.GET) + @CrossOrigin + public String getByCountyCode(@RequestParam("qxdm") Integer qxdm) { + Iterable list = typicalFarmerService.getByCountyCode(qxdm); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/lxr",method = RequestMethod.GET) + @CrossOrigin + public String getByLxr(@RequestParam("lxr") String lxr) { + Iterable list = typicalFarmerService.getByLxr(lxr); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/user-name",method = RequestMethod.GET) + @CrossOrigin + public String getByUserName(@RequestParam("userName") String userName) { + Optional obj = typicalFarmerService.getByTel(userName); + if(obj.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } else { + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,obj.get(),locale); + } + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @CrossOrigin + public String dataAdd(@Validated({TypicalFarmerQoInsert.class}) @RequestBody TypicalFarmerQo typicalFarmerQo, + BindingResult bindingResult) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 验证用户名是否重复 + if(!sysUserService.checkUserName(typicalFarmerQo.getTel())){ + return outputEncapsulationObject(PromptMessageEnum.USER_ALREADY_EXIST,"用户名已存在!",locale); + } + // 添加新用户 + typicalFarmerService.add(typicalFarmerQo,typicalFarmerQo.getTel()); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/update",method = RequestMethod.POST) + @CrossOrigin + public String dataUpdate(@Validated({TypicalFarmerQoUpdate.class}) @RequestBody TypicalFarmerQo typicalFarmerQo, + BindingResult bindingResult) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 验证用户名是否存在 + if(sysUserService.checkUserName(typicalFarmerQo.getTel())){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"用户名不存在!",locale); + } + // 添加新用户 + typicalFarmerService.update(typicalFarmerQo); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String dataDelete(@RequestParam("id") Integer id) { + Optional typicalPlotEntity = typicalFarmerService.getById(id); + if(typicalPlotEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + typicalFarmerService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/TypicalPlotController.java b/src/main/java/com/xkrs/microservice/controller/TypicalPlotController.java new file mode 100644 index 0000000..993c1ce --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/TypicalPlotController.java @@ -0,0 +1,139 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.TypicalPlotEntity; +import com.xkrs.microservice.model.qo.TypicalPlotQo; +import com.xkrs.microservice.model.validation.TypicalPlotQoInsert; +import com.xkrs.microservice.model.validation.TypicalPlotQoUpdate; +import com.xkrs.microservice.service.TypicalPlotService; + +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; + +/** + * 典型区地块管理 + * @author tajochen + */ +@RestController +@RequestMapping("/api/typical-plot") +public class TypicalPlotController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private TypicalPlotService typicalPlotService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + @CrossOrigin + public String getAllRecord() { + Iterable list = typicalPlotService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/qxdm",method = RequestMethod.GET) + @CrossOrigin + public String getByCountyCode(@RequestParam("qxdm") Integer qxdm) { + Iterable list = typicalPlotService.getByCountyCode(qxdm); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/xzdm",method = RequestMethod.GET) + @CrossOrigin + public String getByTownCode(@RequestParam("xzdm") String xzdm) { + Iterable list = typicalPlotService.getByTownCode(xzdm); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/dkbh",method = RequestMethod.GET) + @CrossOrigin + public String getByDkbh(@RequestParam("dkbh") String dkbh) { + Optional res = typicalPlotService.getByDkbh(dkbh); + if(res.isPresent()){ + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res.get(),locale); + } + return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"dkbh 不存在",locale); + } + + @RequestMapping(value="/get/lxr",method = RequestMethod.GET) + @CrossOrigin + public String getByLxr(@RequestParam("lxr") String lxr) { + Iterable list = typicalPlotService.getByLxr(lxr); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/tel",method = RequestMethod.GET) + @CrossOrigin + public String getByTel(@RequestParam("tel") String tel) { + Iterable list = typicalPlotService.getByTel(tel); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/user-name",method = RequestMethod.GET) + @CrossOrigin + public String getByUserName(@RequestParam("userName") String userName) { + Iterable list = typicalPlotService.getByTel(userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/update",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String dataUpdate(@Validated({TypicalPlotQoUpdate.class}) @RequestBody TypicalPlotQo typicalPlotQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + typicalPlotService.update(typicalPlotQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor','auth_farm_user')") + @CrossOrigin + public String dataAdd(@Validated({TypicalPlotQoInsert.class}) @RequestBody TypicalPlotQo typicalPlotQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 监测地块编号是否存在 + Optional typicalPlotEntity = typicalPlotService.getByDkbh(typicalPlotQo.getDkbh()); + if(typicalPlotEntity.isPresent()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"地块编号已存在",locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + typicalPlotService.add(typicalPlotQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor','auth_farm_user')") + @CrossOrigin + public String dataDelete(@RequestParam("id") Integer id) { + Optional typicalPlotEntity = typicalPlotService.getById(id); + if(typicalPlotEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + typicalPlotService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/TypicalPlotIrrigationController.java b/src/main/java/com/xkrs/microservice/controller/TypicalPlotIrrigationController.java new file mode 100644 index 0000000..dde01ff --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/TypicalPlotIrrigationController.java @@ -0,0 +1,131 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.TypicalPlotIrrigationEntity; +import com.xkrs.microservice.model.qo.TypicalPlotIrrigationQo; +import com.xkrs.microservice.model.validation.TypicalPlotIrrigationQoInsert; +import com.xkrs.microservice.service.TypicalPlotIrrigationService; + +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToTime; + +/** + * 灌溉信息表管理 + * @author tajochen + */ +@RestController +@RequestMapping("/api/typical-plot-irrigation") +public class TypicalPlotIrrigationController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private TypicalPlotIrrigationService typicalPlotIrrigationService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + @CrossOrigin + public String getAllRecord() { + Iterable list = typicalPlotIrrigationService.getAllRecord(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/ggbh",method = RequestMethod.GET) + @CrossOrigin + public String getByGgbh(@RequestParam("ggbh") String ggbh) { + Optional list = typicalPlotIrrigationService.getByGgbh(ggbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/qxbh",method = RequestMethod.GET) + @CrossOrigin + public String getByQxbh(@RequestParam("qxbh") Integer qxbh) { + Iterable list = typicalPlotIrrigationService.getByQxbh(qxbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/dkbh",method = RequestMethod.GET) + @CrossOrigin + public String getByDkbh(@RequestParam("dkbh") String dkbh) { + Iterable list = typicalPlotIrrigationService.getByDkbh(dkbh); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/user-name",method = RequestMethod.GET) + @CrossOrigin + public String getByUserName(@RequestParam("userName") String userName) { + Iterable list = typicalPlotIrrigationService.getByUserName(userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/condition",method = RequestMethod.GET) + @CrossOrigin + public String getByCondition(@RequestParam("xzbh") String xzbh, + @RequestParam("cropCode") Integer cropCode, + @RequestParam("sTimeTs") Long sTime, + @RequestParam("eTimeTs") Long eTime) { + List list = typicalPlotIrrigationService.getAllByCondition(xzbh,cropCode,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/time",method = RequestMethod.GET) + @CrossOrigin + public String getByQxbhAndCreateTimeBetween(@RequestParam("qxdm") Integer qxdm,@RequestParam("sTimeTs") Long sTimeTs,@RequestParam("eTimeTs") Long eTimeTs) { + if(sTimeTs > eTimeTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDateTime sTime = timeMillisToTime(sTimeTs); + LocalDateTime eTime = timeMillisToTime(eTimeTs); + Iterable list = typicalPlotIrrigationService.findAllByQxbhAndStrtimeBetween(qxdm,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor','auth_farm_user')") + @CrossOrigin + public String dataAdd(@Validated({TypicalPlotIrrigationQoInsert.class}) @RequestBody TypicalPlotIrrigationQo typicalPlotIrrigationQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 验证灌溉编号是否存在 + Optional typicalPlotIrrigationEntity = typicalPlotIrrigationService.getByGgbh(typicalPlotIrrigationQo.getGgbh()); + if(typicalPlotIrrigationEntity.isPresent()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"灌溉编号重复!",locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + typicalPlotIrrigationService.add(typicalPlotIrrigationQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String dataDelete(@RequestParam("id") Integer id) { + Optional typicalPlotIrrigationEntity = typicalPlotIrrigationService.getById(id); + if(typicalPlotIrrigationEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + typicalPlotIrrigationService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/controller/WcsRecordController.java b/src/main/java/com/xkrs/microservice/controller/WcsRecordController.java new file mode 100644 index 0000000..695dfa8 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/WcsRecordController.java @@ -0,0 +1,111 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.entity.WcsRecordEntity; +import com.xkrs.microservice.model.qo.WcsRecordQo; +import com.xkrs.microservice.model.validation.WcsRecordQoInsert; +import com.xkrs.microservice.service.WcsRecordService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList; +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.common.tool.TokenUtil.getTokenUserName; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; + +/** + * 栅格服务管理 + * @author tajochen + */ +@RestController +@RequestMapping("/api/wcs-record") +public class WcsRecordController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private WcsRecordService wcsRecordService; + + @RequestMapping(value="/get/all",method = RequestMethod.GET) + public String getAllFiles() { + Iterable list = wcsRecordService.getAllService(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/service-code",method = RequestMethod.GET) + public String getByProductCode(@RequestParam("serviceCode") String serviceCode) { + WcsRecordEntity res = wcsRecordService.getByServiceCode(serviceCode); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + + @RequestMapping(value="/get/product-type",method = RequestMethod.GET) + public String getByProductType(@RequestParam("productType") String productType) { + Iterable list = wcsRecordService.getByProductType(productType); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + @RequestMapping(value="/get/admcode/product-type",method = RequestMethod.GET) + public String getByAdmCodeAndProductTypeAndDate(@RequestParam("admCode") Integer admCode, + @RequestParam("productType") String productType) { + Iterable list = wcsRecordService.getByAdmCodeAndProductType(admCode,productType); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + + @RequestMapping(value="/get/admcode/product-type/date",method = RequestMethod.GET) + public String getByAdmCodeAndProductTypeAndDate(@RequestParam("admCode") Integer admCode, + @RequestParam("productType") String productType, + @RequestParam("startDateTs") Long startDateTs, + @RequestParam("endDateTs") Long endDateTs) { + if(startDateTs > endDateTs){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + LocalDate sTime = timeMillisToDate(startDateTs); + LocalDate eTime = timeMillisToDate(endDateTs); + Iterable list = wcsRecordService.getByAdmCodeAndProductTypeAndDate(admCode,productType,sTime,eTime); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale); + } + + + @RequestMapping(value="/add",method = RequestMethod.POST) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')") + @CrossOrigin + public String fileAdd(@Validated({WcsRecordQoInsert.class}) @RequestBody WcsRecordQo wcsRecordQo, + BindingResult bindingResult,@RequestHeader(value="Authorization") String token) { + // 验证数据合法性 + if(bindingResult.hasErrors()){ + return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale); + } + // 验证数据是否存在 + if(wcsRecordService.getByServiceCode(wcsRecordQo.getServiceCode())!=null){ + return outputEncapsulationObject(PromptMessageEnum.DATA_REPEAT,"数据已存在",locale); + } + // 获取当前用户名 + String userName = getTokenUserName(token); + wcsRecordService.add(wcsRecordQo,userName); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } + + @RequestMapping(value="/delete",method = RequestMethod.DELETE) + @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") + @CrossOrigin + public String fileDelete(@RequestParam("id") Integer id) { + Optional wcsRecordEntity = wcsRecordService.getById(id); + if(wcsRecordEntity.isEmpty()){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale); + } + wcsRecordService.delete(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); + } +} diff --git a/src/main/java/com/xkrs/microservice/controller/WeatherController.java b/src/main/java/com/xkrs/microservice/controller/WeatherController.java new file mode 100644 index 0000000..bc84cc3 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/WeatherController.java @@ -0,0 +1,92 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.common.tool.PageBean; +import com.xkrs.microservice.common.tool.WeatherGet; +import com.xkrs.microservice.dao.WeatherDao; +import com.xkrs.microservice.model.entity.WeatherEntity; +import com.xkrs.microservice.service.WeatherService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @author XinYiSong + */ +@RestController +@RequestMapping("/api/weather-station") +public class WeatherController { + + @Resource + private WeatherGet weatherGet; + + @Resource + private WeatherService weatherService; + + @Resource + private WeatherDao weatherDao; + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + /** + * 测试 + * @return + */ + @PostMapping("/insertWeather") + public void insertWeather(){ + weatherGet.findWeather(); + } + + /** + * 查询相关的天气和气候 + * @param map + * @return + */ + @PostMapping("/queryWeather") + public String queryWeather(@RequestBody Map map){ + Integer pageNo = (Integer) map.get("pageNo"); + String addTimeStart = (String) map.get("addTimeStart"); + String addTimeEnd = (String) map.get("addTimeEnd"); + PageBean pageBean = weatherService.queryWeather(pageNo, addTimeStart, addTimeEnd); + if(pageBean.getList() == null || pageBean.getList().size() == 0){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有相关数据",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,pageBean,locale); + } + + /** + * 查询气候最新的一条信息 + * @return + */ + @GetMapping("/selectNewest") + public String selectNewest(){ + WeatherEntity weatherEntity = weatherDao.selectNewest(); + if(weatherEntity == null){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有相关数据",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,weatherEntity,locale); + } + + /** + * 根据时间查询气象信息 + * 修改 + * @param map + * @return + */ + @PostMapping("/selectWeather") + public String selectWeather(@RequestBody Map map){ + String addTimeStart = (String) map.get("addTimeStart"); + String addTimeEnd = (String) map.get("addTimeEnd"); + List weatherEntities = weatherService.selectWeather(addTimeStart, addTimeEnd); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,weatherEntities,locale); + } +} diff --git a/src/main/java/com/xkrs/microservice/controller/WeatherStationController.java b/src/main/java/com/xkrs/microservice/controller/WeatherStationController.java new file mode 100644 index 0000000..bc39e5a --- /dev/null +++ b/src/main/java/com/xkrs/microservice/controller/WeatherStationController.java @@ -0,0 +1,53 @@ +package com.xkrs.microservice.controller; + +import com.xkrs.microservice.common.encapsulation.PromptMessageEnum; +import com.xkrs.microservice.model.vo.ForecastWeather7DayVo; +import com.xkrs.microservice.model.vo.RealTimeWeatherVo; +import com.xkrs.microservice.service.MeteorologicalService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.Locale; + +import static com.xkrs.microservice.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; +import static com.xkrs.microservice.util.NumberUtil.isStrAdmCode; + +/** + * 行政区划气象站点服务 + * @author tajochen + */ +@RestController +@RequestMapping("/api/weather") +public class WeatherStationController { + + /** + * 获取区域信息 + */ + Locale locale = LocaleContextHolder.getLocale(); + + @Resource + private MeteorologicalService meteorologicalService; + + @RequestMapping(value="/get/now",method = RequestMethod.GET) + public String getWeatherNowByAdmCode(@RequestParam(value="admCode") String admCode) { + if(!isStrAdmCode(admCode)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + RealTimeWeatherVo res = meteorologicalService.getWeatherNowByAdmCode(Integer.valueOf(admCode)); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + + @RequestMapping(value="/get/forecast",method = RequestMethod.GET) + public String getWeatherForecastByAdmCode(@RequestParam(value="admCode") String admCode) { + if(!isStrAdmCode(admCode)){ + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale); + } + ForecastWeather7DayVo res = meteorologicalService.getWeatherForecastByAdmCode(Integer.valueOf(admCode)); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,res,locale); + } + +} diff --git a/src/main/java/com/xkrs/microservice/dao/AppFileDao.java b/src/main/java/com/xkrs/microservice/dao/AppFileDao.java new file mode 100644 index 0000000..fc3d0f7 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/AppFileDao.java @@ -0,0 +1,19 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.FileAppEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * AppFileDao + * @author tajochen + */ +public interface AppFileDao extends JpaRepository { + + /** + * 获取指定版本号的记录 + * @param versionNumber 版本号 + * @return + */ + Iterable findByVersionNumber(String versionNumber); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/CropClassifyRecordDao.java b/src/main/java/com/xkrs/microservice/dao/CropClassifyRecordDao.java new file mode 100644 index 0000000..6160db9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/CropClassifyRecordDao.java @@ -0,0 +1,49 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.CropClassifyRecordEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.time.LocalDate; + +/** + * CropClassifyRecordDao + * @author tajochen + */ +public interface CropClassifyRecordDao extends JpaRepository { + + /** + * 获取指定行政区划代码 + * @param countyCode 行政区划代码 + * @return + */ + Iterable findByCountyCode(Integer countyCode); + + /** + * 获取指定街道代码 + * @param townCode 街道代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable findByTownCodeAndCropDateBetween(String townCode,LocalDate startDate,LocalDate endDate); + + /** + * 获取指定街道代码 + * @param townCode 街道代码 + * @param cropCode 作物代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable findByTownCodeAndCropCodeAndCropDateBetween(String townCode,Integer cropCode ,LocalDate startDate,LocalDate endDate); + + /** + * 获取指定行政区划代码和指定日期段 + * @param countyCode 行政区划代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable findByCountyCodeAndCropDateBetween(Integer countyCode,LocalDate startDate,LocalDate endDate); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/DicCropClassifyDao.java b/src/main/java/com/xkrs/microservice/dao/DicCropClassifyDao.java new file mode 100644 index 0000000..ccba1fb --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/DicCropClassifyDao.java @@ -0,0 +1,12 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.DicCropClassifyEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * DicLandClassifyDao + * @author tajochen + */ +public interface DicCropClassifyDao extends JpaRepository { + +} diff --git a/src/main/java/com/xkrs/microservice/dao/DicDroughtClassifyDao.java b/src/main/java/com/xkrs/microservice/dao/DicDroughtClassifyDao.java new file mode 100644 index 0000000..e32d4cc --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/DicDroughtClassifyDao.java @@ -0,0 +1,12 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.DicDroughtClassifyEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * DicLandClassifyDao + * @author tajochen + */ +public interface DicDroughtClassifyDao extends JpaRepository { + +} diff --git a/src/main/java/com/xkrs/microservice/dao/DicLandClassifyDao.java b/src/main/java/com/xkrs/microservice/dao/DicLandClassifyDao.java new file mode 100644 index 0000000..39762e9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/DicLandClassifyDao.java @@ -0,0 +1,12 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.DicLandClassifyEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * DicLandClassifyDao + * @author tajochen + */ +public interface DicLandClassifyDao extends JpaRepository { + +} diff --git a/src/main/java/com/xkrs/microservice/dao/DicProductDao.java b/src/main/java/com/xkrs/microservice/dao/DicProductDao.java new file mode 100644 index 0000000..3c55126 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/DicProductDao.java @@ -0,0 +1,12 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.DicProductEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * DicProductDao + * @author tajochen + */ +public interface DicProductDao extends JpaRepository { + +} diff --git a/src/main/java/com/xkrs/microservice/dao/DicSoilClassifyDao.java b/src/main/java/com/xkrs/microservice/dao/DicSoilClassifyDao.java new file mode 100644 index 0000000..4fded6f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/DicSoilClassifyDao.java @@ -0,0 +1,12 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.DicSoilClassifyEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * DicSoilClassifyDao + * @author tajochen + */ +public interface DicSoilClassifyDao extends JpaRepository { + +} diff --git a/src/main/java/com/xkrs/microservice/dao/FarmingInfoDao.java b/src/main/java/com/xkrs/microservice/dao/FarmingInfoDao.java new file mode 100644 index 0000000..e91781a --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/FarmingInfoDao.java @@ -0,0 +1,51 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.FarmingInfoEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +/** + * FarmingInfoDao + * @author tajochen + */ +public interface FarmingInfoDao extends JpaRepository { + + /** + * 查找农情信息根据地块编号 + * @param dkbh 地块编号 + * @return + */ + Iterable findAllByDkbh(String dkbh); + + /** + * 查找农情信息根据作物代码,区县编号 + * @param zwbh 作物编号 + * @param qxbh 区县编号 + * @return + */ + Iterable findAllByZwdmAndQxbh(Integer zwbh,Integer qxbh); + + /** + * 查找农情信息根据区县编号 + * @param qxbh 区县编号 + * @return + */ + Iterable findAllByQxbh(Integer qxbh); + + /** + * 查找最新农情信息根据区县编号 + * @param qxbh 区县编号 + * @return + */ + @Query(value = "SELECT * FROM farming_info A WHERE A.create_time = ( SELECT MAX ( B.create_time ) " + + "FROM farming_info B WHERE A.dkbh = B.dkbh ) AND A.qxbh = :qxbh", nativeQuery = true) + Iterable findNewAllByQxbh(Integer qxbh); + + /** + * 查找农情信息根据姓名 + * @param userName 联系人姓名 + * @return + */ + Iterable findAllByAddUserName(String userName); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/FileDocumentDao.java b/src/main/java/com/xkrs/microservice/dao/FileDocumentDao.java new file mode 100644 index 0000000..a3cb722 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/FileDocumentDao.java @@ -0,0 +1,12 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.FileDocumentEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * FileDocumentDao + * @author tajochen + */ +public interface FileDocumentDao extends JpaRepository { + +} diff --git a/src/main/java/com/xkrs/microservice/dao/HydrologicalStationDao.java b/src/main/java/com/xkrs/microservice/dao/HydrologicalStationDao.java new file mode 100644 index 0000000..959568d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/HydrologicalStationDao.java @@ -0,0 +1,31 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.HydrologicalStationEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.time.LocalDateTime; + +/** + * HydrologicalStationDao + * @author tajochen + */ +public interface HydrologicalStationDao extends JpaRepository { + + /** + * 根据时间段查询水文站点数据 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + Iterable findByRecordTimeBetween(LocalDateTime sTime,LocalDateTime eTime); + + /** + * 根据时间段查询水文站点数据 + * @param name 站点名称 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + Iterable findByNameAndRecordTimeBetween(String name, LocalDateTime sTime,LocalDateTime eTime); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/IndependentCheckDao.java b/src/main/java/com/xkrs/microservice/dao/IndependentCheckDao.java new file mode 100644 index 0000000..bb27659 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/IndependentCheckDao.java @@ -0,0 +1,26 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.IndependentCheckEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * IndependentCheckDao + * @author tajochen + */ +public interface IndependentCheckDao extends JpaRepository { + + /** + * 查找自主核查结果根据区县代码 + * @param qxdm 区县代码 + * @return + */ + Iterable findByQxdm(Integer qxdm); + + /** + * 查找自主核查结果根据用户名 + * @param userName 用户名 + * @return + */ + Iterable findAllByAddUserName(String userName); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/IrrigationCheckDao.java b/src/main/java/com/xkrs/microservice/dao/IrrigationCheckDao.java new file mode 100644 index 0000000..07ecb89 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/IrrigationCheckDao.java @@ -0,0 +1,52 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.IrrigationCheckEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.time.LocalDateTime; +import java.util.Optional; + +/** + * IrrigationCheckDao + * @author tajochen + */ +public interface IrrigationCheckDao extends JpaRepository { + + /** + * 查找灌溉核查结果根据灌溉编号 + * @param ggbh 灌溉编号 + * @return + */ + Optional findByGgbh(String ggbh); + + /** + * 查找灌溉核查结果根据区县编号 + * @param qxbh 区县编号 + * @return + */ + Iterable findAllByQxbh(Integer qxbh); + + /** + * 查找灌溉核查结果根据地块编号 + * @param dkbh 地块编号 + * @return + */ + Iterable findAllByDkbh(String dkbh); + + /** + * 查找灌溉核查结果根据区县编号和时间 + * @param qxbh 区县编号 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + Iterable findAllByQxbhAndCreateTimeBetween(Integer qxbh,LocalDateTime sTime,LocalDateTime eTime); + + /** + * 查找灌溉核查结果用户名 + * @param userName 用户名 + * @return + */ + Iterable findByAddUserName(String userName); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/IrrigationRecordDao.java b/src/main/java/com/xkrs/microservice/dao/IrrigationRecordDao.java new file mode 100644 index 0000000..0533d2e --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/IrrigationRecordDao.java @@ -0,0 +1,39 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.IrrigationRecordEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.time.LocalDate; + +/** + * IrrigationRecordDao + * @author tajochen + */ +public interface IrrigationRecordDao extends JpaRepository { + + /** + * 获取指定行政区划代码 + * @param countyCode 区县代码 + * @return + */ + Iterable findByCountyCode(Integer countyCode); + + /** + * 获取指定街道代码 + * @param townCode 街道代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable findByTownCodeAndIrrigationDateBetween(String townCode,LocalDate startDate,LocalDate endDate); + + /** + * 获取指定行政区划代码和指定日期段 + * @param countyCode 行政区划代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable findByCountyCodeAndIrrigationDateBetween(Integer countyCode,LocalDate startDate,LocalDate endDate); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/IrrigationSarRecordDao.java b/src/main/java/com/xkrs/microservice/dao/IrrigationSarRecordDao.java new file mode 100644 index 0000000..1e54b5b --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/IrrigationSarRecordDao.java @@ -0,0 +1,52 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.IrrigationSarRecordEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.time.LocalDate; + +/** + * IrrigationSarRecordDao + * @author tajochen + */ +public interface IrrigationSarRecordDao extends JpaRepository { + + /** + * 获取指定行政区划代码 + * @param countyCode 区县代码 + * @return + */ + Iterable findByCountyCode(Integer countyCode); + + /** + * 获取指定街道代码 + * @param townCode 街道代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable findByTownCodeAndIrrigationDateBetween(String townCode,LocalDate startDate,LocalDate endDate); + + /** + * 获取指定数据动态多条件 + * @param townCode 街道代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + @Query(value = "SELECT * FROM irrigation_sar_record WHERE CASE WHEN ( :townCode ) <> '' " + + "THEN town_code = :townCode ELSE 1 = 1 END " + + "AND irrigation_date <= :endDate AND irrigation_date >= :startDate ; ", nativeQuery = true) + Iterable getAllByCondition(String townCode,LocalDate startDate,LocalDate endDate); + + /** + * 获取指定行政区划代码和指定日期段 + * @param countyCode 行政区划代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable findByCountyCodeAndIrrigationDateBetween(Integer countyCode,LocalDate startDate,LocalDate endDate); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/MeteorologicalStationDao.java b/src/main/java/com/xkrs/microservice/dao/MeteorologicalStationDao.java new file mode 100644 index 0000000..3f0a6f0 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/MeteorologicalStationDao.java @@ -0,0 +1,19 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.MeteorologicalStationEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * RelAdmWeatherStationDao + * @author tajochen + */ +public interface MeteorologicalStationDao extends JpaRepository { + + /** + * 获取天气城市站点信息 + * @param code + * @return + */ + MeteorologicalStationEntity findByCode(Integer code); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/ShpCityDao.java b/src/main/java/com/xkrs/microservice/dao/ShpCityDao.java new file mode 100644 index 0000000..0196c81 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/ShpCityDao.java @@ -0,0 +1,46 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.ShpCityEntity; +import com.xkrs.microservice.model.vo.ShpCityVo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * ShpCityDao 表实体类 + * @author tajochen + */ +public interface ShpCityDao extends JpaRepository { + + /** + * 查找所有地级市 + * @return + */ + @Query(value = "select new com.xkrs.microservice.model.vo.ShpCityVo (city.id,city.code,city.name,city.proCode," + + "city.proName,city.shapeArea,city.center) " + + "from ShpCityEntity city ") + List selectAllCity(); + + /** + * 查找所有地级市根据省级代码 + * @param proCode 省级代码 + * @return + */ + @Query(value = "select new com.xkrs.microservice.model.vo.ShpCityVo (city.id,city.code,city.name,city.proCode," + + "city.proName,city.shapeArea,city.center) " + + "from ShpCityEntity city where city.proCode = :proCode") + List selectAllCityByProvinceCode(@Param("proCode") Integer proCode); + + /** + * 查找指定地级市根据地级市代码 + * @param code 地级市代码 + * @return + */ + @Query(value = "select new com.xkrs.microservice.model.vo.ShpCityVo (city.id,city.code,city.name,city.proCode," + + "city.proName,city.shapeArea,city.center) " + + "from ShpCityEntity city where city.code = :code") + ShpCityVo selectCityByCityCode(@Param("code") Integer code); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/ShpCountyDao.java b/src/main/java/com/xkrs/microservice/dao/ShpCountyDao.java new file mode 100644 index 0000000..8134e43 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/ShpCountyDao.java @@ -0,0 +1,59 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.ShpCountyEntity; +import com.xkrs.microservice.model.vo.ShpCountyVo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * ShpCountyDao 表实体类 + * @author tajochen + */ +public interface ShpCountyDao extends JpaRepository { + + /** + * 查找所有区县 + * @return + */ + @Query(value = "select new com.xkrs.microservice.model.vo.ShpCountyVo (county.id,county.code,county.name," + + "county.cityCode,county.cityName,county.proCode,county.proName,county.shapeArea,county.center," + + "county.memo) " + + "from ShpCountyEntity county") + List selectAllCounty(); + + /** + * 查找所有区县根据省级代码 + * @param proCode 省级代码 + * @return + */ + @Query(value = "select new com.xkrs.microservice.model.vo.ShpCountyVo (county.id,county.code,county.name," + + "county.cityCode,county.cityName,county.proCode,county.proName,county.shapeArea,county.center," + + "county.memo) " + + "from ShpCountyEntity county where county.proCode= :proCode") + List selectAllCountyByProvinceCode(@Param("proCode") Integer proCode); + + /** + * 查找所有区县根据市级代码 + * @param cityCode 地级市代码 + * @return + */ + @Query(value = "select new com.xkrs.microservice.model.vo.ShpCountyVo (county.id,county.code,county.name," + + "county.cityCode,county.cityName,county.proCode,county.proName,county.shapeArea,county.center," + + "county.memo) " + + "from ShpCountyEntity county where county.cityCode= :cityCode") + List selectAllCountyByCityCode(@Param("cityCode") Integer cityCode); + + /** + * 查找指定区县根据区县代码 + * @param code 区县代码 + * @return + */ + @Query(value = "select new com.xkrs.microservice.model.vo.ShpCountyVo (county.id,county.code,county.name," + + "county.cityCode,county.cityName,county.proCode,county.proName,county.shapeArea,county.center," + + "county.memo) " + + "from ShpCountyEntity county where county.code= :code") + ShpCountyVo selectCountyByCountyCode(@Param("code") Integer code); +} diff --git a/src/main/java/com/xkrs/microservice/dao/SysAuthorityDao.java b/src/main/java/com/xkrs/microservice/dao/SysAuthorityDao.java new file mode 100644 index 0000000..4b9e51d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/SysAuthorityDao.java @@ -0,0 +1,26 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.SysAuthorityEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * SysAuthorityDao + * @author tajochen + */ +public interface SysAuthorityDao extends JpaRepository { + /** + * 查询权限实体列表根据用户名 Object[] + * @param userName 用户名 + * @return 用户实体 + */ + @Query(value = "SELECT a.id, a.authority_name, a.authority_name_zh, a.authority_desc " + + "FROM sys_authority a,rel_role_authority ra,sys_role r " + + "WHERE r.id = ra.role_id AND ra.authority_id = a.id AND r.id " + + "IN (SELECT r.id FROM sys_user u,sys_role r,rel_user_role ur " + + " WHERE u.user_name = :userName AND u.id = ur.user_id AND ur.role_id = r.id)", nativeQuery = true) + List selectByUserName(@Param("userName") String userName); +} diff --git a/src/main/java/com/xkrs/microservice/dao/SysRoleDao.java b/src/main/java/com/xkrs/microservice/dao/SysRoleDao.java new file mode 100644 index 0000000..588b7c9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/SysRoleDao.java @@ -0,0 +1,61 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.SysRoleEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * SysRoleDao + * @author tajochen + */ +public interface SysRoleDao extends JpaRepository { + + /** + * 查询用户角色列表根据用户id + * @param id 编号 + * @return + */ + @Query(value = "SELECT sys_role.id,sys_role.role_name,sys_role.role_name_zh,sys_role.role_desc " + + "FROM sys_role,rel_user_role " + + "WHERE sys_role.id = rel_user_role.role_id " + + "AND rel_user_role.user_id = :id ", nativeQuery = true) + List selectByUserId(@Param("id") Integer id); + + /** + * 查询用户角色列表根据用户名 + * @param userName 用户名 + * @return + */ + @Query(value = "SELECT sys_role.id,sys_role.role_name,sys_role.role_name_zh,sys_role.role_desc " + + "FROM sys_role,rel_user_role,sys_user "+ + "WHERE sys_role.ID = rel_user_role.role_id " + + "AND rel_user_role.user_id = sys_user.id " + + "AND rel_user_role.user_id = sys_user.id " + + "AND sys_user.user_name = :userName ", nativeQuery = true) + List selectByUserName(@Param("userName") String userName); + + +// /** +// * 根据用户名修改用户角色 +// */ +// @Modifying +// @Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " + +// "WHERE user_name = :userName ;", nativeQuery = true) +// int updateUserRoleByUserName(@Param("userName") String userName); + + /** + * 添加用户角色根据用户名和角色名 + * @param userName 用户名 + * @param roleName 角色名 + * @return + */ + @Modifying + @Query(value = "INSERT INTO rel_user_role (id,role_id, user_id) " + + "SELECT nextval('rel_user_role_seq'),sys_role.ID,sys_user.ID FROM sys_role,sys_user " + + "WHERE sys_role.role_name = :roleName AND sys_user.user_name = :userName ", nativeQuery = true) + int insertRelUserRole(@Param("userName") String userName,@Param("roleName") String roleName); +} diff --git a/src/main/java/com/xkrs/microservice/dao/SysUserDao.java b/src/main/java/com/xkrs/microservice/dao/SysUserDao.java new file mode 100644 index 0000000..00f3a83 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/SysUserDao.java @@ -0,0 +1,105 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.SysUserEntity; +import com.xkrs.microservice.model.vo.SysUserVo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * SysUserDao + * @author tajochen + */ +public interface SysUserDao extends JpaRepository { + + /** + * 获取指定userName + * @param userName 用户名 + * @return + */ + SysUserEntity findByUserName(String userName); + + + /** + * 获取指定用户Vo(未删除、已激活) + * @param userName 用户名 + * @return + */ + @Query(value = "select new com.xkrs.microservice.model.vo.SysUserVo (u.id, u.userName, u.nickName,u.realName, u.userCode, " + + "u.sex, u.telephone, u.email, u.admCode, u.address,u.birthday,u.signature,r.roleNameZh, u.portraitId," + + "u.statusCode,u.addTime,u.lastEntryTime,u.lastEntryIp,u.memo) from SysUserEntity u ,SysRoleEntity r," + + "RelUserRoleEntity u_r " + + "WHERE u.deleteFlag = 0 AND u.activeFlag = 0 AND r.id = u_r.roleId AND u.id = u_r.userId " + + "AND u.userName = :userName") + SysUserVo selectSysUserByUserName(@Param("userName") String userName); + + /** + * 检查系统用户名是否存在 + * @param userName 用户名 + * @return + */ + @Query(value = "SELECT COUNT(*) FROM sys_user WHERE user_name = :userName", nativeQuery = true) + int checkUserName(@Param("userName") String userName); + + /** + * 查找用户实体根据用户名 + * @param userName 用户名 + * @return + */ + @Query(value = "SELECT * FROM sys_user WHERE user_name = :userName", nativeQuery = true) + SysUserEntity selectByUserName(@Param("userName") String userName); + + /** + * 更新用户登录信息 + * @param userName 用户名 + * @param ipAddress ip地址 + * @return + */ + @Modifying + @Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " + + "WHERE user_name = :userName ;", nativeQuery = true) + int updateSysUserLogin(@Param("userName") String userName,@Param("ipAddress") String ipAddress); + + /** + * 软删除系统用户根据用户名 + * @param userName 用户名 + * @return + */ + @Modifying + @Query(value = "UPDATE sys_user SET delete_flag = 1 " + + "WHERE user_name = :userName ;", nativeQuery = true) + int softDeleteSysUserByUserName(@Param("userName") String userName); + + /** + * 软删除系统用户根据id + * @param id 编号 + * @return + */ + @Modifying + @Query(value = "UPDATE sys_user SET delete_flag = 1 " + + "WHERE id = :id ;", nativeQuery = true) + int softDeleteGeneralUserById(@Param("id") Integer id); + + /** + * 获取所有系统用户Vo(未删除、已激活) + * @return + */ + @Query(value = "select new com.xkrs.microservice.model.vo.SysUserVo (u.id, u.userName, u.nickName,u.realName, u.userCode, " + + "u.sex, u.telephone, u.email, u.admCode, u.address,u.birthday,u.signature,r.roleNameZh, u.portraitId," + + "u.statusCode,u.addTime,u.lastEntryTime,u.lastEntryIp,u.memo) from SysUserEntity u ,SysRoleEntity r," + + "RelUserRoleEntity u_r " + + "WHERE u.deleteFlag = 0 AND u.activeFlag = 0 AND r.id = u_r.roleId AND u.id = u_r.userId") + List selectAllSysUser(); + + /** + * 删除系统用户(危险操作!) + * @param userName 用户名 + * @return + */ + @Modifying + @Query(value = "DELETE FROM sys_user WHERE user_name = :userName ;", nativeQuery = true) + int deleteSysUser(@Param("userName") String userName); +} diff --git a/src/main/java/com/xkrs/microservice/dao/TifProductDao.java b/src/main/java/com/xkrs/microservice/dao/TifProductDao.java new file mode 100644 index 0000000..71c7fcd --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/TifProductDao.java @@ -0,0 +1,71 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.TifProductEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.time.LocalDate; + +/** + * TifProductDao + * @author tajochen + */ +public interface TifProductDao extends JpaRepository { + + /** + * 根据产品代码查找 + * @param productCode 产品代码 + * @return + */ + TifProductEntity findByProductCode(String productCode); + + /** + * 根据产品类型查找 + * @param productType 产品类型 + * @return + */ + Iterable findByProductType(String productType); + + /** + * 根据产品类型和产品日期查找 + * @param productType 产品类型 + * @param sDate 开始时间 + * @param eDate 结束时间 + * @return + */ + Iterable findByProductTypeAndProductDateBetween(String productType, LocalDate sDate,LocalDate eDate); + + /** + * 根据行政区划代码查找 + * @param admCode 行政区划代码 + * @return + */ + Iterable findByAdmCode(Integer admCode); + + /** + * 根据行政区划代码和产品日期查找 + * @param admCode 行政区划代码 + * @param sDate 开始时间 + * @param eDate 结束时间 + * @return + */ + Iterable findByAdmCodeAndProductDateBetween(Integer admCode, LocalDate sDate,LocalDate eDate); + + /** + * 根据产品类型和行政区划代码和产品类型 + * @param productType 产品类型 + * @param admCode 行政区划代码 + * @return + */ + Iterable findByProductTypeAndAdmCode(String productType,Integer admCode); + + /** + * 根据产品类型和行政区划代码和产品类型和产品日期查找 + * @param productType 产品类型 + * @param admCode 行政区划代码 + * @param sDate 开始时间 + * @param eDate 结束时间 + * @return + */ + Iterable findByProductTypeAndAdmCodeAndProductDateBetween(String productType,Integer admCode, LocalDate sDate,LocalDate eDate); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/TypicalFarmerDao.java b/src/main/java/com/xkrs/microservice/dao/TypicalFarmerDao.java new file mode 100644 index 0000000..97f2cf4 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/TypicalFarmerDao.java @@ -0,0 +1,42 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.TypicalFarmerEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; + +/** + * TypicalFarmerDao + * @author tajochen + */ +public interface TypicalFarmerDao extends JpaRepository { + + /** + * 查找农户根据姓名 + * @param lxr 联系人姓名 + * @return + */ + Iterable findAllByLxr(String lxr); + + /** + * 查找农户根据手机号(帐号) + * @param tel 手机号 + * @return + */ + Optional findByTel(String tel); + + /** + * 查找农户根据乡镇代码 + * @param xzdm 乡镇代码 + * @return + */ + Iterable findAllByXzdm(String xzdm); + + /** + * 查找农户根据区县代码 + * @param qxdm 区县代码 + * @return + */ + Iterable findAllByQxdm(Integer qxdm); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/TypicalPlotDao.java b/src/main/java/com/xkrs/microservice/dao/TypicalPlotDao.java new file mode 100644 index 0000000..0b263ed --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/TypicalPlotDao.java @@ -0,0 +1,49 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.TypicalPlotEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; + +/** + * TypicalPlotDao + * @author tajochen + */ +public interface TypicalPlotDao extends JpaRepository { + + /** + * 查找典型地块根据地块编号 + * @param dkbh + * @return + */ + Optional findAllByDkbh(String dkbh); + + /** + * 查找典型地块根据姓名 + * @param lxr 联系人姓名 + * @return + */ + Iterable findAllByLxr(String lxr); + + /** + * 查找典型地块根据手机号(帐号) + * @param tel 手机号 + * @return + */ + Iterable findAllByTel(String tel); + + /** + * 查找典型地块根据区县代码 + * @param qxdm 区县代码 + * @return + */ + Iterable findAllByQxdm(Integer qxdm); + + /** + * 查找典型地块根据乡镇代码 + * @param xzdm 乡镇代码 + * @return + */ + Iterable findAllByXzdm(String xzdm); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/TypicalPlotIrrigationDao.java b/src/main/java/com/xkrs/microservice/dao/TypicalPlotIrrigationDao.java new file mode 100644 index 0000000..e6290d0 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/TypicalPlotIrrigationDao.java @@ -0,0 +1,69 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.TypicalPlotIrrigationEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Optional; + +/** + * TypicalPlotIrrigationDao + * @author tajochen + */ +public interface TypicalPlotIrrigationDao extends JpaRepository { + + /** + * 查找灌溉记录列表根据地块编号 + * @param dkbh 地块编号 + * @return + */ + Iterable findAllByDkbh(String dkbh); + + /** + * 查找灌溉记录列表根据区县代码 + * @param countyCode 区县代码 + * @return + */ + Iterable findAllByQxbh(Integer countyCode); + + /** + * 查找灌溉记录根据灌溉编号 + * @param qxbh 区县代码 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + Iterable findAllByQxbhAndEndtimeBetween(Integer qxbh,LocalDateTime sTime,LocalDateTime eTime); + + /** + * 查找灌溉记录根据灌溉编号 + * @param ggbh 灌溉编号 + * @return + */ + Optional findByGgbh(String ggbh); + + /** + * 查找灌溉记录根据添加用户名 + * @param addUserName 添加用户名 + * @return + */ + Iterable findAllByAddUserName(String addUserName); + + /** + * 查找灌溉记录根据区县代码 + * @param xzbh 乡镇编号 + * @param cropCode 作物代码 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return + */ + @Query(value = "SELECT * FROM typical_plot_irrigation WHERE CASE WHEN ( :xzbh ) <> '' " + + "THEN xzbh = :xzbh ELSE 1 = 1 END " + + "AND strtime <= :endTime AND endtime >= :startTime " + + "AND CASE WHEN ( :cropCode ) <> 0 " + + "THEN crop_code = :cropCode ELSE 1 = 1 END;", nativeQuery = true) + List getAllByCondition(String xzbh, Integer cropCode, LocalDateTime startTime, LocalDateTime endTime); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/WcsRecordDao.java b/src/main/java/com/xkrs/microservice/dao/WcsRecordDao.java new file mode 100644 index 0000000..d159c7c --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/WcsRecordDao.java @@ -0,0 +1,64 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.WcsRecordEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.time.LocalDate; + +/** + * WcsRecordDao + * @author tajochen + */ +public interface WcsRecordDao extends JpaRepository { + + /** + * 根据服务代码查找 + * @param serviceCode 服务代码 + * @return + */ + WcsRecordEntity findByServiceCode(String serviceCode); + + /** + * 根据产品类型查找 + * @param productType 产品类型 + * @return + */ + Iterable findByProductType(String productType); + + /** + * 根据产品类型和产品日期查找 + * @param productType 产品类型 + * @param sDate 开始时间 + * @param eDate 结束时间 + * @return + */ + Iterable findByProductTypeAndProductDateBetween(String productType, LocalDate sDate, LocalDate eDate); + + /** + * 根据行政区划代码和产品日期查找 + * @param admCode 行政区划代码 + * @param sDate 开始时间 + * @param eDate 结束时间 + * @return + */ + Iterable findByAdmCodeAndProductDateBetween(Integer admCode, LocalDate sDate, LocalDate eDate); + + /** + * 根据产品类型和行政区划代码和产品类型 + * @param productType 产品类型 + * @param admCode 行政区划代码 + * @return + */ + Iterable findByProductTypeAndAdmCode(String productType,Integer admCode); + + /** + * 根据产品类型和行政区划代码和产品类型和产品日期查找 + * @param productType 产品类型 + * @param admCode 行政区划代码 + * @param sDate 开始时间 + * @param eDate 结束时间 + * @return + */ + Iterable findByProductTypeAndAdmCodeAndProductDateBetween(String productType,Integer admCode, LocalDate sDate,LocalDate eDate); + +} diff --git a/src/main/java/com/xkrs/microservice/dao/WeatherDao.java b/src/main/java/com/xkrs/microservice/dao/WeatherDao.java new file mode 100644 index 0000000..1081b8c --- /dev/null +++ b/src/main/java/com/xkrs/microservice/dao/WeatherDao.java @@ -0,0 +1,21 @@ +package com.xkrs.microservice.dao; + +import com.xkrs.microservice.model.entity.WeatherEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Component; + +/** + * @author XinYi Song + */ +@Component +public interface WeatherDao extends JpaRepository, JpaSpecificationExecutor { + + /** + * 查询最新的一条记录 + * @return + */ + @Query(value = "SELECT * from weather ORDER BY add_time desc limit 1",nativeQuery = true) + WeatherEntity selectNewest(); +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/CropClassifyRecordEntity.java b/src/main/java/com/xkrs/microservice/model/entity/CropClassifyRecordEntity.java new file mode 100644 index 0000000..1cba329 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/CropClassifyRecordEntity.java @@ -0,0 +1,169 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * CropClassifyRecordEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="crop_classify_record") +public class CropClassifyRecordEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "crop_classify_record_gen") + @SequenceGenerator(name = "crop_classify_record_seq_gen", sequenceName = "crop_classify_record_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false) + private Integer countyCode; + + @Column( length = 32, nullable = false, columnDefinition = "varchar(32)") + private String countyName; + + @Column( length = 16, nullable = false, columnDefinition = "varchar(16)") + private String townCode; + + @Column( length = 32, nullable = false, columnDefinition = "varchar(32)") + private String townName; + + @Column( nullable = false) + private Integer cropCode; + + private LocalDate cropDate; + + private Long area; + + @Column( length = 128, columnDefinition = "varchar(128)") + private String dataSource; + + @Column( length = 128, columnDefinition = "varchar(128)") + private String memo; + + @Column( length = 32,nullable = false, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime addTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCountyCode() { + return countyCode; + } + + public void setCountyCode(Integer countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } + + public String getTownName() { + return townName; + } + + public void setTownName(String townName) { + this.townName = townName; + } + + public Integer getCropCode() { + return cropCode; + } + + public void setCropCode(Integer cropCode) { + this.cropCode = cropCode; + } + + public LocalDate getCropDate() { + return cropDate; + } + + public void setCropDate(LocalDate cropDate) { + this.cropDate = cropDate; + } + + public Long getArea() { + return area; + } + + public void setArea(Long area) { + this.area = area; + } + + public String getDataSource() { + return dataSource; + } + + public void setDataSource(String dataSource) { + this.dataSource = dataSource; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getAddTime() { + return addTime; + } + + public void setAddTime(LocalDateTime addTime) { + this.addTime = addTime; + } + + @Override + public String toString() { + return "CropClassifyRecordEntity{" + + "id=" + id + + ", countyCode=" + countyCode + + ", countyName='" + countyName + '\'' + + ", townCode='" + townCode + '\'' + + ", townName='" + townName + '\'' + + ", cropCode=" + cropCode + + ", cropDate=" + cropDate + + ", area=" + area + + ", dataSource='" + dataSource + '\'' + + ", memo='" + memo + '\'' + + ", addUserName='" + addUserName + '\'' + + ", addTime=" + addTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/DicCropClassifyEntity.java b/src/main/java/com/xkrs/microservice/model/entity/DicCropClassifyEntity.java new file mode 100644 index 0000000..2d75593 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/DicCropClassifyEntity.java @@ -0,0 +1,73 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; + +/** + * DicLandClassify 表实体类 + * @author tajochen + */ +@Entity +@Table(name="dic_crop_classify") +public class DicCropClassifyEntity { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "dic_crop_classify_seq_gen") + @SequenceGenerator(name = "dic_crop_classify_seq_gen", sequenceName = "dic_crop_classify_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false, columnDefinition = "int4") + private Integer code; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String name; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @Override + public String toString() { + return "DicCropClassifyEntity{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", memo='" + memo + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/DicDroughtClassifyEntity.java b/src/main/java/com/xkrs/microservice/model/entity/DicDroughtClassifyEntity.java new file mode 100644 index 0000000..4780a56 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/DicDroughtClassifyEntity.java @@ -0,0 +1,73 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; + +/** + * DicLandClassify 表实体类 + * @author tajochen + */ +@Entity +@Table(name="dic_drought_classify") +public class DicDroughtClassifyEntity { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "dic_drought_classify_seq_gen") + @SequenceGenerator(name = "dic_drought_classify_seq_gen", sequenceName = "dic_drought_classify_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false, columnDefinition = "int4") + private Integer code; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String name; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @Override + public String toString() { + return "DicDroughtClassifyEntity{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", memo='" + memo + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/DicLandClassifyEntity.java b/src/main/java/com/xkrs/microservice/model/entity/DicLandClassifyEntity.java new file mode 100644 index 0000000..69c0fdd --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/DicLandClassifyEntity.java @@ -0,0 +1,73 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; + +/** + * DicLandClassify 表实体类 + * @author tajochen + */ +@Entity +@Table(name="dic_land_classify") +public class DicLandClassifyEntity { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "dic_land_classify_seq_gen") + @SequenceGenerator(name = "dic_land_classify_seq_gen", sequenceName = "dic_land_classify_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false, columnDefinition = "int4") + private Integer code; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String name; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @Override + public String toString() { + return "DicLandClassifyEntity{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", memo='" + memo + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/DicProductEntity.java b/src/main/java/com/xkrs/microservice/model/entity/DicProductEntity.java new file mode 100644 index 0000000..e7c2ea9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/DicProductEntity.java @@ -0,0 +1,97 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; + +/** + * DicLandClassify 表实体类 + * @author tajochen + */ +@Entity +@Table(name="dic_product") +public class DicProductEntity { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "dic_product_seq_gen") + @SequenceGenerator(name = "dic_product_seq_gen", sequenceName = "dic_product_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false,length = 64,unique = true, columnDefinition = "varchar(64)") + private String productType; + + @Column(length = 64, columnDefinition = "varchar(64)") + private String productTypeCn; + + @Column(length = 64, columnDefinition = "varchar(64)") + private String productOrigin; + + @Column(length = 64, columnDefinition = "varchar(64)") + private String productCycle; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getProductType() { + return productType; + } + + public void setProductType(String productType) { + this.productType = productType; + } + + public String getProductTypeCn() { + return productTypeCn; + } + + public void setProductTypeCn(String productTypeCn) { + this.productTypeCn = productTypeCn; + } + + public String getProductOrigin() { + return productOrigin; + } + + public void setProductOrigin(String productOrigin) { + this.productOrigin = productOrigin; + } + + public String getProductCycle() { + return productCycle; + } + + public void setProductCycle(String productCycle) { + this.productCycle = productCycle; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @Override + public String toString() { + return "DicProductEntity{" + + "id=" + id + + ", productType='" + productType + '\'' + + ", productTypeCn='" + productTypeCn + '\'' + + ", productOrigin='" + productOrigin + '\'' + + ", productCycle='" + productCycle + '\'' + + ", memo='" + memo + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/DicSoilClassifyEntity.java b/src/main/java/com/xkrs/microservice/model/entity/DicSoilClassifyEntity.java new file mode 100644 index 0000000..583e623 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/DicSoilClassifyEntity.java @@ -0,0 +1,97 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; + +/** + * DicSoilClassify 表实体类 + * @author tajochen + */ +@Entity +@Table(name="dic_soil_classify") +public class DicSoilClassifyEntity { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "dic_soil_classify_seq_gen") + @SequenceGenerator(name = "dic_soil_classify_seq_gen", sequenceName = "dic_soil_classify_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false, columnDefinition = "int4") + private Integer code; + + @Column(length = 64, nullable = false, columnDefinition = "varchar(64)") + private String value; + + @Column(length = 64, columnDefinition = "varchar(64)") + private String symbol; + + @Column(length = 255, columnDefinition = "varchar(255)") + private String engExplanation; + + @Column(length = 255, columnDefinition = "varchar(255)") + private String chExplanation; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } + + public String getEngExplanation() { + return engExplanation; + } + + public void setEngExplanation(String engExplanation) { + this.engExplanation = engExplanation; + } + + public String getChExplanation() { + return chExplanation; + } + + public void setChExplanation(String chExplanation) { + this.chExplanation = chExplanation; + } + + @Override + public String toString() { + return "DicSoilClassify{" + + "id=" + id + + ", code=" + code + + ", value='" + value + '\'' + + ", symbol='" + symbol + '\'' + + ", engExplanation='" + engExplanation + '\'' + + ", chExplanation='" + chExplanation + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/FarmingInfoEntity.java b/src/main/java/com/xkrs/microservice/model/entity/FarmingInfoEntity.java new file mode 100644 index 0000000..689dce3 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/FarmingInfoEntity.java @@ -0,0 +1,145 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * FarmingInfoEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="farming_info") +public class FarmingInfoEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "farming_info_gen") + @SequenceGenerator(name = "farming_info_seq_gen", sequenceName = "farming_info_seq",allocationSize = 1) + private Integer id; + + @Column( length = 32, columnDefinition = "varchar(32)", nullable = false) + private String dkbh; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String zwmc; + + private Integer zwdm; + + @Column( nullable = false) + private Integer qxbh; + + @Column( length = 512, columnDefinition = "varchar(512)",nullable = false) + private String nqzp; + + @Column( length = 64, columnDefinition = "varchar(64)", nullable = false) + private String nqzt; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String remark; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime createTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDkbh() { + return dkbh; + } + + public void setDkbh(String dkbh) { + this.dkbh = dkbh; + } + + public String getZwmc() { + return zwmc; + } + + public void setZwmc(String zwmc) { + this.zwmc = zwmc; + } + + public Integer getZwdm() { + return zwdm; + } + + public void setZwdm(Integer zwdm) { + this.zwdm = zwdm; + } + + public Integer getQxbh() { + return qxbh; + } + + public void setQxbh(Integer qxbh) { + this.qxbh = qxbh; + } + + public String getNqzp() { + return nqzp; + } + + public void setNqzp(String nqzp) { + this.nqzp = nqzp; + } + + public String getNqzt() { + return nqzt; + } + + public void setNqzt(String nqzt) { + this.nqzt = nqzt; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + @Override + public String toString() { + return "FarmingInfoEntity{" + + "id=" + id + + ", dkbh='" + dkbh + '\'' + + ", zwmc='" + zwmc + '\'' + + ", zwdm=" + zwdm + + ", qxbh=" + qxbh + + ", nqzp='" + nqzp + '\'' + + ", nqzt='" + nqzt + '\'' + + ", remark='" + remark + '\'' + + ", addUserName='" + addUserName + '\'' + + ", createTime=" + createTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/FileAppEntity.java b/src/main/java/com/xkrs/microservice/model/entity/FileAppEntity.java new file mode 100644 index 0000000..242427b --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/FileAppEntity.java @@ -0,0 +1,134 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * FileApp 表实体类 + * @author tajochen + */ +@Entity +@Table(name="file_app") +public class FileAppEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "app_file_seq_gen") + @SequenceGenerator(name = "app_file_seq_gen", sequenceName = "app_file_seq",allocationSize = 1) + private Integer id; + + @Column(length = 64, nullable = false, columnDefinition = "varchar(64)") + private String name; + + @Column(length = 192 , nullable = false, columnDefinition = "varchar(192)") + private String appPath; + + @Column( length = 128, nullable = false,unique = true, columnDefinition = "varchar(128)") + private String versionNumber; + + @Column( length = 128, nullable = false, columnDefinition = "varchar(128)") + private String size; + + @Column( length = 192, nullable = false, columnDefinition = "varchar(192)") + private String md5; + + @Column( length = 192, columnDefinition = "varchar(192)") + private String memo; + + @Column( length = 32,nullable = false, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime addTime; + + 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 getAppPath() { + return appPath; + } + + public void setAppPath(String appPath) { + this.appPath = appPath; + } + + public String getVersionNumber() { + return versionNumber; + } + + public void setVersionNumber(String versionNumber) { + this.versionNumber = versionNumber; + } + + public String getSize() { + return size; + } + + public void setSize(String size) { + this.size = size; + } + + public String getMd5() { + return md5; + } + + public void setMd5(String md5) { + this.md5 = md5; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getAddTime() { + return addTime; + } + + public void setAddTime(LocalDateTime addTime) { + this.addTime = addTime; + } + + @Override + public String toString() { + return "FileAppEntity{" + + "id=" + id + + ", name='" + name + '\'' + + ", appPath='" + appPath + '\'' + + ", versionNumber='" + versionNumber + '\'' + + ", size='" + size + '\'' + + ", md5='" + md5 + '\'' + + ", memo='" + memo + '\'' + + ", addUserName='" + addUserName + '\'' + + ", addTime=" + addTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/FileDocumentEntity.java b/src/main/java/com/xkrs/microservice/model/entity/FileDocumentEntity.java new file mode 100644 index 0000000..974d62f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/FileDocumentEntity.java @@ -0,0 +1,132 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * FileDocument 表实体类 + * @author tajochen + */ +@Entity +@Table(name="file_document") +public class FileDocumentEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "file_document_seq_gen") + @SequenceGenerator(name = "file_document_seq_gen", sequenceName = "file_document_seq",allocationSize = 1) + private Integer id; + + @Column(length = 64, nullable = false, columnDefinition = "varchar(64)") + private String name; + + @Column( nullable = false, columnDefinition = "int4") + private Integer category; + + @Column(length = 192 , nullable = false, columnDefinition = "varchar(192)") + private String filePath; + + @Column( length = 128, nullable = false, columnDefinition = "varchar(128)") + private String fileSize; + + @Column( length = 192, nullable = false, columnDefinition = "varchar(192)") + private String md5; + + @Column( length = 128, columnDefinition = "varchar(128)") + private String memo; + + @Column( length = 32,nullable = false, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime addTime; + + 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 Integer getCategory() { + return category; + } + + public void setCategory(Integer category) { + this.category = category; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getFileSize() { + return fileSize; + } + + public void setFileSize(String fileSize) { + this.fileSize = fileSize; + } + + public String getMd5() { + return md5; + } + + public void setMd5(String md5) { + this.md5 = md5; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getAddTime() { + return addTime; + } + + public void setAddTime(LocalDateTime addTime) { + this.addTime = addTime; + } + + @Override + public String toString() { + return "FileDocumentEntity{" + + "id=" + id + + ", name='" + name + '\'' + + ", category=" + category + + ", filePath='" + filePath + '\'' + + ", fileSize='" + fileSize + '\'' + + ", md5='" + md5 + '\'' + + ", memo='" + memo + '\'' + + ", addUserName=" + addUserName + + ", addTime=" + addTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/HydrologicalStationEntity.java b/src/main/java/com/xkrs/microservice/model/entity/HydrologicalStationEntity.java new file mode 100644 index 0000000..4d603ad --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/HydrologicalStationEntity.java @@ -0,0 +1,151 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * HydrologicalStationEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="hydrological_station") +public class HydrologicalStationEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "hydrological_station_gen") + @SequenceGenerator(name = "hydrological_station_seq_gen", sequenceName = "hydrological_station_seq",allocationSize = 1) + private Integer id; + + @Column( length = 64,nullable = false) + private String name; + + private LocalDateTime recordTime; + + private Integer countyCode; + + @Column( length = 32, nullable = false, columnDefinition = "varchar(32)") + private String countyName; + + private Double longitude; + + private Double latitude; + + private Integer droughtLevel; + + private Double drp; + + private String remarks; + + private LocalDateTime createTime; + + 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 LocalDateTime getRecordTime() { + return recordTime; + } + + public void setRecordTime(LocalDateTime recordTime) { + this.recordTime = recordTime; + } + + public Integer getCountyCode() { + return countyCode; + } + + public void setCountyCode(Integer countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public Integer getDroughtLevel() { + return droughtLevel; + } + + public void setDroughtLevel(Integer droughtLevel) { + this.droughtLevel = droughtLevel; + } + + public Double getDrp() { + return drp; + } + + public void setDrp(Double drp) { + this.drp = drp; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + @Override + public String toString() { + return "HydrologicalStationEntity{" + + "id=" + id + + ", name='" + name + '\'' + + ", recordTime=" + recordTime + + ", countyCode=" + countyCode + + ", countyName='" + countyName + '\'' + + ", longitude=" + longitude + + ", latitude=" + latitude + + ", droughtLevel=" + droughtLevel + + ", drp=" + drp + + ", remarks='" + remarks + '\'' + + ", createTime=" + createTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/IndependentCheckEntity.java b/src/main/java/com/xkrs/microservice/model/entity/IndependentCheckEntity.java new file mode 100644 index 0000000..b981102 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/IndependentCheckEntity.java @@ -0,0 +1,243 @@ +package com.xkrs.microservice.model.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.micrometer.core.instrument.util.StringUtils; +import org.geolatte.geom.Geometry; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * IndependentCheckEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="independent_check") +public class IndependentCheckEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "independent_check_gen") + @SequenceGenerator(name = "independent_check_seq_gen", sequenceName = "independent_check_seq",allocationSize = 1) + private Integer id; + + private Integer qxdm; + + private String qxmc; + + private Integer zwdm; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String zwmc; + + private Double lai; + + private Double swc; + + private Integer ggzt; + + @Column( length = 512, columnDefinition = "varchar(512)") + private String hczp; + + private Integer sfwrj; + + private Integer sdcjgp; + + private Double xzb; + + private Double yzb; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String remark; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime createTime; + + private Geometry geom; + + @Transient + private String wktGeom; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getQxdm() { + return qxdm; + } + + public void setQxdm(Integer qxdm) { + this.qxdm = qxdm; + } + + public String getQxmc() { + return qxmc; + } + + public void setQxmc(String qxmc) { + this.qxmc = qxmc; + } + + public Integer getZwdm() { + return zwdm; + } + + public void setZwdm(Integer zwdm) { + this.zwdm = zwdm; + } + + public String getZwmc() { + return zwmc; + } + + public void setZwmc(String zwmc) { + this.zwmc = zwmc; + } + + public Double getLai() { + return lai; + } + + public void setLai(Double lai) { + this.lai = lai; + } + + public Double getSwc() { + return swc; + } + + public void setSwc(Double swc) { + this.swc = swc; + } + + public Integer getGgzt() { + return ggzt; + } + + public void setGgzt(Integer ggzt) { + this.ggzt = ggzt; + } + + public String getHczp() { + return hczp; + } + + public void setHczp(String hczp) { + this.hczp = hczp; + } + + public Integer getSfwrj() { + return sfwrj; + } + + public void setSfwrj(Integer sfwrj) { + this.sfwrj = sfwrj; + } + + public Integer getSdcjgp() { + return sdcjgp; + } + + public void setSdcjgp(Integer sdcjgp) { + this.sdcjgp = sdcjgp; + } + + public Double getXzb() { + return xzb; + } + + public void setXzb(Double xzb) { + this.xzb = xzb; + } + + public Double getYzb() { + return yzb; + } + + public void setYzb(Double yzb) { + this.yzb = yzb; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + @JsonIgnore + public Geometry getGeom() { + return geom; + } + + @JsonIgnore + public void setGeom(Geometry geom) { + this.geom = geom; + } + + public String getWktGeom() { + if(StringUtils.isNotBlank(wktGeom)){ + return wktGeom; + } else if(geom == null){ + return ""; + } else { + return geom.toString(); + } + } + + public void setWktGeom(String wktGeom) { + this.wktGeom = wktGeom; + } + + @Override + public String toString() { + return "IndependentCheckEntity{" + + "id=" + id + + ", qxdm=" + qxdm + + ", qxmc='" + qxmc + '\'' + + ", zwdm=" + zwdm + + ", zwmc='" + zwmc + '\'' + + ", lai=" + lai + + ", swc=" + swc + + ", ggzt=" + ggzt + + ", hczp='" + hczp + '\'' + + ", sfwrj=" + sfwrj + + ", sdcjgp=" + sdcjgp + + ", xzb=" + xzb + + ", yzb=" + yzb + + ", remark='" + remark + '\'' + + ", addUserName='" + addUserName + '\'' + + ", createTime=" + createTime + + ", geom=" + geom + + ", wktGeom='" + wktGeom + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/IrrigationCheckEntity.java b/src/main/java/com/xkrs/microservice/model/entity/IrrigationCheckEntity.java new file mode 100644 index 0000000..77aa313 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/IrrigationCheckEntity.java @@ -0,0 +1,168 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * IrrigationCheckEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="irrigation_check") +public class IrrigationCheckEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "irrigation_check_gen") + @SequenceGenerator(name = "irrigation_check_seq_gen", sequenceName = "irrigation_check_seq",allocationSize = 1) + private Integer id; + + @Column( length = 32, columnDefinition = "varchar(32)",unique = true, nullable = false) + private String hsbh; + + @Column( length = 32, columnDefinition = "varchar(32)", nullable = false) + private String ggbh; + + @Column( length = 32, columnDefinition = "varchar(32)", nullable = false) + private String dkbh; + + @Column( nullable = false) + private Integer qxbh; + + @Column( length = 512, columnDefinition = "varchar(512)") + private String hszp; + + @Column( nullable = false) + private Integer hszt; + + private Double xzb; + + private Double yzb; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String remark; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime createTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getHsbh() { + return hsbh; + } + + public void setHsbh(String hsbh) { + this.hsbh = hsbh; + } + + public String getGgbh() { + return ggbh; + } + + public void setGgbh(String ggbh) { + this.ggbh = ggbh; + } + + public String getDkbh() { + return dkbh; + } + + public void setDkbh(String dkbh) { + this.dkbh = dkbh; + } + + public Integer getQxbh() { + return qxbh; + } + + public void setQxbh(Integer qxbh) { + this.qxbh = qxbh; + } + + public String getHszp() { + return hszp; + } + + public void setHszp(String hszp) { + this.hszp = hszp; + } + + public Integer getHszt() { + return hszt; + } + + public void setHszt(Integer hszt) { + this.hszt = hszt; + } + + public Double getXzb() { + return xzb; + } + + public void setXzb(Double xzb) { + this.xzb = xzb; + } + + public Double getYzb() { + return yzb; + } + + public void setYzb(Double yzb) { + this.yzb = yzb; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + @Override + public String toString() { + return "IrrigationCheckEntity{" + + "id=" + id + + ", hsbh='" + hsbh + '\'' + + ", ggbh='" + ggbh + '\'' + + ", dkbh='" + dkbh + '\'' + + ", qxbh=" + qxbh + + ", hszp='" + hszp + '\'' + + ", hszt=" + hszt + + ", xzb=" + xzb + + ", yzb=" + yzb + + ", remark='" + remark + '\'' + + ", addUserName='" + addUserName + '\'' + + ", createTime=" + createTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/IrrigationRecordEntity.java b/src/main/java/com/xkrs/microservice/model/entity/IrrigationRecordEntity.java new file mode 100644 index 0000000..1baaeb3 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/IrrigationRecordEntity.java @@ -0,0 +1,157 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * IrrigationRecordEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="irrigation_record") +public class IrrigationRecordEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "irrigation_record_gen") + @SequenceGenerator(name = "irrigation_record_seq_gen", sequenceName = "irrigation_record_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false) + private Integer countyCode; + + @Column( length = 32, nullable = false, columnDefinition = "varchar(32)") + private String countyName; + + @Column( length = 16, nullable = false, columnDefinition = "varchar(16)") + private String townCode; + + @Column( length = 32, nullable = false, columnDefinition = "varchar(32)") + private String townName; + + private LocalDate irrigationDate; + + private Double area; + + @Column( length = 128, columnDefinition = "varchar(128)") + private String dataSource; + + @Column( length = 128, columnDefinition = "varchar(128)") + private String memo; + + @Column( length = 32,nullable = false, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime addTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCountyCode() { + return countyCode; + } + + public void setCountyCode(Integer countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public LocalDate getIrrigationDate() { + return irrigationDate; + } + + public void setIrrigationDate(LocalDate irrigationDate) { + this.irrigationDate = irrigationDate; + } + + public Double getArea() { + return area; + } + + public void setArea(Double area) { + this.area = area; + } + + public String getDataSource() { + return dataSource; + } + + public void setDataSource(String dataSource) { + this.dataSource = dataSource; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getAddTime() { + return addTime; + } + + public void setAddTime(LocalDateTime addTime) { + this.addTime = addTime; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } + + public String getTownName() { + return townName; + } + + public void setTownName(String townName) { + this.townName = townName; + } + + @Override + public String toString() { + return "IrrigationRecordEntity{" + + "id=" + id + + ", countyCode=" + countyCode + + ", countyName='" + countyName + '\'' + + ", townCode='" + townCode + '\'' + + ", townName='" + townName + '\'' + + ", irrigationDate=" + irrigationDate + + ", area=" + area + + ", dataSource='" + dataSource + '\'' + + ", memo='" + memo + '\'' + + ", addUserName='" + addUserName + '\'' + + ", addTime=" + addTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/IrrigationSarRecordEntity.java b/src/main/java/com/xkrs/microservice/model/entity/IrrigationSarRecordEntity.java new file mode 100644 index 0000000..e0e9d81 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/IrrigationSarRecordEntity.java @@ -0,0 +1,180 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * IrrigationSarRecordEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="irrigation_sar_record") +public class IrrigationSarRecordEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "irrigation_sar_record_gen") + @SequenceGenerator(name = "irrigation_sar_record_seq_gen", sequenceName = "irrigation_sar_record_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false) + private Integer countyCode; + + @Column( length = 32, nullable = false, columnDefinition = "varchar(32)") + private String countyName; + + @Column( length = 16, nullable = false, columnDefinition = "varchar(16)") + private String townCode; + + @Column( length = 32, nullable = false, columnDefinition = "varchar(32)") + private String townName; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String cropName; + + private Integer cropCode; + + private LocalDate irrigationDate; + + private Double area; + + @Column( length = 128, columnDefinition = "varchar(128)") + private String dataSource; + + @Column( length = 128, columnDefinition = "varchar(128)") + private String memo; + + @Column( length = 32,nullable = false, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime addTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCountyCode() { + return countyCode; + } + + public void setCountyCode(Integer countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public LocalDate getIrrigationDate() { + return irrigationDate; + } + + public void setIrrigationDate(LocalDate irrigationDate) { + this.irrigationDate = irrigationDate; + } + + public Double getArea() { + return area; + } + + public void setArea(Double area) { + this.area = area; + } + + public String getDataSource() { + return dataSource; + } + + public void setDataSource(String dataSource) { + this.dataSource = dataSource; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getAddTime() { + return addTime; + } + + public void setAddTime(LocalDateTime addTime) { + this.addTime = addTime; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } + + public String getTownName() { + return townName; + } + + public void setTownName(String townName) { + this.townName = townName; + } + + public String getCropName() { + return cropName; + } + + public void setCropName(String cropName) { + this.cropName = cropName; + } + + public Integer getCropCode() { + return cropCode; + } + + public void setCropCode(Integer cropCode) { + this.cropCode = cropCode; + } + + @Override + public String toString() { + return "IrrigationSarRecordEntity{" + + "id=" + id + + ", countyCode=" + countyCode + + ", countyName='" + countyName + '\'' + + ", townCode='" + townCode + '\'' + + ", townName='" + townName + '\'' + + ", cropName='" + cropName + '\'' + + ", cropCode=" + cropCode + + ", irrigationDate=" + irrigationDate + + ", area=" + area + + ", dataSource='" + dataSource + '\'' + + ", memo='" + memo + '\'' + + ", addUserName='" + addUserName + '\'' + + ", addTime=" + addTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/MeteorologicalStationEntity.java b/src/main/java/com/xkrs/microservice/model/entity/MeteorologicalStationEntity.java new file mode 100644 index 0000000..0dcc6b0 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/MeteorologicalStationEntity.java @@ -0,0 +1,174 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * RelAdmWeatherStationEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="meteorological_station") +public class MeteorologicalStationEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "rel_adm_weather_station_seq_gen") + @SequenceGenerator(name = "rel_adm_weather_station_seq_gen", sequenceName = "rel_adm_weather_station_seq",allocationSize = 1) + private Integer id; + + private Integer code; + + @Column(length = 32, nullable = false, columnDefinition = "varchar(32)") + private String name; + + private Integer cityCode; + + @Column(length = 32, nullable = false, columnDefinition = "varchar(32)") + private String cityName; + + private Integer proCode; + + @Column(length = 16, nullable = false, columnDefinition = "varchar(16)") + private String proName; + + private Integer cityWeatherCode; + + private Double height; + + private Double lat; + + private Double lon; + + private Integer stationId; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getCityCode() { + return cityCode; + } + + public void setCityCode(Integer cityCode) { + this.cityCode = cityCode; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public Integer getProCode() { + return proCode; + } + + public void setProCode(Integer proCode) { + this.proCode = proCode; + } + + public String getProName() { + return proName; + } + + public void setProName(String proName) { + this.proName = proName; + } + + public Integer getCityWeatherCode() { + return cityWeatherCode; + } + + public void setCityWeatherCode(Integer cityWeatherCode) { + this.cityWeatherCode = cityWeatherCode; + } + + public Double getHeight() { + return height; + } + + public void setHeight(Double height) { + this.height = height; + } + + public Double getLat() { + return lat; + } + + public void setLat(Double lat) { + this.lat = lat; + } + + public Double getLon() { + return lon; + } + + public void setLon(Double lon) { + this.lon = lon; + } + + public Integer getStationId() { + return stationId; + } + + public void setStationId(Integer stationId) { + this.stationId = stationId; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @Override + public String toString() { + return "RelAdmWeatherStationEntity{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", cityCode=" + cityCode + + ", cityName='" + cityName + '\'' + + ", proCode=" + proCode + + ", proName='" + proName + '\'' + + ", cityWeatherCode=" + cityWeatherCode + + ", height=" + height + + ", lat=" + lat + + ", lon=" + lon + + ", stationId=" + stationId + + ", memo='" + memo + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/MonitoringStationEntity.java b/src/main/java/com/xkrs/microservice/model/entity/MonitoringStationEntity.java new file mode 100644 index 0000000..e847caa --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/MonitoringStationEntity.java @@ -0,0 +1,73 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; + +/** + * DicLandClassify 表实体类 + * @author tajochen + */ +@Entity +@Table(name="monitoring_station") +public class MonitoringStationEntity { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "dic_crop_classify_seq_gen") + @SequenceGenerator(name = "dic_crop_classify_seq_gen", sequenceName = "dic_crop_classify_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false, columnDefinition = "int4") + private Integer code; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String name; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @Override + public String toString() { + return "DicCropClassifyEntity{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", memo='" + memo + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/RelRoleAuthorityEntity.java b/src/main/java/com/xkrs/microservice/model/entity/RelRoleAuthorityEntity.java new file mode 100644 index 0000000..2152b1c --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/RelRoleAuthorityEntity.java @@ -0,0 +1,60 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * RelRoleAuthority 表实体类 + * @author tajochen + */ +@Entity +@Table(name="rel_role_authority") +public class RelRoleAuthorityEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "rel_role_authority_seq_gen") + @SequenceGenerator(name = "rel_role_authority_seq_gen", sequenceName = "rel_role_authority_seq",allocationSize = 1) + private Integer id; + + @Column(nullable = false) + private Integer roleId; + + @Column(nullable = false) + private Integer authorityId; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getRoleId() { + return roleId; + } + + public void setRoleId(Integer roleId) { + this.roleId = roleId; + } + + public Integer getAuthorityId() { + return authorityId; + } + + public void setAuthorityId(Integer authorityId) { + this.authorityId = authorityId; + } + + @Override + public String toString() { + return "RelRoleAuthorityEntity{" + + "id=" + id + + ", roleId=" + roleId + + ", authorityId=" + authorityId + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/com/xkrs/microservice/model/entity/RelUserRoleEntity.java b/src/main/java/com/xkrs/microservice/model/entity/RelUserRoleEntity.java new file mode 100644 index 0000000..f1a9061 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/RelUserRoleEntity.java @@ -0,0 +1,60 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * RelUserRole 表实体类 + * @author tajochen + */ +@Entity +@Table(name="rel_user_role") +public class RelUserRoleEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "rel_user_role_seq_gen") + @SequenceGenerator(name = "rel_user_role_seq_gen", sequenceName = "rel_user_role_seq",allocationSize = 1) + private Integer id; + + @Column(nullable = false) + private Long userId; + + @Column(nullable = false) + private Integer roleId; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Integer getRoleId() { + return roleId; + } + + public void setRoleId(Integer roleId) { + this.roleId = roleId; + } + + @Override + public String toString() { + return "RelUserRoleEntity{" + + "id=" + id + + ", userId=" + userId + + ", roleId=" + roleId + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/com/xkrs/microservice/model/entity/ShpCityEntity.java b/src/main/java/com/xkrs/microservice/model/entity/ShpCityEntity.java new file mode 100644 index 0000000..f033283 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/ShpCityEntity.java @@ -0,0 +1,142 @@ +package com.xkrs.microservice.model.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.micrometer.core.instrument.util.StringUtils; +import org.geolatte.geom.Geometry; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * ShpCity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="shp_city") +public class ShpCityEntity implements Serializable { + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "shp_city_seq_gen") + @SequenceGenerator(name = "shp_city_seq_gen", sequenceName = "shp_city_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false, unique = true, columnDefinition = "int4") + private Integer code; + + @Column(length = 32, nullable = false, columnDefinition = "varchar(32)") + private String name; + + @Column( nullable = false, columnDefinition = "int4") + private Integer proCode; + + @Column(length = 16, nullable = false, columnDefinition = "varchar(16)") + private String proName; + + private double shapeArea; + + @Column( columnDefinition = "varchar(192)") + private String center; + + private Geometry geom; + + @Transient + private String wktGeom; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getProCode() { + return proCode; + } + + public void setProCode(Integer proCode) { + this.proCode = proCode; + } + + public String getProName() { + return proName; + } + + public void setProName(String proName) { + this.proName = proName; + } + + public double getShapeArea() { + return shapeArea; + } + + public void setShapeArea(double shapeArea) { + this.shapeArea = shapeArea; + } + + public String getCenter() { + return center; + } + + public void setCenter(String center) { + this.center = center; + } + + @JsonIgnore + public Geometry getGeom() { + return geom; + } + + @JsonIgnore + public void setGeom(Geometry geom) { + this.geom = geom; + } + + public String getWktGeom() { + if(StringUtils.isNotBlank(wktGeom)){ + return wktGeom; + } else if(geom == null){ + return ""; + } else { + return geom.toString(); + } + } + + public void setWktGeom(String wktGeom) { + this.wktGeom = wktGeom; + } + + @Override + public String toString() { + return "ShpCityEntity{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", proCode=" + proCode + + ", proName='" + proName + '\'' + + ", shapeArea=" + shapeArea + + ", center='" + center + '\'' + + ", geom=" + geom + + ", wktGeom='" + wktGeom + '\'' + + '}'; + } +} + diff --git a/src/main/java/com/xkrs/microservice/model/entity/ShpCountyEntity.java b/src/main/java/com/xkrs/microservice/model/entity/ShpCountyEntity.java new file mode 100644 index 0000000..ea16fa2 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/ShpCountyEntity.java @@ -0,0 +1,177 @@ +package com.xkrs.microservice.model.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.micrometer.core.instrument.util.StringUtils; +import org.locationtech.jts.geom.Geometry; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * ShpCounty 表实体类 + * @author tajochen + */ +@Entity +@Table(name="shp_county") +public class ShpCountyEntity implements Serializable { + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "shp_county_seq_gen") + @SequenceGenerator(name = "shp_county_seq_gen", sequenceName = "shp_county_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false, unique = true, columnDefinition = "int4") + private Integer code; + + @Column(length = 32, nullable = false, columnDefinition = "varchar(32)") + private String name; + + @Column( nullable = false, columnDefinition = "int4") + private Integer cityCode; + + @Column(length = 32, nullable = false, columnDefinition = "varchar(32)") + private String cityName; + + @Column( nullable = false, columnDefinition = "int4") + private Integer proCode; + + @Column(length = 16, nullable = false, columnDefinition = "varchar(16)") + private String proName; + + private double shapeArea; + + @Column( columnDefinition = "varchar(192)") + private String center; + + @Column( columnDefinition = "varchar(192)") + private String memo; + + private Geometry geom; + + @Transient + private String wktGeom; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getCityCode() { + return cityCode; + } + + public void setCityCode(Integer cityCode) { + this.cityCode = cityCode; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public Integer getProCode() { + return proCode; + } + + public void setProCode(Integer proCode) { + this.proCode = proCode; + } + + public String getProName() { + return proName; + } + + public void setProName(String proName) { + this.proName = proName; + } + + public double getShapeArea() { + return shapeArea; + } + + public void setShapeArea(double shapeArea) { + this.shapeArea = shapeArea; + } + + public String getCenter() { + return center; + } + + public void setCenter(String center) { + this.center = center; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @JsonIgnore + public Geometry getGeom() { + return geom; + } + + @JsonIgnore + public void setGeom(Geometry geom) { + this.geom = geom; + } + + public String getWktGeom() { + if(StringUtils.isNotBlank(wktGeom)){ + return wktGeom; + } else if(geom == null){ + return ""; + } else { + return geom.toString(); + } + } + + public void setWktGeom(String wktGeom) { + this.wktGeom = wktGeom; + } + + @Override + public String toString() { + return "ShpCountyEntity{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", cityCode=" + cityCode + + ", cityName='" + cityName + '\'' + + ", proCode=" + proCode + + ", proName='" + proName + '\'' + + ", shapeArea=" + shapeArea + + ", center='" + center + '\'' + + ", memo='" + memo + '\'' + + ", geom=" + geom + + ", wktGeom='" + wktGeom + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/ShpProvinceEntity.java b/src/main/java/com/xkrs/microservice/model/entity/ShpProvinceEntity.java new file mode 100644 index 0000000..43761ea --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/ShpProvinceEntity.java @@ -0,0 +1,118 @@ +package com.xkrs.microservice.model.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.micrometer.core.instrument.util.StringUtils; +import org.geolatte.geom.Geometry; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * ShpProvince 表实体类 + * @author tajochen + */ +@Entity +@Table(name="shp_province") +public class ShpProvinceEntity implements Serializable { + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "shp_province_seq_gen") + @SequenceGenerator(name = "shp_province_seq_gen", sequenceName = "shp_province_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false, unique = true, columnDefinition = "int4") + private Integer code; + + @Column(length = 16, nullable = false, columnDefinition = "varchar(16)") + private String name; + + private double shapeArea; + + @Column( columnDefinition = "varchar(192)") + private String center; + + private Geometry geom; + + @Transient + private String wktGeom; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getShapeArea() { + return shapeArea; + } + + public void setShapeArea(double shapeArea) { + this.shapeArea = shapeArea; + } + + public String getCenter() { + return center; + } + + public void setCenter(String center) { + this.center = center; + } + + @JsonIgnore + public Geometry getGeom() { + return geom; + } + + @JsonIgnore + public void setGeom(Geometry geom) { + this.geom = geom; + } + + public String getWktGeom() { + if(StringUtils.isNotBlank(wktGeom)){ + return wktGeom; + } else if(geom == null){ + return ""; + } else { + return geom.toString(); + } + } + + public void setWktGeom(String wktGeom) { + this.wktGeom = wktGeom; + } + + @Override + public String toString() { + return "ShpProvinceEntity{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", shapeArea=" + shapeArea + + ", center='" + center + '\'' + + ", geom=" + geom + + ", wktGeom='" + wktGeom + '\'' + + '}'; + } +} + diff --git a/src/main/java/com/xkrs/microservice/model/entity/StationRecordEntity.java b/src/main/java/com/xkrs/microservice/model/entity/StationRecordEntity.java new file mode 100644 index 0000000..dd71531 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/StationRecordEntity.java @@ -0,0 +1,169 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * StationRecordEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="station_record") +public class StationRecordEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "station_record_gen") + @SequenceGenerator(name = "station_record_seq_gen", sequenceName = "station_record_seq",allocationSize = 1) + private Integer id; + + @Column( nullable = false) + private Integer countyCode; + + @Column( length = 32, nullable = false, columnDefinition = "varchar(32)") + private String countyName; + + @Column( length = 16, nullable = false, columnDefinition = "varchar(16)") + private String townCode; + + @Column( length = 32, nullable = false, columnDefinition = "varchar(32)") + private String townName; + + @Column( nullable = false) + private Integer cropCode; + + private LocalDate cropDate; + + private Long area; + + @Column( length = 128, columnDefinition = "varchar(128)") + private String dataSource; + + @Column( length = 128, columnDefinition = "varchar(128)") + private String memo; + + @Column( length = 32,nullable = false, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime addTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCountyCode() { + return countyCode; + } + + public void setCountyCode(Integer countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } + + public String getTownName() { + return townName; + } + + public void setTownName(String townName) { + this.townName = townName; + } + + public Integer getCropCode() { + return cropCode; + } + + public void setCropCode(Integer cropCode) { + this.cropCode = cropCode; + } + + public LocalDate getCropDate() { + return cropDate; + } + + public void setCropDate(LocalDate cropDate) { + this.cropDate = cropDate; + } + + public Long getArea() { + return area; + } + + public void setArea(Long area) { + this.area = area; + } + + public String getDataSource() { + return dataSource; + } + + public void setDataSource(String dataSource) { + this.dataSource = dataSource; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getAddTime() { + return addTime; + } + + public void setAddTime(LocalDateTime addTime) { + this.addTime = addTime; + } + + @Override + public String toString() { + return "CropClassifyRecordEntity{" + + "id=" + id + + ", countyCode=" + countyCode + + ", countyName='" + countyName + '\'' + + ", townCode='" + townCode + '\'' + + ", townName='" + townName + '\'' + + ", cropCode=" + cropCode + + ", cropDate=" + cropDate + + ", area=" + area + + ", dataSource='" + dataSource + '\'' + + ", memo='" + memo + '\'' + + ", addUserName='" + addUserName + '\'' + + ", addTime=" + addTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/SysAuthorityEntity.java b/src/main/java/com/xkrs/microservice/model/entity/SysAuthorityEntity.java new file mode 100644 index 0000000..2822b44 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/SysAuthorityEntity.java @@ -0,0 +1,72 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * SysAuthority 表实体类 + * @author tajochen + */ +@Entity +@Table(name="sys_authority") +public class SysAuthorityEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sys_authority_seq_gen") + @SequenceGenerator(name = "sys_authority_seq_gen", sequenceName = "sys_authority_seq",allocationSize = 1) + private Integer id; + + @Column(length = 64, nullable = false, unique = true,columnDefinition = "varchar(64)") + private String authorityName; + + @Column(length = 64, columnDefinition = "varchar(64)") + private String authorityNameZh; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String authorityDesc; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAuthorityName() { + return authorityName; + } + + public void setAuthorityName(String authorityName) { + this.authorityName = authorityName == null ? null : authorityName.trim(); + } + + public String getAuthorityNameZh() { + return authorityNameZh; + } + + public void setAuthorityNameZh(String authorityNameZh) { + this.authorityNameZh = authorityNameZh == null ? null : authorityNameZh.trim(); + } + + public String getAuthorityDesc() { + return authorityDesc; + } + + public void setAuthorityDesc(String authorityDesc) { + this.authorityDesc = authorityDesc == null ? null : authorityDesc.trim(); + } + + @Override + public String toString() { + return "SysAuthorityEntity{" + + "id=" + id + + ", authorityName='" + authorityName + '\'' + + ", authorityDesc='" + authorityDesc + '\'' + + ", authorityNameZh='" + authorityNameZh + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/com/xkrs/microservice/model/entity/SysRoleEntity.java b/src/main/java/com/xkrs/microservice/model/entity/SysRoleEntity.java new file mode 100644 index 0000000..f019c1d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/SysRoleEntity.java @@ -0,0 +1,72 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * SysRole 表实体类 + * @author tajochen + */ +@Entity +@Table(name="sys_role") +public class SysRoleEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sys_role_seq_gen") + @SequenceGenerator(name = "sys_role_seq_gen", sequenceName = "sys_role_seq",allocationSize = 1) + private Integer id; + + @Column(length = 32, nullable = false, unique = true,columnDefinition = "varchar(32)") + private String roleName; + + @Column(length = 32, columnDefinition = "varchar(32)") + private String roleNameZh; + + @Column(length = 64, columnDefinition = "varchar(64)") + private String roleDesc; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName == null ? null : roleName.trim(); + } + + public String getRoleDesc() { + return roleDesc; + } + + public void setRoleDesc(String roleDesc) { + this.roleDesc = roleDesc == null ? null : roleDesc.trim(); + } + + public String getRoleNameZh() { + return roleNameZh; + } + + public void setRoleNameZh(String roleNameZh) { + this.roleNameZh = roleNameZh == null ? null : roleNameZh.trim(); + } + + @Override + public String toString() { + return "SysRoleEntity{" + + "id=" + id + + ", roleName='" + roleName + '\'' + + ", roleNameZh='" + roleNameZh + '\'' + + ", roleDesc='" + roleDesc + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/com/xkrs/microservice/model/entity/SysUserEntity.java b/src/main/java/com/xkrs/microservice/model/entity/SysUserEntity.java new file mode 100644 index 0000000..1c7a37b --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/SysUserEntity.java @@ -0,0 +1,288 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; + +import java.time.LocalDate; +import java.time.LocalDateTime; + + +/** + * SysUser 表实体类 + * @author tajochen + */ +@Entity +@Table(name="sys_user") +public class SysUserEntity implements Serializable { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sys_user_seq_gen") + @SequenceGenerator(name = "sys_user_seq_gen", sequenceName = "sys_user_seq",allocationSize = 1) + private Integer id; + + @Column(length = 32, nullable = false, unique = true, columnDefinition = "varchar(32)") + private String userName; + + @Column(length = 32, columnDefinition = "varchar(32)") + private String nickName; + + @Column(length = 32, unique = true,columnDefinition = "varchar(32)") + private String userCode; + + @Column(length = 32, columnDefinition = "varchar(32)") + private String realName; + + @Column(length = 64, nullable = false, columnDefinition = "varchar(64)") + private String password; + + @Column(length = 32, nullable = false, columnDefinition = "varchar(32)") + private String salt; + + @Column(columnDefinition = "smallint") + private Integer sex; + + @Column(length = 16, unique = true, columnDefinition = "varchar(16)") + private String telephone; + + @Column(length = 32, columnDefinition = "varchar(32)") + private String email; + + private Integer admCode; + + @Column(length = 64,columnDefinition = "varchar(64)") + private String address; + + private LocalDate birthday; + + @Column(length = 128,columnDefinition = "varchar(128)") + private String signature; + + private Integer portraitId; + + @Column(nullable = false) + private Integer activeFlag; + + @Column(nullable = false,columnDefinition = "smallint") + private Integer statusCode; + + @Column(nullable = false) + private LocalDateTime addTime; + + private LocalDateTime lastEntryTime; + + @Column(length = 64,columnDefinition = "varchar(64)") + private String lastEntryIp; + + @Column(length = 128,columnDefinition = "varchar(128)") + private String memo; + + @Column(nullable = false) + private Integer deleteFlag; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getUserCode() { + return userCode; + } + + public void setUserCode(String userCode) { + this.userCode = userCode; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + public Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public String getTelephone() { + return telephone; + } + + public void setTelephone(String telephone) { + this.telephone = telephone; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Integer getAdmCode() { + return admCode; + } + + public void setAdmCode(Integer admCode) { + this.admCode = admCode; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public LocalDate getBirthday() { + return birthday; + } + + public void setBirthday(LocalDate birthday) { + this.birthday = birthday; + } + + public String getSignature() { + return signature; + } + + public void setSignature(String signature) { + this.signature = signature; + } + + public Integer getPortraitId() { + return portraitId; + } + + public void setPortraitId(Integer portraitId) { + this.portraitId = portraitId; + } + + public Integer getActiveFlag() { + return activeFlag; + } + + public void setActiveFlag(Integer activeFlag) { + this.activeFlag = activeFlag; + } + + public Integer getStatusCode() { + return statusCode; + } + + public void setStatusCode(Integer statusCode) { + this.statusCode = statusCode; + } + + public LocalDateTime getAddTime() { + return addTime; + } + + public void setAddTime(LocalDateTime addTime) { + this.addTime = addTime; + } + + public LocalDateTime getLastEntryTime() { + return lastEntryTime; + } + + public void setLastEntryTime(LocalDateTime lastEntryTime) { + this.lastEntryTime = lastEntryTime; + } + + public String getLastEntryIp() { + return lastEntryIp; + } + + public void setLastEntryIp(String lastEntryIp) { + this.lastEntryIp = lastEntryIp; + } + + public Integer getDeleteFlag() { + return deleteFlag; + } + + public void setDeleteFlag(Integer deleteFlag) { + this.deleteFlag = deleteFlag; + } + + public String getRealName() { + return realName; + } + + public void setRealName(String realName) { + this.realName = realName; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @Override + public String toString() { + return "SysUserEntity{" + + "id=" + id + + ", userName='" + userName + '\'' + + ", nickName='" + nickName + '\'' + + ", userCode='" + userCode + '\'' + + ", realName='" + realName + '\'' + + ", password='" + password + '\'' + + ", salt='" + salt + '\'' + + ", sex=" + sex + + ", telephone='" + telephone + '\'' + + ", email='" + email + '\'' + + ", admCode=" + admCode + + ", address='" + address + '\'' + + ", birthday=" + birthday + + ", signature='" + signature + '\'' + + ", portraitId=" + portraitId + + ", activeFlag=" + activeFlag + + ", statusCode=" + statusCode + + ", addTime=" + addTime + + ", lastEntryTime=" + lastEntryTime + + ", lastEntryIp='" + lastEntryIp + '\'' + + ", memo='" + memo + '\'' + + ", deleteFlag=" + deleteFlag + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/com/xkrs/microservice/model/entity/TifProductEntity.java b/src/main/java/com/xkrs/microservice/model/entity/TifProductEntity.java new file mode 100644 index 0000000..d3ec2c1 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/TifProductEntity.java @@ -0,0 +1,192 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * TifProductEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="tif_product") +public class TifProductEntity { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tif_product_seq_gen") + @SequenceGenerator(name = "tif_product_seq_gen", sequenceName = "tif_product_seq",allocationSize = 1) + private Integer id; + + @Column( length = 128,nullable = false,unique = true, columnDefinition = "varchar(128)") + private String productCode; + + private Integer admCode; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String admName; + + private LocalDate productDate; + + @Column(length = 64,nullable = false, columnDefinition = "varchar(64)") + private String productType; + + @Column(length = 128,nullable = false, columnDefinition = "varchar(128)") + private String fileName; + + @Column(length = 255,nullable = false, columnDefinition = "varchar(255)") + private String filePath; + + @Column(length = 192, columnDefinition = "varchar(192)") + private String fileMd5; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String fileSize; + + @Column(length = 255, columnDefinition = "varchar(255)") + private String thumbnailPath; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String memo; + + private LocalDateTime createTime; + + @Column(length = 32, columnDefinition = "varchar(32)") + private String addUserName; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getProductCode() { + return productCode; + } + + public void setProductCode(String productCode) { + this.productCode = productCode; + } + + public Integer getAdmCode() { + return admCode; + } + + public void setAdmCode(Integer admCode) { + this.admCode = admCode; + } + + public String getAdmName() { + return admName; + } + + public void setAdmName(String admName) { + this.admName = admName; + } + + public LocalDate getProductDate() { + return productDate; + } + + public void setProductDate(LocalDate productDate) { + this.productDate = productDate; + } + + public String getProductType() { + return productType; + } + + public void setProductType(String productType) { + this.productType = productType; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getFileMd5() { + return fileMd5; + } + + public void setFileMd5(String fileMd5) { + this.fileMd5 = fileMd5; + } + + public String getFileSize() { + return fileSize; + } + + public void setFileSize(String fileSize) { + this.fileSize = fileSize; + } + + public String getThumbnailPath() { + return thumbnailPath; + } + + public void setThumbnailPath(String thumbnailPath) { + this.thumbnailPath = thumbnailPath; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + @Override + public String toString() { + return "TifProductEntity{" + + "id=" + id + + ", productCode='" + productCode + '\'' + + ", admCode=" + admCode + + ", admName='" + admName + '\'' + + ", productDate=" + productDate + + ", productType='" + productType + '\'' + + ", fileName='" + fileName + '\'' + + ", filePath='" + filePath + '\'' + + ", fileMd5='" + fileMd5 + '\'' + + ", fileSize='" + fileSize + '\'' + + ", thumbnailPath='" + thumbnailPath + '\'' + + ", memo='" + memo + '\'' + + ", createTime=" + createTime + + ", addUserName='" + addUserName + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/TypicalFarmerEntity.java b/src/main/java/com/xkrs/microservice/model/entity/TypicalFarmerEntity.java new file mode 100644 index 0000000..ff24461 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/TypicalFarmerEntity.java @@ -0,0 +1,204 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * TypicalFarmerEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="typical_farmer") +public class TypicalFarmerEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "typical_farmer_gen") + @SequenceGenerator(name = "typical_farmer_seq_gen", sequenceName = "typical_farmer_seq",allocationSize = 1) + private Integer id; + + @Column( length = 16, columnDefinition = "varchar(16)", nullable = false) + private String lxr; + + @Column( length = 32, columnDefinition = "varchar(32)", nullable = false) + private String lxrid; + + @Column( length = 32, columnDefinition = "varchar(32)",unique = true, nullable = false) + private String tel; + + private Integer qxdm; + + @Column( length = 32, columnDefinition = "varchar(32)", nullable = false) + private String qxmc; + + @Column( length = 32, columnDefinition = "varchar(32)", nullable = false) + private String xzdm; + + @Column( length = 32, columnDefinition = "varchar(32)", nullable = false) + private String xzmc; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String address; + + private LocalDate strdate; + + private LocalDate enddate; + + @Column( length = 512, columnDefinition = "varchar(512)") + private String xyzp; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String remark; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String addUserName; + + private LocalDateTime createTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getLxr() { + return lxr; + } + + public void setLxr(String lxr) { + this.lxr = lxr; + } + + public String getLxrid() { + return lxrid; + } + + public void setLxrid(String lxrid) { + this.lxrid = lxrid; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public Integer getQxdm() { + return qxdm; + } + + public void setQxdm(Integer qxdm) { + this.qxdm = qxdm; + } + + public String getQxmc() { + return qxmc; + } + + public void setQxmc(String qxmc) { + this.qxmc = qxmc; + } + + public String getXzdm() { + return xzdm; + } + + public void setXzdm(String xzdm) { + this.xzdm = xzdm; + } + + public String getXzmc() { + return xzmc; + } + + public void setXzmc(String xzmc) { + this.xzmc = xzmc; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public LocalDate getStrdate() { + return strdate; + } + + public void setStrdate(LocalDate strdate) { + this.strdate = strdate; + } + + public LocalDate getEnddate() { + return enddate; + } + + public void setEnddate(LocalDate enddate) { + this.enddate = enddate; + } + + public String getXyzp() { + return xyzp; + } + + public void setXyzp(String xyzp) { + this.xyzp = xyzp; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + @Override + public String toString() { + return "TypicalFarmerEntity{" + + "id=" + id + + ", lxr='" + lxr + '\'' + + ", lxrid='" + lxrid + '\'' + + ", tel='" + tel + '\'' + + ", qxdm=" + qxdm + + ", qxmc='" + qxmc + '\'' + + ", xzdm='" + xzdm + '\'' + + ", xzmc='" + xzmc + '\'' + + ", address='" + address + '\'' + + ", strdate=" + strdate + + ", enddate=" + enddate + + ", xyzp='" + xyzp + '\'' + + ", remark='" + remark + '\'' + + ", addUserName='" + addUserName + '\'' + + ", createTime=" + createTime + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/TypicalPlotEntity.java b/src/main/java/com/xkrs/microservice/model/entity/TypicalPlotEntity.java new file mode 100644 index 0000000..40c4d25 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/TypicalPlotEntity.java @@ -0,0 +1,400 @@ +package com.xkrs.microservice.model.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.micrometer.core.instrument.util.StringUtils; +import org.geolatte.geom.Geometry; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * TypicalPlotEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="typical_plot") +public class TypicalPlotEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "typical_plot_gen") + @SequenceGenerator(name = "typical_plot_seq_gen", sequenceName = "typical_plot_seq",allocationSize = 1) + private Integer id; + + @Column( length = 32,unique = true,nullable = false, columnDefinition = "varchar(32)") + private String dkbh; + + private Integer dsdm; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String dsmc; + + private Integer qxdm; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String qxmc; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String xzdm; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String xzmc; + + private Integer dlbm; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String dlmc; + + private Integer cbzwdm; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String cbzwmc; + + private Integer xbzwdm; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String xbzwmc; + + private Integer qdzwdm; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String qdzwmc; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String snyd; + + private Float tbmj; + + private Float xzb; + + private Float yzb; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String trlx; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String sysjq; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String dbgq; + + @Column( length = 16, columnDefinition = "varchar(16)") + private String lxr; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String tel; + + @Column( length = 512, columnDefinition = "varchar(512)") + private String dkzp; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String remark; + + private LocalDateTime createTime; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String addUserName; + + private Geometry geom; + + @Transient + private String wktGeom; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDkbh() { + return dkbh; + } + + public void setDkbh(String dkbh) { + this.dkbh = dkbh; + } + + public Integer getDsdm() { + return dsdm; + } + + public void setDsdm(Integer dsdm) { + this.dsdm = dsdm; + } + + public String getDsmc() { + return dsmc; + } + + public void setDsmc(String dsmc) { + this.dsmc = dsmc; + } + + public Integer getQxdm() { + return qxdm; + } + + public void setQxdm(Integer qxdm) { + this.qxdm = qxdm; + } + + public String getQxmc() { + return qxmc; + } + + public void setQxmc(String qxmc) { + this.qxmc = qxmc; + } + + public String getXzdm() { + return xzdm; + } + + public void setXzdm(String xzdm) { + this.xzdm = xzdm; + } + + public String getXzmc() { + return xzmc; + } + + public void setXzmc(String xzmc) { + this.xzmc = xzmc; + } + + public Integer getDlbm() { + return dlbm; + } + + public void setDlbm(Integer dlbm) { + this.dlbm = dlbm; + } + + public String getDlmc() { + return dlmc; + } + + public void setDlmc(String dlmc) { + this.dlmc = dlmc; + } + + public Integer getCbzwdm() { + return cbzwdm; + } + + public void setCbzwdm(Integer cbzwdm) { + this.cbzwdm = cbzwdm; + } + + public String getCbzwmc() { + return cbzwmc; + } + + public void setCbzwmc(String cbzwmc) { + this.cbzwmc = cbzwmc; + } + + public Integer getXbzwdm() { + return xbzwdm; + } + + public void setXbzwdm(Integer xbzwdm) { + this.xbzwdm = xbzwdm; + } + + public String getXbzwmc() { + return xbzwmc; + } + + public void setXbzwmc(String xbzwmc) { + this.xbzwmc = xbzwmc; + } + + public Integer getQdzwdm() { + return qdzwdm; + } + + public void setQdzwdm(Integer qdzwdm) { + this.qdzwdm = qdzwdm; + } + + public String getQdzwmc() { + return qdzwmc; + } + + public void setQdzwmc(String qdzwmc) { + this.qdzwmc = qdzwmc; + } + + public String getSnyd() { + return snyd; + } + + public void setSnyd(String snyd) { + this.snyd = snyd; + } + + public Float getTbmj() { + return tbmj; + } + + public void setTbmj(Float tbmj) { + this.tbmj = tbmj; + } + + public Float getXzb() { + return xzb; + } + + public void setXzb(Float xzb) { + this.xzb = xzb; + } + + public Float getYzb() { + return yzb; + } + + public void setYzb(Float yzb) { + this.yzb = yzb; + } + + public String getTrlx() { + return trlx; + } + + public void setTrlx(String trlx) { + this.trlx = trlx; + } + + public String getSysjq() { + return sysjq; + } + + public void setSysjq(String sysjq) { + this.sysjq = sysjq; + } + + public String getDbgq() { + return dbgq; + } + + public void setDbgq(String dbgq) { + this.dbgq = dbgq; + } + + public String getLxr() { + return lxr; + } + + public void setLxr(String lxr) { + this.lxr = lxr; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getDkzp() { + return dkzp; + } + + public void setDkzp(String dkzp) { + this.dkzp = dkzp; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + @JsonIgnore + public Geometry getGeom() { + return geom; + } + + @JsonIgnore + public void setGeom(Geometry geom) { + this.geom = geom; + } + + public String getWktGeom() { + if(StringUtils.isNotBlank(wktGeom)){ + return wktGeom; + } else if(geom == null){ + return ""; + } else { + return geom.toString(); + } + } + + public void setWktGeom(String wktGeom) { + this.wktGeom = wktGeom; + } + + @Override + public String toString() { + return "TypicalPlotEntity{" + + "id=" + id + + ", dkbh='" + dkbh + '\'' + + ", dsdm=" + dsdm + + ", dsmc='" + dsmc + '\'' + + ", qxdm=" + qxdm + + ", qxmc='" + qxmc + '\'' + + ", xzdm='" + xzdm + '\'' + + ", xzmc='" + xzmc + '\'' + + ", dlbm=" + dlbm + + ", dlmc='" + dlmc + '\'' + + ", cbzwdm=" + cbzwdm + + ", cbzwmc='" + cbzwmc + '\'' + + ", xbzwdm=" + xbzwdm + + ", xbzwmc='" + xbzwmc + '\'' + + ", qdzwdm=" + qdzwdm + + ", qdzwmc='" + qdzwmc + '\'' + + ", snyd='" + snyd + '\'' + + ", tbmj=" + tbmj + + ", xzb=" + xzb + + ", yzb=" + yzb + + ", trlx='" + trlx + '\'' + + ", sysjq='" + sysjq + '\'' + + ", dbgq='" + dbgq + '\'' + + ", lxr='" + lxr + '\'' + + ", tel='" + tel + '\'' + + ", dkzp='" + dkzp + '\'' + + ", remark='" + remark + '\'' + + ", createTime=" + createTime + + ", addUserName='" + addUserName + '\'' + + ", geom=" + geom + + ", wktGeom='" + wktGeom + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/TypicalPlotIrrigationEntity.java b/src/main/java/com/xkrs/microservice/model/entity/TypicalPlotIrrigationEntity.java new file mode 100644 index 0000000..52cfb55 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/TypicalPlotIrrigationEntity.java @@ -0,0 +1,286 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * TypicalPlotIrrigationEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="typical_plot_irrigation") +public class TypicalPlotIrrigationEntity implements Serializable { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "typical_plot_irrigation_gen") + @SequenceGenerator(name = "typical_plot_irrigation_seq_gen", sequenceName = "typical_plot_irrigation_seq",allocationSize = 1) + private Integer id; + + @Column( length = 32, columnDefinition = "varchar(32)",unique = true, nullable = false) + private String ggbh; + + @Column( nullable = false) + private Integer qxbh; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String xzbh; + + @Column( length = 32, columnDefinition = "varchar(32)", nullable = false) + private String dkbh; + + @Column( length = 64, columnDefinition = "varchar(64)",nullable = false) + private String sylx; + + @Column( length = 64, columnDefinition = "varchar(64)",nullable = false) + private String gglx; + + @Column( length = 64, columnDefinition = "varchar(64)", nullable = false) + private String gcff; + + @Column(nullable = false) + private Double ggysl; + + @Column(nullable = false) + private LocalDateTime strtime; + + @Column(nullable = false) + private LocalDateTime endtime; + + @Column( length = 512, columnDefinition = "varchar(512)") + private String strzp; + + @Column( length = 512, columnDefinition = "varchar(512)") + private String endzp; + + private Integer hsbj; + + private Integer qrbj; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String cropName; + + private Integer cropCode; + + private Double irrigationHour; + + private Double irrigationArea; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String remark; + + private LocalDateTime createTime; + + @Column( length = 32, columnDefinition = "varchar(32)") + private String addUserName; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getGgbh() { + return ggbh; + } + + public void setGgbh(String ggbh) { + this.ggbh = ggbh; + } + + public Integer getQxbh() { + return qxbh; + } + + public void setQxbh(Integer qxbh) { + this.qxbh = qxbh; + } + + public String getXzbh() { + return xzbh; + } + + public void setXzbh(String xzbh) { + this.xzbh = xzbh; + } + + public String getDkbh() { + return dkbh; + } + + public void setDkbh(String dkbh) { + this.dkbh = dkbh; + } + + public String getSylx() { + return sylx; + } + + public void setSylx(String sylx) { + this.sylx = sylx; + } + + public String getGglx() { + return gglx; + } + + public void setGglx(String gglx) { + this.gglx = gglx; + } + + public String getGcff() { + return gcff; + } + + public void setGcff(String gcff) { + this.gcff = gcff; + } + + public Double getGgysl() { + return ggysl; + } + + public void setGgysl(Double ggysl) { + this.ggysl = ggysl; + } + + public LocalDateTime getStrtime() { + return strtime; + } + + public void setStrtime(LocalDateTime strtime) { + this.strtime = strtime; + } + + public LocalDateTime getEndtime() { + return endtime; + } + + public void setEndtime(LocalDateTime endtime) { + this.endtime = endtime; + } + + public String getStrzp() { + return strzp; + } + + public void setStrzp(String strzp) { + this.strzp = strzp; + } + + public String getEndzp() { + return endzp; + } + + public void setEndzp(String endzp) { + this.endzp = endzp; + } + + public Integer getHsbj() { + return hsbj; + } + + public void setHsbj(Integer hsbj) { + this.hsbj = hsbj; + } + + public Integer getQrbj() { + return qrbj; + } + + public void setQrbj(Integer qrbj) { + this.qrbj = qrbj; + } + + public String getCropName() { + return cropName; + } + + public void setCropName(String cropName) { + this.cropName = cropName; + } + + public Integer getCropCode() { + return cropCode; + } + + public void setCropCode(Integer cropCode) { + this.cropCode = cropCode; + } + + public Double getIrrigationArea() { + return irrigationArea; + } + + public void setIrrigationArea(Double irrigationArea) { + this.irrigationArea = irrigationArea; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + public Double getIrrigationHour() { + return irrigationHour; + } + + public void setIrrigationHour(Double irrigationHour) { + this.irrigationHour = irrigationHour; + } + + @Override + public String toString() { + return "TypicalPlotIrrigationEntity{" + + "id=" + id + + ", ggbh='" + ggbh + '\'' + + ", qxbh=" + qxbh + + ", xzbh='" + xzbh + '\'' + + ", dkbh='" + dkbh + '\'' + + ", sylx='" + sylx + '\'' + + ", gglx='" + gglx + '\'' + + ", gcff='" + gcff + '\'' + + ", ggysl=" + ggysl + + ", strtime=" + strtime + + ", endtime=" + endtime + + ", strzp='" + strzp + '\'' + + ", endzp='" + endzp + '\'' + + ", hsbj=" + hsbj + + ", qrbj=" + qrbj + + ", cropName='" + cropName + '\'' + + ", cropCode=" + cropCode + + ", irrigationHour=" + irrigationHour + + ", irrigationArea=" + irrigationArea + + ", remark='" + remark + '\'' + + ", createTime=" + createTime + + ", addUserName='" + addUserName + '\'' + + '}'; + } + +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/WcsRecordEntity.java b/src/main/java/com/xkrs/microservice/model/entity/WcsRecordEntity.java new file mode 100644 index 0000000..8f6d1ca --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/WcsRecordEntity.java @@ -0,0 +1,180 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * WcsRecordEntity 表实体类 + * @author tajochen + */ +@Entity +@Table(name="wcs_record") +public class WcsRecordEntity { + + private static final long serialVersionUID = 4359709211352400087L; + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "wcs_record_seq_gen") + @SequenceGenerator(name = "wcs_record_seq_gen", sequenceName = "wcs_record_seq",allocationSize = 1) + private Integer id; + + @Column( length = 128,nullable = false,unique = true, columnDefinition = "varchar(128)") + private String serviceCode; + + private Integer admCode; + + @Column( length = 64, columnDefinition = "varchar(64)") + private String admName; + + private LocalDate productDate; + + @Column(length = 64,nullable = false, columnDefinition = "varchar(64)") + private String productType; + + @Column(length = 128,nullable = false, columnDefinition = "varchar(128)") + private String workSpace; + + @Column(length = 128,nullable = false, columnDefinition = "varchar(255)") + private String layerName; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String srs; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String styleName; + + @Column(length = 128, columnDefinition = "varchar(128)") + private String memo; + + private LocalDateTime createTime; + + @Column(length = 32, columnDefinition = "varchar(32)") + private String addUserName; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getServiceCode() { + return serviceCode; + } + + public void setServiceCode(String serviceCode) { + this.serviceCode = serviceCode; + } + + public Integer getAdmCode() { + return admCode; + } + + public void setAdmCode(Integer admCode) { + this.admCode = admCode; + } + + public String getAdmName() { + return admName; + } + + public void setAdmName(String admName) { + this.admName = admName; + } + + public LocalDate getProductDate() { + return productDate; + } + + public void setProductDate(LocalDate productDate) { + this.productDate = productDate; + } + + public String getProductType() { + return productType; + } + + public void setProductType(String productType) { + this.productType = productType; + } + + public String getWorkSpace() { + return workSpace; + } + + public void setWorkSpace(String workSpace) { + this.workSpace = workSpace; + } + + public String getLayerName() { + return layerName; + } + + public void setLayerName(String layerName) { + this.layerName = layerName; + } + + public String getSrs() { + return srs; + } + + public void setSrs(String srs) { + this.srs = srs; + } + + public String getStyleName() { + return styleName; + } + + public void setStyleName(String styleName) { + this.styleName = styleName; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public String getAddUserName() { + return addUserName; + } + + public void setAddUserName(String addUserName) { + this.addUserName = addUserName; + } + + @Override + public String toString() { + return "WcsRecordEntity{" + + "id=" + id + + ", serviceCode='" + serviceCode + '\'' + + ", admCode=" + admCode + + ", admName='" + admName + '\'' + + ", productDate=" + productDate + + ", productType='" + productType + '\'' + + ", workSpace='" + workSpace + '\'' + + ", layerName='" + layerName + '\'' + + ", srs='" + srs + '\'' + + ", styleName='" + styleName + '\'' + + ", memo='" + memo + '\'' + + ", createTime=" + createTime + + ", addUserName='" + addUserName + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/entity/WeatherEntity.java b/src/main/java/com/xkrs/microservice/model/entity/WeatherEntity.java new file mode 100644 index 0000000..85800e9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/entity/WeatherEntity.java @@ -0,0 +1,349 @@ +package com.xkrs.microservice.model.entity; + +import javax.persistence.*; + +/** + * @author XinYi Song + * 天气的信息 + */ +@Entity +@Table(name="weather") +public class WeatherEntity { + + /** + * 指定主键,建立自增序列,主键值取自序列 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "weather_seq_gen") + @SequenceGenerator(name = "weather_seq_gen", sequenceName = "weather_seq",allocationSize = 1) + private Integer id; + + /** + * 风速 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String windSpeed; + + /** + * 雨量累计 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String rainfall; + + /** + * 大气温度 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String atmosphericTemperature; + + /** + * 大气湿度 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String atmosphericHumidity; + + /** + * 数字气压 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String digitalAirPressure; + + /** + * 太阳总辐射 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String totalSolarRadiation; + + /** + * 风向 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String windDirection; + + /** + * 辐射累计 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String radiationAccumulation; + + /** + * 土温1 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String soilTemperatureOne; + + /** + * 土湿1 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String soilWetOne; + + /** + * 土温2 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String soilTemperatureTwo; + + /** + * 土湿2 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String soilWetTwo; + + /** + * 土温3 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String soilTemperatureThree; + + /** + * 土湿3 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String soilWetThree; + + /** + * 土温4 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String soilTemperatureFour; + + /** + * 土湿4 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String soilWetFour; + + /** + * ph值 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String phValue; + + /** + * 日照时数 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String sunshineHours; + + /** + * 二氧化碳 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String carbonDioxide; + + /** + * 盐分 + */ + @Column(length = 32,columnDefinition = "varchar(32)") + private String salt; + + /** + * 时间 + */ + private String addTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getWindSpeed() { + return windSpeed; + } + + public void setWindSpeed(String windSpeed) { + this.windSpeed = windSpeed; + } + + public String getRainfall() { + return rainfall; + } + + public void setRainfall(String rainfall) { + this.rainfall = rainfall; + } + + public String getAtmosphericTemperature() { + return atmosphericTemperature; + } + + public void setAtmosphericTemperature(String atmosphericTemperature) { + this.atmosphericTemperature = atmosphericTemperature; + } + + public String getAtmosphericHumidity() { + return atmosphericHumidity; + } + + public void setAtmosphericHumidity(String atmosphericHumidity) { + this.atmosphericHumidity = atmosphericHumidity; + } + + public String getDigitalAirPressure() { + return digitalAirPressure; + } + + public void setDigitalAirPressure(String digitalAirPressure) { + this.digitalAirPressure = digitalAirPressure; + } + + public String getTotalSolarRadiation() { + return totalSolarRadiation; + } + + public void setTotalSolarRadiation(String totalSolarRadiation) { + this.totalSolarRadiation = totalSolarRadiation; + } + + public String getWindDirection() { + return windDirection; + } + + public void setWindDirection(String windDirection) { + this.windDirection = windDirection; + } + + public String getRadiationAccumulation() { + return radiationAccumulation; + } + + public void setRadiationAccumulation(String radiationAccumulation) { + this.radiationAccumulation = radiationAccumulation; + } + + public String getSoilTemperatureOne() { + return soilTemperatureOne; + } + + public void setSoilTemperatureOne(String soilTemperatureOne) { + this.soilTemperatureOne = soilTemperatureOne; + } + + public String getSoilWetOne() { + return soilWetOne; + } + + public void setSoilWetOne(String soilWetOne) { + this.soilWetOne = soilWetOne; + } + + public String getSoilTemperatureTwo() { + return soilTemperatureTwo; + } + + public void setSoilTemperatureTwo(String soilTemperatureTwo) { + this.soilTemperatureTwo = soilTemperatureTwo; + } + + public String getSoilWetTwo() { + return soilWetTwo; + } + + public void setSoilWetTwo(String soilWetTwo) { + this.soilWetTwo = soilWetTwo; + } + + public String getSoilTemperatureThree() { + return soilTemperatureThree; + } + + public void setSoilTemperatureThree(String soilTemperatureThree) { + this.soilTemperatureThree = soilTemperatureThree; + } + + public String getSoilWetThree() { + return soilWetThree; + } + + public void setSoilWetThree(String soilWetThree) { + this.soilWetThree = soilWetThree; + } + + public String getSoilTemperatureFour() { + return soilTemperatureFour; + } + + public void setSoilTemperatureFour(String soilTemperatureFour) { + this.soilTemperatureFour = soilTemperatureFour; + } + + public String getSoilWetFour() { + return soilWetFour; + } + + public void setSoilWetFour(String soilWetFour) { + this.soilWetFour = soilWetFour; + } + + public String getPhValue() { + return phValue; + } + + public void setPhValue(String phValue) { + this.phValue = phValue; + } + + public String getSunshineHours() { + return sunshineHours; + } + + public void setSunshineHours(String sunshineHours) { + this.sunshineHours = sunshineHours; + } + + public String getCarbonDioxide() { + return carbonDioxide; + } + + public void setCarbonDioxide(String carbonDioxide) { + this.carbonDioxide = carbonDioxide; + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + public String getAddTime() { + return addTime; + } + + public void setAddTime(String addTime) { + this.addTime = addTime; + } + + @Override + public String toString() { + return "WeatherEntity{" + + "id=" + id + + ", windSpeed='" + windSpeed + '\'' + + ", rainfall='" + rainfall + '\'' + + ", atmosphericTemperature='" + atmosphericTemperature + '\'' + + ", atmosphericHumidity='" + atmosphericHumidity + '\'' + + ", digitalAirPressure='" + digitalAirPressure + '\'' + + ", totalSolarRadiation='" + totalSolarRadiation + '\'' + + ", windDirection='" + windDirection + '\'' + + ", radiationAccumulation='" + radiationAccumulation + '\'' + + ", soilTemperatureOne='" + soilTemperatureOne + '\'' + + ", soilWetOne='" + soilWetOne + '\'' + + ", soilTemperatureTwo='" + soilTemperatureTwo + '\'' + + ", soilWetTwo='" + soilWetTwo + '\'' + + ", soilTemperatureThree='" + soilTemperatureThree + '\'' + + ", soilWetThree='" + soilWetThree + '\'' + + ", soilTemperatureFour='" + soilTemperatureFour + '\'' + + ", soilWetFour='" + soilWetFour + '\'' + + ", phValue='" + phValue + '\'' + + ", sunshineHours='" + sunshineHours + '\'' + + ", carbonDioxide='" + carbonDioxide + '\'' + + ", salt='" + salt + '\'' + + ", addTime='" + addTime + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/AppFileQo.java b/src/main/java/com/xkrs/microservice/model/qo/AppFileQo.java new file mode 100644 index 0000000..cd86b30 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/AppFileQo.java @@ -0,0 +1,100 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.AppFileQoInsert; +import com.xkrs.microservice.model.validation.AppFileQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +/** + * AppFileQo + * @author tajochen + */ +public class AppFileQo { + + @NotNull(message = "{AppFile.id.null}",groups={AppFileQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{AppFile.name.null}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + @Size(max = 64, message = "{AppFile.name.length.illegal}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + private String name; + + @NotBlank(message = "{AppFile.appPath.null}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + @Size(max = 192, message = "{AppFile.appPath.length.illegal}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + private String appPath; + + @NotBlank(message = "{AppFile.versionNumber.null}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + @Size(max = 128, message = "{AppFile.versionNumber.length.illegal}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + @Pattern(regexp = "^([1-9]\\d|[1-9])(.([1-9]\\d|\\d)){2}$",message = "{AppFile.versionNumber.format.illegal}",groups = {AppFileQoInsert.class, + AppFileQoUpdate.class}) + private String versionNumber; + + @NotBlank(message = "{AppFile.size.null}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + @Size(max = 128, message = "{AppFile.size.length.illegal}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + private String size; + + @NotBlank(message = "{AppFile.md5.null}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + @Size(max = 192, message = "{AppFile.md5.length.illegal}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + private String md5; + + @Size(max = 128, message = "{AppFile.memo.length.illegal}",groups = {AppFileQoInsert.class, AppFileQoUpdate.class}) + private String memo; + + 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 getAppPath() { + return appPath; + } + + public void setAppPath(String appPath) { + this.appPath = appPath; + } + + public String getVersionNumber() { + return versionNumber; + } + + public void setVersionNumber(String versionNumber) { + this.versionNumber = versionNumber; + } + + public String getSize() { + return size; + } + + public void setSize(String size) { + this.size = size; + } + + public String getMd5() { + return md5; + } + + public void setMd5(String md5) { + this.md5 = md5; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/CropClassifyRecordQo.java b/src/main/java/com/xkrs/microservice/model/qo/CropClassifyRecordQo.java new file mode 100644 index 0000000..e7205e5 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/CropClassifyRecordQo.java @@ -0,0 +1,129 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.CropClassifyRecordQoInsert; +import com.xkrs.microservice.model.validation.CropClassifyRecordQoUpdate; +import com.xkrs.microservice.model.validation.IrrigationRecordQoInsert; +import com.xkrs.microservice.model.validation.IrrigationRecordQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * CropClassifyRecordQo + * @author tajochen + */ +public class CropClassifyRecordQo { + + @NotNull(message = "{CropClassifyRecord.id.null}",groups={CropClassifyRecordQoUpdate.class}) + private Integer id; + + @NotNull(message = "{CropClassifyRecord.countyCode.null}",groups={CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + private Integer countyCode; + + @NotBlank(message = "{CropClassifyRecord.countyName.null}",groups={CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + @Size(max = 32, message = "{CropClassifyRecord.countyName.length.illegal}",groups = {CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + private String countyName; + + @NotBlank(message = "{CropClassifyRecord.townCode.null}",groups={CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + @Size(max = 16, message = "{CropClassifyRecord.townCode.length.illegal}",groups = {CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + private String townCode; + + @NotBlank(message = "{CropClassifyRecord.townName.null}",groups={CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + @Size(max = 32, message = "{CropClassifyRecord.townName.length.illegal}",groups = {CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + private String townName; + + @NotNull(message = "{CropClassifyRecord.cropCode.null}",groups={CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + private Integer cropCode; + + @NotNull(message = "{CropClassifyRecord.cropDateTs.null}",groups={CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + private Long cropDateTs; + + private Long area; + + @Size(max = 128, message = "{CropClassifyRecord.dataSource.length.illegal}",groups = {CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + private String dataSource; + + @Size(max = 128, message = "{CropClassifyRecord.memo.length.illegal}",groups = {CropClassifyRecordQoInsert.class, CropClassifyRecordQoUpdate.class}) + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCountyCode() { + return countyCode; + } + + public void setCountyCode(Integer countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } + + public String getTownName() { + return townName; + } + + public void setTownName(String townName) { + this.townName = townName; + } + + public Integer getCropCode() { + return cropCode; + } + + public void setCropCode(Integer cropCode) { + this.cropCode = cropCode; + } + + public Long getCropDateTs() { + return cropDateTs; + } + + public void setCropDateTs(Long cropDateTs) { + this.cropDateTs = cropDateTs; + } + + public Long getArea() { + return area; + } + + public void setArea(Long area) { + this.area = area; + } + + public String getDataSource() { + return dataSource; + } + + public void setDataSource(String dataSource) { + this.dataSource = dataSource; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/FarmingInfoQo.java b/src/main/java/com/xkrs/microservice/model/qo/FarmingInfoQo.java new file mode 100644 index 0000000..9644ffa --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/FarmingInfoQo.java @@ -0,0 +1,105 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.FarmingInfoQoInsert; +import com.xkrs.microservice.model.validation.FarmingInfoQoUpdate; + +import javax.persistence.Column; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * FarmingInfoQo + * @author tajochen + */ +public class FarmingInfoQo { + + @NotNull(message = "{FarmingInfo.id.null}",groups={FarmingInfoQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{FarmingInfo.dkbh.null}",groups = {FarmingInfoQoInsert.class, FarmingInfoQoUpdate.class}) + @Size(max = 32, message = "{FarmingInfo.dkbh.length.illegal}",groups = {FarmingInfoQoInsert.class, FarmingInfoQoUpdate.class}) + private String dkbh; + + @NotNull(message = "{FarmingInfo.qxbh.null}",groups={FarmingInfoQoInsert.class,FarmingInfoQoUpdate.class}) + private Integer qxbh; + + @NotBlank(message = "{FarmingInfo.zwmc.null}",groups = {FarmingInfoQoInsert.class, FarmingInfoQoUpdate.class}) + @Size(max = 32, message = "{FarmingInfo.zwmc.length.illegal}",groups = {FarmingInfoQoInsert.class, FarmingInfoQoUpdate.class}) + private String zwmc; + + private Integer zwdm; + + @Size(max = 512, message = "{FarmingInfo.nqzp.length.illegal}",groups = {FarmingInfoQoInsert.class, FarmingInfoQoUpdate.class}) + private String nqzp; + + @Size(max = 64, message = "{FarmingInfo.nqzt.length.illegal}",groups = {FarmingInfoQoInsert.class, FarmingInfoQoUpdate.class}) + private String nqzt; + + @Size(max = 64, message = "{FarmingInfo.remark.length.illegal}",groups = {FarmingInfoQoInsert.class, FarmingInfoQoUpdate.class}) + private String remark; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getQxbh() { + return qxbh; + } + + public void setQxbh(Integer qxbh) { + this.qxbh = qxbh; + } + + public String getZwmc() { + return zwmc; + } + + public void setZwmc(String zwmc) { + this.zwmc = zwmc; + } + + public Integer getZwdm() { + return zwdm; + } + + public void setZwdm(Integer zwdm) { + this.zwdm = zwdm; + } + + public String getDkbh() { + return dkbh; + } + + public void setDkbh(String dkbh) { + this.dkbh = dkbh; + } + + public String getNqzp() { + return nqzp; + } + + public void setNqzp(String nqzp) { + this.nqzp = nqzp; + } + + public String getNqzt() { + return nqzt; + } + + public void setNqzt(String nqzt) { + this.nqzt = nqzt; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/FileDocumentQo.java b/src/main/java/com/xkrs/microservice/model/qo/FileDocumentQo.java new file mode 100644 index 0000000..205bf10 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/FileDocumentQo.java @@ -0,0 +1,107 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.FileDocumentQoInsert; +import com.xkrs.microservice.model.validation.FileDocumentQoUpdate; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * AssistantInvestigatorQo + * @author tajochen + */ +public class FileDocumentQo { + + @NotNull(message = "{FileDocument.id.null}",groups={FileDocumentQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{FileDocument.name.null}",groups = {FileDocumentQoInsert.class}) + @Size(max = 64, message = "{FileDocument.name.length.illegal}", groups={FileDocumentQoInsert.class, FileDocumentQoUpdate.class}) + private String name; + + @Min(value = 0, message = "{FileDocument.category.length.illegal}", groups={FileDocumentQoInsert.class, FileDocumentQoUpdate.class}) + private Integer category; + + @NotBlank(message = "{FileDocument.filePath.null}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class}) + @Size(max = 192, message = "{FileDocument.filePath.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class}) + private String filePath; + + @Size(max = 128, message = "{FileDocument.size.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class}) + private String size; + + @NotBlank(message = "{FileDocument.md5.null}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class}) + @Size(max = 192, message = "{FileDocument.md5.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class}) + private String md5; + + @Size(max = 128, message = "{FileDocument.memo.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class}) + private String memo; + + @Size(max = 128, message = "{FileDocument.checkingToken.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class}) + private String checkingToken; + + 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 Integer getCategory() { + return category; + } + + public void setCategory(Integer category) { + this.category = category; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getSize() { + return size; + } + + public void setSize(String size) { + this.size = size; + } + + public String getMd5() { + return md5; + } + + public void setMd5(String md5) { + this.md5 = md5; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getCheckingToken() { + return checkingToken; + } + + public void setCheckingToken(String checkingToken) { + this.checkingToken = checkingToken; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/HydrologicalStationQo.java b/src/main/java/com/xkrs/microservice/model/qo/HydrologicalStationQo.java new file mode 100644 index 0000000..c991baa --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/HydrologicalStationQo.java @@ -0,0 +1,98 @@ +package com.xkrs.microservice.model.qo; + +/** + * HydrologicalStationQo + * @author tajochen + */ +public class HydrologicalStationQo { + + private Integer id; + + private String name; + + private String county; + + private Long time; + + private Double longitude; + + private Double latitude; + + private Double drp; + + private Integer droughtLevel; + + private String remarks; + + 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 getCounty() { + return county; + } + + public void setCounty(String county) { + this.county = county; + } + + public Long getTime() { + return time; + } + + public void setTime(Long time) { + this.time = time; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public Double getDrp() { + return drp; + } + + public void setDrp(Double drp) { + this.drp = drp; + } + + public Integer getDroughtLevel() { + return droughtLevel; + } + + public void setDroughtLevel(Integer droughtLevel) { + this.droughtLevel = droughtLevel; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/IndependentCheckQo.java b/src/main/java/com/xkrs/microservice/model/qo/IndependentCheckQo.java new file mode 100644 index 0000000..2a7d3de --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/IndependentCheckQo.java @@ -0,0 +1,172 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.IndependentCheckQoInsert; +import com.xkrs.microservice.model.validation.IndependentCheckQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * IndependentCheckQo + * @author tajochen + */ +public class IndependentCheckQo { + + @NotNull(message = "{IndependentCheck.id.null}",groups={IndependentCheckQoUpdate.class}) + private Integer id; + + @NotNull(message = "{IndependentCheck.qxdm.null}",groups={IndependentCheckQoInsert.class,IndependentCheckQoUpdate.class}) + private Integer qxdm; + + @NotBlank(message = "{IndependentCheck.qxmc.null}",groups = {IndependentCheckQoInsert.class, IndependentCheckQoUpdate.class}) + @Size(max = 32, message = "{IndependentCheck.qxmc.length.illegal}",groups = {IndependentCheckQoInsert.class, IndependentCheckQoUpdate.class}) + private String qxmc; + + private Integer zwdm; + + @Size(max = 32, message = "{IndependentCheck.zwmc.length.illegal}",groups = {IndependentCheckQoInsert.class, IndependentCheckQoUpdate.class}) + private String zwmc; + + private Double lai; + + private Double swc; + + private Integer ggzt; + + @Size(max = 512, message = "{IndependentCheck.hczp.length.illegal}",groups = {IndependentCheckQoInsert.class, IndependentCheckQoUpdate.class}) + private String hczp; + + private Integer sfwrj; + + private Integer sdcjgp; + + private Double xzb; + + private Double yzb; + + @Size(max = 64, message = "{IndependentCheck.remark.length.illegal}",groups = {IndependentCheckQoInsert.class, IndependentCheckQoUpdate.class}) + private String remark; + + private String geomStr; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getQxdm() { + return qxdm; + } + + public void setQxdm(Integer qxdm) { + this.qxdm = qxdm; + } + + public String getQxmc() { + return qxmc; + } + + public void setQxmc(String qxmc) { + this.qxmc = qxmc; + } + + public Integer getZwdm() { + return zwdm; + } + + public void setZwdm(Integer zwdm) { + this.zwdm = zwdm; + } + + public String getZwmc() { + return zwmc; + } + + public void setZwmc(String zwmc) { + this.zwmc = zwmc; + } + + public Double getLai() { + return lai; + } + + public void setLai(Double lai) { + this.lai = lai; + } + + public Double getSwc() { + return swc; + } + + public void setSwc(Double swc) { + this.swc = swc; + } + + public Integer getGgzt() { + return ggzt; + } + + public void setGgzt(Integer ggzt) { + this.ggzt = ggzt; + } + + public String getHczp() { + return hczp; + } + + public void setHczp(String hczp) { + this.hczp = hczp; + } + + public Integer getSfwrj() { + return sfwrj; + } + + public void setSfwrj(Integer sfwrj) { + this.sfwrj = sfwrj; + } + + public Integer getSdcjgp() { + return sdcjgp; + } + + public void setSdcjgp(Integer sdcjgp) { + this.sdcjgp = sdcjgp; + } + + public Double getXzb() { + return xzb; + } + + public void setXzb(Double xzb) { + this.xzb = xzb; + } + + public Double getYzb() { + return yzb; + } + + public void setYzb(Double yzb) { + this.yzb = yzb; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getGeomStr() { + return geomStr; + } + + public void setGeomStr(String geomStr) { + this.geomStr = geomStr; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/IrrigationCheckQo.java b/src/main/java/com/xkrs/microservice/model/qo/IrrigationCheckQo.java new file mode 100644 index 0000000..cba1cf1 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/IrrigationCheckQo.java @@ -0,0 +1,126 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.IrrigationCheckQoInsert; +import com.xkrs.microservice.model.validation.IrrigationCheckQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * IrrigationCheckQo + * @author tajochen + */ +public class IrrigationCheckQo { + + @NotNull(message = "{IrrigationCheck.id.null}",groups={IrrigationCheckQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{IrrigationCheck.ggbh.null}",groups = {IrrigationCheckQoInsert.class, IrrigationCheckQoUpdate.class}) + @Size(max = 32, message = "{IrrigationCheck.ggbh.length.illegal}",groups = {IrrigationCheckQoInsert.class, IrrigationCheckQoUpdate.class}) + private String ggbh; + + @NotBlank(message = "{IrrigationCheck.hsbh.null}",groups = {IrrigationCheckQoInsert.class, IrrigationCheckQoUpdate.class}) + @Size(max = 32, message = "{IrrigationCheck.hsbh.length.illegal}",groups = {IrrigationCheckQoInsert.class, IrrigationCheckQoUpdate.class}) + private String hsbh; + + @NotNull(message = "{IrrigationCheck.qxbh.null}",groups = {IrrigationCheckQoInsert.class, IrrigationCheckQoUpdate.class}) + private Integer qxbh; + + @NotBlank(message = "{IrrigationCheck.dkbh.null}",groups = {IrrigationCheckQoInsert.class, IrrigationCheckQoUpdate.class}) + @Size(max = 32, message = "{IrrigationCheck.dkbh.length.illegal}",groups = {IrrigationCheckQoInsert.class, IrrigationCheckQoUpdate.class}) + private String dkbh; + + @Size(max = 512, message = "{IrrigationCheck.hszp.length.illegal}",groups = {IrrigationCheckQoInsert.class, IrrigationCheckQoUpdate.class}) + private String hszp; + + @NotNull(message = "{IrrigationCheck.hszt.null}",groups={IrrigationCheckQoUpdate.class}) + private Integer hszt; + + private Double xzb; + + private Double yzb; + + @Size(max = 64, message = "{IrrigationCheck.remark.length.illegal}",groups = {IrrigationCheckQoInsert.class, IrrigationCheckQoUpdate.class}) + private String remark; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getHsbh() { + return hsbh; + } + + public void setHsbh(String hsbh) { + this.hsbh = hsbh; + } + + public String getGgbh() { + return ggbh; + } + + public void setGgbh(String ggbh) { + this.ggbh = ggbh; + } + + public Integer getQxbh() { + return qxbh; + } + + public void setQxbh(Integer qxbh) { + this.qxbh = qxbh; + } + + public String getDkbh() { + return dkbh; + } + + public void setDkbh(String dkbh) { + this.dkbh = dkbh; + } + + public String getHszp() { + return hszp; + } + + public void setHszp(String hszp) { + this.hszp = hszp; + } + + public Integer getHszt() { + return hszt; + } + + public void setHszt(Integer hszt) { + this.hszt = hszt; + } + + public Double getXzb() { + return xzb; + } + + public void setXzb(Double xzb) { + this.xzb = xzb; + } + + public Double getYzb() { + return yzb; + } + + public void setYzb(Double yzb) { + this.yzb = yzb; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/IrrigationRecordQo.java b/src/main/java/com/xkrs/microservice/model/qo/IrrigationRecordQo.java new file mode 100644 index 0000000..0464de5 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/IrrigationRecordQo.java @@ -0,0 +1,117 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.IrrigationRecordQoInsert; +import com.xkrs.microservice.model.validation.IrrigationRecordQoUpdate; + +import javax.persistence.Column; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * IrrigationRecordQo + * @author tajochen + */ +public class IrrigationRecordQo { + + @NotNull(message = "{IrrigationRecord.id.null}",groups={IrrigationRecordQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{IrrigationRecord.countyCode.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private Integer countyCode; + + @NotBlank(message = "{IrrigationRecord.countyName.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + @Size(max = 32, message = "{IrrigationRecord.countyName.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String countyName; + + @NotBlank(message = "{IrrigationRecord.townCode.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + @Size(max = 16, message = "{IrrigationRecord.townCode.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String townCode; + + @NotBlank(message = "{IrrigationRecord.townName.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + @Size(max = 32, message = "{IrrigationRecord.townName.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String townName; + + @NotNull(message = "{IrrigationRecord.irrigationDateTs.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private Long irrigationDateTs; + + private Double area; + + @Size(max = 128, message = "{IrrigationRecord.dataSource.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String dataSource; + + @Size(max = 128, message = "{IrrigationRecord.memo.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCountyCode() { + return countyCode; + } + + public void setCountyCode(Integer countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } + + public String getTownName() { + return townName; + } + + public void setTownName(String townName) { + this.townName = townName; + } + + public Long getIrrigationDateTs() { + return irrigationDateTs; + } + + public void setIrrigationDateTs(Long irrigationDateTs) { + this.irrigationDateTs = irrigationDateTs; + } + + public Double getArea() { + return area; + } + + public void setArea(Double area) { + this.area = area; + } + + public String getDataSource() { + return dataSource; + } + + public void setDataSource(String dataSource) { + this.dataSource = dataSource; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/IrrigationSarRecordQo.java b/src/main/java/com/xkrs/microservice/model/qo/IrrigationSarRecordQo.java new file mode 100644 index 0000000..01eb513 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/IrrigationSarRecordQo.java @@ -0,0 +1,138 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.IrrigationRecordQoInsert; +import com.xkrs.microservice.model.validation.IrrigationRecordQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * IrrigationSarRecordQo + * @author tajochen + */ +public class IrrigationSarRecordQo { + + @NotNull(message = "{IrrigationSarRecord.id.null}",groups={IrrigationRecordQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{IrrigationSarRecord.countyCode.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private Integer countyCode; + + @NotBlank(message = "{IrrigationSarRecord.countyName.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + @Size(max = 32, message = "{IrrigationSarRecord.countyName.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String countyName; + + @NotBlank(message = "{IrrigationSarRecord.townCode.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + @Size(max = 16, message = "{IrrigationSarRecord.townCode.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String townCode; + + @NotBlank(message = "{IrrigationSarRecord.townName.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + @Size(max = 32, message = "{IrrigationSarRecord.townName.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String townName; + + @NotBlank(message = "{IrrigationSarRecord.cropName.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + @Size(max = 32, message = "{IrrigationSarRecord.cropName.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String cropName; + + private Integer cropCode; + + @NotNull(message = "{IrrigationSarRecord.irrigationDateTs.null}",groups={IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private Long irrigationDateTs; + + private Double area; + + @Size(max = 128, message = "{IrrigationSarRecord.dataSource.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String dataSource; + + @Size(max = 128, message = "{IrrigationSarRecord.memo.length.illegal}",groups = {IrrigationRecordQoInsert.class, IrrigationRecordQoUpdate.class}) + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCountyCode() { + return countyCode; + } + + public void setCountyCode(Integer countyCode) { + this.countyCode = countyCode; + } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getTownCode() { + return townCode; + } + + public void setTownCode(String townCode) { + this.townCode = townCode; + } + + public String getTownName() { + return townName; + } + + public void setTownName(String townName) { + this.townName = townName; + } + + public Long getIrrigationDateTs() { + return irrigationDateTs; + } + + public void setIrrigationDateTs(Long irrigationDateTs) { + this.irrigationDateTs = irrigationDateTs; + } + + public Double getArea() { + return area; + } + + public void setArea(Double area) { + this.area = area; + } + + public String getDataSource() { + return dataSource; + } + + public void setDataSource(String dataSource) { + this.dataSource = dataSource; + } + + public String getCropName() { + return cropName; + } + + public void setCropName(String cropName) { + this.cropName = cropName; + } + + public Integer getCropCode() { + return cropCode; + } + + public void setCropCode(Integer cropCode) { + this.cropCode = cropCode; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/SysUserQo.java b/src/main/java/com/xkrs/microservice/model/qo/SysUserQo.java new file mode 100644 index 0000000..4b6464a --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/SysUserQo.java @@ -0,0 +1,217 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.SysUserQoInsert; +import com.xkrs.microservice.model.validation.SysUserQoUpdate; +import org.hibernate.validator.constraints.Range; + +import javax.validation.constraints.*; + +/** + * SysUserQo + * @author tajochen + */ +public class SysUserQo { + + @NotNull( message = "{SysUser.id.blank}",groups={SysUserQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{SysUser.userName.blank}",groups={SysUserQoInsert.class}) + @Size(min = 3,max = 24, message = "{SysUser.userName.length.illegal}",groups = {SysUserQoInsert.class, + SysUserQoUpdate.class}) + @Pattern(regexp = "^([A-Za-z0-9_]+)$",message = "{SysUser.userName.format.illegal}",groups = {SysUserQoInsert.class, + SysUserQoUpdate.class}) + private String userName; + + @Size(min = 2,max = 24, message = "{SysUser.nickName.length.illegal}",groups = {SysUserQoInsert.class, + SysUserQoUpdate.class}) + private String nickName; + + @Size(min = 2,max = 24, message = "{SysUser.realName.length.illegal}",groups = {SysUserQoInsert.class, + SysUserQoUpdate.class}) + private String realName; + + @Size(max = 128, message = "{SysUser.memo.length.illegal}",groups = {SysUserQoInsert.class, + SysUserQoUpdate.class}) + private String memo; + + @Size(min = 0,max = 16, message = "{SysUser.userCode.length.illegal}",groups = {SysUserQoInsert.class, + SysUserQoUpdate.class}) + @Pattern(regexp = "/^[A-Za-z0-9_-]{3,16}$/g",message = "{SysUser.userCode.format.illegal}", + groups = {SysUserQoInsert.class, SysUserQoUpdate.class}) + private String userCode; + + @NotBlank(message = "{SysUser.password.blank}",groups = {SysUserQoInsert.class}) + @Size(min = 6,max = 16, message = "{SysUser.password.length.illegal}",groups = {SysUserQoInsert.class, + SysUserQoUpdate.class}) + @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$",message = "{SysUser.password.format.illegal}", + groups = {SysUserQoInsert.class,SysUserQoUpdate.class}) + private String password; + + @Range(min=0,max=2,message = "{SysUser.sex.num.illegal}",groups = {SysUserQoInsert.class, SysUserQoUpdate.class}) + private Integer sex; + + @Pattern(regexp = "^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])\\d{8}$", + message = "{SysUser.telephone.format.illegal}",groups = {SysUserQoInsert.class,SysUserQoUpdate.class}) + private String telephone; + + @Size(max = 32, message = "{SysUser.email.length.illegal}",groups = {SysUserQoInsert.class, SysUserQoUpdate.class}) + @Email(message = "{SysUser.email.format.illegal}",groups = {SysUserQoInsert.class, SysUserQoUpdate.class}) + private String email; + + private Integer admCode; + + @Size(max = 64, message = "{SysUser.address.length.illegal}",groups = {SysUserQoInsert.class, SysUserQoUpdate.class}) + private String address; + + private Long birthdayTs; + + @Size(max = 128, message = "{SysUser.personalSignature.length.illegal}",groups = {SysUserQoInsert.class, + SysUserQoUpdate.class}) + private String signature; + + @NotNull(message = "{SysUser.portraitId.illegal}",groups = { SysUserQoUpdate.class}) + private Integer portraitId; + + @NotNull(message = "{SysUser.statusCode.illegal}",groups={SysUserQoUpdate.class}) + @Range(min=0,max=2,message = "{SysUser.statusCode.illegal}",groups = {SysUserQoInsert.class, SysUserQoUpdate.class}) + private Integer statusCode; + + @NotNull(message = "{SysUser.deleteFlag.null}",groups={SysUserQoUpdate.class}) + private Integer deleteFlag; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getUserCode() { + return userCode; + } + + public void setUserCode(String userCode) { + this.userCode = userCode; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public String getTelephone() { + return telephone; + } + + public void setTelephone(String telephone) { + this.telephone = telephone; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Integer getAdmCode() { + return admCode; + } + + public void setAdmCode(Integer admCode) { + this.admCode = admCode; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Long getBirthdayTs() { + return birthdayTs; + } + + public void setBirthdayTs(Long birthdayTs) { + this.birthdayTs = birthdayTs; + } + + public String getSignature() { + return signature; + } + + public void setSignature(String signature) { + this.signature = signature; + } + + public Integer getPortraitId() { + return portraitId; + } + + public void setPortraitId(Integer portraitId) { + this.portraitId = portraitId; + } + + public Integer getStatusCode() { + return statusCode; + } + + public void setStatusCode(Integer statusCode) { + this.statusCode = statusCode; + } + + public Integer getDeleteFlag() { + return deleteFlag; + } + + public void setDeleteFlag(Integer deleteFlag) { + this.deleteFlag = deleteFlag; + } + + public String getRealName() { + return realName; + } + + public void setRealName(String realName) { + this.realName = realName; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/TifProductQo.java b/src/main/java/com/xkrs/microservice/model/qo/TifProductQo.java new file mode 100644 index 0000000..a88778e --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/TifProductQo.java @@ -0,0 +1,151 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.TifProductQoInsert; +import com.xkrs.microservice.model.validation.TifProductQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * TifProductQo + * @author tajochen + */ +public class TifProductQo { + + @NotNull(message = "{TifProduct.id.null}",groups={TifProductQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{TifProduct.productCode.null}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + @Size(max = 128, message = "{TifProduct.productCode.length.illegal}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private String productCode; + + private Long productDateTs; + + @NotBlank(message = "{TifProduct.productType.null}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + @Size(max = 64, message = "{TifProduct.productType.length.illegal}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private String productType; + + @NotNull(message = "{TifProduct.admCode.null}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private Integer admCode; + + @NotBlank(message = "{TifProduct.admName.null}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + @Size(max = 64, message = "{TifProduct.admName.length.illegal}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private String admName; + + @NotBlank(message = "{TifProduct.fileName.null}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + @Size(max = 128, message = "{TifProduct.fileName.length.illegal}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private String fileName; + + @NotBlank(message = "{TifProduct.filePath.null}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + @Size(max = 255, message = "{TifProduct.filePath.length.illegal}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private String filePath; + + @Size(max = 192, message = "{TifProduct.fileMd5.length.illegal}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private String fileMd5; + + @Size(max = 128, message = "{TifProduct.fileSize.length.illegal}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private String fileSize; + + @Size(max = 255, message = "{TifProduct.thumbnailPath.length.illegal}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private String thumbnailPath; + + @Size(max = 128, message = "{TifProduct.memo.length.illegal}",groups = {TifProductQoInsert.class, TifProductQoUpdate.class}) + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getProductCode() { + return productCode; + } + + public void setProductCode(String productCode) { + this.productCode = productCode; + } + + public Long getProductDateTs() { + return productDateTs; + } + + public void setProductDateTs(Long productDateTs) { + this.productDateTs = productDateTs; + } + + public String getProductType() { + return productType; + } + + public void setProductType(String productType) { + this.productType = productType; + } + + public Integer getAdmCode() { + return admCode; + } + + public void setAdmCode(Integer admCode) { + this.admCode = admCode; + } + + public String getAdmName() { + return admName; + } + + public void setAdmName(String admName) { + this.admName = admName; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getFileMd5() { + return fileMd5; + } + + public void setFileMd5(String fileMd5) { + this.fileMd5 = fileMd5; + } + + public String getFileSize() { + return fileSize; + } + + public void setFileSize(String fileSize) { + this.fileSize = fileSize; + } + + public String getThumbnailPath() { + return thumbnailPath; + } + + public void setThumbnailPath(String thumbnailPath) { + this.thumbnailPath = thumbnailPath; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/TypicalFarmerQo.java b/src/main/java/com/xkrs/microservice/model/qo/TypicalFarmerQo.java new file mode 100644 index 0000000..eae84c5 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/TypicalFarmerQo.java @@ -0,0 +1,164 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.SysUserQoInsert; +import com.xkrs.microservice.model.validation.SysUserQoUpdate; +import com.xkrs.microservice.model.validation.TypicalFarmerQoInsert; +import com.xkrs.microservice.model.validation.TypicalFarmerQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +/** + * TypicalFarmerQo + * @author tajochen + */ +public class TypicalFarmerQo { + + @NotBlank(message = "{TypicalFarmer.lxr.null}",groups = {TypicalFarmerQoInsert.class, TypicalFarmerQoUpdate.class}) + @Size(max = 16, message = "{TypicalFarmer.lxr.length.illegal}",groups = {TypicalFarmerQoInsert.class, TypicalFarmerQoUpdate.class}) + private String lxr; + + @Size(max = 32, message = "{TypicalFarmer.lxrid.length.illegal}",groups = {TypicalFarmerQoInsert.class, TypicalFarmerQoUpdate.class}) + private String lxrid; + + @NotBlank(message = "{TypicalFarmer.tel.null}",groups = {TypicalFarmerQoInsert.class, TypicalFarmerQoUpdate.class}) + @Pattern(regexp = "^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])\\d{8}$", + message = "{SysUser.telephone.format.illegal}",groups = {SysUserQoInsert.class, SysUserQoUpdate.class}) + private String tel; + + private Integer qxdm; + + @Size(max = 32, message = "{TypicalFarmer.qxmc.length.illegal}",groups = {TypicalFarmerQoInsert.class}) + private String qxmc; + + @Size(max = 32, message = "{TypicalFarmer.xzdm.length.illegal}",groups = {TypicalFarmerQoInsert.class}) + private String xzdm; + + @Size(max = 32, message = "{TypicalFarmer.xzmc.length.illegal}",groups = {TypicalFarmerQoInsert.class}) + private String xzmc; + + @Size(max = 64, message = "{TypicalFarmer.address.length.illegal}",groups = {TypicalFarmerQoInsert.class, TypicalFarmerQoUpdate.class}) + private String address; + + private Long strdateTs; + + private Long enddateTs; + + @Size(max = 512, message = "{TypicalFarmer.xyzp.length.illegal}",groups = {TypicalFarmerQoInsert.class, TypicalFarmerQoUpdate.class}) + private String xyzp; + + @Size(max = 64, message = "{TypicalFarmer.remark.length.illegal}",groups = {TypicalFarmerQoInsert.class, TypicalFarmerQoUpdate.class}) + private String remark; + + @NotBlank(message = "{TypicalFarmer.password.blank}",groups = {SysUserQoInsert.class}) + @Size(min = 6,max = 16, message = "{TypicalFarmer.password.length.illegal}",groups = {SysUserQoInsert.class}) + @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$",message = "{TypicalFarmer.password.format.illegal}", + groups = {SysUserQoInsert.class}) + private String password; + + public String getLxr() { + return lxr; + } + + public void setLxr(String lxr) { + this.lxr = lxr; + } + + public String getLxrid() { + return lxrid; + } + + public void setLxrid(String lxrid) { + this.lxrid = lxrid; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public Integer getQxdm() { + return qxdm; + } + + public void setQxdm(Integer qxdm) { + this.qxdm = qxdm; + } + + public String getQxmc() { + return qxmc; + } + + public void setQxmc(String qxmc) { + this.qxmc = qxmc; + } + + public String getXzdm() { + return xzdm; + } + + public void setXzdm(String xzdm) { + this.xzdm = xzdm; + } + + public String getXzmc() { + return xzmc; + } + + public void setXzmc(String xzmc) { + this.xzmc = xzmc; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Long getStrdateTs() { + return strdateTs; + } + + public void setStrdateTs(Long strdateTs) { + this.strdateTs = strdateTs; + } + + public Long getEnddateTs() { + return enddateTs; + } + + public void setEnddateTs(Long enddateTs) { + this.enddateTs = enddateTs; + } + + public String getXyzp() { + return xyzp; + } + + public void setXyzp(String xyzp) { + this.xyzp = xyzp; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/TypicalPlotIrrigationQo.java b/src/main/java/com/xkrs/microservice/model/qo/TypicalPlotIrrigationQo.java new file mode 100644 index 0000000..0e03ae2 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/TypicalPlotIrrigationQo.java @@ -0,0 +1,232 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.TypicalPlotIrrigationQoInsert; +import com.xkrs.microservice.model.validation.TypicalPlotIrrigationQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * TypicalPlotIrrigationQo + * @author tajochen + */ +public class TypicalPlotIrrigationQo { + + @NotNull(message = "{TypicalPlotIrrigation.id.null}",groups={TypicalPlotIrrigationQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{TypicalPlotIrrigation.ggbh.null}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + @Size(max = 32, message = "{TypicalPlotIrrigation.ggbh.length.illegal}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + private String ggbh; + + @NotNull(message = "{TypicalPlotIrrigation.qxbh.null}",groups={TypicalPlotIrrigationQoInsert.class,TypicalPlotIrrigationQoUpdate.class}) + private Integer qxbh; + + @NotNull(message = "{TypicalPlotIrrigation.xzbh.null}",groups={TypicalPlotIrrigationQoInsert.class,TypicalPlotIrrigationQoUpdate.class}) + private String xzbh; + + @NotBlank(message = "{TypicalPlotIrrigation.dkbh.null}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + @Size(max = 32, message = "{TypicalPlotIrrigation.dkbh.length.illegal}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + private String dkbh; + + @Size(max = 64, message = "{TypicalPlotIrrigation.sylx.length.illegal}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + private String sylx; + + @Size(max = 64, message = "{TypicalPlotIrrigation.gglx.length.illegal}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + private String gglx; + + @Size(max = 64, message = "{TypicalPlotIrrigation.gcff.length.illegal}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + private String gcff; + + @NotNull(message = "{TypicalPlotIrrigation.ggysl.null}",groups={TypicalPlotIrrigationQoInsert.class,TypicalPlotIrrigationQoUpdate.class}) + private Double ggysl; + + @NotNull(message = "{TypicalPlotIrrigation.strtimeTs.null}",groups={TypicalPlotIrrigationQoInsert.class,TypicalPlotIrrigationQoUpdate.class}) + private Long strtimeTs; + + @NotNull(message = "{TypicalPlotIrrigation.endtimeTs.null}",groups={TypicalPlotIrrigationQoInsert.class,TypicalPlotIrrigationQoUpdate.class}) + private Long endtimeTs; + + @Size(max = 512, message = "{TypicalPlotIrrigation.strzp.length.illegal}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + private String strzp; + + @Size(max = 512, message = "{TypicalPlotIrrigation.endzp.length.illegal}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + private String endzp; + + private Integer hsbj; + + private Integer qrbj; + + @NotNull(message = "{TypicalPlotIrrigation.cropName.null}",groups={TypicalPlotIrrigationQoInsert.class,TypicalPlotIrrigationQoUpdate.class}) + private String cropName; + + private Integer cropCode; + + private Double irrigationHour; + + private Double irrigationArea; + + @Size(max = 64, message = "{TypicalPlotIrrigation.remark.length.illegal}",groups = {TypicalPlotIrrigationQoInsert.class, TypicalPlotIrrigationQoUpdate.class}) + private String remark; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getGgbh() { + return ggbh; + } + + public void setGgbh(String ggbh) { + this.ggbh = ggbh; + } + + public Integer getQxbh() { + return qxbh; + } + + public void setQxbh(Integer qxbh) { + this.qxbh = qxbh; + } + + public String getXzbh() { + return xzbh; + } + + public void setXzbh(String xzbh) { + this.xzbh = xzbh; + } + + public String getDkbh() { + return dkbh; + } + + public void setDkbh(String dkbh) { + this.dkbh = dkbh; + } + + public String getSylx() { + return sylx; + } + + public void setSylx(String sylx) { + this.sylx = sylx; + } + + public String getGglx() { + return gglx; + } + + public void setGglx(String gglx) { + this.gglx = gglx; + } + + public String getGcff() { + return gcff; + } + + public void setGcff(String gcff) { + this.gcff = gcff; + } + + public Double getGgysl() { + return ggysl; + } + + public void setGgysl(Double ggysl) { + this.ggysl = ggysl; + } + + public Long getStrtimeTs() { + return strtimeTs; + } + + public void setStrtimeTs(Long strtimeTs) { + this.strtimeTs = strtimeTs; + } + + public Long getEndtimeTs() { + return endtimeTs; + } + + public void setEndtimeTs(Long endtimeTs) { + this.endtimeTs = endtimeTs; + } + + public String getStrzp() { + return strzp; + } + + public void setStrzp(String strzp) { + this.strzp = strzp; + } + + public String getEndzp() { + return endzp; + } + + public void setEndzp(String endzp) { + this.endzp = endzp; + } + + public Integer getHsbj() { + return hsbj; + } + + public void setHsbj(Integer hsbj) { + this.hsbj = hsbj; + } + + public Integer getQrbj() { + return qrbj; + } + + public void setQrbj(Integer qrbj) { + this.qrbj = qrbj; + } + + public String getCropName() { + return cropName; + } + + public void setCropName(String cropName) { + this.cropName = cropName; + } + + public Integer getCropCode() { + return cropCode; + } + + public void setCropCode(Integer cropCode) { + this.cropCode = cropCode; + } + + public Double getIrrigationHour() { + return irrigationHour; + } + + public void setIrrigationHour(Double irrigationHour) { + this.irrigationHour = irrigationHour; + } + + public Double getIrrigationArea() { + return irrigationArea; + } + + public void setIrrigationArea(Double irrigationArea) { + this.irrigationArea = irrigationArea; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/TypicalPlotQo.java b/src/main/java/com/xkrs/microservice/model/qo/TypicalPlotQo.java new file mode 100644 index 0000000..4065de7 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/TypicalPlotQo.java @@ -0,0 +1,314 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.TypicalPlotQoInsert; +import com.xkrs.microservice.model.validation.TypicalPlotQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * TypicalPlotQo + * @author tajochen + */ +public class TypicalPlotQo { + + @NotNull(message = "{TypicalPlot.id.null}",groups={TypicalPlotQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{TypicalPlot.dkbh.null}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + @Size(max = 32, message = "{TypicalPlot.dkbh.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String dkbh; + + private Integer dsdm; + + @Size(max = 32, message = "{TypicalPlot.dsmc.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String dsmc; + + private Integer qxdm; + + @Size(max = 32, message = "{TypicalPlot.qxmc.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String qxmc; + + @Size(max = 32, message = "{TypicalPlot.xzdm.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String xzdm; + + @Size(max = 32, message = "{TypicalPlot.xzmc.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String xzmc; + + private Integer dlbm; + + @Size(max = 64, message = "{TypicalPlot.dlmc.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String dlmc; + + private Integer cbzwdm; + + @Size(max = 64, message = "{TypicalPlot.cbzwmc.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String cbzwmc; + + private Integer xbzwdm; + + @Size(max = 64, message = "{TypicalPlot.xbzwmc.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String xbzwmc; + + private Integer qdzwdm; + + @Size(max = 64, message = "{TypicalPlot.qdzwmc.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String qdzwmc; + + @Size(max = 64, message = "{TypicalPlot.snyd.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String snyd; + + private Float tbmj; + + private Float xzb; + + private Float yzb; + + @Size(max = 64, message = "{TypicalPlot.trlx.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String trlx; + + @Size(max = 64, message = "{TypicalPlot.sysjq.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String sysjq; + + @Size(max = 64, message = "{TypicalPlot.dbgq.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String dbgq; + + @Size(max = 16, message = "{TypicalPlot.lxr.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String lxr; + + @Size(max = 32, message = "{TypicalPlot.tel.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String tel; + + @Size(max = 512, message = "{TypicalPlot.dkzp.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String dkzp; + + @Size(max = 64, message = "{TypicalPlot.remark.length.illegal}",groups = {TypicalPlotQoInsert.class, TypicalPlotQoUpdate.class}) + private String remark; + + private String geomStr; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getDkbh() { + return dkbh; + } + + public void setDkbh(String dkbh) { + this.dkbh = dkbh; + } + + public Integer getDsdm() { + return dsdm; + } + + public void setDsdm(Integer dsdm) { + this.dsdm = dsdm; + } + + public String getDsmc() { + return dsmc; + } + + public void setDsmc(String dsmc) { + this.dsmc = dsmc; + } + + public Integer getQxdm() { + return qxdm; + } + + public void setQxdm(Integer qxdm) { + this.qxdm = qxdm; + } + + public String getQxmc() { + return qxmc; + } + + public void setQxmc(String qxmc) { + this.qxmc = qxmc; + } + + public String getXzdm() { + return xzdm; + } + + public void setXzdm(String xzdm) { + this.xzdm = xzdm; + } + + public String getXzmc() { + return xzmc; + } + + public void setXzmc(String xzmc) { + this.xzmc = xzmc; + } + + public Integer getDlbm() { + return dlbm; + } + + public void setDlbm(Integer dlbm) { + this.dlbm = dlbm; + } + + public String getDlmc() { + return dlmc; + } + + public void setDlmc(String dlmc) { + this.dlmc = dlmc; + } + + public Integer getCbzwdm() { + return cbzwdm; + } + + public void setCbzwdm(Integer cbzwdm) { + this.cbzwdm = cbzwdm; + } + + public String getCbzwmc() { + return cbzwmc; + } + + public void setCbzwmc(String cbzwmc) { + this.cbzwmc = cbzwmc; + } + + public Integer getXbzwdm() { + return xbzwdm; + } + + public void setXbzwdm(Integer xbzwdm) { + this.xbzwdm = xbzwdm; + } + + public String getXbzwmc() { + return xbzwmc; + } + + public void setXbzwmc(String xbzwmc) { + this.xbzwmc = xbzwmc; + } + + public Integer getQdzwdm() { + return qdzwdm; + } + + public void setQdzwdm(Integer qdzwdm) { + this.qdzwdm = qdzwdm; + } + + public String getQdzwmc() { + return qdzwmc; + } + + public void setQdzwmc(String qdzwmc) { + this.qdzwmc = qdzwmc; + } + + public String getSnyd() { + return snyd; + } + + public void setSnyd(String snyd) { + this.snyd = snyd; + } + + public Float getTbmj() { + return tbmj; + } + + public void setTbmj(Float tbmj) { + this.tbmj = tbmj; + } + + public Float getXzb() { + return xzb; + } + + public void setXzb(Float xzb) { + this.xzb = xzb; + } + + public Float getYzb() { + return yzb; + } + + public void setYzb(Float yzb) { + this.yzb = yzb; + } + + public String getTrlx() { + return trlx; + } + + public void setTrlx(String trlx) { + this.trlx = trlx; + } + + public String getSysjq() { + return sysjq; + } + + public void setSysjq(String sysjq) { + this.sysjq = sysjq; + } + + public String getDbgq() { + return dbgq; + } + + public void setDbgq(String dbgq) { + this.dbgq = dbgq; + } + + public String getLxr() { + return lxr; + } + + public void setLxr(String lxr) { + this.lxr = lxr; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getDkzp() { + return dkzp; + } + + public void setDkzp(String dkzp) { + this.dkzp = dkzp; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getGeomStr() { + return geomStr; + } + + public void setGeomStr(String geomStr) { + this.geomStr = geomStr; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/qo/WcsRecordQo.java b/src/main/java/com/xkrs/microservice/model/qo/WcsRecordQo.java new file mode 100644 index 0000000..bb2d7f1 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/qo/WcsRecordQo.java @@ -0,0 +1,140 @@ +package com.xkrs.microservice.model.qo; + +import com.xkrs.microservice.model.validation.WcsRecordQoInsert; +import com.xkrs.microservice.model.validation.WcsRecordQoUpdate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * WcsRecordQo + * @author tajochen + */ +public class WcsRecordQo { + + @NotNull(message = "{WcsRecord.id.null}",groups={WcsRecordQoUpdate.class}) + private Integer id; + + @NotBlank(message = "{WcsRecord.productCode.null}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + @Size(max = 128, message = "{WcsRecord.productCode.length.illegal}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + private String serviceCode; + + private Long productDateTs; + + @NotBlank(message = "{WcsRecord.productType.null}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + @Size(max = 64, message = "{WcsRecord.productType.length.illegal}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + private String productType; + + @NotNull(message = "{WcsRecord.admCode.null}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + private Integer admCode; + + @NotBlank(message = "{WcsRecord.admName.null}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + @Size(max = 64, message = "{TifProduct.admName.length.illegal}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + private String admName; + + @NotBlank(message = "{WcsRecord.fileName.null}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + @Size(max = 128, message = "{WcsRecord.fileName.length.illegal}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + private String workSpace; + + @NotBlank(message = "{WcsRecord.filePath.null}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + @Size(max = 128, message = "{WcsRecord.filePath.length.illegal}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + private String layerName; + + @Size(max = 128, message = "{WcsRecord.fileMd5.length.illegal}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + private String srs; + + @Size(max = 128, message = "{WcsRecord.fileSize.length.illegal}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + private String styleName; + + @Size(max = 128, message = "{WcsRecord.memo.length.illegal}",groups = {WcsRecordQoInsert.class, WcsRecordQoUpdate.class}) + private String memo; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getServiceCode() { + return serviceCode; + } + + public void setServiceCode(String serviceCode) { + this.serviceCode = serviceCode; + } + + public Long getProductDateTs() { + return productDateTs; + } + + public void setProductDateTs(Long productDateTs) { + this.productDateTs = productDateTs; + } + + public String getProductType() { + return productType; + } + + public void setProductType(String productType) { + this.productType = productType; + } + + public Integer getAdmCode() { + return admCode; + } + + public void setAdmCode(Integer admCode) { + this.admCode = admCode; + } + + public String getAdmName() { + return admName; + } + + public void setAdmName(String admName) { + this.admName = admName; + } + + public String getWorkSpace() { + return workSpace; + } + + public void setWorkSpace(String workSpace) { + this.workSpace = workSpace; + } + + public String getLayerName() { + return layerName; + } + + public void setLayerName(String layerName) { + this.layerName = layerName; + } + + public String getSrs() { + return srs; + } + + public void setSrs(String srs) { + this.srs = srs; + } + + public String getStyleName() { + return styleName; + } + + public void setStyleName(String styleName) { + this.styleName = styleName; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/AppFileQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/AppFileQoInsert.java new file mode 100644 index 0000000..0fd4d15 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/AppFileQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * AppFileQoInsert + * @author tajochen + */ +public interface AppFileQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/AppFileQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/AppFileQoUpdate.java new file mode 100644 index 0000000..2f8557a --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/AppFileQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * AppFileQoUpdate + * @author tajochen + */ +public interface AppFileQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/CropClassifyRecordQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/CropClassifyRecordQoInsert.java new file mode 100644 index 0000000..41f5323 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/CropClassifyRecordQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * CropClassifyRecordQoInsert + * @author tajochen + */ +public interface CropClassifyRecordQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/CropClassifyRecordQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/CropClassifyRecordQoUpdate.java new file mode 100644 index 0000000..65c8f17 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/CropClassifyRecordQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * CropClassifyRecordQoUpdate + * @author tajochen + */ +public interface CropClassifyRecordQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/FarmingInfoQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/FarmingInfoQoInsert.java new file mode 100644 index 0000000..8e774c8 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/FarmingInfoQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * FarmingInfoQoInsert + * @author tajochen + */ +public interface FarmingInfoQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/FarmingInfoQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/FarmingInfoQoUpdate.java new file mode 100644 index 0000000..38b8cdc --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/FarmingInfoQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * FarmingInfoQoUpdate + * @author tajochen + */ +public interface FarmingInfoQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/FileDocumentQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/FileDocumentQoInsert.java new file mode 100644 index 0000000..433030a --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/FileDocumentQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.microservice.model.validation; + +/** + * FileDocumentQoInsert + * @author tajochen + */ +public interface FileDocumentQoInsert { +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/FileDocumentQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/FileDocumentQoUpdate.java new file mode 100644 index 0000000..e44bee2 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/FileDocumentQoUpdate.java @@ -0,0 +1,8 @@ +package com.xkrs.microservice.model.validation; + +/** + * FileDocumentQoUpdate + * @author tajochen + */ +public interface FileDocumentQoUpdate { +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/HydrologicalStationQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/HydrologicalStationQoInsert.java new file mode 100644 index 0000000..f6df8a1 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/HydrologicalStationQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * HydrologicalStationQoInsert + * @author tajochen + */ +public interface HydrologicalStationQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/HydrologicalStationQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/HydrologicalStationQoUpdate.java new file mode 100644 index 0000000..2703a62 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/HydrologicalStationQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * HydrologicalStationQoUpdate + * @author tajochen + */ +public interface HydrologicalStationQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/IndependentCheckQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/IndependentCheckQoInsert.java new file mode 100644 index 0000000..2b67a34 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/IndependentCheckQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * IndependentCheckQoInsert + * @author tajochen + */ +public interface IndependentCheckQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/IndependentCheckQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/IndependentCheckQoUpdate.java new file mode 100644 index 0000000..da75742 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/IndependentCheckQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * IndependentCheckQoUpdate + * @author tajochen + */ +public interface IndependentCheckQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/IrrigationCheckQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/IrrigationCheckQoInsert.java new file mode 100644 index 0000000..c13a5ae --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/IrrigationCheckQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.microservice.model.validation; + +/** + * IrrigationCheckQoInsert + * @author tajochen + */ +public interface IrrigationCheckQoInsert { +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/IrrigationCheckQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/IrrigationCheckQoUpdate.java new file mode 100644 index 0000000..fc224bb --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/IrrigationCheckQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * IrrigationCheckQoUpdate + * @author tajochen + */ +public interface IrrigationCheckQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/IrrigationRecordQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/IrrigationRecordQoInsert.java new file mode 100644 index 0000000..52a4aa7 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/IrrigationRecordQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * IrrigationRecordQoInsert + * @author tajochen + */ +public interface IrrigationRecordQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/IrrigationRecordQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/IrrigationRecordQoUpdate.java new file mode 100644 index 0000000..0110aa3 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/IrrigationRecordQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * IrrigationRecordQoUpdate + * @author tajochen + */ +public interface IrrigationRecordQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/IrrigationSarRecordQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/IrrigationSarRecordQoInsert.java new file mode 100644 index 0000000..9d27826 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/IrrigationSarRecordQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * IrrigationSarRecordQoInsert + * @author tajochen + */ +public interface IrrigationSarRecordQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/IrrigationSarRecordQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/IrrigationSarRecordQoUpdate.java new file mode 100644 index 0000000..27f190f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/IrrigationSarRecordQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * IrrigationSarRecordQoUpdate + * @author tajochen + */ +public interface IrrigationSarRecordQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/SysUserQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/SysUserQoInsert.java new file mode 100644 index 0000000..8fe5289 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/SysUserQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.microservice.model.validation; + +/** + * SysUserQoInsert + * @author tajochen + */ +public interface SysUserQoInsert { +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/SysUserQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/SysUserQoUpdate.java new file mode 100644 index 0000000..3589f48 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/SysUserQoUpdate.java @@ -0,0 +1,8 @@ +package com.xkrs.microservice.model.validation; + +/** + * SysUserQoUpdate + * @author tajochen + */ +public interface SysUserQoUpdate { +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/TifProductQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/TifProductQoInsert.java new file mode 100644 index 0000000..62727d9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/TifProductQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * TifProductQoInsert + * @author tajochen + */ +public interface TifProductQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/TifProductQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/TifProductQoUpdate.java new file mode 100644 index 0000000..54f5323 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/TifProductQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * TifProductQoUpdate + * @author tajochen + */ +public interface TifProductQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/TypicalFarmerQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/TypicalFarmerQoInsert.java new file mode 100644 index 0000000..c12d84e --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/TypicalFarmerQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * TypicalFarmerQoInsert + * @author tajochen + */ +public interface TypicalFarmerQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/TypicalFarmerQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/TypicalFarmerQoUpdate.java new file mode 100644 index 0000000..1d905eb --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/TypicalFarmerQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * TypicalFarmerQoUpdate + * @author tajochen + */ +public interface TypicalFarmerQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotIrrigationQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotIrrigationQoInsert.java new file mode 100644 index 0000000..ea64ebd --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotIrrigationQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * TypicalPlotIrrigationQoInsert + * @author tajochen + */ +public interface TypicalPlotIrrigationQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotIrrigationQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotIrrigationQoUpdate.java new file mode 100644 index 0000000..29b205a --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotIrrigationQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * TypicalPlotIrrigationQoUpdate + * @author tajochen + */ +public interface TypicalPlotIrrigationQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotQoInsert.java new file mode 100644 index 0000000..beb05cd --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * TypicalPlotQoInsert + * @author tajochen + */ +public interface TypicalPlotQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotQoUpdate.java new file mode 100644 index 0000000..d56736d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/TypicalPlotQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * TypicalPlotQoUpdate + * @author tajochen + */ +public interface TypicalPlotQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/WcsRecordQoInsert.java b/src/main/java/com/xkrs/microservice/model/validation/WcsRecordQoInsert.java new file mode 100644 index 0000000..bf2a1b7 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/WcsRecordQoInsert.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * WcsRecordQoInsert + * @author tajochen + */ +public interface WcsRecordQoInsert { + +} diff --git a/src/main/java/com/xkrs/microservice/model/validation/WcsRecordQoUpdate.java b/src/main/java/com/xkrs/microservice/model/validation/WcsRecordQoUpdate.java new file mode 100644 index 0000000..68e4443 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/validation/WcsRecordQoUpdate.java @@ -0,0 +1,9 @@ +package com.xkrs.microservice.model.validation; + +/** + * WcsRecordQoUpdate + * @author tajochen + */ +public interface WcsRecordQoUpdate { + +} diff --git a/src/main/java/com/xkrs/microservice/model/vo/FileServerResultVo.java b/src/main/java/com/xkrs/microservice/model/vo/FileServerResultVo.java new file mode 100644 index 0000000..9e70b92 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/vo/FileServerResultVo.java @@ -0,0 +1,67 @@ +package com.xkrs.microservice.model.vo; + +import java.io.Serializable; + +/** + * FileServerResultVo 文件服务器查询结果 + * @author tajochen + */ +public class FileServerResultVo implements Serializable { + + /** + * 状态信息 + */ + String status; + + /** + * 提示信息 + */ + String message; + + /** + * 数据 + */ + T data; + + public FileServerResultVo() { + } + + public FileServerResultVo(String status, String msg, T data) { + this.status = status; + this.message = msg; + this.data = data; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + @Override + public String toString() { + return "FileServerResultVo{" + + "status='" + status + '\'' + + ", message='" + message + '\'' + + ", data=" + data + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/vo/ForecastWeather7DayVo.java b/src/main/java/com/xkrs/microservice/model/vo/ForecastWeather7DayVo.java new file mode 100644 index 0000000..32b9063 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/vo/ForecastWeather7DayVo.java @@ -0,0 +1,103 @@ +package com.xkrs.microservice.model.vo; + +import java.io.Serializable; +import java.util.Map; + +/** + * 7天预报 + * @author wd + */ +public class ForecastWeather7DayVo implements Serializable { + /** + * 城市地点 + */ + private String city; + + /** + * 天气 + */ + private String[] weather; + + /** + * 风向 + */ + private String[] wd; + + /** + * 风力 + */ + private String[] ws; + + /** + * 高温数组 + */ + private String[] tempMax; + + /** + * 低温数组 + */ + private String[] tempMin; + + /** + * 8天天气集合 + */ + private Map> weatherMap7Day; + + private static final Long serialVersionUID = 1L; + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String[] getWeather() { + return weather; + } + + public void setWeather(String[] weather) { + this.weather = weather; + } + + public String[] getWd() { + return wd; + } + + public void setWd(String[] wd) { + this.wd = wd; + } + + public String[] getWs() { + return ws; + } + + public void setWs(String[] ws) { + this.ws = ws; + } + + public String[] getTempMax() { + return tempMax; + } + + public void setTempMax(String[] tempMax) { + this.tempMax = tempMax; + } + + public String[] getTempMin() { + return tempMin; + } + + public void setTempMin(String[] tempMin) { + this.tempMin = tempMin; + } + + public Map> getWeatherMap7Day() { + return weatherMap7Day; + } + + public void setWeatherMap7Day(Map> weatherMap7Day) { + this.weatherMap7Day = weatherMap7Day; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/vo/MonitoringStationResultVo.java b/src/main/java/com/xkrs/microservice/model/vo/MonitoringStationResultVo.java new file mode 100644 index 0000000..d64c8e9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/vo/MonitoringStationResultVo.java @@ -0,0 +1,70 @@ +package com.xkrs.microservice.model.vo; + +import java.io.Serializable; + +/** + * MonitoringStationResultVo 监测站Vo + * @author tajochen + */ +public class MonitoringStationResultVo implements Serializable { + + String datetime; + + String eUnit; + + String eValue; + + String eKey; + + String eName; + + String eNum; + + public String getDatetime() { + return datetime; + } + + public void setDatetime(String datetime) { + this.datetime = datetime; + } + + public String geteUnit() { + return eUnit; + } + + public void seteUnit(String eUnit) { + this.eUnit = eUnit; + } + + public String geteValue() { + return eValue; + } + + public void seteValue(String eValue) { + this.eValue = eValue; + } + + public String geteKey() { + return eKey; + } + + public void seteKey(String eKey) { + this.eKey = eKey; + } + + public String geteName() { + return eName; + } + + public void seteName(String eName) { + this.eName = eName; + } + + public String geteNum() { + return eNum; + } + + public void seteNum(String eNum) { + this.eNum = eNum; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/vo/MonitoringStationReturnVo.java b/src/main/java/com/xkrs/microservice/model/vo/MonitoringStationReturnVo.java new file mode 100644 index 0000000..ab03ec0 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/vo/MonitoringStationReturnVo.java @@ -0,0 +1,61 @@ +package com.xkrs.microservice.model.vo; + +import java.io.Serializable; +import java.util.ArrayList; + +/** + * MonitoringStationReturnVo 监测站返回Vo + * @author tajochen + */ +public class MonitoringStationReturnVo implements Serializable { + + String statusCode; + + String message; + + ArrayList entity; + + Long deviceId; + + Long deviceName; + + public String getStatusCode() { + return statusCode; + } + + public void setStatusCode(String statusCode) { + this.statusCode = statusCode; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public ArrayList getEntity() { + return entity; + } + + public void setEntity(ArrayList entity) { + this.entity = entity; + } + + public Long getDeviceId() { + return deviceId; + } + + public void setDeviceId(Long deviceId) { + this.deviceId = deviceId; + } + + public Long getDeviceName() { + return deviceName; + } + + public void setDeviceName(Long deviceName) { + this.deviceName = deviceName; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/vo/RealTimeWeatherVo.java b/src/main/java/com/xkrs/microservice/model/vo/RealTimeWeatherVo.java new file mode 100644 index 0000000..e5d80eb --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/vo/RealTimeWeatherVo.java @@ -0,0 +1,256 @@ +package com.xkrs.microservice.model.vo; + +import java.io.Serializable; + +/** + * 实时天气 + * @author wd + */ +public class RealTimeWeatherVo implements Serializable { + /** + * 县级 + */ + private String name; + /** + * 区划代码 + */ + private String code; + /** + * 市级 + */ + private String cityName; + /** + * 市级代码 + */ + private String cityCode; + /** + * 省级 + */ + private String proName; + /** + * 省级代码 + */ + private String proCode; + /** + * 天气 + */ + private String weather; + /** + * 温度 摄氏度 + */ + private String temp; + /** + * 华氏度 + */ + private String tempf; + /** + * 风向 + */ + private String wd; + /** + * 风力 + */ + private String ws; + /** + * 风力速度 + */ + private String wse; + /** + * 湿度 + */ + private String sd; + /** + * 当前时间 + */ + private String realTime; + /** + * 气压 + */ + private String qy; + /** + * 能见度 + */ + private String njd; + /** + * 降水 + */ + private String rain; + /** + * 24小时降雨 + */ + private String rain24; + /** + * 天气 + */ + private String aqi; + /** + * pm2.5 + */ + private String aqiPm25; + + private static final Long serialVersionUID = 1L; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public String getCityCode() { + return cityCode; + } + + public void setCityCode(String cityCode) { + this.cityCode = cityCode; + } + + public String getProName() { + return proName; + } + + public void setProName(String proName) { + this.proName = proName; + } + + public String getProCode() { + return proCode; + } + + public void setProCode(String proCode) { + this.proCode = proCode; + } + + public String getWeather() { + return weather; + } + + public void setWeather(String weather) { + this.weather = weather; + } + + public String getWd() { + return wd; + } + + public void setWd(String wd) { + this.wd = wd; + } + + public String getWs() { + return ws; + } + + public void setWs(String ws) { + this.ws = ws; + } + + public String getSd() { + return sd; + } + + public void setSd(String sd) { + this.sd = sd; + } + + public String getRealTime() { + return realTime; + } + + public void setRealTime(String realTime) { + this.realTime = realTime; + } + + public String getQy() { + return qy; + } + + public void setQy(String qy) { + this.qy = qy; + } + + public String getNjd() { + return njd; + } + + public void setNjd(String njd) { + this.njd = njd; + } + + public String getRain() { + return rain; + } + + public void setRain(String rain) { + this.rain = rain; + } + + public String getRain24() { + return rain24; + } + + public void setRain24(String rain24) { + this.rain24 = rain24; + } + + public String getAqi() { + return aqi; + } + + public void setAqi(String aqi) { + this.aqi = aqi; + } + + public String getAqiPm25() { + return aqiPm25; + } + + public void setAqiPm25(String aqiPm25) { + this.aqiPm25 = aqiPm25; + } + + public String getTemp() { + return temp; + } + + public void setTemp(String temp) { + this.temp = temp; + } + + public String getTempf() { + return tempf; + } + + public void setTempf(String tempf) { + this.tempf = tempf; + } + + public static Long getSerialVersionUid() { + return serialVersionUID; + } + + public String getWse() { + return wse; + } + + public void setWse(String wse) { + this.wse = wse; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/vo/ShpCityVo.java b/src/main/java/com/xkrs/microservice/model/vo/ShpCityVo.java new file mode 100644 index 0000000..ca5f7ef --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/vo/ShpCityVo.java @@ -0,0 +1,109 @@ +package com.xkrs.microservice.model.vo; + +import java.io.Serializable; + +/** + * ShpCityVo + * @author tajochen + */ +public class ShpCityVo implements Serializable { + + private Integer id; + + private Integer code; + + private String name; + + private Integer proCode; + + private String proName; + + private double shapeArea; + + private String center; + + public ShpCityVo(Integer id, Integer code, String name, Integer proCode, String proName, double shapeArea, + String center) { + this.id = id; + this.code = code; + this.name = name; + this.proCode = proCode; + this.proName = proName; + this.shapeArea = shapeArea; + this.center = center; + } + + public ShpCityVo() { + + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getProCode() { + return proCode; + } + + public void setProCode(Integer proCode) { + this.proCode = proCode; + } + + public String getProName() { + return proName; + } + + public void setProName(String proName) { + this.proName = proName; + } + + public double getShapeArea() { + return shapeArea; + } + + public void setShapeArea(double shapeArea) { + this.shapeArea = shapeArea; + } + + public String getCenter() { + return center; + } + + public void setCenter(String center) { + this.center = center; + } + + @Override + public String toString() { + return "ShpCityVo{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", proCode=" + proCode + + ", proName='" + proName + '\'' + + ", shapeArea=" + shapeArea + + ", center='" + center + '\'' + + '}'; + } +} + diff --git a/src/main/java/com/xkrs/microservice/model/vo/ShpCountyVo.java b/src/main/java/com/xkrs/microservice/model/vo/ShpCountyVo.java new file mode 100644 index 0000000..c0e856f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/vo/ShpCountyVo.java @@ -0,0 +1,145 @@ +package com.xkrs.microservice.model.vo; + +import java.io.Serializable; + +/** + * ShpCountyVo + * @author tajochen + */ +public class ShpCountyVo implements Serializable { + + private Integer id; + + private Integer code; + + private String name; + + private Integer cityCode; + + private String cityName; + + private Integer proCode; + + private String proName; + + private double shapeArea; + + private String center; + + private String memo; + + + public ShpCountyVo(Integer id, Integer code, String name, Integer cityCode, String cityName, Integer proCode, + String proName, double shapeArea, String center, String memo) { + this.id = id; + this.code = code; + this.name = name; + this.cityCode = cityCode; + this.cityName = cityName; + this.proCode = proCode; + this.proName = proName; + this.shapeArea = shapeArea; + this.center = center; + this.memo = memo; + } + + public ShpCountyVo() { + + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getCityCode() { + return cityCode; + } + + public void setCityCode(Integer cityCode) { + this.cityCode = cityCode; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public Integer getProCode() { + return proCode; + } + + public void setProCode(Integer proCode) { + this.proCode = proCode; + } + + public String getProName() { + return proName; + } + + public void setProName(String proName) { + this.proName = proName; + } + + public double getShapeArea() { + return shapeArea; + } + + public void setShapeArea(double shapeArea) { + this.shapeArea = shapeArea; + } + + public String getCenter() { + return center; + } + + public void setCenter(String center) { + this.center = center; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @Override + public String toString() { + return "ShpCountyVo{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", cityCode=" + cityCode + + ", cityName='" + cityName + '\'' + + ", proCode=" + proCode + + ", proName='" + proName + '\'' + + ", shapeArea=" + shapeArea + + ", center='" + center + '\'' + + ", memo='" + memo + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/microservice/model/vo/ShpProvinceVo.java b/src/main/java/com/xkrs/microservice/model/vo/ShpProvinceVo.java new file mode 100644 index 0000000..11c183d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/vo/ShpProvinceVo.java @@ -0,0 +1,84 @@ +package com.xkrs.microservice.model.vo; + +import java.io.Serializable; + +/** + * ShpProvinceVo + * @author tajochen + */ +public class ShpProvinceVo implements Serializable { + + private Integer id; + + private Integer code; + + private String name; + + private double shapeArea; + + private String center; + + public ShpProvinceVo(Integer id, Integer code, String name, double shapeArea, String center) { + this.id = id; + this.code = code; + this.name = name; + this.shapeArea = shapeArea; + this.center = center; + } + + public ShpProvinceVo() { + + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getShapeArea() { + return shapeArea; + } + + public void setShapeArea(double shapeArea) { + this.shapeArea = shapeArea; + } + + public String getCenter() { + return center; + } + + public void setCenter(String center) { + this.center = center; + } + + @Override + public String toString() { + return "ShpCityVo{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", shapeArea=" + shapeArea + + ", center='" + center + '\'' + + '}'; + } +} + diff --git a/src/main/java/com/xkrs/microservice/model/vo/SysUserVo.java b/src/main/java/com/xkrs/microservice/model/vo/SysUserVo.java new file mode 100644 index 0000000..cc9cbb0 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/model/vo/SysUserVo.java @@ -0,0 +1,252 @@ +package com.xkrs.microservice.model.vo; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * SysUserVo + * @Author tajochen + */ +public class SysUserVo implements Serializable { + private Integer id; + + private String userName; + + private String nickName; + + private String realName; + + private String userCode; + + private Integer sex; + + private String telephone; + + private String email; + + private Integer admCode; + + private String address; + + private LocalDate birthday; + + private String signature; + + private String roleNameZh; + + private Integer portraitId; + + private Integer statusCode; + + private LocalDateTime addTime; + + private LocalDateTime lastEntryTime; + + private String lastEntryIp; + + private String memo; + + public SysUserVo(Integer id, String userName, String nickName,String realName,String userCode, Integer sex, String telephone, + String email, Integer admCode, String address, LocalDate birthday, String signature,String roleNameZh, + Integer portraitId, Integer statusCode, LocalDateTime addTime, LocalDateTime lastEntryTime, String lastEntryIp, + String memo) { + this.id = id; + this.userName = userName; + this.nickName = nickName; + this.realName = realName; + this.userCode = userCode; + this.sex = sex; + this.telephone = telephone; + this.email = email; + this.admCode = admCode; + this.address = address; + this.birthday = birthday; + this.signature = signature; + this.roleNameZh = roleNameZh; + this.portraitId = portraitId; + this.statusCode = statusCode; + this.addTime = addTime; + this.lastEntryTime = lastEntryTime; + this.lastEntryIp = lastEntryIp; + this.memo = memo; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getUserCode() { + return userCode; + } + + public void setUserCode(String userCode) { + this.userCode = userCode; + } + + public Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public String getTelephone() { + return telephone; + } + + public void setTelephone(String telephone) { + this.telephone = telephone; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Integer getAdmCode() { + return admCode; + } + + public void setAdmCode(Integer admCode) { + this.admCode = admCode; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public LocalDate getBirthday() { + return birthday; + } + + public void setBirthday(LocalDate birthday) { + this.birthday = birthday; + } + + public String getSignature() { + return signature; + } + + public void setSignature(String signature) { + this.signature = signature; + } + + public String getRoleNameZh() { + return roleNameZh; + } + + public void setRoleNameZh(String roleNameZh) { + this.roleNameZh = roleNameZh; + } + + public Integer getPortraitId() { + return portraitId; + } + + public void setPortraitId(Integer portraitId) { + this.portraitId = portraitId; + } + + public Integer getStatusCode() { + return statusCode; + } + + public void setStatusCode(Integer statusCode) { + this.statusCode = statusCode; + } + + public LocalDateTime getAddTime() { + return addTime; + } + + public void setAddTime(LocalDateTime addTime) { + this.addTime = addTime; + } + + public LocalDateTime getLastEntryTime() { + return lastEntryTime; + } + + public void setLastEntryTime(LocalDateTime lastEntryTime) { + this.lastEntryTime = lastEntryTime; + } + + public String getLastEntryIp() { + return lastEntryIp; + } + + public void setLastEntryIp(String lastEntryIp) { + this.lastEntryIp = lastEntryIp; + } + + public String getRealName() { + return realName; + } + + public void setRealName(String realName) { + this.realName = realName; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + @Override + public String toString() { + return "SysUserVo{" + + "id=" + id + + ", userName='" + userName + '\'' + + ", nickName='" + nickName + '\'' + + ", realName='" + realName + '\'' + + ", userCode='" + userCode + '\'' + + ", sex=" + sex + + ", telephone='" + telephone + '\'' + + ", email='" + email + '\'' + + ", admCode=" + admCode + + ", address='" + address + '\'' + + ", birthday=" + birthday + + ", signature='" + signature + '\'' + + ", roleNameZh='" + roleNameZh + '\'' + + ", portraitId=" + portraitId + + ", statusCode=" + statusCode + + ", addTime=" + addTime + + ", lastEntryTime=" + lastEntryTime + + ", lastEntryIp='" + lastEntryIp + '\'' + + ", memo='" + memo + '\'' + + '}'; + } +} + diff --git a/src/main/java/com/xkrs/microservice/service/AdministrativeDivisionService.java b/src/main/java/com/xkrs/microservice/service/AdministrativeDivisionService.java new file mode 100644 index 0000000..8f03c64 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/AdministrativeDivisionService.java @@ -0,0 +1,59 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.vo.ShpCityVo; +import com.xkrs.microservice.model.vo.ShpCountyVo; + +/** + * 行政区划接口 + * @author tajochen + */ +public interface AdministrativeDivisionService { + + /** + * 获取所有地级市 + * @return + */ + Iterable getAllCity(); + + /** + * 获取所有地级市根据省级代码 + * @param proCode 省级代码 + * @return + */ + Iterable getAllCityByProvinceCode(Integer proCode); + + /** + * 获取地级市根据指定地级市编码 + * @param code 地级市代码 + * @return + */ + ShpCityVo getCityByCityCode(Integer code); + + /** + * 获取所有区县 + * @return + */ + Iterable getAllCounty(); + + /** + * 获取所有区县根据省级代码 + * @param proCode 省级代码 + * @return + */ + Iterable getAllCountyByProvinceCode(Integer proCode); + + /** + * 获取所有区县根据地级市代码 + * @param cityCode 城市代码 + * @return + */ + Iterable getAllCountyByCityCode(Integer cityCode); + + /** + * 获取指定区县根据区县代码 + * @param countyCode 区县代码 + * @return + */ + ShpCountyVo getCountyByCountyCode(Integer countyCode); + +} diff --git a/src/main/java/com/xkrs/microservice/service/AppManageService.java b/src/main/java/com/xkrs/microservice/service/AppManageService.java new file mode 100644 index 0000000..fda14ed --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/AppManageService.java @@ -0,0 +1,55 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.FileAppEntity; +import com.xkrs.microservice.model.qo.AppFileQo; + +import java.util.List; +import java.util.Optional; + +/** + * App管理接口 + * @author tajochen + */ +public interface AppManageService { + + /** + * 获取所有APP版本列表 + * @return + */ + Iterable getAllFile(); + + /** + * 获取指定id记录 + * @param id 编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定版本号的记录 + * @param versionNumber 版本号 + * @return + */ + Iterable getByVersionNumber(String versionNumber); + + /** + * 检查App的版本号 + * @param versionNumber 版本号 + * @return + */ + List checkLastVersionNumber(String versionNumber); + + /** + * 新增APP记录 + * @param appFileQo app属性 + * @param userName 用户名 + */ + void add(AppFileQo appFileQo, String userName); + + /** + * 删除APP记录 + * @param id 编号 + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/CacheService.java b/src/main/java/com/xkrs/microservice/service/CacheService.java new file mode 100644 index 0000000..e1c7097 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/CacheService.java @@ -0,0 +1,22 @@ +package com.xkrs.microservice.service; + +/** + * 缓存服务 + * @author tajochen + */ +public interface CacheService { + + /** + * 根据测试名称查找 + * @param testName + * @return + */ + String findByTestName(String testName); + + /** + * 设置测试名称 + * @param testName + * @return + */ + String setTestName(String testName); +} diff --git a/src/main/java/com/xkrs/microservice/service/CropClassifyRecordService.java b/src/main/java/com/xkrs/microservice/service/CropClassifyRecordService.java new file mode 100644 index 0000000..8dbc26f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/CropClassifyRecordService.java @@ -0,0 +1,66 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.CropClassifyRecordEntity; +import com.xkrs.microservice.model.qo.CropClassifyRecordQo; + +import java.time.LocalDate; +import java.util.Optional; + +/** + * 种植分类记录数据服务管理接口 + * @author tajochen + */ +public interface CropClassifyRecordService { + + /** + * 获取所有种植分类记录 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取指定id的种植分类记录 + * @param id 记录编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定行政区划的所有种植分类记录 + * @param admCode 行政区划代码 + * @return + */ + Iterable getByAdmCode(Integer admCode); + + /** + * 获取指定街道和日期的所有种植分类记录 + * @param townCode 街道代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable getByTownCodeAndDate(String townCode, LocalDate startDate, LocalDate endDate); + + /** + * 获取指定行政区划和时间段的所有种植分类核查记录 + * @param admCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + Iterable getByAdmCodeAndDateTime(Integer admCode, LocalDate startDate, LocalDate endDate); + + /** + * 新增种植分类记录 + * @param cropClassifyRecordQo + * @param userName 用户名 + */ + void add(CropClassifyRecordQo cropClassifyRecordQo, String userName); + + /** + * 删除种植分类记录 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/DicBusinessService.java b/src/main/java/com/xkrs/microservice/service/DicBusinessService.java new file mode 100644 index 0000000..64941c4 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/DicBusinessService.java @@ -0,0 +1,41 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.*; + +/** + * 业务字典接口 + * @author tajochen + */ +public interface DicBusinessService { + + /** + * 获取所有土壤类型 + * @return + */ + Iterable getAllSoilClassify(); + + /** + * 获取所有土地利用类型 + * @return + */ + Iterable getAllLandClassify(); + + /** + * 获取所有旱情类型 + * @return + */ + Iterable getAllDroughtClassify(); + + /** + * 获取所有种植结构类型 + * @return + */ + Iterable getAllCropClassify(); + + /** + * 获取所有产品类型 + * @return + */ + Iterable getAllProduct(); + +} diff --git a/src/main/java/com/xkrs/microservice/service/FarmingInfoService.java b/src/main/java/com/xkrs/microservice/service/FarmingInfoService.java new file mode 100644 index 0000000..1a0b3f0 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/FarmingInfoService.java @@ -0,0 +1,76 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.FarmingInfoEntity; +import com.xkrs.microservice.model.qo.FarmingInfoQo; + +import java.util.Optional; + +/** + * 农情信息服务管理接口 + * @author tajochen + */ +public interface FarmingInfoService { + + /** + * 获取所有农情信息 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取指定id的农情信息 + * @param id 记录编号 + * @return + */ + Optional getById(Integer id); + + /** + * 查找农情信息根据地块编号 + * @param dkbh 地块编码 + * @return + */ + Iterable getByDkbh(String dkbh); + + /** + * 查找农情信息根据区县编号 + * @param qxbh 区县编号 + * @return + */ + Iterable getByQxbh(Integer qxbh); + + /** + * 查找农情信息根据作物代码,区县编号 + * @param qxbh 区县编号 + * @param zwbh 作物代码 + * @return + */ + Iterable getByZwdmAndQxbh(Integer zwbh,Integer qxbh); + + /** + * 获取所有新农情根据区县编号 + * @param qxbh + * @return + */ + Iterable getNewByQxbh(Integer qxbh); + + /** + * 获取所有农情信息根据用户名 + * @param userName 用户名 + * @return + */ + Iterable getByUserName(String userName); + + /** + * 新增农情信息 + * @param farmingInfoQo + * @param userName 用户名 + */ + void add(FarmingInfoQo farmingInfoQo, String userName); + + /** + * 删除农情信息 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/FileDocumentService.java b/src/main/java/com/xkrs/microservice/service/FileDocumentService.java new file mode 100644 index 0000000..ccb7a1f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/FileDocumentService.java @@ -0,0 +1,45 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.FileDocumentEntity; +import com.xkrs.microservice.model.qo.FileDocumentQo; + +import java.util.Optional; + +/** + * 文档管理接口 + * @author tajochen + */ +public interface FileDocumentService { + + /** + * 文档列表 + * @return + */ + Iterable getAllFile(); + + /** + * 获取指定id记录 + * @param id + * @return + */ + Optional getById(Integer id); + + /** + * 新增文档记录 + * @param fileDocumentQo + * @param userName + */ + void add(FileDocumentQo fileDocumentQo,String userName); + + /** + * 删除文档记录 + * @param id + */ + void delete(Integer id); + + /** + * 修改文档记录 + * @param fileDocumentEntity + */ + void update(FileDocumentEntity fileDocumentEntity); +} diff --git a/src/main/java/com/xkrs/microservice/service/FileServerService.java b/src/main/java/com/xkrs/microservice/service/FileServerService.java new file mode 100644 index 0000000..f5f7407 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/FileServerService.java @@ -0,0 +1,53 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.vo.FileServerResultVo; + +/** + * 文件服务器接口 + * @author tajochen + */ +public interface FileServerService { + + /** + * 获取文件统计信息 + * @return + */ + FileServerResultVo getFileStat(); + + /** + * 删除文件 + * @param md5 信息摘要 + * @param path 路径 + * @return + */ + FileServerResultVo deleteFile(String md5,String path); + + /** + * 获取文件信息 + * @param md5 信息摘要 + * @param path 路径 + * @return + */ + FileServerResultVo getFileInfo(String md5,String path); + + /** + * 获取文件列表 + * @param dir 目录名 + * @return + */ + FileServerResultVo getFileList(String dir); + + /** + * 修复统计信息 + * @param date 要修复的日期,格式如:20190725 + * @return + */ + FileServerResultVo getFileRepairStat(String date); + + /** + * 同步失败修复 + * @param force 是否强行修复(0|1) + * @return + */ + FileServerResultVo getFileRepair(String force); +} diff --git a/src/main/java/com/xkrs/microservice/service/HydrologicalStationService.java b/src/main/java/com/xkrs/microservice/service/HydrologicalStationService.java new file mode 100644 index 0000000..11d6d78 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/HydrologicalStationService.java @@ -0,0 +1,41 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.HydrologicalStationEntity; +import com.xkrs.microservice.model.qo.HydrologicalStationQo; + +import java.time.LocalDateTime; + +/** + * 水文站点服务接口 + * @author tajochen + */ +public interface HydrologicalStationService { + + /** + * 获取所有水文站点数据 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取时间段水文站点数据 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + Iterable getByTime(LocalDateTime sTime,LocalDateTime eTime); + + /** + * 新增水文站点数据 + * @param hydrologicalStationQo 水文站点数据 + */ + void add(HydrologicalStationQo hydrologicalStationQo); + + /** + * 删除水文站点数据 + * @param id 编号 + * @return + */ + int delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/IndependentCheckService.java b/src/main/java/com/xkrs/microservice/service/IndependentCheckService.java new file mode 100644 index 0000000..36ec6ac --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/IndependentCheckService.java @@ -0,0 +1,54 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.IndependentCheckEntity; +import com.xkrs.microservice.model.qo.IndependentCheckQo; + +import java.util.Optional; + +/** + * 自主核查记录服务管理接口 + * @author tajochen + */ +public interface IndependentCheckService { + + /** + * 获取所有自主核查记录 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取指定id的自主核查记录 + * @param id 记录编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定区县代码的自主核查记录 + * @param countyCode 区县代码 + * @return + */ + Iterable getByCountyCode(Integer countyCode); + + /** + * 获取指定用户的所有自主核查记录 + * @param userName 用户名 + * @return + */ + Iterable getByUserName(String userName); + + /** + * 新增灌溉核查记录 + * @param irrigationCheckQo + * @param userName 用户名 + */ + void add(IndependentCheckQo irrigationCheckQo, String userName); + + /** + * 删除自主核查记录 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/IrrigationCheckService.java b/src/main/java/com/xkrs/microservice/service/IrrigationCheckService.java new file mode 100644 index 0000000..776119d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/IrrigationCheckService.java @@ -0,0 +1,78 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.IrrigationCheckEntity; +import com.xkrs.microservice.model.qo.IrrigationCheckQo; + +import java.time.LocalDateTime; +import java.util.Optional; + +/** + * 灌溉核查记录服务管理接口 + * @author tajochen + */ +public interface IrrigationCheckService { + + /** + * 获取所有灌溉核查记录 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取指定id的灌溉核查记录 + * @param id 记录编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定用户的所有灌溉核查记录 + * @param userName 用户名 + * @return + */ + Iterable getByUserName(String userName); + + /** + * 获取指定地块编号的所有灌溉核查记录 + * @param dkbh 地块编号 + * @return + */ + Iterable getByDkbh(String dkbh); + + /** + * 获取指定地块编号的所有区县编号 + * @param qxbh 区县编号 + * @return + */ + Iterable getByQxbh(Integer qxbh); + + /** + * 查找灌溉核查结果根据区县编号和时间 + * @param qxbh 区县编号 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + Iterable getByQxbhAndCreateTimeBetween(Integer qxbh, LocalDateTime sTime, LocalDateTime eTime); + + /** + * 获取指定灌溉编号的所有灌溉核查记录 + * @param ggbh 灌溉编号 + * @return + */ + Optional getByGgbh(String ggbh); + + /** + * 新增灌溉核查记录 + * @param irrigationCheckQo + * @param userName 用户名 + */ + void add(IrrigationCheckQo irrigationCheckQo, String userName); + + /** + * 删除灌溉核查记录 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/IrrigationRecordService.java b/src/main/java/com/xkrs/microservice/service/IrrigationRecordService.java new file mode 100644 index 0000000..38995c7 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/IrrigationRecordService.java @@ -0,0 +1,66 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.IrrigationRecordEntity; +import com.xkrs.microservice.model.qo.IrrigationRecordQo; + +import java.time.LocalDate; +import java.util.Optional; + +/** + * 灌溉记录数据服务管理接口 + * @author tajochen + */ +public interface IrrigationRecordService { + + /** + * 获取所有灌溉记录 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取指定id的记录 + * @param id 记录编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定行政区划的所有灌溉记录 + * @param admCode 行政区划代码 + * @return + */ + Iterable getByAdmCode(Integer admCode); + + /** + * 获取指定街道代码和时间段的所有灌溉记录 + * @param townCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + Iterable getByTownCodeAndDate(String townCode, LocalDate startDate, LocalDate endDate); + + /** + * 获取指定行政区划和时间段的所有灌溉核查记录 + * @param admCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + Iterable getByAdmCodeAndDateTime(Integer admCode, LocalDate startDate, LocalDate endDate); + + /** + * 新增灌溉记录 + * @param irrigationFieldCheckQo + * @param userName 用户名 + */ + void add(IrrigationRecordQo irrigationFieldCheckQo, String userName); + + /** + * 删除灌溉记录 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/IrrigationSarRecordService.java b/src/main/java/com/xkrs/microservice/service/IrrigationSarRecordService.java new file mode 100644 index 0000000..7e33e3c --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/IrrigationSarRecordService.java @@ -0,0 +1,75 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.IrrigationSarRecordEntity; +import com.xkrs.microservice.model.qo.IrrigationSarRecordQo; + +import java.time.LocalDate; +import java.util.Optional; + +/** + * 灌溉Sar记录数据服务管理接口 + * @author tajochen + */ +public interface IrrigationSarRecordService { + + /** + * 获取所有灌溉记录 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取指定id的记录 + * @param id 记录编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定行政区划的所有灌溉记录 + * @param admCode 行政区划代码 + * @return + */ + Iterable getByAdmCode(Integer admCode); + + /** + * 获取指定街道代码和时间段的所有灌溉记录 + * @param townCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + Iterable getByTownCodeAndDate(String townCode, LocalDate startDate, LocalDate endDate); + + /** + * 获取灌溉统计动态多条件查询 + * @param townCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + Iterable geAllByCondition(String townCode, LocalDate startDate, LocalDate endDate); + + /** + * 获取指定行政区划和时间段的所有灌溉核查记录 + * @param admCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + Iterable getByAdmCodeAndDateTime(Integer admCode, LocalDate startDate, LocalDate endDate); + + /** + * 新增灌溉记录 + * @param irrigationSarRecordQo + * @param userName 用户名 + */ + void add(IrrigationSarRecordQo irrigationSarRecordQo, String userName); + + /** + * 删除灌溉记录 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/MeteorologicalService.java b/src/main/java/com/xkrs/microservice/service/MeteorologicalService.java new file mode 100644 index 0000000..a562db5 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/MeteorologicalService.java @@ -0,0 +1,28 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.vo.ForecastWeather7DayVo; +import com.xkrs.microservice.model.vo.RealTimeWeatherVo; + +import java.util.List; + +/** + * 气象接口 + * @author tajochen + */ +public interface MeteorologicalService { + + /** + * 获取当前行政区划天气 + * @param admCode 行政区划代码 + * @return + */ + RealTimeWeatherVo getWeatherNowByAdmCode(Integer admCode); + + /** + * 获取行政区划天气预报 + * @param admCode 行政区划代码 + * @return + */ + ForecastWeather7DayVo getWeatherForecastByAdmCode(Integer admCode); + +} diff --git a/src/main/java/com/xkrs/microservice/service/SysAuthorityService.java b/src/main/java/com/xkrs/microservice/service/SysAuthorityService.java new file mode 100644 index 0000000..2c285d1 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/SysAuthorityService.java @@ -0,0 +1,19 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.SysAuthorityEntity; + +import java.util.List; + +/** + * 系统权限服务接口 + * @author tajochen + */ +public interface SysAuthorityService { + + /** + * 获取权限实体列表根据用户名 + * @param userName + * @return + */ + List getSysAuthorityListByUserName(String userName); +} diff --git a/src/main/java/com/xkrs/microservice/service/SysRoleService.java b/src/main/java/com/xkrs/microservice/service/SysRoleService.java new file mode 100644 index 0000000..5c270fc --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/SysRoleService.java @@ -0,0 +1,19 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.SysRoleEntity; + +import java.util.List; + +/** + * 系统角色服务接口 + * @author tajochen + */ +public interface SysRoleService { + + /** + * 获取角色实体列表根据用户名 + * @param userName + * @return + */ + List getSysRoleListByUserName(String userName); +} diff --git a/src/main/java/com/xkrs/microservice/service/SysUserService.java b/src/main/java/com/xkrs/microservice/service/SysUserService.java new file mode 100644 index 0000000..d8e3f9e --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/SysUserService.java @@ -0,0 +1,98 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.SysUserEntity; +import com.xkrs.microservice.model.qo.SysUserQo; +import com.xkrs.microservice.model.vo.SysUserVo; + +/** + * 系统用户服务接口 + * @author tajochen + */ +public interface SysUserService { + + /** + * 获取指定用户Vo + * @param userName 用户名 + * @return + */ + SysUserVo getSysUserVoByUserName(String userName); + + /** + * 用户头像更新 + * @param userName 用户名 + * @param portraitId 编号 + * @return + */ + int updateSysUserPortrait(String userName,Integer portraitId); + + /** + * 用户密码更新 + * @param userName 用户名 + * @param oldPassword 旧密码 + * @param newPassword 新密码 + * @return + */ + int updateSysUserPassword(String userName,String oldPassword,String newPassword); + + /** + * 检查用户名 + * @param userName 用户名 + * @return + */ + boolean checkUserName(String userName); + + /** + * 获取所有用户 + * @return + */ + Iterable getAllSysUser(); + + /** + * 保存用户 + * @param sysUserQo + */ + void addUser(SysUserQo sysUserQo); + + /** + * 获取系统用户实体根据用户名 + * @param userName 用户名 + * @return + */ + SysUserEntity getSysUserByUserName(String userName); + + /** + * 用户登录更新 + * @param userName 用户名 + * @param ipAddress ip地址 + * @return + */ + int updateSysUserLogin(String userName,String ipAddress); + + /** + * 系统用户更新 + * @param sysUserQo + * @return + */ + int updateSysUser(SysUserQo sysUserQo); + + /** + * 禁用用户账号 + * @param userName + * @return + */ + int disableSysUser(String userName); + + /** + * 启用用户账号 + * @param userName + * @return + */ + int enableSysUser(String userName); + + /** + * 软删除系统用户 + * @param id 编号 + * @return + */ + int softDeleteGeneralUser(Integer id); +} diff --git a/src/main/java/com/xkrs/microservice/service/TifProductService.java b/src/main/java/com/xkrs/microservice/service/TifProductService.java new file mode 100644 index 0000000..0c45893 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/TifProductService.java @@ -0,0 +1,93 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.TifProductEntity; +import com.xkrs.microservice.model.qo.TifProductQo; +import org.springframework.cache.annotation.Cacheable; + +import javax.persistence.criteria.CriteriaBuilder; +import java.time.LocalDate; +import java.util.Optional; + +/** + * 栅格产品管理接口 + * @author tajochen + */ +public interface TifProductService { + + /** + * 获取所有栅格产品 + * @return + */ + Iterable getAllFile(); + + /** + * 获取指定产品编号的产品 + * @param productCode 产品编号 + * @return + */ + TifProductEntity getByProductCode(String productCode); + + /** + * 获取指定id的产品 + * @param id 产品编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定类型的所有产品 + * @param productType 产品类型 + * @return + */ + Iterable getByProductType(String productType); + + /** + * 获取指定类型和时间段的所有产品 + * @param productType 产品类型 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable getByProductTypeAndDate(String productType, LocalDate startDate,LocalDate endDate); + + /** + * 获取指定类型和行政区划的所有产品 + * @param admCode 行政区划 + * @param productType 产品类型 + * @return + */ + Iterable getByAdmCodeAndProductType(Integer admCode,String productType); + + /** + * 获取指定行政区划和时间段的所有产品 + * @param admCode 行政区划代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable getByAdmCodeAndProductDateBetween(Integer admCode, LocalDate startDate,LocalDate endDate); + + /** + * 获取指定类型和行政区划和时间段的所有产品 + * @param admCode 行政区划 + * @param productType 产品类型 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable getByAdmCodeAndProductTypeAndDate(Integer admCode,String productType, LocalDate startDate,LocalDate endDate); + + /** + * 新增栅格产品 + * @param tifProductQo + * @param userName 用户名 + */ + void add(TifProductQo tifProductQo, String userName); + + /** + * 删除栅格产品 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/TypicalFarmerService.java b/src/main/java/com/xkrs/microservice/service/TypicalFarmerService.java new file mode 100644 index 0000000..fd4af33 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/TypicalFarmerService.java @@ -0,0 +1,74 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.TypicalFarmerEntity; +import com.xkrs.microservice.model.qo.TypicalFarmerQo; + +import java.util.Optional; + +/** + * 典型区农户服务管理接口 + * @author tajochen + */ +public interface TypicalFarmerService { + + /** + * 获取所有农户记录 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取指定id的农户记录 + * @param id 记录编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定乡镇代码的所有农户记录 + * @param xzdm 乡镇代码 + * @return + */ + Iterable getByTownCode(String xzdm); + + /** + * 获取指定区县代码的所有农户记录 + * @param qxdm 区县代码 + * @return + */ + Iterable getByCountyCode(Integer qxdm); + + /** + * 获取指定姓名的农户记录 + * @param lxr 联系人 + * @return + */ + Iterable getByLxr(String lxr); + + /** + * 获取指定手机号的所有农户记录 + * @param tel 手机号 + * @return + */ + Optional getByTel(String tel); + + /** + * 新增农户记录 + * @param typicalFarmerQo + * @param userName 用户名 + */ + void add(TypicalFarmerQo typicalFarmerQo, String userName); + + /** + * 修改农户记录 + * @param typicalFarmerQo + */ + void update(TypicalFarmerQo typicalFarmerQo); + + /** + * 删除农户记录 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/TypicalPlotIrrigationService.java b/src/main/java/com/xkrs/microservice/service/TypicalPlotIrrigationService.java new file mode 100644 index 0000000..1991d66 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/TypicalPlotIrrigationService.java @@ -0,0 +1,89 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.TypicalPlotIrrigationEntity; +import com.xkrs.microservice.model.qo.TypicalPlotIrrigationQo; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Optional; + +/** + * 典型区地块灌溉信息管理接口 + * @author tajochen + */ +public interface TypicalPlotIrrigationService { + + /** + * 获取所有地块灌溉信息 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取指定id的地块灌溉信息 + * @param id 记录编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定灌溉编号的某个地块灌溉信息 + * @param ggbh 灌溉编号 + * @return + */ + Optional getByGgbh(String ggbh); + + /** + * 查找灌溉记录列表根据区县编号 + * @param qxbh 区县编号 + * @return + */ + Iterable getByQxbh(Integer qxbh); + + /** + * 查找灌溉记录列表根据地块编号 + * @param dkbh 地块编号 + * @return + */ + Iterable getByDkbh(String dkbh); + + /** + * 查找灌溉记录根据灌溉编号 + * @param qxbh 区县代码 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + Iterable findAllByQxbhAndStrtimeBetween(Integer qxbh, LocalDateTime sTime, LocalDateTime eTime); + + /** + * 查找灌溉记录根据动态多条件 + * @param xzbh 乡镇街道代码 + * @param cropCode 作物代码 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + List getAllByCondition(String xzbh,Integer cropCode, Long sTime, Long eTime); + + /** + * 获取指定用户名的所有地块灌溉信息 + * @param userName 用户名 + * @return + */ + Iterable getByUserName(String userName); + + /** + * 新增地块灌溉信息 + * @param typicalPlotIrrigationQo + * @param userName 用户名 + */ + void add(TypicalPlotIrrigationQo typicalPlotIrrigationQo, String userName); + + /** + * 删除地块灌溉信息 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/TypicalPlotService.java b/src/main/java/com/xkrs/microservice/service/TypicalPlotService.java new file mode 100644 index 0000000..c62e5de --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/TypicalPlotService.java @@ -0,0 +1,82 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.TypicalPlotEntity; +import com.xkrs.microservice.model.qo.TypicalPlotQo; + +import java.util.Optional; + +/** + * 典型地块服务管理接口 + * @author tajochen + */ +public interface TypicalPlotService { + + /** + * 获取所有典型地块记录 + * @return + */ + Iterable getAllRecord(); + + /** + * 获取指定id的典型地块记录 + * @param id 记录编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定编号的典型地块记录 + * @param dkbh 地块编号 + * @return + */ + Optional getByDkbh(String dkbh); + + /** + * 获取指定区县代码的所有典型地块记录 + * @param qxdm 区县代码 + * @return + */ + Iterable getByCountyCode(Integer qxdm); + + /** + * 获取指定乡镇街道代码的所有典型地块记录 + * @param xzdm 街道代码 + * @return + */ + Iterable getByTownCode(String xzdm); + + /** + * 获取指定联系人的所有典型地块记录 + * @param lxr 联系人 + * @return + */ + Iterable getByLxr(String lxr); + + /** + * 获取指定手机号的所有典型地块记录 + * @param tel 手机号 + * @return + */ + Iterable getByTel(String tel); + + /** + * 新增典型地块记录 + * @param typicalPlotQo + * @param userName 用户名 + */ + void add(TypicalPlotQo typicalPlotQo,String userName); + + /** + * 更新典型地块记录 + * @param typicalPlotQo + * @param userName + */ + void update(TypicalPlotQo typicalPlotQo,String userName); + + /** + * 删除典型地块记录 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/WcsRecordService.java b/src/main/java/com/xkrs/microservice/service/WcsRecordService.java new file mode 100644 index 0000000..efba55d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/WcsRecordService.java @@ -0,0 +1,91 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.model.entity.WcsRecordEntity; +import com.xkrs.microservice.model.qo.WcsRecordQo; + +import java.time.LocalDate; +import java.util.Optional; + +/** + * 栅格服务管理接口 + * @author tajochen + */ +public interface WcsRecordService { + + /** + * 获取所有栅格服务 + * @return + */ + Iterable getAllService(); + + /** + * 获取指定服务代码的产品 + * @param serviceCode 服务代码 + * @return + */ + WcsRecordEntity getByServiceCode(String serviceCode); + + /** + * 获取指定id的产品 + * @param id 产品编号 + * @return + */ + Optional getById(Integer id); + + /** + * 获取指定类型的所有服务 + * @param productType 产品类型 + * @return + */ + Iterable getByProductType(String productType); + + /** + * 获取指定类型和时间段的所有服务 + * @param productType 产品类型 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable getByProductTypeAndDate(String productType, LocalDate startDate,LocalDate endDate); + + /** + * 获取指定类型和行政区划的所有服务 + * @param admCode 行政区划 + * @param productType 产品类型 + * @return + */ + Iterable getByAdmCodeAndProductType(Integer admCode,String productType); + + /** + * 获取指定行政区划和时间段的所有服务 + * @param admCode 行政区划代码 + * @param startDate 开始日期 + * @param endDate 行政区划代码 + * @return + */ + Iterable getByAdmCodeAndDate(Integer admCode, LocalDate startDate,LocalDate endDate); + + /** + * 获取指定类型和行政区划和时间段的所有服务 + * @param admCode 行政区划 + * @param productType 产品类型 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + Iterable getByAdmCodeAndProductTypeAndDate(Integer admCode,String productType, LocalDate startDate,LocalDate endDate); + + /** + * 新增栅格服务 + * @param wcsRecordQo + * @param userName 用户名 + */ + void add(WcsRecordQo wcsRecordQo, String userName); + + /** + * 删除栅格服务 + * @param id + */ + void delete(Integer id); + +} diff --git a/src/main/java/com/xkrs/microservice/service/WeatherService.java b/src/main/java/com/xkrs/microservice/service/WeatherService.java new file mode 100644 index 0000000..478f5f9 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/WeatherService.java @@ -0,0 +1,29 @@ +package com.xkrs.microservice.service; + +import com.xkrs.microservice.common.tool.PageBean; +import com.xkrs.microservice.model.entity.WeatherEntity; + +import java.util.List; + +/** + * @author XinYi Song + */ +public interface WeatherService { + + /** + * 动态多条件查询气候信息 + * @param page + * @param addTimeStart + * @param addTimeEnd + * @return + */ + PageBean queryWeather(Integer page, String addTimeStart, String addTimeEnd); + + /** + * 根据时间段查询气象信息 + * @param addTimeStart + * @param addTimeEnd + * @return + */ + List selectWeather(String addTimeStart, String addTimeEnd); +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/AdministrativeDivisionServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/AdministrativeDivisionServiceImpl.java new file mode 100644 index 0000000..5f79f24 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/AdministrativeDivisionServiceImpl.java @@ -0,0 +1,108 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.ShpCityDao; +import com.xkrs.microservice.dao.ShpCountyDao; +import com.xkrs.microservice.model.vo.ShpCityVo; +import com.xkrs.microservice.model.vo.ShpCountyVo; +import com.xkrs.microservice.service.AdministrativeDivisionService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * 行政区划接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "AdministrativeDivisionServiceCache") +public class AdministrativeDivisionServiceImpl implements AdministrativeDivisionService { + + Logger logger = LoggerFactory.getLogger(AdministrativeDivisionServiceImpl.class); + + @Resource + private ShpCityDao shpCityDao; + + @Resource + private ShpCountyDao shpCountyDao; + + /** + * 获取所有地级市 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllCity(){ + return shpCityDao.selectAllCity(); + } + + /** + * 获取所有地级市根据省级代码 + * @param proCode 省级代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllCityByProvinceCode(Integer proCode){ + return shpCityDao.selectAllCityByProvinceCode(proCode); + } + + /** + * 获取地级市根据指定地级市编码 + * @param code 地级市代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public ShpCityVo getCityByCityCode(Integer code){ + return shpCityDao.selectCityByCityCode(code); + } + + /** + * 获取所有区县 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllCounty(){ + return shpCountyDao.selectAllCounty(); + } + + + /** + * 获取所有区县根据省级代码 + * @param proCode 省级代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllCountyByProvinceCode(Integer proCode){ + return shpCountyDao.selectAllCountyByProvinceCode(proCode); + } + + /** + * 获取所有区县根据地级市代码 + * @param cityCode 城市代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllCountyByCityCode(Integer cityCode){ + return shpCountyDao.selectAllCountyByCityCode(cityCode); + } + + /** + * 获取指定区县根据区县代码 + * @param countyCode 区县代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public ShpCountyVo getCountyByCountyCode(Integer countyCode){ + return shpCountyDao.selectCountyByCountyCode(countyCode); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/AppManageServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/AppManageServiceImpl.java new file mode 100644 index 0000000..4f2e1cb --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/AppManageServiceImpl.java @@ -0,0 +1,136 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.AppFileDao; +import com.xkrs.microservice.model.entity.FileAppEntity; +import com.xkrs.microservice.model.qo.AppFileQo; +import com.xkrs.microservice.service.AppManageService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import static com.xkrs.microservice.util.VersionNumberUtil.compareVersion; +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; + +/** + * App管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "AppManageServiceCache") +public class AppManageServiceImpl implements AppManageService { + + Logger logger = LoggerFactory.getLogger(AppManageServiceImpl.class); + + @Resource + private AppFileDao appFileDao; + + /** + * 获取所有APP列表 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllFile(){ + return appFileDao.findAll(Sort.by(Sort.Direction.DESC, "addTime")); + } + + /** + * 获取指定id记录 + * @param id + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return appFileDao.findById(id); + } + + /** + * 获取指定版本号的记录 + * @param versionNumber + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByVersionNumber(String versionNumber){ + return appFileDao.findByVersionNumber(versionNumber); + } + + /** + * 检查 App 的版本号 + * @param versionNumber + * @return + */ + @Override + public List checkLastVersionNumber(String versionNumber){ + Iterable res = appFileDao.findAll(Sort.by(Sort.Direction.DESC, "addTime")); + List res2 = new ArrayList<>(); + List res3 = new ArrayList<>(); + // 获取新版本 + for(FileAppEntity s: res){ + // 比较版本号 + int n = compareVersion(versionNumber,s.getVersionNumber()); + if(n == -1){ + res2.add(s); + } + } + if(res2.size()>0){ + String tempVersionNumber = res2.get(0).getVersionNumber(); + // 获取新版本 + for(FileAppEntity ss: res){ + // 比较版本号 + int n = compareVersion(tempVersionNumber,ss.getVersionNumber()); + if(n == -1){ + tempVersionNumber = ss.getVersionNumber(); + } + } + // 获取最新新版本 + for(FileAppEntity ss: res){ + if(ss.getVersionNumber().equals(tempVersionNumber)){ + res3.add(ss); + } + } + } + return res3; + } + + /** + * 新增APP记录 + * @param appFileQo + * @param userName + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "AppManageServiceCache",allEntries = true) + @Override + public void add(AppFileQo appFileQo, String userName){ + FileAppEntity fileAppEntity = new FileAppEntity(); + CopyPropertiesUtil.copy( appFileQo, fileAppEntity); + fileAppEntity.setAddUserName(userName); + // 设置系统时间 + fileAppEntity.setAddTime(getNowTime()); + appFileDao.save(fileAppEntity); + } + + /** + * 删除APP记录 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "AppManageServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + appFileDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/CacheServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/CacheServiceImpl.java new file mode 100644 index 0000000..ee8de08 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/CacheServiceImpl.java @@ -0,0 +1,36 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.service.CacheService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +/** + * 系统用户服务 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "CacheServiceCache") +public class CacheServiceImpl implements CacheService { + + Logger logger = LoggerFactory.getLogger(CacheServiceImpl.class); + + @Cacheable(keyGenerator = "keyGenerator",unless="#result == null") + @Override + public String findByTestName(String testName) { + System.out.println("findByTestName 没有加载缓存"); + logger.warn("findByTestName 没有加载缓存"); + return testName; + } + + @CacheEvict(value = "CacheServiceCache",allEntries = true) + @Override + public String setTestName(String testName) { + System.out.println("setTestName 进行 CacheEvict"); + logger.warn("setTestName 进行 CacheEvict"); + return testName; + } +} \ No newline at end of file diff --git a/src/main/java/com/xkrs/microservice/service/impl/CropClassifyRecordServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/CropClassifyRecordServiceImpl.java new file mode 100644 index 0000000..1581f21 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/CropClassifyRecordServiceImpl.java @@ -0,0 +1,133 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.CropClassifyRecordDao; +import com.xkrs.microservice.model.entity.CropClassifyRecordEntity; +import com.xkrs.microservice.model.qo.CropClassifyRecordQo; +import com.xkrs.microservice.service.CropClassifyRecordService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import com.xkrs.microservice.util.IterUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; + +/** + * 种植分类记录数据服务管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "CropClassifyRecordServiceCache") +public class CropClassifyRecordServiceImpl implements CropClassifyRecordService { + + Logger logger = LoggerFactory.getLogger(CropClassifyRecordServiceImpl.class); + + @Resource + private CropClassifyRecordDao cropClassifyRecordDao; + + /** + * 获取所有种植分类记录 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return cropClassifyRecordDao.findAll(); + } + + /** + * 获取指定id的种植分类记录 + * @param id 记录编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return cropClassifyRecordDao.findById(id); + } + + /** + * 获取指定行政区划的所有种植分类记录 + * @param admCode 行政区划代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCode(Integer admCode){ + return cropClassifyRecordDao.findByCountyCode(admCode); + } + + /** + * 获取指定街道和日期的所有种植分类记录 + * @param townCode 街道代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByTownCodeAndDate(String townCode, LocalDate startDate, LocalDate endDate){ + return cropClassifyRecordDao.findByTownCodeAndCropDateBetween(townCode,startDate,endDate); + } + + /** + * 获取指定行政区划和时间段的所有种植分类核查记录 + * @param admCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCodeAndDateTime(Integer admCode, LocalDate startDate, LocalDate endDate){ + return cropClassifyRecordDao.findByCountyCodeAndCropDateBetween(admCode,startDate,endDate); + } + + /** + * 新增种植分类记录 + * @param cropClassifyRecordQo + * @param userName 用户名 + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "CropClassifyRecordServiceCache",allEntries = true) + @Override + public void add(CropClassifyRecordQo cropClassifyRecordQo, String userName){ + CropClassifyRecordEntity cropClassifyRecordEntity = new CropClassifyRecordEntity(); + CopyPropertiesUtil.copy(cropClassifyRecordQo, cropClassifyRecordEntity); + LocalDate cropDate = timeMillisToDate(cropClassifyRecordQo.getCropDateTs()); + // 判断数据是否存在 + Iterable ss = cropClassifyRecordDao.findByTownCodeAndCropCodeAndCropDateBetween(cropClassifyRecordQo.getTownCode(),cropClassifyRecordQo.getCropCode(),cropDate,cropDate); + // 若存在则覆盖 + if(IterUtil.isNotEmpty(ss)){ + CropClassifyRecordEntity old = ss.iterator().next(); + cropClassifyRecordEntity.setId(old.getId()); + } + cropClassifyRecordEntity.setCropDate(cropDate); + // 设置添加用户 + cropClassifyRecordEntity.setAddUserName(userName); + // 设置系统时间 + cropClassifyRecordEntity.setAddTime(getNowTime()); + cropClassifyRecordDao.save(cropClassifyRecordEntity); + } + + /** + * 删除种植分类记录 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "CropClassifyRecordServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + cropClassifyRecordDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/DicBusinessServiceServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/DicBusinessServiceServiceImpl.java new file mode 100644 index 0000000..13c09f0 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/DicBusinessServiceServiceImpl.java @@ -0,0 +1,89 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.*; +import com.xkrs.microservice.model.entity.*; +import com.xkrs.microservice.service.DicBusinessService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * 文件服务器接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "DicBusinessServiceServiceCache") +public class DicBusinessServiceServiceImpl implements DicBusinessService { + + Logger logger = LoggerFactory.getLogger(DicBusinessServiceServiceImpl.class); + + @Resource + private DicSoilClassifyDao dicSoilClassifyDao; + + @Resource + private DicLandClassifyDao dicLandClassifyDao; + + @Resource + private DicProductDao dicProductDao; + + @Resource + private DicDroughtClassifyDao dicDroughtClassifyDao; + + @Resource + private DicCropClassifyDao dicCropClassifyDao; + + /** + * 获取所有土壤类型 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllSoilClassify(){ + return dicSoilClassifyDao.findAll(); + } + + /** + * 获取所有土地利用类型 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllLandClassify(){ + return dicLandClassifyDao.findAll(); + } + + /** + * 获取所有旱情类型 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllDroughtClassify(){ + return dicDroughtClassifyDao.findAll(); + } + + /** + * 获取所有种植结构类型 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllCropClassify(){ + return dicCropClassifyDao.findAll(); + } + + /** + * 获取所有产品类型 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllProduct(){ + return dicProductDao.findAll(); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/FarmingInfoServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/FarmingInfoServiceImpl.java new file mode 100644 index 0000000..55296af --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/FarmingInfoServiceImpl.java @@ -0,0 +1,142 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.FarmingInfoDao; +import com.xkrs.microservice.model.entity.FarmingInfoEntity; +import com.xkrs.microservice.model.qo.FarmingInfoQo; +import com.xkrs.microservice.model.qo.TypicalFarmerQo; +import com.xkrs.microservice.service.FarmingInfoService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.*; + +/** + * FarmingInfoService 农情上报接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "FarmingInfoServiceCache") +public class FarmingInfoServiceImpl implements FarmingInfoService { + + Logger logger = LoggerFactory.getLogger(FarmingInfoServiceImpl.class); + + @Resource + private FarmingInfoDao farmingInfoDao; + + /** + * 获取所有农情上报记录列表 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return farmingInfoDao.findAll(Sort.by(Sort.Direction.DESC, "createTime")); + } + + /** + * 获取指定id农情上报记录 + * @param id + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return farmingInfoDao.findById(id); + } + + /** + * 获取指定乡镇代码的所有农情上报记录列表 + * @param dkbh 地块编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByDkbh(String dkbh){ + return farmingInfoDao.findAllByDkbh(dkbh); + } + + /** + * 查找农情信息根据区县编号 + * @param qxbh 区县编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByQxbh(Integer qxbh){ + return farmingInfoDao.findAllByQxbh(qxbh); + } + + /** + * 查找农情信息根据作物代码,区县编号 + * @param qxbh 区县编号 + * @param zwbh 作物代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByZwdmAndQxbh(Integer zwbh,Integer qxbh){ + return farmingInfoDao.findAllByZwdmAndQxbh(zwbh, qxbh); + } + + /** + * 获取所有新农情根据区县编号 + * @param qxbh + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getNewByQxbh(Integer qxbh){ + return farmingInfoDao.findNewAllByQxbh(qxbh); + } + + /** + * 获取指定用户名的农情上报记录列表 + * @param userName 用户名 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByUserName(String userName){ + return farmingInfoDao.findAllByAddUserName(userName); + } + + /** + * 新增农情上报记录 + * @param farmingInfoQo + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "FarmingInfoServiceCache",allEntries = true) + @Override + public void add(FarmingInfoQo farmingInfoQo, String userName){ + FarmingInfoEntity farmingInfoEntity = new FarmingInfoEntity(); + CopyPropertiesUtil.copy( farmingInfoQo, farmingInfoEntity); + farmingInfoEntity.setAddUserName(userName); + // 设置系统时间 + farmingInfoEntity.setCreateTime(getNowTime()); + farmingInfoDao.save(farmingInfoEntity); + } + + /** + * 删除农情上报记录 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "FarmingInfoServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + farmingInfoDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/FileDocumentServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/FileDocumentServiceImpl.java new file mode 100644 index 0000000..e4af66d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/FileDocumentServiceImpl.java @@ -0,0 +1,97 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.FileDocumentDao; +import com.xkrs.microservice.model.entity.FileDocumentEntity; +import com.xkrs.microservice.model.qo.FileDocumentQo; +import com.xkrs.microservice.service.FileDocumentService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.*; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; + +/** + * 文档管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "FileDocumentServiceCache") +public class FileDocumentServiceImpl implements FileDocumentService { + + Logger logger = LoggerFactory.getLogger(FileDocumentServiceImpl.class); + + @Resource + private FileDocumentDao fileDocumentDao; + + /** + * 文档列表 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator",unless="#result == null") + @Override + public Iterable getAllFile() { + return fileDocumentDao.findAll(); + } + + /** + * 获取指定id记录 + * @param id + * @return + */ + @Cacheable(keyGenerator = "keyGenerator",unless="#result == null") + @Override + public Optional getById(Integer id) { + return fileDocumentDao.findById(id); + } + + /** + * 新增文档记录 + * @param fileDocumentQo + * @param userName + */ + @Transactional(rollbackFor=Exception.class) + @Override + @CacheEvict(value = "FileDocumentServiceCache",allEntries = true) + public void add(FileDocumentQo fileDocumentQo,String userName) { + FileDocumentEntity fileDocumentEntity = new FileDocumentEntity(); + fileDocumentEntity.setName(fileDocumentQo.getName()); + fileDocumentEntity.setFilePath(fileDocumentQo.getFilePath()); + fileDocumentEntity.setAddUserName(userName); + fileDocumentEntity.setCategory(fileDocumentQo.getCategory()); + fileDocumentEntity.setMemo(fileDocumentQo.getMemo()); + fileDocumentEntity.setMd5(fileDocumentQo.getMd5()); + fileDocumentEntity.setFileSize(fileDocumentQo.getSize()); + // 设置系统时间 + fileDocumentEntity.setAddTime(getNowTime()); + fileDocumentDao.save(fileDocumentEntity); + } + + /** + * 删除文档记录 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @Override + @CacheEvict(value = "FileDocumentServiceCache",allEntries = true) + public void delete(Integer id) { + fileDocumentDao.deleteById(id); + } + + /** + * 修改文档记录 + * @param fileDocumentEntity + */ + @Transactional(rollbackFor=Exception.class) + @Override + @CacheEvict(value = "FileDocumentServiceCache",allEntries = true) + public void update(FileDocumentEntity fileDocumentEntity) { + fileDocumentDao.save(fileDocumentEntity); + } +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/FileServerServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/FileServerServiceImpl.java new file mode 100644 index 0000000..8176601 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/FileServerServiceImpl.java @@ -0,0 +1,115 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.model.vo.FileServerResultVo; +import com.xkrs.microservice.service.FileServerService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +import static com.xkrs.microservice.common.tool.FileServerTool.postFileManage; + +/** + * 文件服务器接口 + * @author tajochen + */ +@Service +public class FileServerServiceImpl implements FileServerService { + + Logger logger = LoggerFactory.getLogger(FileServerServiceImpl.class); + + @Value("${my.FileServerAdminAdress}") + private String fileServerAdminAdress; + + /** + * 获取文件统计信息 + * @return + */ + @Override + public FileServerResultVo getFileStat(){ + String requestUrl = fileServerAdminAdress + "/group1/stat"; + Map map = new HashMap<>(16); + return postFileManage(requestUrl,map); + } + + /** + * 删除文件 + * @param md5 信息摘要 + * @param path 路径 + * @return + */ + @Override + public FileServerResultVo deleteFile(String md5,String path){ + String requestUrl = fileServerAdminAdress + "/group1/delete"; + Map map = new HashMap<>(16); + if(md5 != null && !md5.isEmpty()){ + map.put("md5",md5); + } + if(path != null && !path.isEmpty()){ + map.put("path",path); + } + return postFileManage(requestUrl,map); + } + + /** + * 获取文件信息 + * @param md5 信息摘要 + * @param path 路径 + * @return + */ + @Override + public FileServerResultVo getFileInfo(String md5,String path){ + String requestUrl = fileServerAdminAdress + "/group1/get_file_info"; + Map map = new HashMap<>(16); + if(md5 != null && !md5.isEmpty()){ + map.put("md5",md5); + } + if(path != null && !path.isEmpty()){ + map.put("path",path); + } + return postFileManage(requestUrl,map); + } + + /** + * 获取文件列表 + * @param dir 目录名 + * @return + */ + @Override + public FileServerResultVo getFileList(String dir){ + String requestUrl = fileServerAdminAdress + "/group1/list_dir"; + Map map = new HashMap<>(16); + map.put("dir",dir); + return postFileManage(requestUrl,map); + } + + /** + * 修复统计信息 + * @param date 要修复的日期,格式如:20190725 + * @return + */ + @Override + public FileServerResultVo getFileRepairStat(String date){ + String requestUrl = fileServerAdminAdress + "/group1/repair_stat"; + Map map = new HashMap<>(16); + map.put("date",date); + return postFileManage(requestUrl,map); + } + + /** + * 同步失败修复 + * @param force 是否强行修复(0|1) + * @return + */ + @Override + public FileServerResultVo getFileRepair(String force){ + String requestUrl = fileServerAdminAdress + "/group1/repair"; + Map map = new HashMap<>(16); + map.put("force",force); + return postFileManage(requestUrl,map); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/HydrologicalStationServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/HydrologicalStationServiceImpl.java new file mode 100644 index 0000000..f09f73a --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/HydrologicalStationServiceImpl.java @@ -0,0 +1,103 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.HydrologicalStationDao; +import com.xkrs.microservice.model.entity.HydrologicalStationEntity; +import com.xkrs.microservice.model.qo.HydrologicalStationQo; +import com.xkrs.microservice.service.HydrologicalStationService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import com.xkrs.microservice.util.IterUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; + +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.*; + +/** + * 水文站点服务接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "HydrologicalStationServiceCache") +public class HydrologicalStationServiceImpl implements HydrologicalStationService { + + Logger logger = LoggerFactory.getLogger(HydrologicalStationServiceImpl.class); + + @Resource + private HydrologicalStationDao hydrologicalStationDao; + + /** + * 获取所有水文站点数据 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return hydrologicalStationDao.findAll(); + } + + /** + * 获取时间段水文站点数据 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByTime(LocalDateTime sTime,LocalDateTime eTime){ + return hydrologicalStationDao.findByRecordTimeBetween(sTime,eTime); + } + + /** + * 新增水文站点数据 + * @param hydrologicalStationQo 水文站点数据 + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "HydrologicalStationServiceCache",allEntries = true) + @Override + public void add(HydrologicalStationQo hydrologicalStationQo){ + HydrologicalStationEntity hydrologicalStationEntity = new HydrologicalStationEntity(); + CopyPropertiesUtil.copy( hydrologicalStationQo, hydrologicalStationEntity); + hydrologicalStationEntity.setCountyName(hydrologicalStationQo.getCounty()); + LocalDateTime theTime = timeMillisToTime(hydrologicalStationQo.getTime()); + // 判断数据是否存在 + LocalDateTime todayStart = LocalDateTime.of(theTime.toLocalDate(), LocalTime.MIN); + LocalDateTime todayEnd = LocalDateTime.of(theTime.toLocalDate(), LocalTime.MAX); + Iterable ss = hydrologicalStationDao.findByNameAndRecordTimeBetween(hydrologicalStationQo.getName(),todayStart,todayEnd); + // 若存在则跳过 + if(IterUtil.isNotEmpty(ss)){ + return; + } + // 如果 + hydrologicalStationEntity.setRecordTime(theTime); + hydrologicalStationEntity.setCreateTime(getNowTime()); + hydrologicalStationDao.save(hydrologicalStationEntity); + } + + /** + * 删除水文站点数据 + * @param id 编号 + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "HydrologicalStationServiceCache",allEntries = true) + @Override + public int delete(Integer id){ + Optional res = hydrologicalStationDao.findById(id); + if(res.isPresent()){ + hydrologicalStationDao.deleteById(id); + return 0; + } else { + return 1; + } + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/IndependentCheckServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/IndependentCheckServiceImpl.java new file mode 100644 index 0000000..de9bc4d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/IndependentCheckServiceImpl.java @@ -0,0 +1,108 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.IndependentCheckDao; +import com.xkrs.microservice.model.entity.IndependentCheckEntity; +import com.xkrs.microservice.model.qo.IndependentCheckQo; +import com.xkrs.microservice.service.IndependentCheckService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; +import static com.xkrs.microservice.util.OpenGeoUtil.wktStrToGeom; + +/** + * FarmingInfoService 自主核查上报接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "IndependentCheckServiceCache") +public class IndependentCheckServiceImpl implements IndependentCheckService { + + Logger logger = LoggerFactory.getLogger(IndependentCheckServiceImpl.class); + + @Resource + private IndependentCheckDao independentCheckDao; + + /** + * 获取所有自主核查记录列表 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return independentCheckDao.findAll(Sort.by(Sort.Direction.DESC, "createTime")); + } + + /** + * 获取指定id自主核查记录 + * @param id + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return independentCheckDao.findById(id); + } + + /** + * 获取指定区县代码的自主核查记录 + * @param countyCode 区县代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByCountyCode(Integer countyCode){ + return independentCheckDao.findByQxdm(countyCode); + } + + /** + * 获取指定用户名的自主核查记录列表 + * @param userName 用户名 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByUserName(String userName){ + return independentCheckDao.findAllByAddUserName(userName); + } + + /** + * 新增自主核查记录 + * @param independentCheckQo + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "IndependentCheckServiceCache",allEntries = true) + @Override + public void add(IndependentCheckQo independentCheckQo, String userName){ + IndependentCheckEntity independentCheckEntity = new IndependentCheckEntity(); + CopyPropertiesUtil.copy( independentCheckQo, independentCheckEntity); + independentCheckEntity.setAddUserName(userName); + // 转化geometry + independentCheckEntity.setGeom(wktStrToGeom(independentCheckQo.getGeomStr())); + // 设置系统时间 + independentCheckEntity.setCreateTime(getNowTime()); + independentCheckDao.save(independentCheckEntity); + } + + /** + * 删除自主核查记录 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "IndependentCheckServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + independentCheckDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/IrrigationCheckServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/IrrigationCheckServiceImpl.java new file mode 100644 index 0000000..5c206d7 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/IrrigationCheckServiceImpl.java @@ -0,0 +1,157 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.IrrigationCheckDao; +import com.xkrs.microservice.dao.TypicalPlotIrrigationDao; +import com.xkrs.microservice.model.entity.IrrigationCheckEntity; +import com.xkrs.microservice.model.entity.TypicalPlotIrrigationEntity; +import com.xkrs.microservice.model.qo.IrrigationCheckQo; +import com.xkrs.microservice.service.IrrigationCheckService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.cache.annotation.Caching; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; + +/** + * FarmingInfoService 灌溉核查上报接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "IrrigationCheckServiceCache") +public class IrrigationCheckServiceImpl implements IrrigationCheckService { + + Logger logger = LoggerFactory.getLogger(IrrigationCheckServiceImpl.class); + + @Resource + private IrrigationCheckDao irrigationCheckDao; + + @Resource + private TypicalPlotIrrigationDao typicalPlotIrrigationDao; + + /** + * 获取所有灌溉核查上报记录列表 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return irrigationCheckDao.findAll(Sort.by(Sort.Direction.DESC, "createTime")); + } + + /** + * 获取指定id灌溉核查上报记录 + * @param id + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return irrigationCheckDao.findById(id); + } + + + /** + * 获取指定用户的所有灌溉核查记录 + * @param userName 用户名 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByUserName(String userName){ + return irrigationCheckDao.findByAddUserName(userName); + } + + /** + * 获取指定地块编号的所有灌溉核查记录 + * @param dkbh 地块编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByDkbh(String dkbh){ + return irrigationCheckDao.findAllByDkbh(dkbh); + } + + /** + * 获取指定地块编号的所有区县编号 + * @param qxbh 区县编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByQxbh(Integer qxbh){ + return irrigationCheckDao.findAllByQxbh(qxbh); + } + + /** + * 查找灌溉核查结果根据区县编号和时间 + * @param qxbh 区县编号 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByQxbhAndCreateTimeBetween(Integer qxbh, LocalDateTime sTime, LocalDateTime eTime){ + return irrigationCheckDao.findAllByQxbhAndCreateTimeBetween(qxbh,sTime,eTime); + } + + /** + * 获取指定灌溉编号的所有灌溉核查记录 + * @param ggbh 灌溉编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getByGgbh(String ggbh){ + return irrigationCheckDao.findByGgbh(ggbh); + } + + /** + * 新增灌溉核查上报 + * @param irrigationCheckQo + */ + @Transactional(rollbackFor=Exception.class) + @Caching(evict={@CacheEvict(value = "IrrigationCheckServiceCache",allEntries = true), + @CacheEvict(value = "TypicalPlotIrrigationService",allEntries = true)}) + @Override + public void add(IrrigationCheckQo irrigationCheckQo, String userName){ + IrrigationCheckEntity irrigationCheckEntity = new IrrigationCheckEntity(); + CopyPropertiesUtil.copy( irrigationCheckQo, irrigationCheckEntity); + irrigationCheckEntity.setAddUserName(userName); + // 设置系统时间 + irrigationCheckEntity.setCreateTime(getNowTime()); + irrigationCheckDao.save(irrigationCheckEntity); + // 修改灌溉记录 + Optional typicalPlotIrrigationEntityOptional = typicalPlotIrrigationDao.findByGgbh(irrigationCheckEntity.getGgbh()); + if (typicalPlotIrrigationEntityOptional.isPresent()){ + TypicalPlotIrrigationEntity typicalPlotIrrigationEntity = typicalPlotIrrigationEntityOptional.get(); + typicalPlotIrrigationEntity.setHsbj(2); + typicalPlotIrrigationEntity.setQrbj(irrigationCheckEntity.getHszt()); + typicalPlotIrrigationDao.save(typicalPlotIrrigationEntity); + } + } + + /** + * 删除灌溉核查上报 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "IrrigationCheckServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + irrigationCheckDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/IrrigationRecordServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/IrrigationRecordServiceImpl.java new file mode 100644 index 0000000..67df09f --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/IrrigationRecordServiceImpl.java @@ -0,0 +1,132 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.IrrigationRecordDao; +import com.xkrs.microservice.model.entity.IrrigationRecordEntity; +import com.xkrs.microservice.model.qo.IrrigationRecordQo; +import com.xkrs.microservice.service.IrrigationRecordService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import com.xkrs.microservice.util.IterUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.*; + +/** + * 灌溉记录数据服务管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "IrrigationRecordServiceCache") +public class IrrigationRecordServiceImpl implements IrrigationRecordService { + + Logger logger = LoggerFactory.getLogger(IrrigationRecordServiceImpl.class); + + @Resource + private IrrigationRecordDao irrigationRecordDao; + + /** + * 获取所有灌溉记录 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return irrigationRecordDao.findAll(); + } + + /** + * 获取指定id的灌溉记录 + * @param id 记录编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return irrigationRecordDao.findById(id); + } + + /** + * 获取指定行政区划的所有灌溉记录 + * @param admCode 行政区划代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCode(Integer admCode){ + return irrigationRecordDao.findByCountyCode(admCode); + } + + /** + * 获取指定街道代码和时间段的所有灌溉记录 + * @param townCode 街道代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByTownCodeAndDate(String townCode, LocalDate startDate, LocalDate endDate){ + return irrigationRecordDao.findByTownCodeAndIrrigationDateBetween(townCode, startDate, endDate); + } + + /** + * 获取指定行政区划和时间段的所有灌溉记录 + * @param admCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCodeAndDateTime(Integer admCode, LocalDate startDate, LocalDate endDate){ + return irrigationRecordDao.findByCountyCodeAndIrrigationDateBetween(admCode,startDate,endDate); + } + + /** + * 新增灌溉记录 + * @param irrigationFieldCheckQo + * @param userName 用户名 + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "IrrigationRecordServiceCache",allEntries = true) + @Override + public void add(IrrigationRecordQo irrigationFieldCheckQo, String userName){ + IrrigationRecordEntity irrigationRecordEntity = new IrrigationRecordEntity(); + CopyPropertiesUtil.copy(irrigationFieldCheckQo, irrigationRecordEntity); + LocalDate irrigationDate = timeMillisToDate(irrigationFieldCheckQo.getIrrigationDateTs()); + // 判断数据是否存在 + Iterable ss = irrigationRecordDao.findByTownCodeAndIrrigationDateBetween(irrigationFieldCheckQo.getTownCode(),irrigationDate,irrigationDate); + // 若存在则覆盖 + if(IterUtil.isNotEmpty(ss)){ + IrrigationRecordEntity old = ss.iterator().next(); + irrigationRecordEntity.setId(old.getId()); + } + irrigationRecordEntity.setIrrigationDate(irrigationDate); + // 设置添加用户 + irrigationRecordEntity.setAddUserName(userName); + // 设置系统时间 + irrigationRecordEntity.setAddTime(getNowTime()); + irrigationRecordDao.save(irrigationRecordEntity); + } + + /** + * 删除灌溉记录 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "IrrigationRecordServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + irrigationRecordDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/IrrigationSarRecordServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/IrrigationSarRecordServiceImpl.java new file mode 100644 index 0000000..7577a1c --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/IrrigationSarRecordServiceImpl.java @@ -0,0 +1,146 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.IrrigationSarRecordDao; +import com.xkrs.microservice.model.entity.IrrigationSarRecordEntity; +import com.xkrs.microservice.model.qo.IrrigationSarRecordQo; +import com.xkrs.microservice.service.IrrigationSarRecordService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import com.xkrs.microservice.util.IterUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; + +/** + * 灌溉Sar记录数据服务管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "IrrigationSarRecordServiceCache") +public class IrrigationSarRecordServiceImpl implements IrrigationSarRecordService { + + Logger logger = LoggerFactory.getLogger(IrrigationSarRecordServiceImpl.class); + + @Resource + private IrrigationSarRecordDao irrigationSarRecordDao; + + /** + * 获取所有灌溉记录 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return irrigationSarRecordDao.findAll(); + } + + /** + * 获取指定id的灌溉记录 + * @param id 记录编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return irrigationSarRecordDao.findById(id); + } + + /** + * 获取指定行政区划的所有灌溉记录 + * @param admCode 行政区划代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCode(Integer admCode){ + return irrigationSarRecordDao.findByCountyCode(admCode); + } + + /** + * 获取指定街道代码和时间段的所有灌溉记录 + * @param townCode 街道代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByTownCodeAndDate(String townCode, LocalDate startDate, LocalDate endDate){ + return irrigationSarRecordDao.findByTownCodeAndIrrigationDateBetween(townCode, startDate, endDate); + } + + /** + * 获取灌溉统计动态多条件查询 + * @param townCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable geAllByCondition(String townCode, LocalDate startDate, LocalDate endDate){ + return irrigationSarRecordDao.getAllByCondition(townCode,startDate,endDate); + } + + /** + * 获取指定行政区划和时间段的所有灌溉记录 + * @param admCode 行政区划代码 + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCodeAndDateTime(Integer admCode, LocalDate startDate, LocalDate endDate){ + return irrigationSarRecordDao.findByCountyCodeAndIrrigationDateBetween(admCode,startDate,endDate); + } + + /** + * 新增灌溉记录 + * @param irrigationFieldCheckQo + * @param userName 用户名 + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "IrrigationSarRecordServiceCache",allEntries = true) + @Override + public void add(IrrigationSarRecordQo irrigationFieldCheckQo, String userName){ + IrrigationSarRecordEntity irrigationSarRecordEntity = new IrrigationSarRecordEntity(); + CopyPropertiesUtil.copy(irrigationFieldCheckQo, irrigationSarRecordEntity); + LocalDate irrigationDate = timeMillisToDate(irrigationFieldCheckQo.getIrrigationDateTs()); + // 判断数据是否存在 + Iterable ss = irrigationSarRecordDao.findByTownCodeAndIrrigationDateBetween(irrigationFieldCheckQo.getTownCode(),irrigationDate,irrigationDate); + // 若存在则覆盖 + if(IterUtil.isNotEmpty(ss)){ + IrrigationSarRecordEntity old = ss.iterator().next(); + irrigationSarRecordEntity.setId(old.getId()); + } + irrigationSarRecordEntity.setIrrigationDate(irrigationDate); + // 设置添加用户 + irrigationSarRecordEntity.setAddUserName(userName); + // 设置系统时间 + irrigationSarRecordEntity.setAddTime(getNowTime()); + irrigationSarRecordDao.save(irrigationSarRecordEntity); + } + + /** + * 删除灌溉记录 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "IrrigationSarRecordServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + irrigationSarRecordDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/MeteorologicalServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/MeteorologicalServiceImpl.java new file mode 100644 index 0000000..666034e --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/MeteorologicalServiceImpl.java @@ -0,0 +1,69 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.MeteorologicalStationDao; +import com.xkrs.microservice.model.entity.MeteorologicalStationEntity; +import com.xkrs.microservice.model.vo.ForecastWeather7DayVo; +import com.xkrs.microservice.model.vo.RealTimeWeatherVo; +import com.xkrs.microservice.service.MeteorologicalService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import static com.xkrs.microservice.common.tool.CrawlingWeather7Day.getReptileWeather7Day; +import static com.xkrs.microservice.common.tool.CrawlingWeatherNew.handlerWeatherData; + +/** + * 行政区划接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "AdministrativeDivisionServiceCache") +public class MeteorologicalServiceImpl implements MeteorologicalService { + + static final Logger logger = LoggerFactory.getLogger(MeteorologicalServiceImpl.class); + + @Resource + private MeteorologicalStationDao meteorologicalStationDao; + + /** + * 获取当前行政区划天气 + * @param admCode 行政区划代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public RealTimeWeatherVo getWeatherNowByAdmCode(Integer admCode){ + MeteorologicalStationEntity relAdmWeatherStationEntity= meteorologicalStationDao.findByCode(admCode); + if(relAdmWeatherStationEntity != null){ + RealTimeWeatherVo res = handlerWeatherData(relAdmWeatherStationEntity.getCityWeatherCode().toString()); + return res; + } + return null; + } + + /** + * 获取行政区划天气预报 + * @param admCode 行政区划代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public ForecastWeather7DayVo getWeatherForecastByAdmCode(Integer admCode){ + MeteorologicalStationEntity relAdmWeatherStationEntity= meteorologicalStationDao.findByCode(admCode); + if(relAdmWeatherStationEntity != null){ + String stationId = ""; + if(relAdmWeatherStationEntity.getStationId()!=null){ + stationId = relAdmWeatherStationEntity.getStationId().toString(); + } + ForecastWeather7DayVo res = getReptileWeather7Day(relAdmWeatherStationEntity.getCityWeatherCode().toString(), + stationId); + return res; + } + return null; + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/SysAuthorityServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/SysAuthorityServiceImpl.java new file mode 100644 index 0000000..dd94e60 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/SysAuthorityServiceImpl.java @@ -0,0 +1,29 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.SysAuthorityDao; +import com.xkrs.microservice.model.entity.SysAuthorityEntity; +import com.xkrs.microservice.service.SysAuthorityService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 系统权限服务实现 + * @author tajochen + */ +@Service +public class SysAuthorityServiceImpl implements SysAuthorityService { + + Logger logger = LoggerFactory.getLogger(SysAuthorityServiceImpl.class); + + @Resource + private SysAuthorityDao sysAuthorityDao; + + @Override + public List getSysAuthorityListByUserName(String userName) { + return sysAuthorityDao.selectByUserName(userName); + } +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/SysRoleServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000..9f0ba92 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,29 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.SysRoleDao; +import com.xkrs.microservice.model.entity.SysRoleEntity; +import com.xkrs.microservice.service.SysRoleService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 系统角色服务实现 + * @author tajochen + */ +@Service +public class SysRoleServiceImpl implements SysRoleService { + + Logger logger = LoggerFactory.getLogger(SysRoleServiceImpl.class); + + @Resource + private SysRoleDao sysRoleDao; + + @Override + public List getSysRoleListByUserName(String userName) { + return sysRoleDao.selectByUserName(userName); + } +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000..0d0db0b --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/SysUserServiceImpl.java @@ -0,0 +1,226 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.SysRoleDao; +import com.xkrs.microservice.dao.SysUserDao; +import com.xkrs.microservice.model.entity.SysRoleEntity; +import com.xkrs.microservice.model.entity.SysUserEntity; +import com.xkrs.microservice.model.qo.SysUserQo; +import com.xkrs.microservice.model.vo.SysUserVo; +import com.xkrs.microservice.service.SysUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.crypto.keygen.KeyGenerators; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; + +import java.util.List; +import java.util.regex.Pattern; + +import static com.xkrs.microservice.util.DateTimeUtil.*; +import static com.xkrs.microservice.util.EncryptDecryptUtil.encrypt256; + +/** + * 系统用户服务实现 + * @author tajochen + */ +@Service +public class SysUserServiceImpl implements SysUserService { + + Logger logger = LoggerFactory.getLogger(SysUserServiceImpl.class); + + @Resource + private SysUserDao sysUserDao; + + @Resource + private SysRoleDao sysRoleDao; + + /** + * 获取指定用户Vo + * @param userName 用户名 + * @return + */ + @Override + public SysUserVo getSysUserVoByUserName(String userName){ + return sysUserDao.selectSysUserByUserName(userName); + } + + /** + * 用户头像更新 + * @param userName 用户名 + * @param portraitId 编号 + * @return + */ + @Override + public int updateSysUserPortrait(String userName,Integer portraitId){ + SysUserEntity sysUserEntity = sysUserDao.findByUserName(userName); + if(sysUserEntity==null){ + return 1; + } + sysUserEntity.setPortraitId(portraitId); + sysUserDao.save(sysUserEntity); + return 0; + } + + /** + * 用户密码更新 + * @param userName 用户名 + * @param oldPassword 旧密码 + * @param newPassword 新密码 + * @return + */ + @Override + public int updateSysUserPassword(String userName,String oldPassword,String newPassword){ + // 检查旧密码是否正确 + SysUserEntity sysUserEntity = sysUserDao.findByUserName(userName); + if(sysUserEntity==null){ + return 1; + } + String oldPasswordStr = encrypt256(oldPassword + sysUserEntity.getSalt()); + // 如果旧密码不正确 +// if(!oldPasswordStr.equals(sysUserEntity.getPassword())){ +// return 2; +// } + String pattern = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$"; + boolean isMatch = Pattern.matches(pattern, newPassword); + // 如果新密码不符合规则 +// if(!isMatch){ +// return 3; +// } + String salt = KeyGenerators.string().generateKey(); + sysUserEntity.setSalt(salt); + sysUserEntity.setPassword(encrypt256(newPassword + salt)); + sysUserDao.save(sysUserEntity); + return 0; + } + + /** + * 检查用户名是否存在 + * @param userName 用户名 + * @return + */ + @Override + public boolean checkUserName(String userName) { + int num = sysUserDao.checkUserName(userName); + return (num == 0); + } + + /** + * 禁用用户账号 + * @param userName + * @return + */ + @Transactional(rollbackFor=Exception.class) + @Override + public int disableSysUser(String userName){ + SysUserEntity sysUserEntity = sysUserDao.findByUserName(userName); + sysUserEntity.setStatusCode(2); + sysUserDao.save(sysUserEntity); + return 1; + } + + /** + * 启用用户账号 + * @param userName + * @return + */ + @Transactional(rollbackFor=Exception.class) + @Override + public int enableSysUser(String userName){ + SysUserEntity sysUserEntity = sysUserDao.findByUserName(userName); + sysUserEntity.setStatusCode(0); + sysUserDao.save(sysUserEntity); + return 1; + } + + /** + * 新增用户 + * @param sysUserQo + */ + @Transactional(rollbackFor=Exception.class) + @Override + public void addUser(SysUserQo sysUserQo) { + String salt = KeyGenerators.string().generateKey(); + SysUserEntity sysUserEntity = new SysUserEntity(); + sysUserEntity.setUserName(sysUserQo.getUserName()); + sysUserEntity.setSalt(salt); + sysUserEntity.setPassword(encrypt256(sysUserQo.getPassword() + salt)); + sysUserEntity.setAdmCode(sysUserQo.getAdmCode()); + sysUserEntity.setAddress(sysUserQo.getAddress()); + sysUserEntity.setEmail(sysUserQo.getEmail()); + sysUserEntity.setTelephone(sysUserQo.getTelephone()); + sysUserEntity.setPortraitId(0); + if(sysUserQo.getBirthdayTs()!=null){ + sysUserEntity.setBirthday(timeMillisToDate(sysUserQo.getBirthdayTs())); + } + sysUserEntity.setActiveFlag(0); + sysUserEntity.setStatusCode(2); + sysUserEntity.setAddTime(getNowTime()); + sysUserEntity.setDeleteFlag(0); + sysUserEntity.setMemo(sysUserQo.getMemo()); + sysUserEntity.setRealName(sysUserQo.getRealName()); + sysUserDao.save(sysUserEntity); + sysRoleDao.insertRelUserRole(sysUserEntity.getUserName(),"role_general_user"); + } + + /** + * 查询所有用户Vo + * @return + */ + @Transactional(rollbackFor=Exception.class) + @Override + public Iterable getAllSysUser() { + Iterable ls = sysUserDao.selectAllSysUser(); + return ls; + } + + @Transactional(rollbackFor=Exception.class) + @Override + public SysUserEntity getSysUserByUserName(String userName) { + return sysUserDao.selectByUserName(userName); + } + + @Transactional(rollbackFor=Exception.class) + @Override + public int updateSysUserLogin(String userName,String ipAddress) { + return sysUserDao.updateSysUserLogin(userName,ipAddress); + } + + /** + * 更新用户 + * @param sysUserQo + * @return + */ + @Transactional(rollbackFor=Exception.class) + @Override + public int updateSysUser(SysUserQo sysUserQo) { + SysUserEntity sysUserEntity = new SysUserEntity(); + sysUserEntity.setNickName(sysUserQo.getNickName()); + sysUserDao.save(sysUserEntity); + return 1; + } + + /** + * 软删除普通用户 + * @param id 编号 + * @return + */ + @Transactional(rollbackFor=Exception.class) + @Override + public int softDeleteGeneralUser(Integer id) { + String adminRole = "role_administor"; + String sysRole ="role_system_manager"; + + List list = sysRoleDao.selectByUserId(id); + if(list.size()>0){ + SysRoleEntity sysRoleEntity = list.get(1); + if(sysRole.equals(sysRoleEntity.getRoleName())||adminRole.equals(sysRoleEntity.getRoleName())){ + sysUserDao.softDeleteGeneralUserById(id); + return 0; + } + } + return 1; + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/TifProductServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/TifProductServiceImpl.java new file mode 100644 index 0000000..4a0e886 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/TifProductServiceImpl.java @@ -0,0 +1,162 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.TifProductDao; +import com.xkrs.microservice.model.entity.TifProductEntity; +import com.xkrs.microservice.model.qo.TifProductQo; +import com.xkrs.microservice.service.TifProductService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; + +/** + * 栅格产品管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "TifProductServiceCache") +public class TifProductServiceImpl implements TifProductService { + + Logger logger = LoggerFactory.getLogger(TifProductServiceImpl.class); + + @Resource + private TifProductDao tifProductDao; + + /** + * 获取所有栅格产品 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllFile(){ + return tifProductDao.findAll(); + } + + /** + * 获取指定产品编号的产品 + * @param productCode 产品编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public TifProductEntity getByProductCode(String productCode){ + return tifProductDao.findByProductCode(productCode); + } + + /** + * 获取指定id的产品 + * @param id 产品编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return tifProductDao.findById(id); + } + + /** + * 获取指定类型的所有产品 + * @param productType 产品类型 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByProductType(String productType){ + return tifProductDao.findByProductType(productType); + } + + /** + * 获取指定类型和时间段的所有产品 + * @param productType 产品类型 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByProductTypeAndDate(String productType, LocalDate startDate, LocalDate endDate){ + return tifProductDao.findByProductTypeAndProductDateBetween(productType,startDate,endDate); + } + + /** + * 获取指定行政区划和时间段的所有产品 + * @param admCode 行政区划代码 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCodeAndProductDateBetween(Integer admCode, LocalDate startDate,LocalDate endDate){ + return tifProductDao.findByAdmCodeAndProductDateBetween(admCode,startDate,endDate); + } + + /** + * 获取指定类型和行政区划的所有产品 + * @param admCode 行政区划 + * @param productType 产品类型 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCodeAndProductType(Integer admCode,String productType){ + return tifProductDao.findByProductTypeAndAdmCode(productType,admCode); + } + + /** + * 获取指定类型和行政区划和时间段的所有产品 + * @param admCode 行政区划 + * @param productType 产品类型 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCodeAndProductTypeAndDate(Integer admCode,String productType, LocalDate startDate,LocalDate endDate){ + return tifProductDao.findByProductTypeAndAdmCodeAndProductDateBetween(productType,admCode,startDate,endDate); + } + + /** + * 新增栅格产品记录 + * @param tifProductQo + * @param userName 用户名 + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TifProductServiceCache",allEntries = true) + @Override + public void add(TifProductQo tifProductQo, String userName){ + TifProductEntity tifProductEntity = new TifProductEntity(); + CopyPropertiesUtil.copy(tifProductQo, tifProductEntity); + LocalDate productDate = timeMillisToDate(tifProductQo.getProductDateTs()); + tifProductEntity.setProductDate(productDate); + // 设置添加用户 + tifProductEntity.setAddUserName(userName); + // 设置系统时间 + tifProductEntity.setCreateTime(getNowTime()); + tifProductDao.save(tifProductEntity); + } + + /** + * 删除栅格产品 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TifProductServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + tifProductDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/TypicalFarmerServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/TypicalFarmerServiceImpl.java new file mode 100644 index 0000000..4f2abf2 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/TypicalFarmerServiceImpl.java @@ -0,0 +1,184 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.SysRoleDao; +import com.xkrs.microservice.dao.SysUserDao; +import com.xkrs.microservice.dao.TypicalFarmerDao; +import com.xkrs.microservice.model.entity.SysUserEntity; +import com.xkrs.microservice.model.entity.TypicalFarmerEntity; +import com.xkrs.microservice.model.qo.TypicalFarmerQo; +import com.xkrs.microservice.service.TypicalFarmerService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Sort; +import org.springframework.security.crypto.keygen.KeyGenerators; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; +import static com.xkrs.microservice.util.EncryptDecryptUtil.encrypt256; + +/** + * TypicalFarmerService 管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "TypicalFarmerServiceCache") +public class TypicalFarmerServiceImpl implements TypicalFarmerService { + + Logger logger = LoggerFactory.getLogger(TypicalFarmerServiceImpl.class); + + @Resource + private TypicalFarmerDao typicalFarmerDao; + + @Resource + private SysUserDao sysUserDao; + + @Resource + private SysRoleDao sysRoleDao; + + /** + * 获取所有农户记录列表 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return typicalFarmerDao.findAll(Sort.by(Sort.Direction.DESC, "createTime")); + } + + /** + * 获取指定id记录 + * @param id + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return typicalFarmerDao.findById(id); + } + + /** + * 获取指定乡镇代码的所有农户记录列表 + * @param xzdm 乡镇代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByTownCode(String xzdm){ + return typicalFarmerDao.findAllByXzdm(xzdm); + } + + /** + * 获取指定区县代码的所有农户记录列表 + * @param qxdm 区县代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByCountyCode(Integer qxdm){ + return typicalFarmerDao.findAllByQxdm(qxdm); + } + + /** + * 获取指定姓名的所有农户记录列表 + * @param lxr 联系人 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByLxr(String lxr){ + return typicalFarmerDao.findAllByLxr(lxr); + } + + /** + * 获取指定手机号的农户记录列表 + * @param tel 手机号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getByTel(String tel){ + return typicalFarmerDao.findByTel(tel); + } + + /** + * 新增农户记录 + * @param typicalFarmerQo + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TypicalFarmerServiceCache",allEntries = true) + @Override + public void add(TypicalFarmerQo typicalFarmerQo, String userName){ + String salt = KeyGenerators.string().generateKey(); + SysUserEntity sysUserEntity = new SysUserEntity(); + sysUserEntity.setUserName(userName); + sysUserEntity.setSalt(salt); + sysUserEntity.setPassword(encrypt256(typicalFarmerQo.getPassword() + salt)); + sysUserEntity.setAdmCode(typicalFarmerQo.getQxdm()); + sysUserEntity.setAddress(typicalFarmerQo.getAddress()); + sysUserEntity.setTelephone(typicalFarmerQo.getTel()); + sysUserEntity.setPortraitId(0); + sysUserEntity.setActiveFlag(0); + sysUserEntity.setStatusCode(2); + sysUserEntity.setAddTime(getNowTime()); + sysUserEntity.setDeleteFlag(0); + sysUserEntity.setRealName(typicalFarmerQo.getLxr()); + sysUserEntity.setMemo("农户"); + sysUserDao.save(sysUserEntity); + sysRoleDao.insertRelUserRole(sysUserEntity.getUserName(),"role_farm_user"); + TypicalFarmerEntity typicalFarmerEntity = new TypicalFarmerEntity(); + CopyPropertiesUtil.copy( typicalFarmerQo, typicalFarmerEntity); + typicalFarmerEntity.setAddUserName(userName); + // 设置协议时间 + LocalDate sDate = timeMillisToDate(typicalFarmerQo.getStrdateTs()); + typicalFarmerEntity.setStrdate(sDate); + LocalDate eDate = timeMillisToDate(typicalFarmerQo.getEnddateTs()); + typicalFarmerEntity.setEnddate(eDate); + // 设置系统时间 + typicalFarmerEntity.setCreateTime(getNowTime()); + typicalFarmerDao.save(typicalFarmerEntity); + } + + /** + * 修改农户记录 + * @param typicalFarmerQo + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TypicalFarmerServiceCache",allEntries = true) + @Override + public void update(TypicalFarmerQo typicalFarmerQo){ + Optional typicalFarmerEntityOptional = typicalFarmerDao.findByTel(typicalFarmerQo.getTel()); + TypicalFarmerEntity typicalFarmerEntity = typicalFarmerEntityOptional.get(); + typicalFarmerEntity.setLxr(typicalFarmerQo.getLxr()); + typicalFarmerEntity.setLxrid(typicalFarmerQo.getLxrid()); + typicalFarmerEntity.setAddress(typicalFarmerQo.getAddress()); + LocalDate sDate = timeMillisToDate(typicalFarmerQo.getStrdateTs()); + typicalFarmerEntity.setStrdate(sDate); + LocalDate eDate = timeMillisToDate(typicalFarmerQo.getEnddateTs()); + typicalFarmerEntity.setEnddate(eDate); + typicalFarmerEntity.setXyzp(typicalFarmerQo.getXyzp()); + typicalFarmerEntity.setRemark(typicalFarmerQo.getRemark()); + typicalFarmerDao.save(typicalFarmerEntity); + } + + /** + * 删除农户记录列表 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TypicalFarmerServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + typicalFarmerDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/TypicalPlotIrrigationServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/TypicalPlotIrrigationServiceImpl.java new file mode 100644 index 0000000..f16790b --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/TypicalPlotIrrigationServiceImpl.java @@ -0,0 +1,163 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.TypicalPlotIrrigationDao; +import com.xkrs.microservice.model.entity.TypicalPlotIrrigationEntity; +import com.xkrs.microservice.model.qo.TypicalPlotIrrigationQo; +import com.xkrs.microservice.service.TypicalPlotIrrigationService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.*; + +/** + * TypicalPlotService 地块灌溉信息管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "TypicalPlotIrrigationService") +public class TypicalPlotIrrigationServiceImpl implements TypicalPlotIrrigationService { + + Logger logger = LoggerFactory.getLogger(TypicalPlotIrrigationServiceImpl.class); + + @Resource + private TypicalPlotIrrigationDao typicalPlotIrrigationDao; + + /** + * 获取所有记录列表 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return typicalPlotIrrigationDao.findAll(Sort.by(Sort.Direction.DESC, "createTime")); + } + + /** + * 获取指定id记录 + * @param id + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return typicalPlotIrrigationDao.findById(id); + } + + /** + * 获取指定灌溉编号的地块灌溉信息 + * @param ggbh 灌溉编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getByGgbh(String ggbh){ + return typicalPlotIrrigationDao.findByGgbh(ggbh); + } + + /** + * 查找灌溉记录列表根据区县编号 + * @param qxbh 区县编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByQxbh(Integer qxbh){ + return typicalPlotIrrigationDao.findAllByQxbh(qxbh); + } + + /** + * 获取指定编号的地块灌溉信息 + * @param dkbh 地块编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByDkbh(String dkbh){ + return typicalPlotIrrigationDao.findAllByDkbh(dkbh); + } + + /** + * 查找灌溉记录根据灌溉编号 + * @param qxbh 区县代码 + * @param sTime 开始时间 + * @param eTime 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable findAllByQxbhAndStrtimeBetween(Integer qxbh, LocalDateTime sTime, LocalDateTime eTime){ + return typicalPlotIrrigationDao.findAllByQxbhAndEndtimeBetween(qxbh,sTime,eTime); + } + + /** + * 查找灌溉记录根据动态多条件 + * @param xzbh 乡镇街道代码 + * @param cropCode 作物代码 + * @param sTimeTs 开始时间 + * @param eTimeTs 结束时间 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public List getAllByCondition(String xzbh, Integer cropCode, Long sTimeTs, Long eTimeTs){ + LocalDateTime startTime = timeMillisToTime(sTimeTs); + LocalDateTime endTime = timeMillisToTime(eTimeTs); + return typicalPlotIrrigationDao.getAllByCondition(xzbh,cropCode,startTime,endTime); + } + + /** + * 获取指定用户名的所有地块灌溉信息 + * @param userName 用户名 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByUserName(String userName){ + return typicalPlotIrrigationDao.findAllByAddUserName(userName); + } + + /** + * 新增典型地块灌溉信息 + * @param typicalPlotIrrigationQo + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TypicalPlotIrrigationService",allEntries = true) + @Override + public void add(TypicalPlotIrrigationQo typicalPlotIrrigationQo,String userName){ + TypicalPlotIrrigationEntity typicalPlotEntity = new TypicalPlotIrrigationEntity(); + CopyPropertiesUtil.copy( typicalPlotIrrigationQo, typicalPlotEntity); + typicalPlotEntity.setAddUserName(userName); + // 设置灌溉时间 + LocalDateTime sTime = timeMillisToTime(typicalPlotIrrigationQo.getStrtimeTs()); + typicalPlotEntity.setStrtime(sTime); + LocalDateTime eTime = timeMillisToTime(typicalPlotIrrigationQo.getEndtimeTs()); + typicalPlotEntity.setEndtime(eTime); + // 设置系统时间 + typicalPlotEntity.setCreateTime(getNowTime()); + typicalPlotIrrigationDao.save(typicalPlotEntity); + } + + /** + * 删除地块灌溉信息 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TypicalPlotIrrigationService",allEntries = true) + @Override + public void delete(Integer id){ + typicalPlotIrrigationDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/TypicalPlotServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/TypicalPlotServiceImpl.java new file mode 100644 index 0000000..7b98588 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/TypicalPlotServiceImpl.java @@ -0,0 +1,164 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.TypicalPlotDao; +import com.xkrs.microservice.model.entity.TypicalPlotEntity; +import com.xkrs.microservice.model.qo.TypicalPlotQo; +import com.xkrs.microservice.service.TypicalPlotService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import javax.validation.constraints.NotEmpty; +import java.util.Objects; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; +import static com.xkrs.microservice.util.OpenGeoUtil.wktStrToGeom; + +/** + * TypicalPlotService管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "TypicalPlotServiceCache") +public class TypicalPlotServiceImpl implements TypicalPlotService { + + Logger logger = LoggerFactory.getLogger(TypicalPlotServiceImpl.class); + + @Resource + private TypicalPlotDao typicalPlotDao; + + /** + * 获取所有记录列表 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllRecord(){ + return typicalPlotDao.findAll(Sort.by(Sort.Direction.DESC, "createTime")); + } + + /** + * 获取指定id记录 + * @param id + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return typicalPlotDao.findById(id); + } + + /** + * 获取指定编号的典型地块记录 + * @param dkbh 地块编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getByDkbh(String dkbh){ + return typicalPlotDao.findAllByDkbh(dkbh); + } + + /** + * 获取指定区县代码的所有典型地块记录 + * @param qxdm 区县代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByCountyCode(Integer qxdm){ + return typicalPlotDao.findAllByQxdm(qxdm); + } + + /** + * 获取指定乡镇街道代码的所有典型地块记录 + * @param xzdm 街道代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByTownCode(String xzdm){ + return typicalPlotDao.findAllByXzdm(xzdm); + } + + /** + * 获取指定联系人的所有典型地块记录 + * @param lxr 联系人 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByLxr(String lxr){ + return typicalPlotDao.findAllByLxr(lxr); + } + + /** + * 获取指定联系人的所有典型地块记录 + * @param tel 手机号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByTel(String tel){ + return typicalPlotDao.findAllByTel(tel); + } + + /** + * 新增典型地块记录 + * @param typicalPlotQo + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TypicalPlotServiceCache",allEntries = true) + @Override + public void add(TypicalPlotQo typicalPlotQo,String userName){ + TypicalPlotEntity typicalPlotEntity = new TypicalPlotEntity(); + CopyPropertiesUtil.copy( typicalPlotQo, typicalPlotEntity); + typicalPlotEntity.setAddUserName(userName); + if( !typicalPlotQo.getGeomStr().isEmpty()){ + // 转化geometry + typicalPlotEntity.setGeom(wktStrToGeom(typicalPlotQo.getGeomStr())); + } + // 设置系统时间 + typicalPlotEntity.setCreateTime(getNowTime()); + typicalPlotDao.save(typicalPlotEntity); + } + + /** + * 更新典型地块记录 + * @param typicalPlotQo + * @param userName + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TypicalPlotServiceCache",allEntries = true) + @Override + public void update(TypicalPlotQo typicalPlotQo,String userName){ + TypicalPlotEntity typicalPlotEntity = new TypicalPlotEntity(); + CopyPropertiesUtil.copy( typicalPlotQo, typicalPlotEntity); + typicalPlotEntity.setAddUserName(userName); + // 转化geometry + typicalPlotEntity.setGeom(wktStrToGeom(typicalPlotQo.getGeomStr())); + // 设置系统时间 + typicalPlotEntity.setCreateTime(getNowTime()); + typicalPlotDao.save(typicalPlotEntity); + } + + /** + * 删除典型地块记录 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "TypicalPlotServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + typicalPlotDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/WcsRecordServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/WcsRecordServiceImpl.java new file mode 100644 index 0000000..c2e7967 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/WcsRecordServiceImpl.java @@ -0,0 +1,162 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.dao.WcsRecordDao; +import com.xkrs.microservice.model.entity.WcsRecordEntity; +import com.xkrs.microservice.model.qo.WcsRecordQo; +import com.xkrs.microservice.service.WcsRecordService; +import com.xkrs.microservice.util.CopyPropertiesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.Optional; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; +import static com.xkrs.microservice.util.DateTimeUtil.timeMillisToDate; + +/** + * 栅格服务管理接口 + * @author tajochen + */ +@Service +@CacheConfig(cacheNames = "WcsRecordServiceCache") +public class WcsRecordServiceImpl implements WcsRecordService { + + Logger logger = LoggerFactory.getLogger(WcsRecordServiceImpl.class); + + @Resource + private WcsRecordDao wcsRecordDao; + + /** + * 获取所有栅格服务 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getAllService(){ + return wcsRecordDao.findAll(); + } + + /** + * 获取指定服务编号的栅格服务 + * @param serviceCode 服务代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public WcsRecordEntity getByServiceCode(String serviceCode){ + return wcsRecordDao.findByServiceCode(serviceCode); + } + + /** + * 获取指定id的产品 + * @param id 产品编号 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Optional getById(Integer id){ + return wcsRecordDao.findById(id); + } + + /** + * 获取指定类型的所有栅格服务 + * @param productType 产品类型 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByProductType(String productType){ + return wcsRecordDao.findByProductType(productType); + } + + /** + * 获取指定类型和行政区划的所有服务 + * @param admCode 行政区划 + * @param productType 产品类型 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCodeAndProductType(Integer admCode,String productType) { + return wcsRecordDao.findByProductTypeAndAdmCode(productType,admCode); + } + + /** + * 获取指定类型和时间段的所有栅格服务 + * @param productType 产品类型 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByProductTypeAndDate(String productType, LocalDate startDate, LocalDate endDate){ + return wcsRecordDao.findByProductTypeAndProductDateBetween(productType,startDate,endDate); + } + + /** + * 获取指定行政区划和时间段的所有服务 + * @param admCode 行政区划代码 + * @param startDate 开始日期 + * @param endDate 行政区划代码 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCodeAndDate(Integer admCode, LocalDate startDate,LocalDate endDate){ + return wcsRecordDao.findByAdmCodeAndProductDateBetween(admCode,startDate,endDate); + } + + /** + * 获取指定类型和行政区划和时间段的所有服务 + * @param admCode 行政区划 + * @param productType 产品类型 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public Iterable getByAdmCodeAndProductTypeAndDate(Integer admCode,String productType, LocalDate startDate,LocalDate endDate){ + return wcsRecordDao.findByProductTypeAndAdmCodeAndProductDateBetween (productType,admCode,startDate,endDate); + } + + /** + * 新增栅格服务记录 + * @param wcsRecordQo + * @param userName 用户名 + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "WcsRecordServiceCache",allEntries = true) + @Override + public void add(WcsRecordQo wcsRecordQo, String userName){ + WcsRecordEntity wcsRecordEntity = new WcsRecordEntity(); + CopyPropertiesUtil.copy(wcsRecordQo, wcsRecordEntity); + LocalDate productDate = timeMillisToDate(wcsRecordQo.getProductDateTs()); + wcsRecordEntity.setProductDate(productDate); + // 设置添加用户 + wcsRecordEntity.setAddUserName(userName); + // 设置系统时间 + wcsRecordEntity.setCreateTime(getNowTime()); + wcsRecordDao.save(wcsRecordEntity); + } + + /** + * 删除栅格服务 + * @param id + */ + @Transactional(rollbackFor=Exception.class) + @CacheEvict(value = "WcsRecordServiceCache",allEntries = true) + @Override + public void delete(Integer id){ + wcsRecordDao.deleteById(id); + } + +} diff --git a/src/main/java/com/xkrs/microservice/service/impl/WeatherServiceImpl.java b/src/main/java/com/xkrs/microservice/service/impl/WeatherServiceImpl.java new file mode 100644 index 0000000..c35ea2e --- /dev/null +++ b/src/main/java/com/xkrs/microservice/service/impl/WeatherServiceImpl.java @@ -0,0 +1,103 @@ +package com.xkrs.microservice.service.impl; + +import com.xkrs.microservice.common.tool.PageBean; +import com.xkrs.microservice.dao.WeatherDao; +import com.xkrs.microservice.model.entity.WeatherEntity; +import com.xkrs.microservice.service.WeatherService; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import java.util.ArrayList; +import java.util.List; + +/** + * @author HP + */ +@Service +@CacheConfig(cacheNames = "WeatherServiceCache") +public class WeatherServiceImpl implements WeatherService { + + @Resource + private WeatherDao weatherDao; + + /** + * 动态多条件查询气候信息 + * @param page + * @param addTimeStart + * @param addTimeEnd + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public PageBean queryWeather(Integer page, String addTimeStart, String addTimeEnd) { + + Specification specification = new Specification() { + private static final long serialVersionUID = 1L; + + @Override + public Predicate toPredicate(Root root, CriteriaQuery query, + CriteriaBuilder criteriaBuilder) { + List lst = new ArrayList(); + + if(addTimeStart != null && !"".equals(addTimeStart)){ + lst.add(criteriaBuilder.greaterThanOrEqualTo(root.get("addTime").as(String.class), addTimeStart)); + } + if(addTimeEnd != null && !"".equals(addTimeEnd)){ + lst.add(criteriaBuilder.lessThanOrEqualTo(root.get("addTime").as(String.class), addTimeEnd)); + } + + return query.where(lst.toArray(new Predicate[] {})).getRestriction(); + + } + }; + System.out.println(specification.toString()); + + long count = weatherDao.count(specification); + PageBean pageBean2 = new PageBean(); + pageBean2.setTotalCount(count); + pageBean2.setPageSize(10); + // addTime表示按数据库中哪个字段排序,DESC倒序 + Pageable pageable = PageRequest.of(page - 1,pageBean2.getPageSize(), Sort.by(Sort.Direction.DESC, "addTime")); + // 封装分页查询条件 + Page emailGradeTaskList = weatherDao.findAll(specification, pageable); + pageBean2.setList(emailGradeTaskList.getContent()); + return pageBean2; + } + + /** + * 根据时间查询气象信息 + * @param startTime + * @param endTime + * @return + */ + @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") + @Override + public List selectWeather(String startTime, String endTime) { + Specification specification = new Specification() { + @Override + public Predicate toPredicate(Root root, CriteriaQuery criteriaQuery, CriteriaBuilder criteriaBuilder) { + List list = new ArrayList<>(); + if(startTime != null && !"".equals(startTime)){ + list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("addTime").as(String.class), startTime)); + } + if(endTime != null && !"".equals(endTime)){ + list.add(criteriaBuilder.lessThanOrEqualTo(root.get("addTime").as(String.class), endTime)); + } + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + } + }; + return weatherDao.findAll(specification); + } +} diff --git a/src/main/java/com/xkrs/microservice/util/AliMsgUtil.java b/src/main/java/com/xkrs/microservice/util/AliMsgUtil.java new file mode 100644 index 0000000..6adfedb --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/AliMsgUtil.java @@ -0,0 +1,42 @@ +package com.xkrs.microservice.util; + +import com.aliyun.dysmsapi20170525.models.*; +import com.aliyun.teaopenapi.models.*; + +/** + * 阿里巴巴短信工具 + * @author tajochen + */ +public class AliMsgUtil { + + /** + * 使用AK&SK初始化账号Client + * @param accessKeyId 访问秘钥id + * @param accessKeySecret 访问密钥密码 + * @return Client + * @throws Exception + */ + public static com.aliyun.dysmsapi20170525.Client createClient(String accessKeyId, String accessKeySecret) throws Exception { + Config config = new Config() + // 您的AccessKey ID + .setAccessKeyId(accessKeyId) + // 您的AccessKey Secret + .setAccessKeySecret(accessKeySecret); + // 访问的域名 + config.endpoint = "dysmsapi.aliyuncs.com"; + return new com.aliyun.dysmsapi20170525.Client(config); + } + + public static void main(String[] argsA) throws Exception { + java.util.List args = java.util.Arrays.asList(argsA); + com.aliyun.dysmsapi20170525.Client client = AliMsgUtil.createClient("LTAI5tMSjLfu8Xu2w6WeguFF", "hvqM5zpi72hvX4VXM71wq6AE0XYtDI"); + SendSmsRequest sendSmsRequest = new SendSmsRequest() + .setSignName("青岛星科瑞升") + .setTemplateCode("SMS_221082764") + .setTemplateParam("{\"code\":\"123456\"}") + .setPhoneNumbers("123456789,123456798"); + // 复制代码运行请自行打印 API 的返回值 + SendSmsResponse response = client.sendSms(sendSmsRequest); + System.out.println(response); + } +} diff --git a/src/main/java/com/xkrs/microservice/util/CopyPropertiesUtil.java b/src/main/java/com/xkrs/microservice/util/CopyPropertiesUtil.java new file mode 100644 index 0000000..7b8c6aa --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/CopyPropertiesUtil.java @@ -0,0 +1,52 @@ +package com.xkrs.microservice.util; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +/** + * 复制源对象的属性值 + * @author tajochen + */ +public class CopyPropertiesUtil { + + /** + * 复制源对象和目标对象的属性值 + * @param source 源对象 + * @param target 目标对象 + */ + public static void copy(Object source, Object target) { + //得到对象的Class + Class sourceClass = source.getClass(); + Class targetClass = target.getClass(); + //得到Class对象的所有属性 + Field[] sourceFields = sourceClass.getDeclaredFields(); + Field[] targetFields = targetClass.getDeclaredFields(); + + for(Field sourceField : sourceFields){ + //属性名 + String name = sourceField.getName(); + //属性类型 + Class type = sourceField.getType(); + String methodName = name.substring(0, 1).toUpperCase() + name.substring(1); + try{ + //得到属性对应get方法 + Method getMethod = sourceClass.getMethod("get" + methodName); + //执行源对象的get方法得到属性值 + Object value = getMethod.invoke(source); + //目标对象的属性名 + for(Field targetField : targetFields){ + String targetName = targetField.getName(); + if(targetName.equals(name)){ + //属性对应的set方法 + Method setMethod = targetClass.getMethod("set" + methodName, type); + //执行目标对象的set方法 + setMethod.invoke(target, value); + } + } + } + catch (Exception e){ + e.printStackTrace(); + } + } + } +} diff --git a/src/main/java/com/xkrs/microservice/util/DateTimeUtil.java b/src/main/java/com/xkrs/microservice/util/DateTimeUtil.java new file mode 100644 index 0000000..65fecdb --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/DateTimeUtil.java @@ -0,0 +1,211 @@ +package com.xkrs.microservice.util; + +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 日期时间工具 + * @author tajochen + */ +public class DateTimeUtil { + + private final static String COMMON_PATTERN_DATETIME = "yyyy-MM-dd HH:mm:ss"; + private final static String COMMON_PATTERN_DATE = "yyyy-MM-dd"; + private final static String COMMON_PATTERN_DATE_NO_LINE = "yyyyMMdd"; + private final static DateTimeFormatter COMMON_FORMATTER_DATETIME = DateTimeFormatter.ofPattern(COMMON_PATTERN_DATETIME); + private final static DateTimeFormatter COMMON_FORMATTER_DATE = DateTimeFormatter.ofPattern(COMMON_PATTERN_DATE); + private final static DateTimeFormatter COMMON_FORMATTER_DATE_NO_LINE = DateTimeFormatter.ofPattern(COMMON_PATTERN_DATE_NO_LINE); + private final static ZoneOffset DEFAULT_ZONE_OFFSET = ZoneOffset.of("+8"); + + /** + * 字符串转LocalDate + * @param dateStr 日期字符串 + * @return + */ + public static LocalDate stringToDate(String dateStr) { + assert dateStr != null; + return LocalDate.parse(dateStr, COMMON_FORMATTER_DATE); + } + + /** + * LocalDate转字符串 + * @param date 日期 + * @return + */ + public static String dateToString(LocalDate date) { + assert date != null; + return COMMON_FORMATTER_DATE.format(date); + } + + /** + * LocalDate转字符串无横线 + * @param date 日期 + * @return + */ + public static String dateToStringNoLine(LocalDate date) { + assert date != null; + return COMMON_FORMATTER_DATE_NO_LINE.format(date); + } + + /** + * LocalDateTime转字符串 + * @param dateTime 日期时间 + * @return + */ + public static String dateTimeToString(LocalDateTime dateTime) { + assert dateTime != null; + return COMMON_FORMATTER_DATETIME.format(dateTime); + } + + /** + * 字符串转LocalDateTime + * @param dateTimeStr 日期时间字符串 + * @return + */ + public static LocalDateTime stringToDateTime(String dateTimeStr) { + assert dateTimeStr != null; + return LocalDateTime.parse(dateTimeStr, COMMON_FORMATTER_DATETIME); + } + + /** + * 字符串转Instant时间戳 + * @param str 字符串 + * @return + */ + public static Instant stringToInstant(String str) { + assert str != null; + return stringToDateTime(str).toInstant(DEFAULT_ZONE_OFFSET); + } + + /** + * LocalDateTime转字符串(格式化) + * @param dateTime 日期时间 + * @param formatter 格式化标准 + * @return + */ + public static String dateToStringFormatter(LocalDateTime dateTime, DateTimeFormatter formatter) { + assert dateTime != null; + return formatter.format(dateTime); + } + + /** + * 字符串转LocalDateTime(格式化) + * @param dateTimeStr 日期时间字符串 + * @param formatter 格式化标准 + * @return + */ + public static LocalDateTime stringToDateTimeFormatter(String dateTimeStr, DateTimeFormatter formatter) { + assert dateTimeStr != null; + return LocalDateTime.parse(dateTimeStr, formatter); + } + + /** + * 字符串转 local date + * @param dateStr 日期字符串 + * @return + */ + public static LocalDate stringToDateFormatter(String dateStr){ + return LocalDate.parse(dateStr, COMMON_FORMATTER_DATE); + } + + + /** + * 日期转时间戳 + * @param dateTime 日期时间 + * @return + */ + public static long dateToTimeMillis(LocalDateTime dateTime) { + assert dateTime != null; + return dateTime.toInstant(DEFAULT_ZONE_OFFSET).toEpochMilli(); + } + + /** + * 时间戳转日期 + * @param timeMillis 时间戳(长整型) + * @return + */ + public static LocalDate timeMillisToDate(long timeMillis) { + return Instant.ofEpochSecond(timeMillis).atZone(DEFAULT_ZONE_OFFSET).toLocalDate(); + } + + /** + * 时间戳转时间 + * @param timeMillis 时间戳(长整型) + * @return + */ + public static LocalDateTime timeMillisToTime(long timeMillis) { + return LocalDateTime.ofEpochSecond(timeMillis,0, DEFAULT_ZONE_OFFSET); + } + + /** + * 获取当前时间 hh:mm:ss:nnn + * @return + */ + public static LocalDateTime getNowTime() { + return LocalDateTime.now(); + } + + /** + * 获取当前日期 yyyy-MM-dd + * @return + */ + public static LocalDate getToday() { + return LocalDate.now(); + } + + /** + * 获取当前 Instant 时间戳 + * @return + */ + public static Instant getInstant() { + return Instant.now(); + } + + /** + * 判断日期格式是否合法 "yyyy-MM-dd" + * @param strDate 日期字符串 + * @return + */ + public static boolean isValidDate(String strDate) { + final int minLen = 10; + if(strDate == null || strDate.length() < minLen) { + return false; + } + //正则表达式校验日期格式 yyyy-MM-dd + String eL = "(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-" + + "(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|" + + "((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)" + + "(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|" + + "1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))" + + "|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)"; + Pattern pat = Pattern.compile(eL); + Matcher matcher = pat.matcher(strDate); + return matcher.matches(); + } + + /** + * 判断时间格式 格式必须为 "YYYY-MM-DD HH:mm:ss" + * @param sDateTime 日期时间字符串 + * @return + */ + public static boolean isValidDateTime(String sDateTime) { + final int minLen = 19; + if ((sDateTime == null) || (sDateTime.length() < minLen)) { + return false; + } + String eL = "(((01[0-9]{2}|0[2-9][0-9]{2}|[1-9][0-9]{3})-(0?[13578]|1[02])-" + + "(0?[1-9]|[12]\\\\d|3[01]))|((01[0-9]{2}|0[2-9][0-9]{2}|[1-9][0-9]{3})-" + + "(0?[13456789]|1[012])-(0?[1-9]|[12]\\\\d|30))|((01[0-9]{2}|0[2-9][0-9]{2}|[1-9][0-9]{3})-0?2-" + + "(0?[1-9]|1\\\\d|2[0-8]))|(((1[6-9]|[2-9]\\\\d)(0[48]|[2468][048]|[13579][26])|" + + "((04|08|12|16|[2468][048]|[3579][26])00))-0?2-29)) (20|21|22|23|[0-1]?\\\\d):[0-5]?\\\\d:[0-5]?\\\\d"; + Pattern pat = Pattern.compile(eL); + Matcher matcher = pat.matcher(sDateTime); + return matcher.matches(); + } + +} diff --git a/src/main/java/com/xkrs/microservice/util/EncryptDecryptUtil.java b/src/main/java/com/xkrs/microservice/util/EncryptDecryptUtil.java new file mode 100644 index 0000000..29c9935 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/EncryptDecryptUtil.java @@ -0,0 +1,67 @@ +package com.xkrs.microservice.util; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * SHA加密解密工具 + * @author tajochen + */ +public class EncryptDecryptUtil { + + /** + * SHA-256加密 + * @param strText 字符串 + * @return + */ + public static String encrypt256(final String strText){ + return encryptSha(strText,"SHA-256"); + } + + /** + * SHA-512加密 + * @param strText 字符串 + * @return + */ + public static String encrypt512(final String strText){ + return encryptSha(strText,"SHA-512"); + } + + /** + * 基础SHA加密 + * @param strText 字符串 + * @param strType 字符串类型 + * @return + */ + private static String encryptSha(final String strText, final String strType){ + // 返回值 + String strResult=null; + // 是否是有效的字符串 + if (strText != null && strText.length()>0){ + // 加密开始,创建加密对象,并传入加密类型 + try { + MessageDigest messageDigest = MessageDigest.getInstance(strType); + // 传入加密的字符串 + messageDigest.update(strText.getBytes()); + // 得到bytes类型结果 + byte[] byteBuffer = messageDigest.digest(); + StringBuilder strHexString = new StringBuilder(); + for (byte b : byteBuffer) { + String hex = Integer.toHexString(0xff & b); + if (hex.length() == 1) { + strHexString.append('0'); + } + strHexString.append(hex); + } + // 得到返回的结果 + strResult = strHexString.toString(); + } + catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + } + return strResult; + } + +} + diff --git a/src/main/java/com/xkrs/microservice/util/HashUtil.java b/src/main/java/com/xkrs/microservice/util/HashUtil.java new file mode 100644 index 0000000..cd99f75 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/HashUtil.java @@ -0,0 +1,40 @@ +package com.xkrs.microservice.util; + +import java.security.MessageDigest; + +/** + * md5加密解密工具 + * @author tajochen + */ +public class HashUtil { + + /** + * MD5加密 + * + * @param password + * @return + */ + public static String md5Encode(String password) { + MessageDigest md5 = null; + try { + md5 = MessageDigest.getInstance("MD5"); + } catch (Exception e) { + throw new RuntimeException(e); + } + char[] charArray = password.toCharArray(); + byte[] byteArray = new byte[charArray.length]; + for (int i = 0; i < charArray.length; i++){ + byteArray[i] = (byte) charArray[i]; + } + byte[] md5Bytes = md5.digest(byteArray); + StringBuilder hexValue = new StringBuilder(); + for (byte md5Byte : md5Bytes) { + int val = ((int) md5Byte) & 0xff; + if (val < 16) { + hexValue.append("0"); + } + hexValue.append(Integer.toHexString(val)); + } + return hexValue.toString(); + } +} diff --git a/src/main/java/com/xkrs/microservice/util/IpUtil.java b/src/main/java/com/xkrs/microservice/util/IpUtil.java new file mode 100644 index 0000000..66b456b --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/IpUtil.java @@ -0,0 +1,43 @@ +package com.xkrs.microservice.util; + +import javax.servlet.http.HttpServletRequest; + +/** + * IP地址处理工具 + * @author tajochen + */ +public class IpUtil { + + public static String getIpAddr(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + final String unkonwMsg = "unknown"; + final char splitChar = ','; + if (ip != null && ip.length() != 0 && !unkonwMsg.equalsIgnoreCase(ip)) { + // 多次反向代理后会有多个ip值,第一个ip才是真实ip + if( ip.indexOf(splitChar)!=-1 ){ + ip = ip.split(",")[0]; + } + } + if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_CLIENT_IP"); + } + if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) { + ip = request.getHeader("X-Real-IP"); + } + if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + System.out.println("获取客户端ip: " + ip); + return ip; + } + +} diff --git a/src/main/java/com/xkrs/microservice/util/IterUtil.java b/src/main/java/com/xkrs/microservice/util/IterUtil.java new file mode 100644 index 0000000..09d3fb6 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/IterUtil.java @@ -0,0 +1,53 @@ +package com.xkrs.microservice.util; + +import java.util.Iterator; + +/** + * 迭代器相关工具类 + * @author Looly + */ +public class IterUtil { + + /** + * Iterable是否为空 + * + * @param iterable Iterable对象 + * @return 是否为空 + */ + public static boolean isEmpty(Iterable iterable) { + return null == iterable || isEmpty(iterable.iterator()); + } + + /** + * Iterator是否为空 + * + * @param iterator Iterator对象 + * @return 是否为空 + */ + public static boolean isEmpty(Iterator iterator) { + return null == iterator || !iterator.hasNext(); + } + + /** + * Iterable是否为空 + * + * @param iterable Iterable对象 + * @return 是否为空 + */ + public static boolean isNotEmpty(Iterable iterable) { + return null != iterable && isNotEmpty(iterable.iterator()); + } + + /** + * Iterator是否为空 + * + * @param Iterator Iterator对象 + * @return 是否为空 + */ + public static boolean isNotEmpty(Iterator Iterator) { + return null != Iterator && Iterator.hasNext(); + } + + + +} diff --git a/src/main/java/com/xkrs/microservice/util/MagicAlgorithm.java b/src/main/java/com/xkrs/microservice/util/MagicAlgorithm.java new file mode 100644 index 0000000..2216221 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/MagicAlgorithm.java @@ -0,0 +1,22 @@ +package com.xkrs.microservice.util; + +import java.time.Duration; +import java.time.LocalDateTime; + +import static com.xkrs.microservice.util.DateTimeUtil.getNowTime; + +/** + * 魔法算法 + * @author tajochen + */ +public class MagicAlgorithm { + + public static void main(String[] args) { + LocalDateTime sTime = getNowTime(); + double s = Math.sqrt(213536456); + LocalDateTime eTime = getNowTime(); + Duration duration = Duration.between(sTime,eTime); + System.out.println(s + " 耗时(纳秒):" + duration.toNanos()); + } + +} diff --git a/src/main/java/com/xkrs/microservice/util/NumberUtil.java b/src/main/java/com/xkrs/microservice/util/NumberUtil.java new file mode 100644 index 0000000..e2134e5 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/NumberUtil.java @@ -0,0 +1,89 @@ +package com.xkrs.microservice.util; + +/** + * 数字工具 + * @author tajochen + */ +public class NumberUtil { + + private final static int MIN_CODE = 110000; + private final static int MAX_CODE = 999999; + + /** + * 检查字符串是否为数字 + * @param str 字符串 + * @return + */ + public static boolean isStrNumeric(String str) { + if(str==null||str.length()==0){ + return false; + } + for (int i = 0; i < str.length(); i++) { + System.out.println(str.charAt(i)); + if (!Character.isDigit(str.charAt(i))) { + return false; + } + } + return true; + } + + /** + * 检查字符串是否为行政区划代码,共六位 + * @param str 字符串 + * @return + */ + public static boolean isStrAdmCode(String str) { + if(isStrNumeric(str)){ + try { + int theNum = Integer.parseInt(str); + if(MIN_CODE < theNum && theNum < MAX_CODE){ + return true; + } + } catch (NumberFormatException e){ + return false; + } + } + return false; + } + + /** + * 欧拉筛法:保证每个合数只会被它的最小质因数筛掉,时间复杂度降低到O(n)。 + * 每一个数都去乘以当前素数表里面已有的数,当 indexI 是合数, + * 且 indexI % primeList[indexJ] == 0 时,只能乘以第一个素数 2 + * @param num 最大数字 + * @return + */ + public static int[] eulerScreening(int num) { + boolean[] check = new boolean[num+1]; + int[] primeList = new int[num+1]; + int count = 0; + for (int indexI = 2; indexI <= num; indexI++) { + if (!check[indexI]) { + primeList[count++] = indexI; + } + // 每一个数都去乘以当前素数表里面已有的数,如果 indexI 是合数,且 indexI % primeList[indexJ] == 0,那么它只能乘以第一个素数 2 + // 如:2×2、3×(2、3)、4×(2)、5×(2、3、5)、6×(2)、7×(2、3、5、7)、8×(2)、9×(2、3)、10×(2) + for (int indexJ = 0; indexJ < count; indexJ++) { + // 过大的时候跳出 + if (indexI * primeList[indexJ] > num) { + break; + } + check[indexI * primeList[indexJ]] = true; + // 如果 indexI 是一个合数,而且 indexI % primeList[indexJ] == 0 + // 保证了每个合数只会被它的最小素因子筛掉 + if (indexI % primeList[indexJ] == 0) { + break; + } + } + } + return primeList; + } + + public static void main(String[] args) { + long start = System.currentTimeMillis(); + int[] primeList = eulerScreening(149); + long end = System.currentTimeMillis(); + System.out.println("耗时共 "+ (end - start)+" 毫秒"); + } + +} diff --git a/src/main/java/com/xkrs/microservice/util/OpenGeoUtil.java b/src/main/java/com/xkrs/microservice/util/OpenGeoUtil.java new file mode 100644 index 0000000..d8fd203 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/OpenGeoUtil.java @@ -0,0 +1,31 @@ +package com.xkrs.microservice.util; + +import org.geolatte.geom.Geometry; +import org.geolatte.geom.Point; +import org.geolatte.geom.codec.Wkt; + +/** + * 开源Gis工具集 + * @author tajochen + */ +public class OpenGeoUtil { + + /** + * wkt文本转为点数据 + * @param wkt wkt文本 + * @return + */ + public static Point wktStrToPoint(String wkt) { + return (Point) Wkt.fromWkt(wkt); + } + + /** + * wkt文本转geometry + * @param wkt wkt文本 + * @return + */ + public static Geometry wktStrToGeom(String wkt) { + return Wkt.fromWkt(wkt); + } + +} diff --git a/src/main/java/com/xkrs/microservice/util/RandomUtil.java b/src/main/java/com/xkrs/microservice/util/RandomUtil.java new file mode 100644 index 0000000..1aa2b3d --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/RandomUtil.java @@ -0,0 +1,61 @@ +package com.xkrs.microservice.util; + +import java.util.Random; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 随机字符串产生工具 + * @author tajochen + */ +public class RandomUtil { + /** + * 获取随机字母数字组合 + * @param length + * 字符串长度 + * @return + */ + public static String getRandomCharAndNum(Integer length) { + String str = ""; + StringBuilder strBuffer = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < length; i++) { + boolean b = random.nextBoolean(); + // 字符串 + if (b) { + //取得65大写字母还是97小写字母 + int choice = random.nextBoolean() ? 65 : 97; + strBuffer.append((char) (choice + random.nextInt(26))); + } else { + // 数字 + strBuffer.append(random.nextInt(10)); + } + } + str = strBuffer.toString(); + return str; + } + + /** + * 验证随机字母数字组合是否纯数字与纯字母 + * @param str + * @return true 是 , false 否 + */ + public static boolean isRandomUsable(String str) { + // String regExp = + // "^[A-Za-z]+(([0-9]+[A-Za-z0-9]+)|([A-Za-z0-9]+[0-9]+))|[0-9]+(([A-Za-z]+[A-Za-z0-9]+)|([A-Za-z0-9]+[A-Za-z]+))$"; + String regExp = "^([0-9]+)|([A-Za-z]+)$"; + Pattern pat = Pattern.compile(regExp); + Matcher mat = pat.matcher(str); + return mat.matches(); + } + + /** + * 生成UUID + * @return + */ + public static String getUuid32(){ + return UUID.randomUUID().toString().replace("-", "").toLowerCase(); + } + +} diff --git a/src/main/java/com/xkrs/microservice/util/RequestUtil.java b/src/main/java/com/xkrs/microservice/util/RequestUtil.java new file mode 100644 index 0000000..bcb36ca --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/RequestUtil.java @@ -0,0 +1,269 @@ +package com.xkrs.microservice.util; + +import org.apache.http.Consts; +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.client.utils.URIBuilder; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.HttpMultipartMode; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.entity.mime.content.StringBody; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.*; + +/** + * http请求工具 + * @author tajochen + **/ +public class RequestUtil { + + private static final String FIREFOX_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0"; + private static final String CHROME_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " + + "(KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36"; + + /** + * 模拟 get请求 + * @param url 链接 + * @param map 参数列表 + */ + public static String getStandard(String url, Map map) { + String body = ""; + // 1.拿到一个httpclient的对象 + CloseableHttpClient httpClient = HttpClients.createDefault(); + // 2.1 提交请求体 + ArrayList parameters = new ArrayList<>(); + URIBuilder builder = null; + // 装填参数 + if(map!=null){ + for (Map.Entry entry : map.entrySet()) { + parameters.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); + } + } + CloseableHttpResponse response = null; + try { + builder = new URIBuilder(url); + builder.setParameters(parameters); + // 2.设置请求方式和请求信息 + HttpGet httpGet = new HttpGet(builder.build()); + // 2.1 提交header头信息 + httpGet.addHeader("user-agent", FIREFOX_UA); + // 3.执行请求 + response = httpClient.execute(httpGet); + // 4.获取返回值 + assert response != null; + // 按指定编码转换结果实体为String类型 + body = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); + // 5.关闭连接 + response.close(); + httpClient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + return body; + } + + /** + * 模拟get请求(加请求头) + * @param url + * @param param + * @param token + * @return + */ + public static String doGet(String url, Map param,String token) { + + final int okResNum = 200; + + String result = null; + CloseableHttpClient httpclient = HttpClients.createDefault(); + CloseableHttpResponse response = null; + try { + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + HttpGet httpGet = new HttpGet(uri); + httpGet.addHeader("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"); + httpGet.addHeader("Authorization",token); + response = httpclient.execute(httpGet); + if (response.getStatusLine().getStatusCode() == okResNum) { + result = EntityUtils.toString(response.getEntity(), "UTF-8"); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + httpclient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + } + + /** + * 模拟Post请求 application/x-www-form-urlencoded + * @param url 资源地址 + * @param map 参数列表 + * @return + */ + public static String postStandard(String url, Map map) { + String body = ""; + // 创建httpclient对象 + CloseableHttpClient client = HttpClients.createDefault(); + // 创建post方式请求对象 + HttpPost httpPost = new HttpPost(url); + // 装填参数 + List nvps = new ArrayList<>(); + if(map!=null){ + for (Map.Entry entry : map.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); + } + } + try { + // 设置参数到请求对象中 + httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8")); + // 设置header报文头信息 + httpPost.setHeader("Content-type", "application/x-www-form-urlencoded"); + httpPost.setHeader("User-Agent", FIREFOX_UA); + httpPost.setHeader("Accept", "application"); + httpPost.setHeader("Accept-Encoding", "gzip, deflate"); + // 执行请求操作,并拿到结果(同步阻塞) + CloseableHttpResponse response = client.execute(httpPost); + // 获取结果实体 + HttpEntity entity = response.getEntity(); + if (entity != null) { + // 按指定编码转换结果实体为String类型 + body = EntityUtils.toString(entity, "UTF-8"); + } + EntityUtils.consume(entity); + // 释放链接 + response.close(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + client.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return body; + } + + /** + * 传送json类型的post请求 + * @param url + * @param json + * @return String + */ + public static String doPostJson(String url, String json) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = HttpClients.createDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + try { + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(url); + // 创建请求内容 + StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON); + httpPost.setEntity(entity); + // 执行http请求 + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return resultString; + } + + /** + * 模拟Post请求 multipart/form-data + * @param postFile 请求文件 + * @param postUrl 请求链接 + * @param postParam 请求参数 + * @return + */ + public static Map postFile(File postFile, String postUrl, Map postParam) { + + Logger log = LoggerFactory.getLogger(RequestUtil.class); + Map resultMap = new HashMap<>(16); + CloseableHttpClient httpClient = HttpClients.createDefault(); + try{ + // 把一个普通参数和文件上传给下面这个地址 + HttpPost httpPost = new HttpPost(postUrl); + + // 设置传输参数 + MultipartEntityBuilder multipartEntity = MultipartEntityBuilder.create(); + // 解决乱码问题 + multipartEntity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + multipartEntity.setCharset(StandardCharsets.UTF_8); + + // 设置文件参数 ,获取文件名postFile.getName() + // 把文件转换成流对象FileBody + multipartEntity.addBinaryBody("file",postFile,ContentType.create("multipart/form-data", + Consts.UTF_8),postFile.getName()); + // 设计文件以外的参数 + Set keySet = postParam.keySet(); + for (String key : keySet) { + // 相当于 + multipartEntity.addPart(key, new StringBody(postParam.get(key), ContentType.create( + "multipart/form-data", Consts.UTF_8))); + } + HttpEntity reqEntity = multipartEntity.build(); + httpPost.setEntity(reqEntity); + // 设置header报文头信息 + httpPost.setHeader("User-Agent", FIREFOX_UA); + httpPost.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + httpPost.setHeader("Accept-Encoding","gzip, deflate"); + + // 发起请求,返回请求的响应 + try (CloseableHttpResponse response = httpClient.execute(httpPost)) { + resultMap.put("statusCode", response.getStatusLine().getStatusCode()); + // 获取响应对象 + HttpEntity resEntity = response.getEntity(); + if (resEntity != null) { + // 打印响应内容 + resultMap.put("data", EntityUtils.toString(resEntity, StandardCharsets.UTF_8)); + resultMap.put("message", EntityUtils.toString(resEntity, StandardCharsets.UTF_8)); + resultMap.put("status", EntityUtils.toString(resEntity, StandardCharsets.UTF_8)); + } + // 销毁 + EntityUtils.consume(resEntity); + } catch (Exception e) { + e.printStackTrace(); + } + httpClient.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + log.info("上传结果:" + resultMap); + return resultMap; + } +} diff --git a/src/main/java/com/xkrs/microservice/util/SnowFlakeUtil.java b/src/main/java/com/xkrs/microservice/util/SnowFlakeUtil.java new file mode 100644 index 0000000..db09638 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/SnowFlakeUtil.java @@ -0,0 +1,124 @@ +package com.xkrs.microservice.util; + +/** + * 基于Twitter开源的分布式ID生成算法 snowflake + * @author tajochen + **/ +public class SnowFlakeUtil { + + /** + * 起始时间戳 + * 2018-01-01 00:00:00 + */ + private final static long START_STMP = 1514736000L; + /** + * 序列在id中占用的位数 + */ + private final static long SEQUENCE_BIT = 12L; + /** + * 机器标识占用的位数 + */ + private final static long MACHINE_BIT = 5L; + /** + * 数据中心占用的位数 + */ + private final static long DATACENTER_BIT = 5L; + /** + * 每一部分的最大值 + */ + private final static long MAX_DATACENTER_NUM = ~(-1L << DATACENTER_BIT); + private final static long MAX_MACHINE_NUM = ~(-1L << MACHINE_BIT); + private final static long MAX_SEQUENCE = ~(-1L << SEQUENCE_BIT); + + /** + * 每一部分向左的位移 + */ + private final static long MACHINE_LEFT = SEQUENCE_BIT; + private final static long DATACENTER_LEFT = SEQUENCE_BIT + MACHINE_BIT; + private final static long TIMESTMP_LEFT = DATACENTER_LEFT + DATACENTER_BIT; + + /** + * 数据中心 + */ + private final long datacenterId; + /** + * 机器标识 + */ + private final long machineId; + /** + * 序列号 + */ + private long sequence = 0L; + /** + * 上一次时间戳 + */ + private long lastStmp = -1L; + + public SnowFlakeUtil(long datacenterId, long machineId) { + if (datacenterId > MAX_DATACENTER_NUM || datacenterId < 0) { + throw new IllegalArgumentException("data center id can't be greater than MAX_DATACENTER_NUM or less than 0"); + } + if (machineId > MAX_MACHINE_NUM || machineId < 0) { + throw new IllegalArgumentException("machine id can't be greater than MAX_MACHINE_NUM or less than 0"); + } + this.datacenterId = datacenterId; + this.machineId = machineId; + } + + /** + * 产生下一个ID + * @return + */ + public synchronized long nextId() { + long currStmp = getNewstmp(); + if (currStmp < lastStmp) { + throw new RuntimeException("Clock moved backwards. Refusing to generate id"); + } + + if (currStmp == lastStmp) { + //相同毫秒内,序列号自增 + sequence = (sequence + 1) & MAX_SEQUENCE; + //同一毫秒的序列数已经达到最大 + if (sequence == 0L) { + currStmp = getNextMill(); + } + } else { + //不同毫秒内,序列号置为0 + sequence = 0L; + } + + lastStmp = currStmp; + //时间戳部分 + return (currStmp - START_STMP) << TIMESTMP_LEFT + //数据中心部分 + | datacenterId << DATACENTER_LEFT + //机器标识部分 + | machineId << MACHINE_LEFT + //序列号部分 + | sequence; + } + + private long getNextMill() { + long mill = getNewstmp(); + while (mill <= lastStmp) { + mill = getNewstmp(); + } + return mill; + } + + private long getNewstmp() { + return System.currentTimeMillis(); + } + + public static void main(String[] args) { + SnowFlakeUtil snowFlake = new SnowFlakeUtil(5, 5); + //测试次数 + int testTimes = 10000; + long start = System.currentTimeMillis(); + for (int i = 0; i < testTimes; i++) { + System.out.println(snowFlake.nextId()); + } + + System.out.println(System.currentTimeMillis() - start); + } +} diff --git a/src/main/java/com/xkrs/microservice/util/TiffUtil.java b/src/main/java/com/xkrs/microservice/util/TiffUtil.java new file mode 100644 index 0000000..2e23364 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/TiffUtil.java @@ -0,0 +1,120 @@ +package com.xkrs.microservice.util; + +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.Iterator; + +import javax.imageio.ImageIO; +import javax.imageio.ImageReadParam; +import javax.imageio.ImageReader; +import javax.imageio.metadata.IIOMetadata; +import javax.imageio.stream.ImageInputStream; + +/** + * Tiff操作工具 + * @author tajochen + **/ +public class TiffUtil { + + + /** + * Java Image I/O API 支持的读入,写出普通的格式,如果需要开发其它格式,还需要第三方插件,eg JIMI, JMagic + */ + public static void formatImageNames() { + + String[] imageFormats = ImageIO.getReaderFormatNames(); + // [jpg, BMP, bmp, JPG, wbmp, jpeg, png, PNG, JPEG, WBMP, GIF, gif] + System.out.println(Arrays.asList(imageFormats)); + + String[] imageFormats1 = ImageIO.getWriterFormatNames(); + // [BMP, bmp, jpg, JPG, wbmp, jpeg, png, PNG, JPEG, WBMP, GIF, gif] + System.out.println(Arrays.asList(imageFormats1)); + + } + + /** + * Image I/O高级操作 ImageReader ImageWriter 通过ImageReader + * 可以获取图片信息而不用把整张图片数据都读入内存。 + * @throws IOException + */ + public static void imageReaderOp() throws IOException { + Iterator readers = ImageIO + .getImageReadersByFormatName("JPG"); + ImageReader reader = readers.next(); + // 构造输入源 + File bigFile = new File("E:\\big.jpg"); + ImageInputStream iis = ImageIO.createImageInputStream(bigFile); + // 输入源和ImageReader关联 + reader.setInput(iis, true); + // 获取第一张图片的高度,试图解码文件的必要部分,去获取图片的宽度,而不用读取任何一个象素 + int imageIndex = 0; + int width = reader.getWidth(imageIndex); + } + + /** + * 控制图片操作,ImageReadParam 可以让程序更好的控制内存,比如指定一个感兴趣的区域 + * @throws IOException + */ + public static void imageReadParamOp() throws IOException { + int imageIndex = 0; + Iterator readers = ImageIO + .getImageReadersByFormatName("JPG"); + ImageReader reader = readers.next(); + File bigFile = new File("E:\\big.jpg"); + ImageInputStream iis = ImageIO.createImageInputStream(bigFile); + reader.setInput(iis, true); + ImageReadParam irp = reader.getDefaultReadParam(); + int halfWidth = reader.getWidth(imageIndex) / 2; + int halfHeight = reader.getHeight(imageIndex) / 2; + Rectangle rect = new Rectangle(0, 0, halfWidth, halfHeight); + irp.setSourceRegion(rect); + BufferedImage bi = reader.read(imageIndex, irp); + ImageIO.write(bi, "JPG", new File("E:\\big_half.JPG")); + } + + /** + * 图片元信息 + * @throws IOException + */ + public static void getImageMetadata() throws IOException { + int imageIndex = 0; + Iterator readers = ImageIO + .getImageReadersByFormatName("JPG"); + ImageReader reader = readers.next(); + File bigFile = new File("E:\\big.jpg"); + ImageInputStream iis = ImageIO.createImageInputStream(bigFile); + reader.setInput(iis, true); + IIOMetadata metadata = reader.getImageMetadata(imageIndex); + } + + /** + * 生成缩略图 + * @throws IOException + */ + public static void generateSmall() throws IOException { + File bigFile = new File("E:\\big.jpg"); + Image image = ImageIO.read(bigFile); + int width = image.getWidth(null); + int height = image.getHeight(null); + BufferedImage buffi = new BufferedImage(width / 2, height / 2, + BufferedImage.TYPE_INT_RGB); + Graphics g = buffi.getGraphics(); + g.drawImage(image, 0, 0, width / 2, height / 2, null); + g.dispose(); + ImageIO.write(buffi, "JPG", new File("E:\\small.JPG")); + } + + public static void main(String[] args) throws IOException { + TiffUtil.generateSmall(); + TiffUtil.formatImageNames(); + TiffUtil.imageReaderOp(); + TiffUtil.imageReadParamOp(); + TiffUtil.getImageMetadata(); + } + +} diff --git a/src/main/java/com/xkrs/microservice/util/VersionNumberUtil.java b/src/main/java/com/xkrs/microservice/util/VersionNumberUtil.java new file mode 100644 index 0000000..cc53535 --- /dev/null +++ b/src/main/java/com/xkrs/microservice/util/VersionNumberUtil.java @@ -0,0 +1,34 @@ +package com.xkrs.microservice.util; + +/** + * VersionNumberUtil 版本号工具 + * @author tajochen + */ +public class VersionNumberUtil { + + /** + * 比较三位版本号 ,若 版本1>版本2 返回 1,若版本1<版本2 返回 -1,否则返回0 + * @param version1 版本1 + * @param version2 版本2 + * @return + */ + public static int compareVersion(String version1, String version2) { + String[] v1 = version1.split("\\."); + String[] v2 = version2.split("\\."); + int n = Math.max(v1.length, v2.length); + for (int i = 0; i < n; i++) { + int v1Int = i < v1.length ? Integer.parseInt(v1[i]) : 0; + int v2Int = i < v2.length ? Integer.parseInt(v2[i]) : 0; + if (v1Int == v2Int) { + continue; + } + if (v1Int > v2Int){ + return 1; + } else { + return -1; + } + } + return 0; + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..586795c --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,83 @@ +## Web服务配置 +server.servlet.context-path = /microservice +server.port = 7501 + +## 数据源配置 +spring.datasource.url = jdbc:postgresql://118.24.27.47:5432/SDHydrologyDB_new +#spring.datasource.url = jdbc:postgresql://192.168.2.9:5432/SDHydrologyDB +spring.datasource.userName = postgres +spring.datasource.password = xkrs314 +#spring.datasource.password = xkrs301 +spring.datasource.driverClassName = org.postgresql.Driver + +server.tomcat.uri-encoding=UTF-8 + +## 关闭spring data 的redis仓库 +spring.data.redis.repositories.enabled = false + +## jackson 配置 +spring.jackson.serialization.write-date-keys-as-timestamps = false + +## Hikari连接池设置 +spring.datasource.hikari.auto-commit = true +spring.datasource.hikari.minimum-idle = 5 +spring.datasource.hikari.maximum-pool-size = 12 +spring.datasource.hikari.idle-timeout = 600000 +spring.datasource.hikari.max-lifetime = 1800000 +spring.datasource.hikari.validation-timeout = 5000 +spring.datasource.hikari.connection-test-query=SELECT 1 + +## Spring Data JPA 配置 +spring.jpa.database = POSTGRESQL +spring.jpa.database-platform = org.hibernate.dialect.PostgreSQLDialect +spring.jpa.show-sql = true +# 指定 ddl mode (none, validate, create, create-drop, update) +spring.jpa.hibernate.ddl-auto = update +# 命名策略 隐式规则 implicit-strategy 物理规则 physical-strategy +spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyComponentPathImpl +spring.jpa.properties.hibernate.dialect = org.hibernate.spatial.dialect.postgis.PostgisDialect +spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false + +## Redis配置 +spring.cache.type = redis +spring.redis.database = 6 +spring.redis.host = localhost +spring.redis.port = 6379 +spring.redis.password = sdust2020 +spring.redis.timeout = 10000 +spring.redis.lettuce.pool.max-active = 100 +spring.redis.lettuce.pool.max-wait = 10000 +spring.redis.lettuce.pool.max-idle = 100 +spring.redis.lettuce.pool.min-idle = 1 +spring.redis.lettuce.shutdown-timeout = 0 + +## Devtools配置 +spring.devtools.livereload.enabled = true + +## 多国语言配置 +spring.messages.basename = i18n/messages +spring.messages.encoding = UTF-8 + +# 上传文件配置 +spring.servlet.multipart.enabled=true +# 最大文件大小 +spring.servlet.multipart.max-file-size = 64MB +# 最大请求大小 +spring.servlet.multipart.max-request-size = 70MB + +# 日志设置 +logging.charset.console=UTF-8 +logging.charset.file=UTF-8 + +# 自定义用户最大登录错误尝试次数 +my.MaxLoginErrorCount = 5 + +# 自定义用户登录错误间隔时间(分钟) +my.LoginErrorIntervalTime = 60 + +# 自定义Geoserver服务器地址 +my.GeoserverAdress = http://118.24.27.47:9080/geoserver/ + +# 自定义文件服务器地址 +my.FileServerAdress = http://118.24.27.47:4096/ +my.FileServerAdminAdress = http://127.0.0.1:4096/ diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt new file mode 100644 index 0000000..10b5be9 --- /dev/null +++ b/src/main/resources/banner.txt @@ -0,0 +1,6 @@ + ____ ____ _ ______ _ +|_ \ / _| (_) .' ____ \ (_) + | \/ | __ .---. _ .--. .--. | (___ \_| .---. _ .--. _ __ __ .---. .---. + | |\ /| | [ | / /'`\][ `/'`\]/ .'`\ \ _.____`. / /__\\[ `/'`\][ \ [ ][ | / /'`\]/ /__\\ + _| |_\/_| |_ | | | \__. | | | \__. || \____) || \__., | | \ \/ / | | | \__. | \__., +|_____||_____|[___]'.___.'[___] '.__.' \______.' '.__.'[___] \__/ [___]'.___.' '.__.' diff --git a/src/main/resources/i18n/messages.properties b/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000..47dca8c --- /dev/null +++ b/src/main/resources/i18n/messages.properties @@ -0,0 +1,233 @@ +sys.message.success = 成功 +sys.message.user.not_logged_in = 用户未登录 +sys.message.user.login_error = 用户登陆失败 +sys.message.user.account_forbidden = 用户已被禁止 +sys.message.user.account_not_activated = 用户未激活 +sys.message.user.overtime = 用户登录超时 +sys.message.user.no_permission = 用户权限不足 +sys.message.user.already_logged = 用户已经登录 +sys.message.user.already_exist = 用户名已存在 +sys.message.param.null = 参数为空 +sys.message.param.illegal = 参数非法 +sys.message.data.none = 数据为空 +sys.message.data.wrong = 数据错误 +sys.message.data.repeat = 数据已存在 +sys.message.process.fail = 处理失败 +sys.message.process.overtime = 处理超时 +sys.message.system.inner_error = 系统内部错误 +sys.message.system.abnormal = 系统异常 +sys.message.system.busy = 系统正忙,请稍后 +sys.message.system.maintain = 系统维护中 +sys.message.database.error = 数据库错误 +sys.message.file.exists = 文件已存在 +sys.message.file.write.error = 文件写入失败 +sys.message.file.read.error = 文件读取失败 + +SysUser.id.blank = 用户id不能为空 +SysUser.userName.blank = 用户名不能为空 +SysUser.userName.length.illegal = 用户名长度不合法 +SysUser.userName.format.illegal = 用户名格式不合法 +SysUser.nickName.length.illegal = 用户昵称长度不合法 +SysUser.userCode.length.illegal = 用户编码长度不合法 +SysUser.userCode.format.illegal = 用户编码含有非法字符 +SysUser.password.blank = 用户密码不能为空 +SysUser.password.length.illegal = 用户密码长度不合法 +SysUser.password.format.illegal = 用户密码格式不合法 +SysUser.sex.num.null = 用户性别数字不能为空 +SysUser.sex.num.illegal = 用户性别数字不合法 +SysUser.telephone.format.illegal = 用户手机号码不合法 +SysUser.email.length.illegal = 用户邮箱长度不合法 +SysUser.email.format.illegal = 用户邮箱格式不合法 +SysUser.admCode.illegal = 用户行政区划代码不合法 +SysUser.address.length.illegal = 用户详细地址长度不合法 +SysUser.birthday.format.illegal = 用户出生日期必须是 yyyy-MM-dd +SysUser.personalSignature.length.illegal = 用户个性签名长度非法 +SysUser.portraitId.illegal = 用户头像id非法 +SysUser.statusCode.null = 用户当前状态编码为空 +SysUser.statusCode.illegal = 用户当前状态编码非法 +SysUser.deleteFlag.null = 用户删除标记不能是空 +SysUser.realName.length.illegal = 用户真实姓名长度过长 +SysUser.memo.length.illegal = 用户备注信息长度过长 + +FileDocument.id.null = id 不能为空 +FileDocument.name.null = name 不能为空 +FileDocument.name.length.illegal = name 长度过长 +FileDocument.category.length.illegal = category 长度过长 +FileDocument.filePath.null = filePath 不能为空 +FileDocument.filePath.length.illegal = filePath 长度过长 +FileDocument.size.length.illegal = size 长度过长 +FileDocument.md5.null = md5 不能为空 +FileDocument.md5.length.illegal = md5 长度过长 +FileDocument.memo.length.illegal = memo 长度过长 +FileDocument.checkingToken.length.illegal = checkingToken 长度过长 + +AppFile.id.null = id 不能为空 +AppFile.name.null = name 不能为空 +AppFile.name.length.illegal = name 长度过长 +AppFile.appPath.null = appPath 不能为空 +AppFile.appPath.length.illegal = appPath 长度过长 +AppFile.versionNumber.null = versionNumber 不能为空 +AppFile.versionNumber.length.illegal = versionNumber 长度过长 +AppFile.versionNumber.format.illegal = versionNumber 格式不合法 +AppFile.size.null = size 不能为空 +AppFile.size.length.illegal = size 长度过长 +AppFile.md5.null = md5 不能为空 +AppFile.md5.length.illegal = md5 长度过长 +AppFile.memo.length.illegal = memo 长度过长 + +TifProduct.id.null = id 不能为空 +TifProduct.productCode.null = productCode 不能为空 +TifProduct.productCode.length.illegal = productCode 长度过长 +TifProduct.productType.null = productType 不能为空 +TifProduct.productType.length.illegal = productType 长度过长 +TifProduct.admCode.null = admCode 不能为空 +TifProduct.admName.null = admName 不能为空 +TifProduct.admName.length.illegal = admName 长度过长 +TifProduct.fileName.null = fileName 不能为空 +TifProduct.fileName.length.illegal = fileName 长度过长 +TifProduct.filePath.null = filePath 不能为空 +TifProduct.filePath.length.illegal = filePath 长度过长 +TifProduct.fileMd5.length.illegal = fileMd5 长度过长 +TifProduct.fileSize.length.illegal = fileSize 长度过长 +TifProduct.memo.length.illegal = memo 长度过长 + +WcsRecord.id.null = id 不能为空 +WcsRecord.productCode.null = productCode 不能为空 +WcsRecord.productCode.length.illegal = productCode 长度过长 +WcsRecord.productType.null = productType 不能为空 +WcsRecord.productType.length.illegal = productType 长度过长 +WcsRecord.admCode.null = admCode 不能为空 +WcsRecord.admName.null = admName 不能为空 +WcsRecord.admName.length.illegal = admName 长度过长 +WcsRecord.fileName.null = fileName 不能为空 +WcsRecord.fileName.length.illegal = fileName 长度过长 +WcsRecord.filePath.null = filePath 不能为空 +WcsRecord.filePath.length.illegal = filePath 长度过长 +WcsRecord.fileMd5.length.illegal = fileMd5 长度过长 +WcsRecord.fileSize.length.illegal = fileSize 长度过长 +WcsRecord.memo.length.illegal = memo 长度过长 + +IrrigationRecord.id.null = id 不能为空 +IrrigationRecord.countyCode.null = countyCode 不能为空 +IrrigationRecord.countyName.null = countyName 不能为空 +IrrigationRecord.countyName.length.illegal = countyName 长度过长 +IrrigationRecord.irrigationDateTs.null = irrigationDateTs 不能为空 +IrrigationRecord.dataSource.length.illegal = dataSource 长度过长 +IrrigationRecord.memo.length.illegal = memo 长度过长 +IrrigationRecord.townCode.null = townCode 不能为空 +IrrigationRecord.townCode.length.illegal = townCode 长度过长 +IrrigationRecord.townName.null = townName 不能为空 +IrrigationRecord.townName.length.illegal = townName 长度过长 + +CropClassifyRecord.id.null = id 不能为空 +CropClassifyRecord.countyCode.null = countyCode 不能为空 +CropClassifyRecord.countyName.null = countyName 不能为空 +CropClassifyRecord.countyName.length.illegal = countyName 长度过长 +CropClassifyRecord.cropCode.null = cropCode 不能为空 +CropClassifyRecord.irrigationDateTs.null = irrigationDateTs 不能为空 +CropClassifyRecord.dataSource.length.illegal = dataSource 长度过长 +CropClassifyRecord.memo.length.illegal = memo 长度过长 +CropClassifyRecord.townCode.null = townCode 不能为空 +CropClassifyRecord.townCode.length.illegal = townCode 长度过长 +CropClassifyRecord.townName.null = townCode 不能为空 +CropClassifyRecord.townName.length.illegal = townCode 长度过长 + +TypicalPlot.id.null = id 不能为空 +TypicalPlot.dkbh.null = dkbh 不能为空 +TypicalPlot.dkbh.length.illegal = dkbh 长度过长 +TypicalPlot.dsmc.length.illegal = dsmc 长度过长 +TypicalPlot.qxmc.length.illegal = qxmc 长度过长 +TypicalPlot.xzdm.length.illegal = xzdm 长度过长 +TypicalPlot.xzmc.length.illegal = xzmc 长度过长 +TypicalPlot.dlmc.length.illegal = dlmc 长度过长 +TypicalPlot.cbzwmc.length.illegal = cbzwmc 长度过长 +TypicalPlot.xbzwmc.length.illegal = xbzwmc 长度过长 +TypicalPlot.qdzwmc.length.illegal = qdzwmc 长度过长 +TypicalPlot.snyd.length.illegal = snyd 长度过长 +TypicalPlot.trlx.length.illegal = trlx 长度过长 +TypicalPlot.sysjq.length.illegal = sysjq 长度过长 +TypicalPlot.dbgq.length.illegal = dbgq 长度过长 +TypicalPlot.lxr.length.illegal = lxr 长度过长 +TypicalPlot.tel.length.illegal = tel 长度过长 +TypicalPlot.dkzp.length.illegal = dkzp 长度过长 +TypicalPlot.remark.length.illegal = remark 长度过长 + +FarmingInfo.id.null = id 不能为空 +FarmingInfo.qxbh.null = qxbh 不能为空 +FarmingInfo.dkbh.null = dkbh 不能为空 +FarmingInfo.dkbh.length.illegal = dkbh 长度过长 +FarmingInfo.nqzp.length.illegal = nqzp 长度过长 +FarmingInfo.nqzt.length.illegal = nqzt 长度过长 +FarmingInfo.remark.length.illegal = remark 长度过长 +FarmingInfo.zwmc.null = zwmc 不能为空 +FarmingInfo.zwmc.length.illegal = zwmc 长度过长 + +IndependentCheck.id.null = id 不能为空 +IndependentCheck.cydbh.null = cydbh 不能为空 +IndependentCheck.cydbh.length.illegal = cydbh 长度过长 +IndependentCheck.zwmc.length.illegal = zwmc 长度过长 +IndependentCheck.hczp.length.illegal = hczp 长度过长 +IndependentCheck.remark.length.illegal = remark 长度过长 +IndependentCheck.qxdm.null = qxdm 不能为空 +IndependentCheck.qxmc.null = qxmc 不能为空 +IndependentCheck.qxmc.length.illegal = qxmc 长度过长 + +IrrigationCheck.id.null = id 不能为空 +IrrigationCheck.ggbh.null = ggbh 不能为空 +IrrigationCheck.ggbh.length.illegal = ggbh 长度过长 +IrrigationCheck.qxbh.null = qxbh 不能为空 +IrrigationCheck.dkbh.null = dkbh 不能为空 +IrrigationCheck.dkbh.length.illegal = dkbh 长度过长 +IrrigationCheck.hszp.length.illegal = hszp 长度过长 +IrrigationCheck.hszt.null = hszt 不能为空 +IrrigationCheck.remark.length.illegal = remark 长度过长 +IrrigationCheck.hsbh.null = hsbh 不能为空 +IrrigationCheck.hsbh.length.illegal = hsbh 长度过长 + +TypicalFarmer.id.null = id 不能为空 +TypicalFarmer.lxr.null = lxr 不能为空 +TypicalFarmer.lxr.length.illegal = lxr 长度过长 +TypicalFarmer.lxrid.length.illegal = lxrid 长度过长 +TypicalFarmer.tel.null = tel 不能为空 +TypicalFarmer.tel.length.illegal = tel 长度过长 +TypicalFarmer.qxmc.length.illegal = qxmc 长度过长 +TypicalFarmer.xzdm.length.illegal = xzdm 长度过长 +TypicalFarmer.xzmc.length.illegal = xzmc 长度过长 +TypicalFarmer.address.length.illegal = address 长度过长 +TypicalFarmer.xyzp.length.illegal = xyzp 长度过长 +TypicalFarmer.remark.length.illegal = remark 长度过长 +TypicalFarmer.password.blank = password 不能为空 +TypicalFarmer.password.length.illegal = password 长度过长 +TypicalFarmer.password.format.illegal = password 格式错误 + +TypicalPlotIrrigation.id.null = id 不能为空 +TypicalPlotIrrigation.ggbh.null = ggbh 不能为空 +TypicalPlotIrrigation.ggbh.length.illegal = ggbh 长度过长 +TypicalPlotIrrigation.qxbh.null = qxbh 不能为空 +TypicalPlotIrrigation.dkbh.null = dkbh 不能为空 +TypicalPlotIrrigation.strtimeTs.null = strtimeTs 不能为空 +TypicalPlotIrrigation.endtimeTs.null = endtimeTs 不能为空 +TypicalPlotIrrigation.dkbh.length.illegal = dkbh 长度过长 +TypicalPlotIrrigation.sylx.length.illegal = sylx 长度过长 +TypicalPlotIrrigation.gglx.length.illegal = gglx 长度过长 +TypicalPlotIrrigation.gcff.length.illegal = gcff 长度过长 +TypicalPlotIrrigation.ggysl.null = ggysl 不能为空 +TypicalPlotIrrigation.strzp.length.illegal = strzp 长度过长 +TypicalPlotIrrigation.endzp.length.illegal = endzp 长度过长 +TypicalPlotIrrigation.remark.length.illegal = remark 长度过长 +TypicalPlotIrrigation.xzbh.null = xzbh 不能为空 +TypicalPlotIrrigation.cropName.null = cropName 不能为空 + +IrrigationSarRecord.id.null = id 不能为空 +IrrigationSarRecord.countyCode.null = countyCode 不能为空 +IrrigationSarRecord.countyName.null = countyName 不能为空 +IrrigationSarRecord.countyName.length.illegal = countyName 长度过长 +IrrigationSarRecord.townCode.null = townCode 不能为空 +IrrigationSarRecord.townCode.length.illegal = townCode 长度过长 +IrrigationSarRecord.townName.null = townName 不能为空 +IrrigationSarRecord.townName.length.illegal = townName 长度过长 +IrrigationSarRecord.cropName.null = cropName 不能为空 +IrrigationSarRecord.cropName.length.illegal = cropName 长度过长 +IrrigationSarRecord.irrigationDateTs.null = irrigationDateTs 不能为空 +IrrigationSarRecord.dataSource.length.illegal = dataSource 长度过长 +IrrigationSarRecord.memo.length.illegal = memo 长度过长 diff --git a/src/main/resources/i18n/messages_en_US.properties b/src/main/resources/i18n/messages_en_US.properties new file mode 100644 index 0000000..6020047 --- /dev/null +++ b/src/main/resources/i18n/messages_en_US.properties @@ -0,0 +1,233 @@ +sys.message.success = success +sys.message.user.not_logged_in = user not logged in +sys.message.user.login_error = user login failed +sys.message.user.account_forbidden = this account is forbidden +sys.message.user.account_not_activated = this account not activated +sys.message.user.overtime = user login timeout +sys.message.user.no_permission = user permission denied +sys.message.user.already_logged = user already logged +sys.message.user.already_exist = user already exist +sys.message.param.null = parameter is null +sys.message.param.illegal = parameter is illegal +sys.message.data.none = data is none +sys.message.data.wrong = data is wrong +sys.message.data.repeat = data is repeat +sys.message.process.fail = process fail +sys.message.process.overtime = process overtime +sys.message.system.inner_error = system inner error +sys.message.system.abnormal = system abnormal +sys.message.system.busy = system is busy +sys.message.system.maintain = system maintenance +sys.message.database.error = database error +sys.message.file.exists = file exists +sys.message.file.write.error = file write error +sys.message.file.read.error = file read error + +SysUser.id.blank = user id can't be blank +SysUser.userName.blank = user name can't be blank +SysUser.userName.length.illegal = user name length illegal +SysUser.userName.format.illegal = user name format illegal +SysUser.nickName.length.illegal = user nickname length illegal +SysUser.userCode.length.illegal = user code length illegal +SysUser.userCode.format.illegal = user code cantains illegal character +SysUser.password.blank = user password can't be blank +SysUser.password.length.illegal = user password length illegal +SysUser.password.format.illegal = user password format illegal +SysUser.sex.num.null = user sex num can't be blank +SysUser.sex.num.illegal = user sex num illegal +SysUser.telephone.format.illegal = user telephone format illegal +SysUser.email.length.illegal = user email length illegal +SysUser.email.format.illegal = user email format illegal +SysUser.admCode.illegal = user administrative area code illegal +SysUser.address.length.illegal = user address length illegal +SysUser.birthday.format.illegal = user birthday must be yyyy-MM-dd +SysUser.personalSignature.length.illegal = user personal signature length illegal +SysUser.portraitId.illegal = user portrait id illegal +SysUser.statusCode.null = user current status code can't be blank +SysUser.statusCode.illegal = user current status code illegal +SysUser.deleteFlag.null = user delete flag can't be null +SysUser.realName.length.illegal = user realName length illegal +SysUser.memo.length.illegal = user memo length illegal + +FileDocument.id.null = id can't be blank +FileDocument.name.null = name can't be blank +FileDocument.name.length.illegal = name length illegal +FileDocument.category.length.illegal = category length illegal +FileDocument.filePath.null = filePath can't be blank +FileDocument.filePath.length.illegal = filePath length illegal +FileDocument.size.length.illegal = size length illegal +FileDocument.md5.null = md5 can't be blank +FileDocument.md5.length.illegal = md5 length illegal +FileDocument.memo.length.illegal = memo length illegal +FileDocument.checkingToken.length.illegal = checkingToken length illegal + +AppFile.id.null = id can't be blank +AppFile.name.null = name can't be blank +AppFile.name.length.illegal = name length illegal +AppFile.appPath.null = appPath can't be blank +AppFile.appPath.length.illegal = appPath length illegal +AppFile.versionNumber.null = versionNumber can't be blank +AppFile.versionNumber.length.illegal = versionNumber length illegal +AppFile.versionNumber.format.illegal = versionNumber illegal +AppFile.size.null = size can't be blank +AppFile.size.length.illegal = size length illegal +AppFile.md5.null = md5 can't be blank +AppFile.md5.length.illegal = md5 length illegal +AppFile.memo.length.illegal = memo length illegal + +TifProduct.id.null = id can't be blank +TifProduct.productCode.null = productCode can't be blank +TifProduct.productCode.length.illegal = productCode length illegal +TifProduct.productType.null = productType can't be blank +TifProduct.productType.length.illegal = productType length illegal +TifProduct.admCode.null = admCode can't be blank +TifProduct.admName.null = admName can't be blank +TifProduct.admName.length.illegal = admName length illegal +TifProduct.fileName.null = fileName can't be blank +TifProduct.fileName.length.illegal = fileName length illegal +TifProduct.filePath.null = filePath can't be blank +TifProduct.filePath.length.illegal = filePath length illegal +TifProduct.fileMd5.length.illegal = fileMd5 length illegal +TifProduct.fileSize.length.illegal = fileSize length illegal +TifProduct.memo.length.illegal = memo length illegal + +WcsRecord.id.null = id can't be blank +WcsRecord.productCode.null = productCode can't be blank +WcsRecord.productCode.length.illegal = productCode length illegal +WcsRecord.productType.null = productType can't be blank +WcsRecord.productType.length.illegal = productType length illegal +WcsRecord.admCode.null = admCode can't be blank +WcsRecord.admName.null = admName can't be blank +WcsRecord.admName.length.illegal = admName length illegal +WcsRecord.fileName.null = fileName can't be blank +WcsRecord.fileName.length.illegal = fileName length illegal +WcsRecord.filePath.null = filePath can't be blank +WcsRecord.filePath.length.illegal = filePath length illegal +WcsRecord.fileMd5.length.illegal = fileMd5 length illegal +WcsRecord.fileSize.length.illegal = fileSize length illegal +WcsRecord.memo.length.illegal = memo length illegal + +IrrigationRecord.id.null = id can't be blank +IrrigationRecord.countyCode.null = countyCode can't be blank +IrrigationRecord.countyName.null = countyName can't be blank +IrrigationRecord.countyName.length.illegal = countyName length illegal +IrrigationRecord.irrigationDateTs.null = irrigationDateTs can't be blank +IrrigationRecord.dataSource.length.illegal = dataSource length illegal +IrrigationRecord.memo.length.illegal = memo length illegal +IrrigationRecord.townCode.null = townCode can't be blank +IrrigationRecord.townCode.length.illegal = townCode length illegal +IrrigationRecord.townName.null = townName can't be blank +IrrigationRecord.townName.length.illegal = townName length illegal + +CropClassifyRecord.id.null = id can't be blank +CropClassifyRecord.countyCode.null = countyCode can't be blank +CropClassifyRecord.countyName.null = countyName can't be blank +CropClassifyRecord.countyName.length.illegal = countyName length illegal +CropClassifyRecord.cropCode.null = cropCode can't be blank +CropClassifyRecord.irrigationDateTs.null = irrigationDateTs can't be blank +CropClassifyRecord.dataSource.length.illegal = dataSource length illegal +CropClassifyRecord.memo.length.illegal = memo length illegal +CropClassifyRecord.townCode.null = townCode can't be blank +CropClassifyRecord.townCode.length.illegal = townCode length illegal +CropClassifyRecord.townName.null = townCode can't be blank +CropClassifyRecord.townName.length.illegal = townCode length illegal + +TypicalPlot.id.null = id can't be blank +TypicalPlot.dkbh.null = dkbh can't be blank +TypicalPlot.dkbh.length.illegal = dkbh length illegal +TypicalPlot.dsmc.length.illegal = dsmc length illegal +TypicalPlot.qxmc.length.illegal = qxmc length illegal +TypicalPlot.xzdm.length.illegal = xzdm length illegal +TypicalPlot.xzmc.length.illegal = xzmc length illegal +TypicalPlot.dlmc.length.illegal = dlmc length illegal +TypicalPlot.cbzwmc.length.illegal = cbzwmc length illegal +TypicalPlot.xbzwmc.length.illegal = xbzwmc length illegal +TypicalPlot.qdzwmc.length.illegal = qdzwmc length illegal +TypicalPlot.snyd.length.illegal = snyd length illegal +TypicalPlot.trlx.length.illegal = trlx length illegal +TypicalPlot.sysjq.length.illegal = sysjq length illegal +TypicalPlot.dbgq.length.illegal = dbgq length illegal +TypicalPlot.lxr.length.illegal = lxr length illegal +TypicalPlot.tel.length.illegal = tel length illegal +TypicalPlot.dkzp.length.illegal = dkzp length illegal +TypicalPlot.remark.length.illegal = remark length illegal + +FarmingInfo.id.null = id can't be blank +FarmingInfo.dkbh.null = dkbh can't be blank +FarmingInfo.qxbh.null = qxbh can't be blank +FarmingInfo.dkbh.length.illegal = dkbh length illegal +FarmingInfo.nqzp.length.illegal = nqzp length illegal +FarmingInfo.nqzt.length.illegal = nqzt length illegal +FarmingInfo.remark.length.illegal = remark length illegal +FarmingInfo.zwmc.null = zwmc can't be blank +FarmingInfo.zwmc.length.illegal = zwmc length illegal + +IndependentCheck.id.null = id can't be blank +IndependentCheck.cydbh.null = cydbh can't be blank +IndependentCheck.cydbh.length.illegal = cydbh length illegal +IndependentCheck.zwmc.length.illegal = zwmc length illegal +IndependentCheck.hczp.length.illegal = hczp length illegal +IndependentCheck.remark.length.illegal = remark length illegal +IndependentCheck.qxdm.null = qxdm can't be blank +IndependentCheck.qxmc.null = qxmc can't be blank +IndependentCheck.qxmc.length.illegal = qxmc length illegal + +IrrigationCheck.id.null = id can't be blank +IrrigationCheck.ggbh.null = ggbh can't be blank +IrrigationCheck.ggbh.length.illegal = ggbh length illegal +IrrigationCheck.qxbh.null = qxbh can't be blank +IrrigationCheck.dkbh.null = dkbh can't be blank +IrrigationCheck.dkbh.length.illegal = dkbh length illegal +IrrigationCheck.hszp.length.illegal = hszp length illegal +IrrigationCheck.hszt.null = hszt can't be blank +IrrigationCheck.remark.length.illegal = remark length illegal +IrrigationCheck.hsbh.null = hsbh can't be blank +IrrigationCheck.hsbh.length.illegal = hsbh length illegal + +TypicalFarmer.id.null = id can't be blank +TypicalFarmer.lxr.null = lxr can't be blank +TypicalFarmer.lxr.length.illegal = lxr length illegal +TypicalFarmer.lxrid.length.illegal = lxrid length illegal +TypicalFarmer.tel.null = tel can't be blank +TypicalFarmer.tel.length.illegal = tel length illegal +TypicalFarmer.qxmc.length.illegal = qxmc length illegal +TypicalFarmer.xzdm.length.illegal = xzdm length illegal +TypicalFarmer.xzmc.length.illegal = xzmc length illegal +TypicalFarmer.address.length.illegal = address length illegal +TypicalFarmer.xyzp.length.illegal = xyzp length illegal +TypicalFarmer.remark.length.illegal = remark length illegal +TypicalFarmer.password.blank = password can't be blank +TypicalFarmer.password.length.illegal = password length illegal +TypicalFarmer.password.format.illegal = password format illegal + +TypicalPlotIrrigation.id.null = id can't be blank +TypicalPlotIrrigation.ggbh.null = ggbh can't be blank +TypicalPlotIrrigation.ggbh.length.illegal = ggbh length illegal +TypicalPlotIrrigation.qxbh.null = qxbh can't be blank +TypicalPlotIrrigation.dkbh.null = dkbh can't be blank +TypicalPlotIrrigation.strtimeTs.null = strtimeTs can't be blank +TypicalPlotIrrigation.endtimeTs.null = endtimeTs can't be blank +TypicalPlotIrrigation.dkbh.length.illegal = dkbh length illegal +TypicalPlotIrrigation.sylx.length.illegal = sylx length illegal +TypicalPlotIrrigation.gglx.length.illegal = gglx length illegal +TypicalPlotIrrigation.gcff.length.illegal = gcff length illegal +TypicalPlotIrrigation.ggysl.null = ggysl can't be blank +TypicalPlotIrrigation.strzp.length.illegal = strzp length illegal +TypicalPlotIrrigation.endzp.length.illegal = endzp length illegal +TypicalPlotIrrigation.remark.length.illegal = remark length illegal +TypicalPlotIrrigation.xzbh.null = xzbh ???? +TypicalPlotIrrigation.cropName.null = cropName ???? + +IrrigationSarRecord.id.null = id can't be blank +IrrigationSarRecord.countyCode.null = countyCode can't be blank +IrrigationSarRecord.countyName.null = countyName can't be blank +IrrigationSarRecord.countyName.length.illegal = countyName length illegal +IrrigationSarRecord.townCode.null = townCode can't be blank +IrrigationSarRecord.townCode.length.illegal = townCode length illegal +IrrigationSarRecord.townName.null = townName can't be blank +IrrigationSarRecord.townName.length.illegal = townName length illegal +IrrigationSarRecord.cropName.null = cropName can't be blank +IrrigationSarRecord.cropName.length.illegal = cropName length illegal +IrrigationSarRecord.irrigationDateTs.null = irrigationDateTs can't be blank +IrrigationSarRecord.dataSource.length.illegal = dataSource length illegal +IrrigationSarRecord.memo.length.illegal = memo length illegal diff --git a/src/main/resources/i18n/messages_zh_CN.properties b/src/main/resources/i18n/messages_zh_CN.properties new file mode 100644 index 0000000..47dca8c --- /dev/null +++ b/src/main/resources/i18n/messages_zh_CN.properties @@ -0,0 +1,233 @@ +sys.message.success = 成功 +sys.message.user.not_logged_in = 用户未登录 +sys.message.user.login_error = 用户登陆失败 +sys.message.user.account_forbidden = 用户已被禁止 +sys.message.user.account_not_activated = 用户未激活 +sys.message.user.overtime = 用户登录超时 +sys.message.user.no_permission = 用户权限不足 +sys.message.user.already_logged = 用户已经登录 +sys.message.user.already_exist = 用户名已存在 +sys.message.param.null = 参数为空 +sys.message.param.illegal = 参数非法 +sys.message.data.none = 数据为空 +sys.message.data.wrong = 数据错误 +sys.message.data.repeat = 数据已存在 +sys.message.process.fail = 处理失败 +sys.message.process.overtime = 处理超时 +sys.message.system.inner_error = 系统内部错误 +sys.message.system.abnormal = 系统异常 +sys.message.system.busy = 系统正忙,请稍后 +sys.message.system.maintain = 系统维护中 +sys.message.database.error = 数据库错误 +sys.message.file.exists = 文件已存在 +sys.message.file.write.error = 文件写入失败 +sys.message.file.read.error = 文件读取失败 + +SysUser.id.blank = 用户id不能为空 +SysUser.userName.blank = 用户名不能为空 +SysUser.userName.length.illegal = 用户名长度不合法 +SysUser.userName.format.illegal = 用户名格式不合法 +SysUser.nickName.length.illegal = 用户昵称长度不合法 +SysUser.userCode.length.illegal = 用户编码长度不合法 +SysUser.userCode.format.illegal = 用户编码含有非法字符 +SysUser.password.blank = 用户密码不能为空 +SysUser.password.length.illegal = 用户密码长度不合法 +SysUser.password.format.illegal = 用户密码格式不合法 +SysUser.sex.num.null = 用户性别数字不能为空 +SysUser.sex.num.illegal = 用户性别数字不合法 +SysUser.telephone.format.illegal = 用户手机号码不合法 +SysUser.email.length.illegal = 用户邮箱长度不合法 +SysUser.email.format.illegal = 用户邮箱格式不合法 +SysUser.admCode.illegal = 用户行政区划代码不合法 +SysUser.address.length.illegal = 用户详细地址长度不合法 +SysUser.birthday.format.illegal = 用户出生日期必须是 yyyy-MM-dd +SysUser.personalSignature.length.illegal = 用户个性签名长度非法 +SysUser.portraitId.illegal = 用户头像id非法 +SysUser.statusCode.null = 用户当前状态编码为空 +SysUser.statusCode.illegal = 用户当前状态编码非法 +SysUser.deleteFlag.null = 用户删除标记不能是空 +SysUser.realName.length.illegal = 用户真实姓名长度过长 +SysUser.memo.length.illegal = 用户备注信息长度过长 + +FileDocument.id.null = id 不能为空 +FileDocument.name.null = name 不能为空 +FileDocument.name.length.illegal = name 长度过长 +FileDocument.category.length.illegal = category 长度过长 +FileDocument.filePath.null = filePath 不能为空 +FileDocument.filePath.length.illegal = filePath 长度过长 +FileDocument.size.length.illegal = size 长度过长 +FileDocument.md5.null = md5 不能为空 +FileDocument.md5.length.illegal = md5 长度过长 +FileDocument.memo.length.illegal = memo 长度过长 +FileDocument.checkingToken.length.illegal = checkingToken 长度过长 + +AppFile.id.null = id 不能为空 +AppFile.name.null = name 不能为空 +AppFile.name.length.illegal = name 长度过长 +AppFile.appPath.null = appPath 不能为空 +AppFile.appPath.length.illegal = appPath 长度过长 +AppFile.versionNumber.null = versionNumber 不能为空 +AppFile.versionNumber.length.illegal = versionNumber 长度过长 +AppFile.versionNumber.format.illegal = versionNumber 格式不合法 +AppFile.size.null = size 不能为空 +AppFile.size.length.illegal = size 长度过长 +AppFile.md5.null = md5 不能为空 +AppFile.md5.length.illegal = md5 长度过长 +AppFile.memo.length.illegal = memo 长度过长 + +TifProduct.id.null = id 不能为空 +TifProduct.productCode.null = productCode 不能为空 +TifProduct.productCode.length.illegal = productCode 长度过长 +TifProduct.productType.null = productType 不能为空 +TifProduct.productType.length.illegal = productType 长度过长 +TifProduct.admCode.null = admCode 不能为空 +TifProduct.admName.null = admName 不能为空 +TifProduct.admName.length.illegal = admName 长度过长 +TifProduct.fileName.null = fileName 不能为空 +TifProduct.fileName.length.illegal = fileName 长度过长 +TifProduct.filePath.null = filePath 不能为空 +TifProduct.filePath.length.illegal = filePath 长度过长 +TifProduct.fileMd5.length.illegal = fileMd5 长度过长 +TifProduct.fileSize.length.illegal = fileSize 长度过长 +TifProduct.memo.length.illegal = memo 长度过长 + +WcsRecord.id.null = id 不能为空 +WcsRecord.productCode.null = productCode 不能为空 +WcsRecord.productCode.length.illegal = productCode 长度过长 +WcsRecord.productType.null = productType 不能为空 +WcsRecord.productType.length.illegal = productType 长度过长 +WcsRecord.admCode.null = admCode 不能为空 +WcsRecord.admName.null = admName 不能为空 +WcsRecord.admName.length.illegal = admName 长度过长 +WcsRecord.fileName.null = fileName 不能为空 +WcsRecord.fileName.length.illegal = fileName 长度过长 +WcsRecord.filePath.null = filePath 不能为空 +WcsRecord.filePath.length.illegal = filePath 长度过长 +WcsRecord.fileMd5.length.illegal = fileMd5 长度过长 +WcsRecord.fileSize.length.illegal = fileSize 长度过长 +WcsRecord.memo.length.illegal = memo 长度过长 + +IrrigationRecord.id.null = id 不能为空 +IrrigationRecord.countyCode.null = countyCode 不能为空 +IrrigationRecord.countyName.null = countyName 不能为空 +IrrigationRecord.countyName.length.illegal = countyName 长度过长 +IrrigationRecord.irrigationDateTs.null = irrigationDateTs 不能为空 +IrrigationRecord.dataSource.length.illegal = dataSource 长度过长 +IrrigationRecord.memo.length.illegal = memo 长度过长 +IrrigationRecord.townCode.null = townCode 不能为空 +IrrigationRecord.townCode.length.illegal = townCode 长度过长 +IrrigationRecord.townName.null = townName 不能为空 +IrrigationRecord.townName.length.illegal = townName 长度过长 + +CropClassifyRecord.id.null = id 不能为空 +CropClassifyRecord.countyCode.null = countyCode 不能为空 +CropClassifyRecord.countyName.null = countyName 不能为空 +CropClassifyRecord.countyName.length.illegal = countyName 长度过长 +CropClassifyRecord.cropCode.null = cropCode 不能为空 +CropClassifyRecord.irrigationDateTs.null = irrigationDateTs 不能为空 +CropClassifyRecord.dataSource.length.illegal = dataSource 长度过长 +CropClassifyRecord.memo.length.illegal = memo 长度过长 +CropClassifyRecord.townCode.null = townCode 不能为空 +CropClassifyRecord.townCode.length.illegal = townCode 长度过长 +CropClassifyRecord.townName.null = townCode 不能为空 +CropClassifyRecord.townName.length.illegal = townCode 长度过长 + +TypicalPlot.id.null = id 不能为空 +TypicalPlot.dkbh.null = dkbh 不能为空 +TypicalPlot.dkbh.length.illegal = dkbh 长度过长 +TypicalPlot.dsmc.length.illegal = dsmc 长度过长 +TypicalPlot.qxmc.length.illegal = qxmc 长度过长 +TypicalPlot.xzdm.length.illegal = xzdm 长度过长 +TypicalPlot.xzmc.length.illegal = xzmc 长度过长 +TypicalPlot.dlmc.length.illegal = dlmc 长度过长 +TypicalPlot.cbzwmc.length.illegal = cbzwmc 长度过长 +TypicalPlot.xbzwmc.length.illegal = xbzwmc 长度过长 +TypicalPlot.qdzwmc.length.illegal = qdzwmc 长度过长 +TypicalPlot.snyd.length.illegal = snyd 长度过长 +TypicalPlot.trlx.length.illegal = trlx 长度过长 +TypicalPlot.sysjq.length.illegal = sysjq 长度过长 +TypicalPlot.dbgq.length.illegal = dbgq 长度过长 +TypicalPlot.lxr.length.illegal = lxr 长度过长 +TypicalPlot.tel.length.illegal = tel 长度过长 +TypicalPlot.dkzp.length.illegal = dkzp 长度过长 +TypicalPlot.remark.length.illegal = remark 长度过长 + +FarmingInfo.id.null = id 不能为空 +FarmingInfo.qxbh.null = qxbh 不能为空 +FarmingInfo.dkbh.null = dkbh 不能为空 +FarmingInfo.dkbh.length.illegal = dkbh 长度过长 +FarmingInfo.nqzp.length.illegal = nqzp 长度过长 +FarmingInfo.nqzt.length.illegal = nqzt 长度过长 +FarmingInfo.remark.length.illegal = remark 长度过长 +FarmingInfo.zwmc.null = zwmc 不能为空 +FarmingInfo.zwmc.length.illegal = zwmc 长度过长 + +IndependentCheck.id.null = id 不能为空 +IndependentCheck.cydbh.null = cydbh 不能为空 +IndependentCheck.cydbh.length.illegal = cydbh 长度过长 +IndependentCheck.zwmc.length.illegal = zwmc 长度过长 +IndependentCheck.hczp.length.illegal = hczp 长度过长 +IndependentCheck.remark.length.illegal = remark 长度过长 +IndependentCheck.qxdm.null = qxdm 不能为空 +IndependentCheck.qxmc.null = qxmc 不能为空 +IndependentCheck.qxmc.length.illegal = qxmc 长度过长 + +IrrigationCheck.id.null = id 不能为空 +IrrigationCheck.ggbh.null = ggbh 不能为空 +IrrigationCheck.ggbh.length.illegal = ggbh 长度过长 +IrrigationCheck.qxbh.null = qxbh 不能为空 +IrrigationCheck.dkbh.null = dkbh 不能为空 +IrrigationCheck.dkbh.length.illegal = dkbh 长度过长 +IrrigationCheck.hszp.length.illegal = hszp 长度过长 +IrrigationCheck.hszt.null = hszt 不能为空 +IrrigationCheck.remark.length.illegal = remark 长度过长 +IrrigationCheck.hsbh.null = hsbh 不能为空 +IrrigationCheck.hsbh.length.illegal = hsbh 长度过长 + +TypicalFarmer.id.null = id 不能为空 +TypicalFarmer.lxr.null = lxr 不能为空 +TypicalFarmer.lxr.length.illegal = lxr 长度过长 +TypicalFarmer.lxrid.length.illegal = lxrid 长度过长 +TypicalFarmer.tel.null = tel 不能为空 +TypicalFarmer.tel.length.illegal = tel 长度过长 +TypicalFarmer.qxmc.length.illegal = qxmc 长度过长 +TypicalFarmer.xzdm.length.illegal = xzdm 长度过长 +TypicalFarmer.xzmc.length.illegal = xzmc 长度过长 +TypicalFarmer.address.length.illegal = address 长度过长 +TypicalFarmer.xyzp.length.illegal = xyzp 长度过长 +TypicalFarmer.remark.length.illegal = remark 长度过长 +TypicalFarmer.password.blank = password 不能为空 +TypicalFarmer.password.length.illegal = password 长度过长 +TypicalFarmer.password.format.illegal = password 格式错误 + +TypicalPlotIrrigation.id.null = id 不能为空 +TypicalPlotIrrigation.ggbh.null = ggbh 不能为空 +TypicalPlotIrrigation.ggbh.length.illegal = ggbh 长度过长 +TypicalPlotIrrigation.qxbh.null = qxbh 不能为空 +TypicalPlotIrrigation.dkbh.null = dkbh 不能为空 +TypicalPlotIrrigation.strtimeTs.null = strtimeTs 不能为空 +TypicalPlotIrrigation.endtimeTs.null = endtimeTs 不能为空 +TypicalPlotIrrigation.dkbh.length.illegal = dkbh 长度过长 +TypicalPlotIrrigation.sylx.length.illegal = sylx 长度过长 +TypicalPlotIrrigation.gglx.length.illegal = gglx 长度过长 +TypicalPlotIrrigation.gcff.length.illegal = gcff 长度过长 +TypicalPlotIrrigation.ggysl.null = ggysl 不能为空 +TypicalPlotIrrigation.strzp.length.illegal = strzp 长度过长 +TypicalPlotIrrigation.endzp.length.illegal = endzp 长度过长 +TypicalPlotIrrigation.remark.length.illegal = remark 长度过长 +TypicalPlotIrrigation.xzbh.null = xzbh 不能为空 +TypicalPlotIrrigation.cropName.null = cropName 不能为空 + +IrrigationSarRecord.id.null = id 不能为空 +IrrigationSarRecord.countyCode.null = countyCode 不能为空 +IrrigationSarRecord.countyName.null = countyName 不能为空 +IrrigationSarRecord.countyName.length.illegal = countyName 长度过长 +IrrigationSarRecord.townCode.null = townCode 不能为空 +IrrigationSarRecord.townCode.length.illegal = townCode 长度过长 +IrrigationSarRecord.townName.null = townName 不能为空 +IrrigationSarRecord.townName.length.illegal = townName 长度过长 +IrrigationSarRecord.cropName.null = cropName 不能为空 +IrrigationSarRecord.cropName.length.illegal = cropName 长度过长 +IrrigationSarRecord.irrigationDateTs.null = irrigationDateTs 不能为空 +IrrigationSarRecord.dataSource.length.illegal = dataSource 长度过长 +IrrigationSarRecord.memo.length.illegal = memo 长度过长 diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml new file mode 100644 index 0000000..646ecf7 --- /dev/null +++ b/src/main/resources/log4j2.xml @@ -0,0 +1,97 @@ + + + + + + /home/sc/web/logs/shandong_hydrology_new + %d{yyyy-MM-dd HH:mm:ss.SSS} [%level] %c{1} : - %msg%n + + + + + + + + + + ${logPattern} + + + + + + + + + + + + + + + + + + + + + ${logPattern} + + + + + + + + + + + + + + + + + + + + + + + + ${logPattern} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/java/com/xkrs/microservice/MicroserviceApplicationTest.java b/src/test/java/com/xkrs/microservice/MicroserviceApplicationTest.java new file mode 100644 index 0000000..1d99da9 --- /dev/null +++ b/src/test/java/com/xkrs/microservice/MicroserviceApplicationTest.java @@ -0,0 +1,31 @@ +package com.xkrs.microservice; + +import com.xkrs.microservice.model.qo.HydrologicalStationQo; +import com.xkrs.microservice.service.HydrologicalStationService; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import javax.annotation.Resource; + + +@SpringBootTest +public class MicroserviceApplicationTest { + + @Resource + private HydrologicalStationService hydrologicalStationService; + + @Test + public void contextLoads() { + System.out.println("hello!"); +// HydrologicalStationQo hydrologicalStationQo = new HydrologicalStationQo(); +// hydrologicalStationQo.setCounty("桓台县"); +// hydrologicalStationQo.setDrp(1.5); +// hydrologicalStationQo.setLatitude(36.1); +// hydrologicalStationQo.setLongitude(117.1); +// hydrologicalStationQo.setName("王家"); +// hydrologicalStationQo.setTime(1546302487L); +// hydrologicalStationQo.setRemarks("测试3"); +// hydrologicalStationService.add(hydrologicalStationQo); + } + +} diff --git a/src/test/java/com/xkrs/util/MyFirstTestCaseTest.java b/src/test/java/com/xkrs/util/MyFirstTestCaseTest.java new file mode 100644 index 0000000..90437ff --- /dev/null +++ b/src/test/java/com/xkrs/util/MyFirstTestCaseTest.java @@ -0,0 +1,53 @@ +package com.xkrs.util; + +import org.junit.jupiter.api.*; + +@DisplayName("我的第一个测试用例") +public class MyFirstTestCaseTest { + + @BeforeAll + public static void init() { + System.out.println("初始化数据"); + } + + @AfterAll + public static void cleanup() { + System.out.println("清理数据"); + } + + @BeforeEach + public void tearup() { + System.out.println("当前测试方法开始"); + } + + @AfterEach + public void tearDown() { + System.out.println("当前测试方法结束"); + } + + @DisplayName("我的第一个测试") + @Test + void testFirstTest() { + System.out.println("我的第一个测试开始测试"); + } + + @DisplayName("我的第二个测试") + @Test + void testSecondTest() { + System.out.println("我的第二个测试开始测试"); + } + +// @DisplayName("我的第三个测试") +// @Disabled +// @Test +// void testThirdTest() { +// System.out.println("我的第三个测试开始测试"); +// } + + @DisplayName("重复测试") + @RepeatedTest(value = 3) + public void i_am_a_repeated_test() { + System.out.println("执行测试"); + } + +}