From f01f4f210fed518eab7a9ac011437a7bfe463dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Sun, 30 Oct 2016 10:43:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/jsh/action/asset/AssetAction.java | 517 ++++++++++++ src/com/jsh/action/asset/ReportAction.java | 120 +++ src/com/jsh/action/basic/AppAction.java | 544 +++++++++++++ src/com/jsh/action/basic/AssetNameAction.java | 289 +++++++ src/com/jsh/action/basic/CategoryAction.java | 273 +++++++ src/com/jsh/action/basic/DepotAction.java | 380 +++++++++ src/com/jsh/action/basic/FunctionsAction.java | 588 ++++++++++++++ src/com/jsh/action/basic/LogAction.java | 192 +++++ src/com/jsh/action/basic/RoleAction.java | 347 ++++++++ src/com/jsh/action/basic/SupplierAction.java | 402 ++++++++++ src/com/jsh/action/basic/UserAction.java | 480 +++++++++++ .../jsh/action/basic/UserBusinessAction.java | 229 ++++++ .../jsh/action/basic/VisitAccountAction.java | 267 +++++++ .../jsh/action/materials/BuildingAction.java | 277 +++++++ .../jsh/action/materials/DepotHeadAction.java | 439 +++++++++++ .../jsh/action/materials/DepotItemAction.java | 395 ++++++++++ .../jsh/action/materials/MaterialAction.java | 391 +++++++++ .../materials/MaterialCategoryAction.java | 275 +++++++ .../jsh/action/materials/PersonAction.java | 273 +++++++ src/com/jsh/base/BaseAction.java | 116 +++ src/com/jsh/base/BaseDAO.java | 137 ++++ src/com/jsh/base/BaseIDAO.java | 124 +++ src/com/jsh/base/BaseIService.java | 105 +++ src/com/jsh/base/BaseService.java | 137 ++++ src/com/jsh/base/Log.java | 174 ++++ .../jsh/constants/asset/AssetConstants.java | 119 +++ .../constants/asset/ExcelConstantsCode.java | 35 + .../jsh/constants/common/AmsConstants.java | 36 + .../common/ExceptionCodeConstants.java | 35 + .../constants/common/LogModuleConstants.java | 65 ++ src/com/jsh/dao/asset/AssetDAO.java | 17 + src/com/jsh/dao/asset/AssetIDAO.java | 9 + src/com/jsh/dao/asset/ReportDAO.java | 21 + src/com/jsh/dao/asset/ReportIDAO.java | 16 + src/com/jsh/dao/basic/AppDAO.java | 17 + src/com/jsh/dao/basic/AppIDAO.java | 9 + src/com/jsh/dao/basic/AssetNameDAO.java | 17 + src/com/jsh/dao/basic/AssetNameIDAO.java | 9 + src/com/jsh/dao/basic/CategoryDAO.java | 17 + src/com/jsh/dao/basic/CategoryIDAO.java | 9 + src/com/jsh/dao/basic/DepotDAO.java | 17 + src/com/jsh/dao/basic/DepotIDAO.java | 9 + src/com/jsh/dao/basic/FunctionsDAO.java | 17 + src/com/jsh/dao/basic/FunctionsIDAO.java | 9 + src/com/jsh/dao/basic/LogDAO.java | 18 + src/com/jsh/dao/basic/LogIDAO.java | 13 + src/com/jsh/dao/basic/RoleDAO.java | 17 + src/com/jsh/dao/basic/RoleIDAO.java | 9 + src/com/jsh/dao/basic/SupplierDAO.java | 19 + src/com/jsh/dao/basic/SupplierIDAO.java | 9 + src/com/jsh/dao/basic/UserBusinessDAO.java | 32 + src/com/jsh/dao/basic/UserBusinessIDAO.java | 14 + src/com/jsh/dao/basic/UserDAO.java | 19 + src/com/jsh/dao/basic/UserIDAO.java | 9 + src/com/jsh/dao/basic/VisitAccountDAO.java | 17 + src/com/jsh/dao/basic/VisitAccountIDAO.java | 9 + src/com/jsh/dao/materials/BuildingDAO.java | 17 + src/com/jsh/dao/materials/BuildingIDAO.java | 9 + src/com/jsh/dao/materials/DepotHeadDAO.java | 32 + src/com/jsh/dao/materials/DepotHeadIDAO.java | 15 + src/com/jsh/dao/materials/DepotItemDAO.java | 59 ++ src/com/jsh/dao/materials/DepotItemIDAO.java | 14 + .../dao/materials/MaterialCategoryDAO.java | 17 + .../dao/materials/MaterialCategoryIDAO.java | 9 + src/com/jsh/dao/materials/MaterialDAO.java | 17 + src/com/jsh/dao/materials/MaterialIDAO.java | 9 + src/com/jsh/dao/materials/PersonDAO.java | 17 + src/com/jsh/dao/materials/PersonIDAO.java | 9 + src/com/jsh/exception/AmsException.java | 73 ++ .../common/OpenSessionInViewFilterExtend.java | 24 + src/com/jsh/filter/user/UserFilter.java | 83 ++ src/com/jsh/junitest/AmsTAsset.hbm.xml | 90 +++ src/com/jsh/junitest/common/ExtendsTest.java | 10 + src/com/jsh/junitest/common/ForTest.java | 14 + .../jsh/junitest/common/ImportExcelTest.java | 156 ++++ src/com/jsh/junitest/common/SumTest.java | 72 ++ src/com/jsh/junitest/common/whileTest.java | 18 + src/com/jsh/junitest/json/CableStream.java | 127 +++ src/com/jsh/junitest/json/Channel.java | 185 +++++ src/com/jsh/junitest/json/ChannelUtil.java | 75 ++ src/com/jsh/junitest/json/IPStream.java | 127 +++ src/com/jsh/junitest/json/JsonTest.java | 28 + src/com/jsh/junitest/spring/SpringTest.java | 37 + src/com/jsh/model/po/App.hbm.xml | 81 ++ src/com/jsh/model/po/App.java | 174 ++++ src/com/jsh/model/po/Asset.hbm.xml | 96 +++ src/com/jsh/model/po/Asset.java | 379 +++++++++ src/com/jsh/model/po/Assetcategory.hbm.xml | 26 + src/com/jsh/model/po/Assetcategory.java | 67 ++ src/com/jsh/model/po/Assetname.hbm.xml | 34 + src/com/jsh/model/po/Assetname.java | 93 +++ src/com/jsh/model/po/Basicuser.hbm.xml | 69 ++ src/com/jsh/model/po/Basicuser.java | 177 +++++ src/com/jsh/model/po/Building.hbm.xml | 29 + src/com/jsh/model/po/Building.java | 70 ++ src/com/jsh/model/po/Category.hbm.xml | 26 + src/com/jsh/model/po/Category.java | 67 ++ src/com/jsh/model/po/Department.hbm.xml | 26 + src/com/jsh/model/po/Department.java | 69 ++ src/com/jsh/model/po/Depot.hbm.xml | 26 + src/com/jsh/model/po/Depot.java | 60 ++ src/com/jsh/model/po/DepotHead.hbm.xml | 96 +++ src/com/jsh/model/po/DepotHead.java | 210 +++++ src/com/jsh/model/po/DepotItem.hbm.xml | 46 ++ src/com/jsh/model/po/DepotItem.java | 103 +++ src/com/jsh/model/po/Functions.hbm.xml | 54 ++ src/com/jsh/model/po/Functions.java | 93 +++ src/com/jsh/model/po/Logdetails.hbm.xml | 44 ++ src/com/jsh/model/po/Logdetails.java | 119 +++ src/com/jsh/model/po/Material.hbm.xml | 39 + src/com/jsh/model/po/Material.java | 91 +++ src/com/jsh/model/po/MaterialCategory.hbm.xml | 24 + src/com/jsh/model/po/MaterialCategory.java | 61 ++ src/com/jsh/model/po/Measureunit.hbm.xml | 26 + src/com/jsh/model/po/Measureunit.java | 72 ++ src/com/jsh/model/po/Person.hbm.xml | 24 + src/com/jsh/model/po/Person.java | 59 ++ src/com/jsh/model/po/Role.hbm.xml | 16 + src/com/jsh/model/po/Role.java | 31 + src/com/jsh/model/po/Supplier.hbm.xml | 49 ++ src/com/jsh/model/po/Supplier.java | 114 +++ src/com/jsh/model/po/UserBusiness.hbm.xml | 26 + src/com/jsh/model/po/UserBusiness.java | 49 ++ src/com/jsh/model/po/VisitAccount.hbm.xml | 49 ++ src/com/jsh/model/po/VisitAccount.java | 114 +++ src/com/jsh/model/vo/asset/AssetModel.java | 429 ++++++++++ .../jsh/model/vo/asset/AssetShowModel.java | 43 + src/com/jsh/model/vo/asset/ReportModel.java | 321 ++++++++ .../jsh/model/vo/asset/ReportShowModel.java | 34 + src/com/jsh/model/vo/basic/AppModel.java | 294 +++++++ src/com/jsh/model/vo/basic/AppShowModel.java | 22 + .../jsh/model/vo/basic/AssetNameModel.java | 154 ++++ .../model/vo/basic/AssetNameShowModel.java | 22 + src/com/jsh/model/vo/basic/CategoryModel.java | 125 +++ .../jsh/model/vo/basic/CategoryShowModel.java | 22 + src/com/jsh/model/vo/basic/DepotModel.java | 150 ++++ .../jsh/model/vo/basic/DepotShowModel.java | 43 + .../jsh/model/vo/basic/FunctionsModel.java | 219 +++++ .../model/vo/basic/FunctionsShowModel.java | 22 + src/com/jsh/model/vo/basic/LogModel.java | 200 +++++ src/com/jsh/model/vo/basic/LogShowModel.java | 43 + src/com/jsh/model/vo/basic/RoleModel.java | 123 +++ src/com/jsh/model/vo/basic/RoleShowModel.java | 22 + src/com/jsh/model/vo/basic/SupplierModel.java | 177 +++++ .../jsh/model/vo/basic/SupplierShowModel.java | 42 + .../jsh/model/vo/basic/UserBusinessModel.java | 123 +++ .../model/vo/basic/UserBusinessShowModel.java | 43 + src/com/jsh/model/vo/basic/UserModel.java | 255 ++++++ src/com/jsh/model/vo/basic/UserShowModel.java | 22 + .../jsh/model/vo/basic/VisitAccountModel.java | 184 +++++ .../model/vo/basic/VisitAccountShowModel.java | 22 + .../jsh/model/vo/materials/BuildingModel.java | 133 ++++ .../model/vo/materials/BuildingShowModel.java | 37 + .../model/vo/materials/DepotHeadModel.java | 257 ++++++ .../vo/materials/DepotHeadShowModel.java | 42 + .../model/vo/materials/DepotItemModel.java | 238 ++++++ .../vo/materials/DepotItemShowModel.java | 22 + .../vo/materials/MaterialCategoryModel.java | 123 +++ .../materials/MaterialCategoryShowModel.java | 43 + .../jsh/model/vo/materials/MaterialModel.java | 175 ++++ .../model/vo/materials/MaterialShowModel.java | 43 + .../jsh/model/vo/materials/PersonModel.java | 121 +++ .../model/vo/materials/PersonShowModel.java | 42 + src/com/jsh/service/asset/AssetIService.java | 30 + src/com/jsh/service/asset/AssetService.java | 746 ++++++++++++++++++ src/com/jsh/service/asset/ReportIService.java | 15 + src/com/jsh/service/asset/ReportService.java | 23 + src/com/jsh/service/basic/AppIService.java | 9 + src/com/jsh/service/basic/AppService.java | 31 + .../jsh/service/basic/AssetNameIService.java | 9 + .../jsh/service/basic/AssetNameService.java | 22 + .../jsh/service/basic/CategoryIService.java | 9 + .../jsh/service/basic/CategoryService.java | 23 + src/com/jsh/service/basic/DepotIService.java | 9 + src/com/jsh/service/basic/DepotService.java | 32 + .../jsh/service/basic/FunctionsIService.java | 9 + .../jsh/service/basic/FunctionsService.java | 31 + src/com/jsh/service/basic/LogIService.java | 16 + src/com/jsh/service/basic/LogService.java | 36 + src/com/jsh/service/basic/RoleIService.java | 9 + src/com/jsh/service/basic/RoleService.java | 30 + .../jsh/service/basic/SupplierIService.java | 9 + .../jsh/service/basic/SupplierService.java | 25 + .../service/basic/UserBusinessIService.java | 15 + .../service/basic/UserBusinessService.java | 32 + src/com/jsh/service/basic/UserIService.java | 33 + src/com/jsh/service/basic/UserService.java | 114 +++ .../service/basic/VisitAccountIService.java | 9 + .../service/basic/VisitAccountService.java | 24 + .../service/materials/BuildingIService.java | 9 + .../service/materials/BuildingService.java | 24 + .../service/materials/DepotHeadIService.java | 15 + .../service/materials/DepotHeadService.java | 32 + .../service/materials/DepotItemIService.java | 26 + .../service/materials/DepotItemService.java | 124 +++ .../materials/MaterialCategoryIService.java | 9 + .../materials/MaterialCategoryService.java | 24 + .../service/materials/MaterialIService.java | 9 + .../service/materials/MaterialService.java | 24 + .../jsh/service/materials/PersonIService.java | 9 + .../jsh/service/materials/PersonService.java | 24 + src/com/jsh/util/common/BeanFactoryUtil.java | 135 ++++ src/com/jsh/util/common/PageUtil.java | 198 +++++ src/com/jsh/util/common/PathTool.java | 84 ++ .../jsh/util/common/SearchConditionUtil.java | 127 +++ src/com/jsh/util/common/Tools.java | 555 +++++++++++++ 206 files changed, 19870 insertions(+) create mode 100644 src/com/jsh/action/asset/AssetAction.java create mode 100644 src/com/jsh/action/asset/ReportAction.java create mode 100644 src/com/jsh/action/basic/AppAction.java create mode 100644 src/com/jsh/action/basic/AssetNameAction.java create mode 100644 src/com/jsh/action/basic/CategoryAction.java create mode 100644 src/com/jsh/action/basic/DepotAction.java create mode 100644 src/com/jsh/action/basic/FunctionsAction.java create mode 100644 src/com/jsh/action/basic/LogAction.java create mode 100644 src/com/jsh/action/basic/RoleAction.java create mode 100644 src/com/jsh/action/basic/SupplierAction.java create mode 100644 src/com/jsh/action/basic/UserAction.java create mode 100644 src/com/jsh/action/basic/UserBusinessAction.java create mode 100644 src/com/jsh/action/basic/VisitAccountAction.java create mode 100644 src/com/jsh/action/materials/BuildingAction.java create mode 100644 src/com/jsh/action/materials/DepotHeadAction.java create mode 100644 src/com/jsh/action/materials/DepotItemAction.java create mode 100644 src/com/jsh/action/materials/MaterialAction.java create mode 100644 src/com/jsh/action/materials/MaterialCategoryAction.java create mode 100644 src/com/jsh/action/materials/PersonAction.java create mode 100644 src/com/jsh/base/BaseAction.java create mode 100644 src/com/jsh/base/BaseDAO.java create mode 100644 src/com/jsh/base/BaseIDAO.java create mode 100644 src/com/jsh/base/BaseIService.java create mode 100644 src/com/jsh/base/BaseService.java create mode 100644 src/com/jsh/base/Log.java create mode 100644 src/com/jsh/constants/asset/AssetConstants.java create mode 100644 src/com/jsh/constants/asset/ExcelConstantsCode.java create mode 100644 src/com/jsh/constants/common/AmsConstants.java create mode 100644 src/com/jsh/constants/common/ExceptionCodeConstants.java create mode 100644 src/com/jsh/constants/common/LogModuleConstants.java create mode 100644 src/com/jsh/dao/asset/AssetDAO.java create mode 100644 src/com/jsh/dao/asset/AssetIDAO.java create mode 100644 src/com/jsh/dao/asset/ReportDAO.java create mode 100644 src/com/jsh/dao/asset/ReportIDAO.java create mode 100644 src/com/jsh/dao/basic/AppDAO.java create mode 100644 src/com/jsh/dao/basic/AppIDAO.java create mode 100644 src/com/jsh/dao/basic/AssetNameDAO.java create mode 100644 src/com/jsh/dao/basic/AssetNameIDAO.java create mode 100644 src/com/jsh/dao/basic/CategoryDAO.java create mode 100644 src/com/jsh/dao/basic/CategoryIDAO.java create mode 100644 src/com/jsh/dao/basic/DepotDAO.java create mode 100644 src/com/jsh/dao/basic/DepotIDAO.java create mode 100644 src/com/jsh/dao/basic/FunctionsDAO.java create mode 100644 src/com/jsh/dao/basic/FunctionsIDAO.java create mode 100644 src/com/jsh/dao/basic/LogDAO.java create mode 100644 src/com/jsh/dao/basic/LogIDAO.java create mode 100644 src/com/jsh/dao/basic/RoleDAO.java create mode 100644 src/com/jsh/dao/basic/RoleIDAO.java create mode 100644 src/com/jsh/dao/basic/SupplierDAO.java create mode 100644 src/com/jsh/dao/basic/SupplierIDAO.java create mode 100644 src/com/jsh/dao/basic/UserBusinessDAO.java create mode 100644 src/com/jsh/dao/basic/UserBusinessIDAO.java create mode 100644 src/com/jsh/dao/basic/UserDAO.java create mode 100644 src/com/jsh/dao/basic/UserIDAO.java create mode 100644 src/com/jsh/dao/basic/VisitAccountDAO.java create mode 100644 src/com/jsh/dao/basic/VisitAccountIDAO.java create mode 100644 src/com/jsh/dao/materials/BuildingDAO.java create mode 100644 src/com/jsh/dao/materials/BuildingIDAO.java create mode 100644 src/com/jsh/dao/materials/DepotHeadDAO.java create mode 100644 src/com/jsh/dao/materials/DepotHeadIDAO.java create mode 100644 src/com/jsh/dao/materials/DepotItemDAO.java create mode 100644 src/com/jsh/dao/materials/DepotItemIDAO.java create mode 100644 src/com/jsh/dao/materials/MaterialCategoryDAO.java create mode 100644 src/com/jsh/dao/materials/MaterialCategoryIDAO.java create mode 100644 src/com/jsh/dao/materials/MaterialDAO.java create mode 100644 src/com/jsh/dao/materials/MaterialIDAO.java create mode 100644 src/com/jsh/dao/materials/PersonDAO.java create mode 100644 src/com/jsh/dao/materials/PersonIDAO.java create mode 100644 src/com/jsh/exception/AmsException.java create mode 100644 src/com/jsh/filter/common/OpenSessionInViewFilterExtend.java create mode 100644 src/com/jsh/filter/user/UserFilter.java create mode 100644 src/com/jsh/junitest/AmsTAsset.hbm.xml create mode 100644 src/com/jsh/junitest/common/ExtendsTest.java create mode 100644 src/com/jsh/junitest/common/ForTest.java create mode 100644 src/com/jsh/junitest/common/ImportExcelTest.java create mode 100644 src/com/jsh/junitest/common/SumTest.java create mode 100644 src/com/jsh/junitest/common/whileTest.java create mode 100644 src/com/jsh/junitest/json/CableStream.java create mode 100644 src/com/jsh/junitest/json/Channel.java create mode 100644 src/com/jsh/junitest/json/ChannelUtil.java create mode 100644 src/com/jsh/junitest/json/IPStream.java create mode 100644 src/com/jsh/junitest/json/JsonTest.java create mode 100644 src/com/jsh/junitest/spring/SpringTest.java create mode 100644 src/com/jsh/model/po/App.hbm.xml create mode 100644 src/com/jsh/model/po/App.java create mode 100644 src/com/jsh/model/po/Asset.hbm.xml create mode 100644 src/com/jsh/model/po/Asset.java create mode 100644 src/com/jsh/model/po/Assetcategory.hbm.xml create mode 100644 src/com/jsh/model/po/Assetcategory.java create mode 100644 src/com/jsh/model/po/Assetname.hbm.xml create mode 100644 src/com/jsh/model/po/Assetname.java create mode 100644 src/com/jsh/model/po/Basicuser.hbm.xml create mode 100644 src/com/jsh/model/po/Basicuser.java create mode 100644 src/com/jsh/model/po/Building.hbm.xml create mode 100644 src/com/jsh/model/po/Building.java create mode 100644 src/com/jsh/model/po/Category.hbm.xml create mode 100644 src/com/jsh/model/po/Category.java create mode 100644 src/com/jsh/model/po/Department.hbm.xml create mode 100644 src/com/jsh/model/po/Department.java create mode 100644 src/com/jsh/model/po/Depot.hbm.xml create mode 100644 src/com/jsh/model/po/Depot.java create mode 100644 src/com/jsh/model/po/DepotHead.hbm.xml create mode 100644 src/com/jsh/model/po/DepotHead.java create mode 100644 src/com/jsh/model/po/DepotItem.hbm.xml create mode 100644 src/com/jsh/model/po/DepotItem.java create mode 100644 src/com/jsh/model/po/Functions.hbm.xml create mode 100644 src/com/jsh/model/po/Functions.java create mode 100644 src/com/jsh/model/po/Logdetails.hbm.xml create mode 100644 src/com/jsh/model/po/Logdetails.java create mode 100644 src/com/jsh/model/po/Material.hbm.xml create mode 100644 src/com/jsh/model/po/Material.java create mode 100644 src/com/jsh/model/po/MaterialCategory.hbm.xml create mode 100644 src/com/jsh/model/po/MaterialCategory.java create mode 100644 src/com/jsh/model/po/Measureunit.hbm.xml create mode 100644 src/com/jsh/model/po/Measureunit.java create mode 100644 src/com/jsh/model/po/Person.hbm.xml create mode 100644 src/com/jsh/model/po/Person.java create mode 100644 src/com/jsh/model/po/Role.hbm.xml create mode 100644 src/com/jsh/model/po/Role.java create mode 100644 src/com/jsh/model/po/Supplier.hbm.xml create mode 100644 src/com/jsh/model/po/Supplier.java create mode 100644 src/com/jsh/model/po/UserBusiness.hbm.xml create mode 100644 src/com/jsh/model/po/UserBusiness.java create mode 100644 src/com/jsh/model/po/VisitAccount.hbm.xml create mode 100644 src/com/jsh/model/po/VisitAccount.java create mode 100644 src/com/jsh/model/vo/asset/AssetModel.java create mode 100644 src/com/jsh/model/vo/asset/AssetShowModel.java create mode 100644 src/com/jsh/model/vo/asset/ReportModel.java create mode 100644 src/com/jsh/model/vo/asset/ReportShowModel.java create mode 100644 src/com/jsh/model/vo/basic/AppModel.java create mode 100644 src/com/jsh/model/vo/basic/AppShowModel.java create mode 100644 src/com/jsh/model/vo/basic/AssetNameModel.java create mode 100644 src/com/jsh/model/vo/basic/AssetNameShowModel.java create mode 100644 src/com/jsh/model/vo/basic/CategoryModel.java create mode 100644 src/com/jsh/model/vo/basic/CategoryShowModel.java create mode 100644 src/com/jsh/model/vo/basic/DepotModel.java create mode 100644 src/com/jsh/model/vo/basic/DepotShowModel.java create mode 100644 src/com/jsh/model/vo/basic/FunctionsModel.java create mode 100644 src/com/jsh/model/vo/basic/FunctionsShowModel.java create mode 100644 src/com/jsh/model/vo/basic/LogModel.java create mode 100644 src/com/jsh/model/vo/basic/LogShowModel.java create mode 100644 src/com/jsh/model/vo/basic/RoleModel.java create mode 100644 src/com/jsh/model/vo/basic/RoleShowModel.java create mode 100644 src/com/jsh/model/vo/basic/SupplierModel.java create mode 100644 src/com/jsh/model/vo/basic/SupplierShowModel.java create mode 100644 src/com/jsh/model/vo/basic/UserBusinessModel.java create mode 100644 src/com/jsh/model/vo/basic/UserBusinessShowModel.java create mode 100644 src/com/jsh/model/vo/basic/UserModel.java create mode 100644 src/com/jsh/model/vo/basic/UserShowModel.java create mode 100644 src/com/jsh/model/vo/basic/VisitAccountModel.java create mode 100644 src/com/jsh/model/vo/basic/VisitAccountShowModel.java create mode 100644 src/com/jsh/model/vo/materials/BuildingModel.java create mode 100644 src/com/jsh/model/vo/materials/BuildingShowModel.java create mode 100644 src/com/jsh/model/vo/materials/DepotHeadModel.java create mode 100644 src/com/jsh/model/vo/materials/DepotHeadShowModel.java create mode 100644 src/com/jsh/model/vo/materials/DepotItemModel.java create mode 100644 src/com/jsh/model/vo/materials/DepotItemShowModel.java create mode 100644 src/com/jsh/model/vo/materials/MaterialCategoryModel.java create mode 100644 src/com/jsh/model/vo/materials/MaterialCategoryShowModel.java create mode 100644 src/com/jsh/model/vo/materials/MaterialModel.java create mode 100644 src/com/jsh/model/vo/materials/MaterialShowModel.java create mode 100644 src/com/jsh/model/vo/materials/PersonModel.java create mode 100644 src/com/jsh/model/vo/materials/PersonShowModel.java create mode 100644 src/com/jsh/service/asset/AssetIService.java create mode 100644 src/com/jsh/service/asset/AssetService.java create mode 100644 src/com/jsh/service/asset/ReportIService.java create mode 100644 src/com/jsh/service/asset/ReportService.java create mode 100644 src/com/jsh/service/basic/AppIService.java create mode 100644 src/com/jsh/service/basic/AppService.java create mode 100644 src/com/jsh/service/basic/AssetNameIService.java create mode 100644 src/com/jsh/service/basic/AssetNameService.java create mode 100644 src/com/jsh/service/basic/CategoryIService.java create mode 100644 src/com/jsh/service/basic/CategoryService.java create mode 100644 src/com/jsh/service/basic/DepotIService.java create mode 100644 src/com/jsh/service/basic/DepotService.java create mode 100644 src/com/jsh/service/basic/FunctionsIService.java create mode 100644 src/com/jsh/service/basic/FunctionsService.java create mode 100644 src/com/jsh/service/basic/LogIService.java create mode 100644 src/com/jsh/service/basic/LogService.java create mode 100644 src/com/jsh/service/basic/RoleIService.java create mode 100644 src/com/jsh/service/basic/RoleService.java create mode 100644 src/com/jsh/service/basic/SupplierIService.java create mode 100644 src/com/jsh/service/basic/SupplierService.java create mode 100644 src/com/jsh/service/basic/UserBusinessIService.java create mode 100644 src/com/jsh/service/basic/UserBusinessService.java create mode 100644 src/com/jsh/service/basic/UserIService.java create mode 100644 src/com/jsh/service/basic/UserService.java create mode 100644 src/com/jsh/service/basic/VisitAccountIService.java create mode 100644 src/com/jsh/service/basic/VisitAccountService.java create mode 100644 src/com/jsh/service/materials/BuildingIService.java create mode 100644 src/com/jsh/service/materials/BuildingService.java create mode 100644 src/com/jsh/service/materials/DepotHeadIService.java create mode 100644 src/com/jsh/service/materials/DepotHeadService.java create mode 100644 src/com/jsh/service/materials/DepotItemIService.java create mode 100644 src/com/jsh/service/materials/DepotItemService.java create mode 100644 src/com/jsh/service/materials/MaterialCategoryIService.java create mode 100644 src/com/jsh/service/materials/MaterialCategoryService.java create mode 100644 src/com/jsh/service/materials/MaterialIService.java create mode 100644 src/com/jsh/service/materials/MaterialService.java create mode 100644 src/com/jsh/service/materials/PersonIService.java create mode 100644 src/com/jsh/service/materials/PersonService.java create mode 100644 src/com/jsh/util/common/BeanFactoryUtil.java create mode 100644 src/com/jsh/util/common/PageUtil.java create mode 100644 src/com/jsh/util/common/PathTool.java create mode 100644 src/com/jsh/util/common/SearchConditionUtil.java create mode 100644 src/com/jsh/util/common/Tools.java diff --git a/src/com/jsh/action/asset/AssetAction.java b/src/com/jsh/action/asset/AssetAction.java new file mode 100644 index 00000000..87b0708c --- /dev/null +++ b/src/com/jsh/action/asset/AssetAction.java @@ -0,0 +1,517 @@ +package com.jsh.action.asset; + +import java.io.IOException; +import java.io.InputStream; +import java.sql.Timestamp; +import java.text.ParseException; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.constants.asset.AssetConstants; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.model.po.Assetname; +import com.jsh.model.po.Basicuser; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.Supplier; +import com.jsh.model.vo.asset.AssetModel; +import com.jsh.service.asset.AssetIService; +import com.jsh.service.basic.AssetNameIService; +import com.jsh.service.basic.CategoryIService; +import com.jsh.service.basic.SupplierIService; +import com.jsh.service.basic.UserIService; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.Tools; + +@SuppressWarnings("serial") +public class AssetAction extends BaseAction +{ + private AssetModel model = new AssetModel(); + private AssetIService assetService; + private CategoryIService categoryService; + private SupplierIService supplierService; + private UserIService userService; + private AssetNameIService assetnameService; + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public String getBasicData() + { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + Map condition = pageUtil.getAdvSearch(); + condition.put("id_s_order", "desc"); + categoryService.find(pageUtil); + mapData.put("categoryList", pageUtil.getPageList()); + supplierService.find(pageUtil); + mapData.put("supplierList", pageUtil.getPageList()); + + condition.put("isystem_n_eq", 1); + condition.put("id_s_order", "desc"); + userService.find(pageUtil); + mapData.put("userList", pageUtil.getPageList()); + + //清除搜索条件 防止对查询有影响 + condition.remove("isystem_n_eq"); + + assetnameService.find(pageUtil); + mapData.put("assetnameList", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } + + /** + * 增加资产 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加资产方法==================="); + Boolean flag = false; + try + { + Asset asset = new Asset(); + //添加设置 + asset.setAssetname(new Assetname(model.getAssetNameID())); + + asset.setLocation(model.getLocation()); + asset.setStatus(model.getStatus()); + asset.setPrice(model.getPrice()); + + if(null != model.getUserID()) + { + asset.setUser( new Basicuser(model.getUserID())); + } + try + { + //购买日期 + asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime())); + //有效日期 + asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime())); + //保修日期 + asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime())); + } + catch (ParseException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e); + } + + asset.setAssetnum(model.getAssetnum()); + asset.setSerialnum(model.getSerialnum()); + asset.setLabels(model.getLabels()); + + asset.setSupplier( new Supplier(model.getSupplierID())); + asset.setDescription(model.getDescription()); + + asset.setCreatetime(new Timestamp(new Date().getTime())); + asset.setCreator(getUser()); + asset.setUpdatetime(new Timestamp(new Date().getTime())); + asset.setUpdator(getUser()); + asset.setAddMonth(Tools.getCurrentMonth()); + assetService.create(asset); + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加资产回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加资产", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "增加资产" + tipMsg)); + Log.infoFileSync("==================结束调用增加资产方法==================="); + } + + /** + * 删除资产 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除资产信息方法delete()================"); + try + { + assetService.delete(model.getAssetID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetID() + " 的资产异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除资产", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除资产ID为 "+ model.getAssetID() + " " + tipMsg + "!", "删除资产" + tipMsg)); + Log.infoFileSync("====================结束调用删除资产信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新资产 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Asset asset = assetService.get(model.getAssetID()); + + //设置要更新的熟悉值 + asset.setAssetname(new Assetname(model.getAssetNameID())); + + asset.setLocation(model.getLocation()); + asset.setStatus(model.getStatus()); + asset.setPrice(model.getPrice()); + + if(null != model.getUserID()) + asset.setUser(new Basicuser(model.getUserID())); + else + asset.setUser(null); + try + { + //购买日期 + asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime())); + //有效日期 + asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime())); + //保修日期 + asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime())); + } + catch (ParseException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e); + } + + asset.setAssetnum(model.getAssetnum()); + asset.setSerialnum(model.getSerialnum()); + asset.setLabels(model.getLabels()); + + asset.setSupplier(new Supplier(model.getSupplierID())); + asset.setDescription(model.getDescription()); + + asset.setUpdatetime(new Timestamp(new Date().getTime())); + asset.setUpdator(getUser()); + assetService.update(asset); + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改资产ID为 : " + model.getAssetID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改资产回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新资产", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新资产ID为 "+ model.getAssetID() + " " + tipMsg + "!", "更新资产" + tipMsg)); + } + + /** + * 批量删除指定ID资产 + * @return + */ + public String batchDelete() + { + try + { + assetService.batchDelete(model.getAssetIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除资产ID为:" + model.getAssetIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除资产", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除资产ID为 "+ model.getAssetIDs() + " " + tipMsg + "!", "批量删除资产" + tipMsg)); + return SUCCESS; + } + + /** + * 查找资产信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + assetService.find(pageUtil); + + getSession().put("pageUtil", pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Asset asset:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", asset.getId()); + //添加资产属性 + item.put("assetname", asset.getAssetname().getAssetname()); + item.put("assetnameID", asset.getAssetname().getId()); + //单价 + item.put("price", Tools.dealNullStr(asset.getPrice() + "")); + //分类 + item.put("category", asset.getAssetname().getCategory().getAssetname()); + item.put("categoryID", asset.getAssetname().getCategory().getId()); + //资产的状态:0==在库,1==在用,2==消费 + item.put("status", getStatusInfo(asset.getStatus())); + item.put("statushort", asset.getStatus()); + //在用用户名称 + item.put("username", asset.getUser()==null?"":asset.getUser().getUsername()); + item.put("userID", asset.getUser()==null?"":asset.getUser().getId()); + //位置 + item.put("location", Tools.dealNullStr(asset.getLocation())); + + //购买日期 + item.put("purchasedate", asset.getPurchasedate()==null?"":Tools.getCurrentMonth(asset.getPurchasedate())); + //有效日期 + item.put("periodofvalidity", asset.getPeriodofvalidity()==null?"":Tools.getCurrentMonth(asset.getPeriodofvalidity())); + //保修日期 + item.put("warrantydate", asset.getWarrantydate()==null?"":Tools.getCurrentMonth(asset.getWarrantydate())); + //资产编号 + item.put("assetnum", Tools.dealNullStr(asset.getAssetnum())); + //资产序列号 + item.put("serialnum", Tools.dealNullStr(asset.getSerialnum())); + //供应商 + item.put("supplier", asset.getSupplier()==null?"":asset.getSupplier().getSupplier()); + //供应商 + item.put("supplierID", asset.getSupplier()==null?"":asset.getSupplier().getId()); + //标签 + item.put("labels", Tools.dealNullStr(asset.getLabels())); + item.put("description", Tools.dealNullStr(asset.getDescription())); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>查找资产信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>回写查询资产信息结果异常", e); + } + } + + /** + * 导出excel表格 + * @return + */ + @SuppressWarnings("unchecked") + public String exportExcel() + { + Log.infoFileSync("===================调用导出资产信息action方法exportExcel开始======================="); + try + { + PageUtil pageUtil = (PageUtil)getSession().get("pageUtil"); + + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + //pageUtil.setAdvSearch(getCondition()); + String isCurrentPage = model.getIsAllData(); + model.setFileName(Tools.changeUnicode(model.getFileName() + ".xls",model.getBrowserType())); + model.setExcelStream(assetService.exmportExcel(isCurrentPage,pageUtil)); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出资产信息action方法exportExcel异常",e); + model.getShowModel().setMsgTip("export excel exception"); + } + Log.infoFileSync("===================调用导出资产信息action方法exportExcel结束=================="); + return AssetConstants.BusinessForExcel.EXCEL; + } + + + /** + * 导入资产excel表格内容 + */ + public String importExcel() + { + //资产excel表格file + Boolean result = false; + String returnStr = ""; + try + { + InputStream in = assetService.importExcel(model.getAssetFile(), model.getIsCheck()); + + if(null != in) + { + model.setFileName(Tools.getRandomChar() + Tools.getNow2(Calendar.getInstance().getTime()) + "_wrong.xls"); + model.setExcelStream(in); + returnStr = AssetConstants.BusinessForExcel.EXCEL; + } + else + { + result = true; + try + { + toClient(result.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>回写导入资产信息结果异常", e); + } + //导入数据成功 + returnStr = SUCCESS; + } + + } + catch (AmsException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>导入excel表格信息异常", e); + } + return returnStr; + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("assetname.id_n_eq", model.getAssetNameID()); + condition.put("assetname.category.id_n_eq", model.getAssetCategoryID()); + condition.put("user.id_n_eq", model.getUserID()); + condition.put("status_n_eq", model.getStatus()); + condition.put("supplier.id_n_eq", model.getSupplierID()); + condition.put("createtime_s_order", "desc"); + return condition; + } + + /** + * 根据状态码转化成说明字符串 + * 资产的状态:0==在库,1==在用,2==消费 + * @param statusCode + * @return + */ + private String getStatusInfo(short statusCode) + { + String statusInfo = ""; + switch(statusCode) + { + case AssetConstants.BusinessForExcel.EXCEl_STATUS_ZAIKU: + statusInfo = "在库"; + break; + + case AssetConstants.BusinessForExcel.EXCEl_STATUS_INUSE: + statusInfo = "在用"; + break; + + case AssetConstants.BusinessForExcel.EXCEl_STATUS_CONSUME: + statusInfo = "消费"; + break; + } + return statusInfo; + } + + //=========Spring注入以及model驱动公共方法=========== + public void setAssetService(AssetIService assetService) + { + this.assetService = assetService; + } + + public void setCategoryService(CategoryIService categoryService) + { + this.categoryService = categoryService; + } + + public void setSupplierService(SupplierIService supplierService) + { + this.supplierService = supplierService; + } + + public void setUserService(UserIService userService) + { + this.userService = userService; + } + + public void setAssetnameService(AssetNameIService assetnameService) + { + this.assetnameService = assetnameService; + } + + @Override + public AssetModel getModel() + { + return model; + } +} diff --git a/src/com/jsh/action/asset/ReportAction.java b/src/com/jsh/action/asset/ReportAction.java new file mode 100644 index 00000000..831347cb --- /dev/null +++ b/src/com/jsh/action/asset/ReportAction.java @@ -0,0 +1,120 @@ +package com.jsh.action.asset; + +import java.util.HashMap; +import java.util.Map; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.model.vo.asset.ReportModel; +import com.jsh.service.asset.ReportIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class ReportAction extends BaseAction +{ + private ReportModel model = new ReportModel(); + private ReportIService reportService; + + /** + * 查找资产信息 + * @return + */ + public String find() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getCondition()); + String reportType = getReportType(new HashMap()); + reportService.find(pageUtil,reportType.split("_")[0],reportType.split("_")[1]); + model.getShowModel().setReportData(pageUtil.getPageList()); + } + catch (AmsException e) + { + Log.errorFileSync(">>>>>>>>>查找资产信息异常", e); + model.getShowModel().setMsgTip("get report data exception"); + } + return SUCCESS; + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("assetname.id_n_eq", model.getAssetNameID()); + condition.put("assetname.category.id_n_eq", model.getAssetCategoryID()); + condition.put("user.id_n_eq", model.getUsernameID()); + condition.put("status_n_eq", model.getStatus()); + condition.put("supplier.id_n_eq", model.getSupplierID()); + condition.put("dataSum_s_order","desc"); + //拼接统计数据条件 + getReportType(condition); + return condition; + } + + /** + * 获取统计条件 + * @param condition + */ + private String getReportType(Map condition) + { +// +// +// +// +// + int reportType = model.getReportType(); + String reportTypeInfo = ""; + String reportTypeName = ""; + switch(reportType) + { + case 0: + condition.put("status_s_gb", "group"); + reportTypeInfo = "status"; + reportTypeName = "status"; + break; + case 1: + condition.put("assetname.category.id_s_gb", "group"); + reportTypeInfo = "assetname.category.id"; + reportTypeName = "assetname.category.assetname"; + break; + case 2: + condition.put("supplier.id_s_gb", "group"); + reportTypeInfo = "supplier.id"; + reportTypeName = "supplier.supplier"; + break; + case 3: + condition.put("assetname.id_s_gb", "group"); + reportTypeInfo = "assetname.id"; + reportTypeName = "assetname.assetname"; + break; + case 4: + condition.put("user.id_s_gb", "group"); + reportTypeInfo = "user.id"; + reportTypeName = "user.username"; + break; + } + return reportTypeInfo + "_" + reportTypeName; + } + //=========Spring注入以及model驱动公共方法=========== + public void setReportService(ReportIService reportService) + { + this.reportService = reportService; + } + + @Override + public ReportModel getModel() + { + return model; + } +} diff --git a/src/com/jsh/action/basic/AppAction.java b/src/com/jsh/action/basic/AppAction.java new file mode 100644 index 00000000..6a9e1fe6 --- /dev/null +++ b/src/com/jsh/action/basic/AppAction.java @@ -0,0 +1,544 @@ +package com.jsh.action.basic; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.struts2.ServletActionContext; +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.exception.AmsException; +import com.jsh.model.po.App; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.AppModel; +import com.jsh.service.basic.AppIService; +import com.jsh.service.basic.UserBusinessIService; +import com.jsh.util.common.PageUtil; +//import com.opensymphony.xwork2.ActionContext; + +@SuppressWarnings("serial") +public class AppAction extends BaseAction +{ + private AppIService appService; + private UserBusinessIService userBusinessService; + private AppModel model = new AppModel(); + + + /** + * 增加应用 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加应用方法create()==================="); + Boolean flag = false; + try + { + App app = new App(); + app.setNumber(model.getNumber()); + app.setName(model.getName()); + app.setType(model.getType()); + + try { + if(model.getIcon()!=null) + { + String path = ServletActionContext.getServletContext().getRealPath("/upload/images/deskIcon"); + String iconName=model.getIcon(); + File file1 = new File(iconName); //文件 + String FileName = file1.getName(); //获取文件名 + app.setIcon(FileName); //设置图片ICON + InputStream is = new FileInputStream(iconName); + File file = new File(path, FileName); + OutputStream os = new FileOutputStream(file); + byte[] b = new byte[1024]; + int bs = 0; + while ((bs = is.read(b)) > 0) { + os.write(b, 0, bs); + } + is.close(); + os.close(); + } + + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + app.setURL(model.getURL()); + app.setWidth(model.getWidth()); + app.setHeight(model.getHeight()); + app.setReSize(model.getReSize()); + app.setOpenMax(model.getOpenMax()); + app.setFlash(model.getFlash()); + app.setZL(model.getZL()); + app.setSort(model.getSort()); + app.setRemark(model.getRemark()); + app.setEnabled(model.getEnabled()); + appService.create(app); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加应用异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加应用回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加应用", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加应用名称为 "+ model.getName() + " " + tipMsg + "!", "增加应用" + tipMsg)); + Log.infoFileSync("==================结束调用增加应用方法create()==================="); + } + + /** + * 删除应用 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除应用方法delete()================"); + try + { + appService.delete(model.getAppID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAppID() + " 的应用异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除应用", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除应用ID为 "+ model.getAppID() + " " + tipMsg + "!", "删除应用" + tipMsg)); + Log.infoFileSync("====================结束调用删除应用方法delete()================"); + return SUCCESS; + } + + /** + * 更新仓库 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + App app = appService.get(model.getAppID()); + app.setNumber(model.getNumber()); + app.setName(model.getName()); + app.setType(model.getType()); + //app.setIcon(model.getIcon()); + app.setURL(model.getURL()); + app.setWidth(model.getWidth()); + app.setHeight(model.getHeight()); + app.setReSize(model.getReSize()); + app.setOpenMax(model.getOpenMax()); + app.setFlash(model.getFlash()); + app.setZL(model.getZL()); + app.setSort(model.getSort()); + app.setRemark(model.getRemark()); + app.setEnabled(model.getEnabled()); + appService.update(app); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改应用ID为 : " + model.getAppID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改应用回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新应用", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新应用ID为 "+ model.getAppID() + " " + tipMsg + "!", "更新应用" + tipMsg)); + } + + /** + * 批量删除指定ID应用 + * @return + */ + public String batchDelete() + { + try + { + appService.batchDelete(model.getAppIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除应用ID为:" + model.getAppIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除应用", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除应用ID为 "+ model.getAppIDs() + " " + tipMsg + "!", "批量删除应用" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() + { + Boolean flag = false; + try + { + flag = appService.checkIsNameExist("name",model.getName(),"Id", model.getAppID()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!"); + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>回写检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!",e); + } + } + } + + /** + * 查找应用信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + appService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(App app:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", app.getId()); + //应用名称 + item.put("Number", app.getNumber()); + item.put("Name", app.getName()); + item.put("Type", app.getType()); + item.put("Icon", app.getIcon()); + item.put("URL", app.getURL()); + item.put("Width", app.getWidth()); + item.put("Height", app.getHeight()); + item.put("ReSize", app.getReSize()); + item.put("OpenMax", app.getOpenMax()); + item.put("Flash", app.getFlash()); + item.put("ZL", app.getZL()); + item.put("Sort", app.getSort()); + item.put("Remark", app.getRemark()); + item.put("Enabled", app.getEnabled()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); + } + } + + /** + * 桌面应用显示 + * @return + */ + public void findDesk() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(100); + //pageUtil.setCurPage(model.getPageNo()); + + JSONObject outer = new JSONObject(); + + //下面是dock + pageUtil.setAdvSearch(getCondition_dock()); + appService.find(pageUtil); + List dataList1 = pageUtil.getPageList(); + + //开始拼接json数据 + //存放数据json数组 + JSONArray dataArray1 = new JSONArray(); + if(null != dataList1) + { + for(App app:dataList1) + { + JSONObject item = new JSONObject(); + item.put("id", app.getId()); + item.put("title", app.getName()); + item.put("type", app.getType()); + item.put("icon", "../../upload/images/deskIcon/"+app.getIcon()); + item.put("url", app.getURL()); + item.put("width", app.getWidth()); + item.put("height", app.getHeight()); + item.put("isresize", app.getReSize()); + item.put("isopenmax", app.getOpenMax()); + item.put("isflash", app.getFlash()); + dataArray1.add(item); + } + } + outer.put("dock", dataArray1); + + //下面是desk + pageUtil.setAdvSearch(getCondition_desk()); + appService.find(pageUtil); + List dataList2 = pageUtil.getPageList(); + + //开始拼接json数据 + //存放数据json数组 + JSONArray dataArray2 = new JSONArray(); + if(null != dataList2) + { + for(App app:dataList2) + { + JSONObject item = new JSONObject(); + item.put("id", app.getId()); + item.put("title", app.getName()); + item.put("type", app.getType()); + item.put("icon", "../../upload/images/deskIcon/"+app.getIcon()); + item.put("url", "../../pages/common/menu.jsp?appID="+app.getNumber()+"&id="+app.getId()); + item.put("width", app.getWidth()); + item.put("height", app.getHeight()); + item.put("isresize", app.getReSize()); + item.put("isopenmax", app.getOpenMax()); + item.put("isflash", app.getFlash()); + dataArray2.add(item); + } + } + outer.put("desk", dataArray2); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); + } + } + + + /** + * 角色对应应用显示 + * @return + */ + public void findRoleAPP() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(100); + //pageUtil.setCurPage(model.getPageNo()); + + pageUtil.setAdvSearch(getCondition_RoleAPP()); + appService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 + JSONObject outer = new JSONObject(); + outer.put("id", 1); + outer.put("text", "应用列表"); + outer.put("state", "open"); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(App app:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", app.getId()); + item.put("text", app.getName()); + //勾选判断1 + Boolean flag = false; + try + { + flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+app.getId().toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag==true){item.put("checked", true);} + //结束 + dataArray.add(item); + } + } + outer.put("children", dataArray); + //回写查询结果 + toClient("["+outer.toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Name_s_like", model.getName()); + condition.put("Type_s_like", model.getType()); + condition.put("Sort_s_order", "asc"); + return condition; + } + + /** + * 拼接搜索条件-桌面dock + * @return + */ + private Map getCondition_dock() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("ZL_s_eq", "dock"); + condition.put("Enabled_n_eq", 1); + condition.put("Sort_s_order", "asc"); + return condition; + } + + /** + * 拼接搜索条件-桌面desk + * @return + */ + private Map getCondition_desk() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("ZL_s_eq", "desk"); + condition.put("Enabled_n_eq", 1); + condition.put("Sort_s_order", "asc"); + return condition; + } + + /** + * 拼接搜索条件-角色对应应用 + * @return + */ + private Map getCondition_RoleAPP() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Enabled_n_eq", 1); + condition.put("Sort_s_order", "asc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public AppModel getModel() + { + return model; + } + public void setAppService(AppIService appService) + { + this.appService = appService; + } + + public void setUserBusinessService(UserBusinessIService userBusinessService) { + this.userBusinessService = userBusinessService; + } + +} diff --git a/src/com/jsh/action/basic/AssetNameAction.java b/src/com/jsh/action/basic/AssetNameAction.java new file mode 100644 index 00000000..513b05f5 --- /dev/null +++ b/src/com/jsh/action/basic/AssetNameAction.java @@ -0,0 +1,289 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Assetname; +import com.jsh.model.po.Category; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.AssetNameModel; +import com.jsh.service.basic.AssetNameIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class AssetNameAction extends BaseAction +{ + private AssetNameModel model = new AssetNameModel(); + + private AssetNameIService assetnameService; + /** + * 增加资产名称 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加资产名称方法create()==================="); + Boolean flag = false; + try + { + Assetname assetname = new Assetname(); + assetname.setAssetname(model.getAssetName()); + //增加资产类型 + assetname.setCategory(new Category(model.getCategoryID())); + + assetname.setIsystem((short)1); + assetname.setIsconsumables(model.getConsumable()); + assetname.setDescription(model.getDescription()); + assetnameService.create(assetname); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产名称异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加资产名称回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加资产名称", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加资产名称名称为 "+ model.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg)); + Log.infoFileSync("==================结束调用增加资产名称方法create()==================="); + } + + /** + * 删除资产名称 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除资产名称信息方法delete()================"); + try + { + assetnameService.delete(model.getAssetNameID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetNameID() + " 的资产名称异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除资产名称", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg)); + Log.infoFileSync("====================结束调用删除资产名称信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新资产名称 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Assetname assetname = assetnameService.get(model.getAssetNameID()); + //增加资产类型 + assetname.setCategory(new Category(model.getCategoryID())); + assetname.setAssetname(model.getAssetName()); + assetname.setIsconsumables(model.getConsumable()); + assetname.setDescription(model.getDescription()); + assetnameService.update(assetname); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改资产名称ID为 : " + model.getAssetNameID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改资产名称回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新资产名称", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg)); + } + + /** + * 批量删除指定ID资产名称 + * @return + */ + public String batchDelete() + { + try + { + assetnameService.batchDelete(model.getAssetNameIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除资产名称ID为:" + model.getAssetNameIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除资产名称", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除资产名称ID为 "+ model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() + { + Boolean flag = false; + try + { + flag = assetnameService.checkIsNameExist("assetname",model.getAssetName(),"id", model.getAssetNameID()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!"); + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!",e); + } + } + } + + /** + * 查找供应商信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + assetnameService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Assetname assetname:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", assetname.getId()); + //供应商名称 + item.put("assetname", assetname.getAssetname()); + item.put("isystem", assetname.getIsystem() == (short)0?"是":"否"); + item.put("consumable", assetname.getIsconsumables() == (short)0?"是":"否"); + item.put("consumableStatus", assetname.getIsconsumables()); + item.put("description", assetname.getDescription()); + item.put("categoryID", assetname.getCategory().getId()); + item.put("category", assetname.getCategory().getAssetname()); + item.put("op", assetname.getIsystem()); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产名称信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产名称信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("assetname_s_like", model.getAssetName()); + condition.put("isconsumables_n_eq", model.getConsumable()); + condition.put("description_s_like", model.getDescription()); + condition.put("category.id_n_eq", model.getCategoryID()); + condition.put("id_s_order", "desc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public AssetNameModel getModel() + { + return model; + } + + public void setAssetnameService(AssetNameIService assetnameService) + { + this.assetnameService = assetnameService; + } +} diff --git a/src/com/jsh/action/basic/CategoryAction.java b/src/com/jsh/action/basic/CategoryAction.java new file mode 100644 index 00000000..2108098e --- /dev/null +++ b/src/com/jsh/action/basic/CategoryAction.java @@ -0,0 +1,273 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Category; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.CategoryModel; +import com.jsh.service.basic.CategoryIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class CategoryAction extends BaseAction +{ + private CategoryIService categoryService; + private CategoryModel model = new CategoryModel(); + /** + * 增加资产类型 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加资产类型方法create()==================="); + Boolean flag = false; + try + { + Category category = new Category(); + category.setAssetname(model.getCategoryName()); + category.setIsystem((short)1); + category.setDescription(model.getDescription()); + categoryService.create(category); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产类型异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加资产类型回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加资产类型", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加资产类型名称为 "+ model.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg)); + Log.infoFileSync("==================结束调用增加资产类型方法create()==================="); + } + + /** + * 删除资产类型 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================"); + try + { + categoryService.delete(model.getCategoryID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg)); + Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新资产类型 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Category category = categoryService.get(model.getCategoryID()); + category.setAssetname(model.getCategoryName()); + category.setDescription(model.getDescription()); + categoryService.update(category); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改资产类型ID为 : " + model.getCategoryID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改资产类型回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新资产类型", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg)); + } + + /** + * 批量删除指定ID资产类型 + * @return + */ + public String batchDelete() + { + try + { + categoryService.batchDelete(model.getCategoryIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除资产类型ID为 "+ model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() + { + Boolean flag = false; + try + { + flag = categoryService.checkIsNameExist("assetname",model.getCategoryName(),"id", model.getCategoryID()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!"); + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!",e); + } + } + } + + /** + * 查找供应商信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + categoryService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Category category:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", category.getId()); + //供应商名称 + item.put("categoryname", category.getAssetname()); + item.put("isystem", category.getIsystem() == (short)0?"是":"否"); + item.put("description", category.getDescription()); + item.put("op", category.getIsystem()); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产类型信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产类型信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("assetname_s_like", model.getCategoryName()); + condition.put("description_s_like", model.getDescription()); + condition.put("id_s_order", "desc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public CategoryModel getModel() + { + return model; + } + public void setCategoryService(CategoryIService categoryService) + { + this.categoryService = categoryService; + } +} diff --git a/src/com/jsh/action/basic/DepotAction.java b/src/com/jsh/action/basic/DepotAction.java new file mode 100644 index 00000000..391f5c48 --- /dev/null +++ b/src/com/jsh/action/basic/DepotAction.java @@ -0,0 +1,380 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Depot; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.Role; +import com.jsh.model.vo.basic.DepotModel; +import com.jsh.service.basic.DepotIService; +import com.jsh.service.basic.UserBusinessIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class DepotAction extends BaseAction +{ + private DepotIService depotService; + private UserBusinessIService userBusinessService; + private DepotModel model = new DepotModel(); + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public String getBasicData() + { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + Map condition = pageUtil.getAdvSearch(); + condition.put("id_s_order", "asc"); + depotService.find(pageUtil); + mapData.put("depotList", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } + + /** + * 增加仓库 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加仓库信息方法create()==================="); + Boolean flag = false; + try + { + Depot depot = new Depot(); + depot.setName(model.getName()); + depot.setSort(model.getSort()); + depot.setRemark(model.getRemark()); + depotService.create(depot); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓库信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加仓库信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加仓库", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加仓库名称为 "+ model.getName() + " " + tipMsg + "!", "增加仓库" + tipMsg)); + Log.infoFileSync("==================结束调用增加仓库方法create()==================="); + } + + /** + * 删除仓库 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除仓库信息方法delete()================"); + try + { + depotService.delete(model.getDepotID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotID() + " 的仓库异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除仓库", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "删除仓库" + tipMsg)); + Log.infoFileSync("====================结束调用删除仓库信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新仓库 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Depot depot = depotService.get(model.getDepotID()); + depot.setName(model.getName()); + depot.setSort(model.getSort()); + depot.setRemark(model.getRemark()); + depotService.update(depot); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改仓库ID为 : " + model.getDepotID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改仓库回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新仓库", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "更新仓库" + tipMsg)); + } + + /** + * 批量删除指定ID仓库 + * @return + */ + public String batchDelete() + { + try + { + depotService.batchDelete(model.getDepotIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除仓库ID为:" + model.getDepotIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除仓库", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除仓库ID为 "+ model.getDepotIDs() + " " + tipMsg + "!", "批量删除仓库" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() + { + Boolean flag = false; + try + { + flag = depotService.checkIsNameExist("name",model.getName(),"id", model.getDepotID()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!"); + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>回写检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!",e); + } + } + } + + /** + * 查找仓库信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + depotService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Depot depot:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", depot.getId()); + //供应商名称 + item.put("name", depot.getName()); + item.put("sort", depot.getSort()); + item.put("remark", depot.getRemark()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e); + } + } + + /** + * 用户对应部门显示 + * @return + */ + public void findUserDepot() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(100); + //pageUtil.setCurPage(model.getPageNo()); + + pageUtil.setAdvSearch(getCondition_UserDepot()); + depotService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 + JSONObject outer = new JSONObject(); + outer.put("id", 1); + outer.put("text", "部门列表"); + outer.put("state", "open"); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Depot depot:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", depot.getId()); + item.put("text", depot.getName()); + //勾选判断1 + Boolean flag = false; + try + { + flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+depot.getId().toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的部门:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag==true){item.put("checked", true);} + //结束 + dataArray.add(item); + } + } + outer.put("children", dataArray); + //回写查询结果 + toClient("["+outer.toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找部门异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询部门结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("name_s_like", model.getName()); + condition.put("remark_s_like", model.getRemark()); + condition.put("sort_s_order", "asc"); + return condition; + } + + /** + * 拼接搜索条件-用户对应部门 + * @return + */ + private Map getCondition_UserDepot() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Id_s_order", "asc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public DepotModel getModel() + { + return model; + } + public void setDepotService(DepotIService depotService) + { + this.depotService = depotService; + } + + public void setUserBusinessService(UserBusinessIService userBusinessService) { + this.userBusinessService = userBusinessService; + } + +} diff --git a/src/com/jsh/action/basic/FunctionsAction.java b/src/com/jsh/action/basic/FunctionsAction.java new file mode 100644 index 00000000..9aa5470f --- /dev/null +++ b/src/com/jsh/action/basic/FunctionsAction.java @@ -0,0 +1,588 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.exception.AmsException; +import com.jsh.model.po.App; +import com.jsh.model.po.Functions; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.FunctionsModel; +import com.jsh.service.basic.FunctionsIService; +import com.jsh.service.basic.UserBusinessIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class FunctionsAction extends BaseAction +{ + private FunctionsIService functionsService; + private UserBusinessIService userBusinessService; + private FunctionsModel model = new FunctionsModel(); + /** + * 增加功能 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加功能信息方法create()==================="); + Boolean flag = false; + try + { + Functions functions = new Functions(); + functions.setNumber(model.getNumber()); + functions.setName(model.getName()); + functions.setPNumber(model.getPNumber()); + functions.setURL(model.getURL()); + functions.setState(model.getState()); + functions.setSort(model.getSort()); + functions.setEnabled(model.getEnabled()); + functions.setType(model.getType()); + + functionsService.create(functions); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加功能信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加功能信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加功能", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加功能名称为 "+ model.getName() + " " + tipMsg + "!", "增加功能" + tipMsg)); + Log.infoFileSync("==================结束调用增加功能方法create()==================="); + } + + /** + * 删除功能 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除功能信息方法delete()================"); + try + { + functionsService.delete(model.getFunctionsID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getFunctionsID() + " 的功能异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除功能", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除功能ID为 "+ model.getFunctionsID() + " " + tipMsg + "!", "删除功能" + tipMsg)); + Log.infoFileSync("====================结束调用删除功能信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新功能 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Functions functions = functionsService.get(model.getFunctionsID()); + functions.setNumber(model.getNumber()); + functions.setName(model.getName()); + functions.setPNumber(model.getPNumber()); + functions.setURL(model.getURL()); + functions.setState(model.getState()); + functions.setSort(model.getSort()); + functions.setEnabled(model.getEnabled()); + functions.setType(model.getType()); + functionsService.update(functions); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改功能ID为 : " + model.getFunctionsID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改功能回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新功能", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新功能ID为 "+ model.getFunctionsID() + " " + tipMsg + "!", "更新功能" + tipMsg)); + } + + /** + * 批量删除指定ID功能 + * @return + */ + public String batchDelete() + { + try + { + functionsService.batchDelete(model.getFunctionsIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除功能ID为:" + model.getFunctionsIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除功能", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除功能ID为 "+ model.getFunctionsIDs() + " " + tipMsg + "!", "批量删除功能" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() + { + Boolean flag = false; + try + { + flag = functionsService.checkIsNameExist("Name",model.getName(),"Id", model.getFunctionsID()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查功能名称为:" + model.getName() + " ID为: " + model.getFunctionsID() + " 是否存在异常!"); + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>回写检查功能名称为:" + model.getName() + " ID为: " + model.getFunctionsID() + " 是否存在异常!",e); + } + } + } + + /** + * 查找功能信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + functionsService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Functions functions:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", functions.getId()); + item.put("Number", functions.getNumber()); + item.put("Name", functions.getName()); + item.put("PNumber", functions.getPNumber()); + item.put("URL", functions.getURL()); + item.put("State", functions.getState()); + item.put("Sort", functions.getSort()); + item.put("Enabled", functions.getEnabled()); + item.put("Type", functions.getType()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找功能信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询功能信息结果异常", e); + } + } + + + /** + * 角色对应功能显示 + * @return + */ + public void findRoleFunctions() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(200); + pageUtil.setAdvSearch(getCondition_RoleFunctions("0")); + functionsService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 + JSONObject outer = new JSONObject(); + outer.put("id", 1); + outer.put("text", "功能列表"); + outer.put("state", "open"); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Functions functions:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", functions.getId()); + item.put("text", functions.getName()); + + //勾选判断1 + Boolean flag = false; + try + { + flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions.getId().toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag==true){item.put("checked", true);} + //结束 + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber())); + functionsService.find(pageUtil); + List dataList1 = pageUtil.getPageList(); + JSONArray dataArray1 = new JSONArray(); + if(null != dataList1) + { + + for(Functions functions1:dataList1) + { + item.put("state", "open"); //如果不为空,节点不展开 + JSONObject item1 = new JSONObject(); + item1.put("id", functions1.getId()); + item1.put("text", functions1.getName()); + + //勾选判断2 + //Boolean flag = false; + try + { + flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions1.getId().toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag==true){item1.put("checked", true);} + //结束 + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber())); + functionsService.find(pageUtil); + List dataList2 = pageUtil.getPageList(); + JSONArray dataArray2 = new JSONArray(); + if(null != dataList2) + { + + for(Functions functions2:dataList2) + { + item1.put("state", "closed"); //如果不为空,节点不展开 + JSONObject item2 = new JSONObject(); + item2.put("id", functions2.getId()); + item2.put("text", functions2.getName()); + + //勾选判断3 + //Boolean flag = false; + try + { + flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions2.getId().toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag==true){item2.put("checked", true);} + //结束 + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber())); + functionsService.find(pageUtil); + List dataList3 = pageUtil.getPageList(); + JSONArray dataArray3 = new JSONArray(); + if(null != dataList3) + { + + for(Functions functions3:dataList3) + { + item2.put("state", "closed"); //如果不为空,节点不展开 + JSONObject item3 = new JSONObject(); + item3.put("id", functions3.getId()); + item3.put("text", functions3.getName()); + + //勾选判断4 + //Boolean flag = false; + try + { + flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions3.getId().toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag==true){item3.put("checked", true);} + //结束 + + dataArray3.add(item3); + item2.put("children", dataArray3); + } + } + + dataArray2.add(item2); + item1.put("children", dataArray2); + } + } + + dataArray1.add(item1); + item.put("children", dataArray1); + } + + } + + dataArray.add(item); + } + outer.put("children", dataArray); + } + //回写查询结果 + toClient("["+outer.toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); + } + } + + + /** + * 页面显示菜单 + * @return + */ + public void findMenu() + { + try + { + String fc=model.getHasFunctions(); //当前用户所拥有的功能列表,格式如:[1][2][5] + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(200); + pageUtil.setAdvSearch(getCondition_RoleFunctions(model.getPNumber())); + functionsService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Functions functions:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", functions.getId()); + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber())); + functionsService.find(pageUtil); + List dataList1 = pageUtil.getPageList(); + JSONArray dataArray1 = new JSONArray(); + if(dataList1.size()!=0) + { + item.put("text", functions.getName()); //是目录就没链接 + for(Functions functions1:dataList1) + { + item.put("state", "open"); //如果不为空,节点展开 + JSONObject item1 = new JSONObject(); + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber())); + functionsService.find(pageUtil); + List dataList2 = pageUtil.getPageList(); + if(fc.indexOf("["+functions1.getId().toString()+"]")!=-1||dataList2.size()!=0) + { + item1.put("id", functions1.getId()); + JSONArray dataArray2 = new JSONArray(); + if(dataList2.size()!=0) + { + item1.put("text", functions1.getName());//是目录就没链接 + for(Functions functions2:dataList2) + { + item1.put("state", "closed"); //如果不为空,节点不展开 + JSONObject item2 = new JSONObject(); + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber())); + functionsService.find(pageUtil); + List dataList3 = pageUtil.getPageList(); + if(fc.indexOf("["+functions2.getId().toString()+"]")!=-1||dataList3.size()!=0) + { + item2.put("id", functions2.getId()); + JSONArray dataArray3 = new JSONArray(); + if(dataList3.size()!=0) + { + item2.put("text", functions2.getName());//是目录就没链接 + for(Functions functions3:dataList3) + { + item2.put("state", "closed"); //如果不为空,节点不展开 + JSONObject item3 = new JSONObject(); + item3.put("id", functions3.getId()); + item3.put("text", functions3.getName()); + // + dataArray3.add(item3); + item2.put("children", dataArray3); + } + } + else + { + //不是目录,有链接 + item2.put("text", ""+functions2.getName()+""); + } + + dataArray2.add(item2); + item1.put("children", dataArray2); + } + } + } + else + { + //不是目录,有链接 + item1.put("text", ""+functions1.getName()+""); + } + + dataArray1.add(item1); + item.put("children", dataArray1); + } + } + } + else + { + //不是目录,有链接 + item.put("text", ""+functions.getName()+""); + } + + dataArray.add(item); + } + } + //回写查询结果 + toClient(dataArray.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Name_s_like", model.getName()); + condition.put("Type_s_eq", model.getType()); + condition.put("Sort_s_order", "asc"); + return condition; + } + + /** + * 拼接搜索条件-角色对应功能 + * @return + */ + private Map getCondition_RoleFunctions(String num) + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Enabled_n_eq", 1); + condition.put("PNumber_s_eq", num); + condition.put("Sort_s_order", "asc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public FunctionsModel getModel() + { + return model; + } + public void setFunctionsService(FunctionsIService functionsService) + { + this.functionsService = functionsService; + } + + public void setUserBusinessService(UserBusinessIService userBusinessService) { + this.userBusinessService = userBusinessService; + } + +} diff --git a/src/com/jsh/action/basic/LogAction.java b/src/com/jsh/action/basic/LogAction.java new file mode 100644 index 00000000..fe722ba2 --- /dev/null +++ b/src/com/jsh/action/basic/LogAction.java @@ -0,0 +1,192 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.LogModel; +import com.jsh.service.basic.UserIService; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.Tools; + +@SuppressWarnings("serial") +public class LogAction extends BaseAction +{ + private LogModel model = new LogModel(); + private UserIService userService; + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public String getBasicData() + { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + Map condition = pageUtil.getAdvSearch(); + condition.clear(); + condition.put("ismanager_n_eq", 0); + userService.find(pageUtil); + mapData.put("userList", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } + + /** + * 删除日志 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除日志信息方法delete()================"); + try + { + logService.delete(model.getLogID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getLogID() + " 的日志异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除日志", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除日志ID为 "+ model.getLogID() + " " + tipMsg + "!", "删除日志" + tipMsg)); + Log.infoFileSync("====================结束调用删除日志信息方法delete()================"); + return SUCCESS; + } + + /** + * 批量删除指定ID日志 + * @return + */ + public String batchDelete() + { + try + { + logService.batchDelete(model.getLogIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除日志ID为:" + model.getLogIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除日志", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除日志ID为 "+ model.getLogIDs() + " " + tipMsg + "!", "批量删除日志" + tipMsg)); + return SUCCESS; + } + + /** + * 查找日志信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + logService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Logdetails log:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", log.getId()); + item.put("clientIP", log.getClientIp()); + item.put("details", log.getContentdetails()); + item.put("createTime", Tools.getCenternTime(log.getCreatetime())); + item.put("operation", log.getOperation()); + item.put("remark", log.getRemark()); + item.put("status", log.getStatus() == 0 ?"成功":"失败"); + item.put("statusShort", log.getStatus()); + item.put("username", log.getUser()==null?"":log.getUser().getUsername()); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>查找日志信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>回写查询日志信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("user.id_n_eq", model.getUsernameID()); + condition.put("createtime_s_gteq", model.getBeginTime()); + condition.put("createtime_s_lteq", model.getEndTime()); + condition.put("operation_s_like", model.getOperation()); + condition.put("clientIp_s_like", model.getClientIp()); + condition.put("status_n_eq", model.getStatus()); + condition.put("contentdetails_s_like", model.getContentdetails()); + condition.put("remark_s_like", model.getRemark()); + condition.put("createtime_s_order", "desc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + public void setUserService(UserIService userService) + { + this.userService = userService; + } + + @Override + public LogModel getModel() + { + return model; + } +} diff --git a/src/com/jsh/action/basic/RoleAction.java b/src/com/jsh/action/basic/RoleAction.java new file mode 100644 index 00000000..eb703031 --- /dev/null +++ b/src/com/jsh/action/basic/RoleAction.java @@ -0,0 +1,347 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.exception.AmsException; +import com.jsh.model.po.App; +import com.jsh.model.po.Role; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.RoleModel; +import com.jsh.service.basic.RoleIService; +import com.jsh.service.basic.UserBusinessIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class RoleAction extends BaseAction +{ + private RoleIService roleService; + private UserBusinessIService userBusinessService; + private RoleModel model = new RoleModel(); + /** + * 增加角色 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加角色信息方法create()==================="); + Boolean flag = false; + try + { + Role role = new Role(); + role.setName(model.getName()); + roleService.create(role); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加角色信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加角色信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加角色", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加角色名称为 "+ model.getName() + " " + tipMsg + "!", "增加角色" + tipMsg)); + Log.infoFileSync("==================结束调用增加角色方法create()==================="); + } + + /** + * 删除角色 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除角色信息方法delete()================"); + try + { + roleService.delete(model.getRoleID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getRoleID() + " 的角色异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除角色", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "删除角色" + tipMsg)); + Log.infoFileSync("====================结束调用删除角色信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新角色 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Role role = roleService.get(model.getRoleID()); + role.setName(model.getName()); + roleService.update(role); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改角色ID为 : " + model.getRoleID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改角色回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新角色", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "更新角色" + tipMsg)); + } + + /** + * 批量删除指定ID角色 + * @return + */ + public String batchDelete() + { + try + { + roleService.batchDelete(model.getRoleIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除角色ID为:" + model.getRoleIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除角色", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除角色ID为 "+ model.getRoleIDs() + " " + tipMsg + "!", "批量删除角色" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() + { + Boolean flag = false; + try + { + flag = roleService.checkIsNameExist("name",model.getName(),"Id", model.getRoleID()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!"); + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>回写检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!",e); + } + } + } + + /** + * 查找角色信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + roleService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Role role:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", role.getId()); + //供应商名称 + item.put("Name", role.getName()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色信息结果异常", e); + } + } + + /** + * 用户对应角色显示 + * @return + */ + public void findUserRole() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(100); + //pageUtil.setCurPage(model.getPageNo()); + + pageUtil.setAdvSearch(getCondition_UserRole()); + roleService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 + JSONObject outer = new JSONObject(); + outer.put("id", 1); + outer.put("text", "角色列表"); + outer.put("state", "open"); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Role role:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", role.getId()); + item.put("text", role.getName()); + //勾选判断1 + Boolean flag = false; + try + { + flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+role.getId().toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag==true){item.put("checked", true);} + //结束 + dataArray.add(item); + } + } + outer.put("children", dataArray); + //回写查询结果 + toClient("["+outer.toString()+"]"); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Name_s_like", model.getName()); + condition.put("Id_s_order", "asc"); + return condition; + } + + /** + * 拼接搜索条件-用户对应角色 + * @return + */ + private Map getCondition_UserRole() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Id_s_order", "asc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public RoleModel getModel() + { + return model; + } + public void setRoleService(RoleIService roleService) + { + this.roleService = roleService; + } + public void setUserBusinessService(UserBusinessIService userBusinessService) { + this.userBusinessService = userBusinessService; + } +} diff --git a/src/com/jsh/action/basic/SupplierAction.java b/src/com/jsh/action/basic/SupplierAction.java new file mode 100644 index 00000000..c15f3eae --- /dev/null +++ b/src/com/jsh/action/basic/SupplierAction.java @@ -0,0 +1,402 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.Supplier; +import com.jsh.model.vo.basic.SupplierModel; +import com.jsh.service.basic.SupplierIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class SupplierAction extends BaseAction +{ + private SupplierIService supplierService; + private SupplierModel model = new SupplierModel(); + + /** + * 增加供应商 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加供应商方法==================="); + Boolean flag = false; + try + { + Supplier supplier = new Supplier(); + supplier.setContacts(model.getContacts()); + supplier.setType(model.getType()); + supplier.setDescription(model.getDescription()); + supplier.setEmail(model.getEmail()); + supplier.setIsystem((short)1); + supplier.setPhonenum(model.getPhonenum()); + supplier.setSupplier(model.getSupplier()); + supplier.setEnabled(model.getEnabled()); + supplierService.create(supplier); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加供应商异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加供应商回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加供应商", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加供应商名称为 "+ model.getSupplier() + " " + tipMsg + "!", "增加供应商" + tipMsg)); + Log.infoFileSync("==================结束调用增加供应商方法==================="); + } + + /** + * 删除供应商 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除供应商信息方法delete()================"); + try + { + supplierService.delete(model.getSupplierID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getSupplierID() + " 的供应商异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除供应商", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除供应商ID为 "+ model.getSupplierID() + ",名称为 " + model.getSupplier() + tipMsg + "!", "删除供应商" + tipMsg)); + Log.infoFileSync("====================结束调用删除供应商信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新供应商 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Supplier supplier = supplierService.get(model.getSupplierID()); + supplier.setContacts(model.getContacts()); + supplier.setType(model.getType()); + supplier.setDescription(model.getDescription()); + supplier.setEmail(model.getEmail()); + supplier.setIsystem((short)1); + supplier.setPhonenum(model.getPhonenum()); + supplier.setSupplier(model.getSupplier()); + supplier.setEnabled(model.getEnabled()); + supplierService.update(supplier); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改供应商ID为 : " + model.getSupplierID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改供应商回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新供应商", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新供应商ID为 "+ model.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg)); + } + + /** + * 批量删除指定ID供应商 + * @return + */ + public String batchDelete() + { + try + { + supplierService.batchDelete(model.getSupplierIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除供应商ID为:" + model.getSupplierIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除供应商", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除供应商ID为 "+ model.getSupplierIDs() + " " + tipMsg + "!", "批量删除供应商" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() + { + Boolean flag = false; + try + { + flag = supplierService.checkIsNameExist("supplier",model.getSupplier(),"id", model.getSupplierID()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查供应商名称为:" + model.getSupplier() + " ID为: " + model.getSupplierID() + " 是否存在异常!"); + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>回写检查供应商名称为:" + model.getSupplier() + " ID为: " + model.getSupplierID() + " 是否存在异常!",e); + } + } + } + + /** + * 查找供应商信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + supplierService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Supplier supplier:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", supplier.getId()); + //供应商名称 + item.put("supplier", supplier.getSupplier()); + item.put("type", supplier.getType()); + item.put("contacts",supplier.getContacts()); + item.put("phonenum", supplier.getPhonenum()); + item.put("email", supplier.getEmail()); + item.put("isystem", supplier.getIsystem() == (short)0?"是":"否"); + item.put("description", supplier.getDescription()); + item.put("enabled", supplier.getEnabled()); + item.put("op", supplier.getIsystem()); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e); + } + } + + /** + * 查找供应商信息-下拉框 + * @return + */ + public void findBySelect_sup() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getCondition_Select_sup()); + supplierService.find(pageUtil); + List dataList = pageUtil.getPageList(); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Supplier supplier:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", supplier.getId()); + //供应商名称 + item.put("supplier", supplier.getSupplier()); + dataArray.add(item); + } + } + //回写查询结果 + toClient(dataArray.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e); + } + } + /** + * 查找客户信息-下拉框 + * @return + */ + public void findBySelect_cus() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getCondition_Select_cus()); + supplierService.find(pageUtil); + List dataList = pageUtil.getPageList(); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Supplier supplier:dataList) + { + JSONObject item = new JSONObject(); + item.put("id", supplier.getId()); + //客户名称 + item.put("supplier", supplier.getSupplier()); + dataArray.add(item); + } + } + //回写查询结果 + toClient(dataArray.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>查找客户信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>回写查询客户信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("supplier_s_like", model.getSupplier()); + condition.put("type_s_like", model.getType()); + condition.put("contacts_s_like", model.getContacts()); + condition.put("phonenum_s_like", model.getPhonenum()); + condition.put("email_s_like", model.getEmail()); + condition.put("description_s_like", model.getDescription()); + condition.put("id_s_order", "desc"); + return condition; + } + + /** + * 拼接搜索条件-下拉框-供应商 + * @return + */ + private Map getCondition_Select_sup() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("type_s_like", "供应商"); + condition.put("id_s_order", "desc"); + return condition; + } + /** + * 拼接搜索条件-下拉框-客户 + * @return + */ + private Map getCondition_Select_cus() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("type_s_like", "客户"); + condition.put("id_s_order", "desc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public SupplierModel getModel() + { + return model; + } + public void setSupplierService(SupplierIService supplierService) + { + this.supplierService = supplierService; + } +} diff --git a/src/com/jsh/action/basic/UserAction.java b/src/com/jsh/action/basic/UserAction.java new file mode 100644 index 00000000..f4332da7 --- /dev/null +++ b/src/com/jsh/action/basic/UserAction.java @@ -0,0 +1,480 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.security.NoSuchAlgorithmException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.constants.common.ExceptionCodeConstants; +import com.jsh.model.po.Basicuser; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.UserModel; +import com.jsh.service.basic.UserIService; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.Tools; + +@SuppressWarnings("serial") +public class UserAction extends BaseAction +{ + private UserModel model = new UserModel(); + private UserIService userService; + + /** + * 需要判断用户状态,用户名密码错误不能登录 ,黑名单用户不能登录,如果已经登录过,不再进行处理,直接进入管理页面 + * @return + */ + public String login() + { + Log.infoFileSync("============用户登录 login 方法调用开始=============="); + String username = model.getLoginame().trim(); + String password = model.getPassword().trim(); + //因密码用MD5加密,需要对密码进行转化 + try + { + password = Tools.md5Encryp(password); + } + catch (NoSuchAlgorithmException e) + { + e.printStackTrace(); + Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e); + } + + //判断用户是否已经登录过,登录过不再处理 + Basicuser sessionUser = (Basicuser)getSession().get("user"); + if(null != sessionUser && username.equalsIgnoreCase(sessionUser.getLoginame()) + && sessionUser.getPassword().equals(password)) + { + Log.infoFileSync("====用户 "+ username + "已经登录过, login 方法调用结束===="); + model.getShowModel().setMsgTip("user already login"); + /*return "login";*/ + } + + //获取用户状态 + int userStatus = -1; + try + { + userStatus = userService.validateUser(username, password); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====",e); + model.getShowModel().setMsgTip("access service exception"); + } + switch (userStatus) + { + case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST: + model.getShowModel().setMsgTip("user is not exist"); + break; + case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR: + model.getShowModel().setMsgTip("user password error"); + break; + case ExceptionCodeConstants.UserExceptionCode.BLACK_USER: + model.getShowModel().setMsgTip("user is black"); + break; + case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION: + model.getShowModel().setMsgTip("access service error"); + break; + default: + try + { + //验证通过 ,可以登录,放入session,记录登录日志 + Basicuser user = userService.getUser(username); + logService.create(new Logdetails(user, "登录系统", model.getClientIp(), + new Timestamp(System.currentTimeMillis()), (short)0,"管理用户:" + username + " 登录系统",username + " 登录系统")); + model.getShowModel().setMsgTip("user can login"); + getSession().put("user", user); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>查询用户名为:" + username + " ,用户信息异常", e); + } + break; + } + /*if(ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT == userStatus) + return "login";*/ + Log.infoFileSync("===============用户登录 login 方法调用结束==============="); + return SUCCESS; + } + + /** + * 用户退出登录 + * @return + */ + public String logout() + { + logService.create(new Logdetails(getUser(), "退出系统", model.getClientIp(), + new Timestamp(System.currentTimeMillis()), (short)0, + "管理用户:" + getUser().getLoginame() + " 退出系统",getUser().getLoginame() + " 退出系统")); + getSession().remove("user"); + return SUCCESS; + } + + /** + * 增加用户 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加用户方法==================="); + Boolean flag = false; + try + { + Basicuser user = new Basicuser(); + user.setDepartment(model.getDepartment()); + user.setDescription(model.getDescription()); + user.setEmail(model.getEmail()); +// user.setIsmanager(model.getIsmanager()); + user.setIsystem((short)1); + user.setIsmanager((short)1); + user.setLoginame(model.getLoginame()); + String password ="00000000"; + //因密码用MD5加密,需要对密码进行转化 + try + { + password=Tools.md5Encryp(password); + } + catch (NoSuchAlgorithmException e) + { + e.printStackTrace(); + Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e); + } + user.setPassword(password); + + user.setPhonenum(model.getPhonenum()); + user.setPosition(model.getPosition()); + user.setUsername(model.getUsername()); + + userService.create(user); + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加用户异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加用户回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加用户", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加用户名称为 "+ model.getUsername() + " " + tipMsg + "!", "增加用户" + tipMsg)); + Log.infoFileSync("==================结束调用增加用户方法==================="); + } + + /** + * 删除用户 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除用户信息方法delete()================"); + try + { + userService.delete(model.getUserID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getUserID() + " 的用户异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除用户", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除用户ID为 "+ model.getUserID() + " " + tipMsg + "!", "删除用户" + tipMsg)); + Log.infoFileSync("====================结束调用删除用户信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新用户 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Basicuser user = userService.get(model.getUserID()); + user.setDepartment(model.getDepartment()); + user.setDescription(model.getDescription()); + user.setEmail(model.getEmail()); + //user.setIsmanager(model.getIsmanager()); + user.setLoginame(model.getLoginame()); + //user.setPassword(model.getPassword()); + user.setPhonenum(model.getPhonenum()); + user.setPosition(model.getPosition()); + user.setUsername(model.getUsername()); + userService.update(user); + + //看是否需要更新seesion中user + if(getUser().getId() == model.getUserID()) + { + getSession().put("user", user); + } + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改用户回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新用户", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新用户ID为 "+ model.getUserID() + " " + tipMsg + "!", "更新用户" + tipMsg)); + } + + /** + * 修改密码 + */ + public void updatePwd() + { + Integer flag = 0; + try + { + Basicuser user = getUser(); + String orgPassword = Tools.md5Encryp(model.getOrgpwd()); + String md5Pwd = Tools.md5Encryp(model.getPassword()); + //必须和原始密码一致才可以更新密码 + if(orgPassword.equalsIgnoreCase(user.getPassword())) + { + + user.setPassword(md5Pwd); + userService.update(user); + + //看是否需要更新seesion中user +// if(getUser().getId() == model.getUserID()) +// { +// getSession().put("user", user); +// } + + flag = 1; + tipMsg = "成功"; + tipType = 0; + } + else + { + flag = 2; + tipMsg = "失败"; + tipType = 1; + } + + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "密码信息失败", e); + flag = 3; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改用户密码回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新用户", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新用户ID为 "+ model.getUserID() + "密码信息 " + tipMsg + "!", "更新用户" + tipMsg)); + } + + /** + * 批量删除指定ID用户 + * @return + */ + public String batchDelete() + { + try + { + userService.batchDelete(model.getUserIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除用户ID为:" + model.getUserIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除用户", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除用户ID为 "+ model.getUserIDs() + " " + tipMsg + "!", "批量删除用户" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() + { + Boolean flag = false; + String fieldName = ""; + String fieldValue = ""; + try + { + if(0 == model.getCheckFlag()) + { + fieldName = "username"; + fieldValue = model.getUsername(); + } + else + { + fieldName = "loginame"; + fieldValue = model.getLoginame(); + } + flag = userService.checkIsNameExist(fieldName,fieldValue, model.getUserID()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!"); + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>回写检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!",e); + } + } + } + + /** + * 查找用户信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + userService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Basicuser user:dataList) + { + + JSONObject item = new JSONObject(); + item.put("id", user.getId()); + item.put("username", user.getUsername()); + item.put("loginame", Tools.dealNullStr(user.getLoginame())); + item.put("password", Tools.dealNullStr(user.getPassword())); + item.put("position", Tools.dealNullStr(user.getPosition())); + item.put("department", Tools.dealNullStr(user.getDepartment())); + item.put("email", Tools.dealNullStr(user.getEmail())); + item.put("phonenum", Tools.dealNullStr(user.getPhonenum())); + item.put("ismanager", user.getIsmanager()== (short)0?"是":"否"); + item.put("isystem",user.getIsystem() == (short)0?"是":"否"); + item.put("status", user.getStatus()); + item.put("description", Tools.dealNullStr(user.getDescription())); + item.put("remark",user.getRemark()); + item.put("op", user.getIsystem()); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>查找用户信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>回写查询用户信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return 拼接后的条件 + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("username_s_like", model.getUsername()); + condition.put("loginame_s_like", model.getLoginame()); + condition.put("id_s_order", "asc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public UserModel getModel() + { + return model; + } + public void setUserService(UserIService userService) + { + this.userService = userService; + } +} diff --git a/src/com/jsh/action/basic/UserBusinessAction.java b/src/com/jsh/action/basic/UserBusinessAction.java new file mode 100644 index 00000000..cae0175e --- /dev/null +++ b/src/com/jsh/action/basic/UserBusinessAction.java @@ -0,0 +1,229 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.UserBusiness; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.UserBusinessModel; +import com.jsh.service.basic.UserBusinessIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class UserBusinessAction extends BaseAction +{ + private UserBusinessIService userBusinessService; + private UserBusinessModel model = new UserBusinessModel(); + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public String getBasicData() + { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + Map condition = pageUtil.getAdvSearch(); + condition.put("KeyId_s_eq", model.getKeyId()); + condition.put("Type_s_eq", model.getType()); + userBusinessService.find(pageUtil); + mapData.put("userBusinessList", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找UserBusiness信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } + + /* + * 测试hql语句的写法 + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public String getceshi() + { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + Map condition = pageUtil.getAdvSearch(); + condition.put("Type_s_eq", model.getType()); + userBusinessService.find(pageUtil,"ceshi"); + mapData.put("userBusinessList", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找UserBusiness信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } + + /** + * 增加UserBusiness + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加UserBusiness信息方法create()==================="); + Boolean flag = false; + try + { + UserBusiness userBusiness = new UserBusiness(); + userBusiness.setType(model.getType()); + userBusiness.setKeyId(model.getKeyId()); + userBusiness.setValue(model.getValue()); + userBusinessService.create(userBusiness); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加UserBusiness信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加UserBusiness信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加UserBusiness", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加UserBusiness为 "+ model.getType() + " " + tipMsg + "!", "增加UserBusiness" + tipMsg)); + Log.infoFileSync("==================结束调用增加UserBusiness方法create()==================="); + } + + /** + * 更新UserBusiness + * @return + */ + public void update() + { + Boolean flag = false; + Long id=0l; + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition_RoleAPP()); + userBusinessService.find(pageUtil); + List dataList = pageUtil.getPageList(); + if(null != dataList) + { + for(UserBusiness userBusiness:dataList) + { + id=userBusiness.getId(); + } + UserBusiness userBusiness = userBusinessService.get(id); + userBusiness.setType(model.getType()); + userBusiness.setKeyId(model.getKeyId()); + userBusiness.setValue(model.getValue()); + userBusinessService.update(userBusiness); + } + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改UserBusiness的ID为 : " + id + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改UserBusiness回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新UserBusiness", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新UserBusiness的ID为 "+ id + " " + tipMsg + "!", "更新UserBusiness" + tipMsg)); + } + + /** + * 拼接搜索条件-RoleAPP + * @return + */ + private Map getCondition_RoleAPP() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Type_s_eq", model.getType()); + condition.put("KeyId_s_eq", model.getKeyId()); + return condition; + } + + /** + * 检查角色对应应用/功能是否存在 + */ + public void checkIsValueExist() + { + Boolean flag = false; + try + { + flag = userBusinessService.checkIsValueExist("Type",model.getType(),"KeyId", model.getKeyId()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色对应应用/功能的类型为:" + model.getType() + " KeyId为: " + model.getKeyId() + " 是否存在异常!"); + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>回写检查角色对应应用/功能的类型为:" + model.getType() + " KeyId为: " + model.getKeyId() + " 是否存在异常!",e); + } + } + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public UserBusinessModel getModel() + { + return model; + } + public void setUserBusinessService(UserBusinessIService userBusinessService) + { + this.userBusinessService = userBusinessService; + } +} diff --git a/src/com/jsh/action/basic/VisitAccountAction.java b/src/com/jsh/action/basic/VisitAccountAction.java new file mode 100644 index 00000000..183d8512 --- /dev/null +++ b/src/com/jsh/action/basic/VisitAccountAction.java @@ -0,0 +1,267 @@ +package com.jsh.action.basic; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Category; +import com.jsh.model.po.Depot; +import com.jsh.model.po.VisitAccount; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.VisitAccountModel; +import com.jsh.service.basic.VisitAccountIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class VisitAccountAction extends BaseAction +{ + private VisitAccountIService visitAccountService; + private VisitAccountModel model = new VisitAccountModel(); + /** + * 增加回访 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加回访信息方法create()==================="); + Boolean flag = false; + try + { + VisitAccount visitAccount = new VisitAccount(); + visitAccount.setDepot(new Depot(model.getProjectId())); + + visitAccount.setLouHao(model.getLouHao()); + visitAccount.setHuHao(model.getHuHao()); + visitAccount.setHuiFang(model.getHuiFang()); + visitAccount.setLuoShi(model.getLuoShi()); + visitAccount.setName(model.getName()); + visitAccount.setTel(model.getTel()); + visitAccount.setAddTime(new Timestamp(new Date().getTime())); + visitAccountService.create(visitAccount); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加回访信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加回访信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加回访", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加回访名称为 "+ model.getName() + " " + tipMsg + "!", "增加回访" + tipMsg)); + Log.infoFileSync("==================结束调用增加回访方法create()==================="); + } + + /** + * 删除回访 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除回访信息方法delete()================"); + try + { + visitAccountService.delete(model.getVisitAccountID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getVisitAccountID() + " 的回访异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除回访", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除回访ID为 "+ model.getVisitAccountID() + " " + tipMsg + "!", "删除回访" + tipMsg)); + Log.infoFileSync("====================结束调用删除回访信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新回访 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + VisitAccount visitAccount = visitAccountService.get(model.getVisitAccountID()); + visitAccount.setDepot(new Depot(model.getProjectId())); + + visitAccount.setLouHao(model.getLouHao()); + visitAccount.setHuHao(model.getHuHao()); + visitAccount.setHuiFang(model.getHuiFang()); + visitAccount.setLuoShi(model.getLuoShi()); + visitAccount.setName(model.getName()); + visitAccount.setTel(model.getTel()); + visitAccount.setAddTime(new Timestamp(new Date().getTime())); + visitAccountService.update(visitAccount); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改回访ID为 : " + model.getVisitAccountID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改回访回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新回访", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新回访ID为 "+ model.getVisitAccountID() + " " + tipMsg + "!", "更新回访" + tipMsg)); + } + + /** + * 批量删除指定ID回访 + * @return + */ + public String batchDelete() + { + try + { + visitAccountService.batchDelete(model.getVisitAccountIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除回访ID为:" + model.getVisitAccountIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除回访", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除回访ID为 "+ model.getVisitAccountIDs() + " " + tipMsg + "!", "批量删除回访" + tipMsg)); + return SUCCESS; + } + + /** + * 查找回访信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + visitAccountService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(VisitAccount visitAccount:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", visitAccount.getId()); + item.put("ProjectId", visitAccount.getDepot().getId()); + item.put("ProjectName", visitAccount.getDepot().getName()); + item.put("LouHao", visitAccount.getLouHao()); + item.put("HuHao", visitAccount.getHuHao()); + item.put("HuiFang", visitAccount.getHuiFang()); + item.put("LuoShi", visitAccount.getLuoShi()); + item.put("Name", visitAccount.getName()); + item.put("Tel", visitAccount.getTel()); + item.put("AddTime", visitAccount.getAddTime()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找回访信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询回访信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("ProjectId_n_eq", model.getProjectId()); + condition.put("LouHao_s_like", model.getLouHao()); + condition.put("AddTime_s_order", "desc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public VisitAccountModel getModel() + { + return model; + } + public void setVisitAccountService(VisitAccountIService visitAccountService) + { + this.visitAccountService = visitAccountService; + } +} diff --git a/src/com/jsh/action/materials/BuildingAction.java b/src/com/jsh/action/materials/BuildingAction.java new file mode 100644 index 00000000..8dce4739 --- /dev/null +++ b/src/com/jsh/action/materials/BuildingAction.java @@ -0,0 +1,277 @@ +package com.jsh.action.materials; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Depot; +import com.jsh.model.po.Building; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.materials.BuildingModel; +import com.jsh.service.materials.BuildingIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class BuildingAction extends BaseAction +{ + private BuildingIService buildingService; + private BuildingModel model = new BuildingModel(); + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public String getBasicData() + { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + Map condition = pageUtil.getAdvSearch(); + condition.put("ProjectId_n_eq", model.getProjectId()); + condition.put("Id_s_order", "asc"); + buildingService.find(pageUtil); + mapData.put("buildingList", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } + /** + * 增加单元 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加单元信息方法create()==================="); + Boolean flag = false; + try + { + Building building = new Building(); + building.setDepot(new Depot(model.getProjectId())); + + building.setName(model.getName()); + building.setRemark(model.getRemark()); + building.setEnabled(model.getEnabled()); + buildingService.create(building); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加单元信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加单元信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加单元", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加单元名称为 "+ model.getName() + " " + tipMsg + "!", "增加单元" + tipMsg)); + Log.infoFileSync("==================结束调用增加单元方法create()==================="); + } + + /** + * 删除单元 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除单元信息方法delete()================"); + try + { + buildingService.delete(model.getBuildingID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getBuildingID() + " 的单元异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除单元", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除单元ID为 "+ model.getBuildingID() + " " + tipMsg + "!", "删除单元" + tipMsg)); + Log.infoFileSync("====================结束调用删除单元信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新单元 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Building building = buildingService.get(model.getBuildingID()); + building.setDepot(new Depot(model.getProjectId())); + + building.setName(model.getName()); + building.setRemark(model.getRemark()); + building.setEnabled(model.getEnabled()); + buildingService.update(building); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改单元ID为 : " + model.getBuildingID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改单元回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新单元", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新单元ID为 "+ model.getBuildingID() + " " + tipMsg + "!", "更新单元" + tipMsg)); + } + + /** + * 批量删除指定ID单元 + * @return + */ + public String batchDelete() + { + try + { + buildingService.batchDelete(model.getBuildingIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除单元ID为:" + model.getBuildingIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除单元", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除单元ID为 "+ model.getBuildingIDs() + " " + tipMsg + "!", "批量删除单元" + tipMsg)); + return SUCCESS; + } + + /** + * 查找单元信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + buildingService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Building building:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", building.getId()); + item.put("ProjectId", building.getDepot().getId()); + item.put("ProjectName", building.getDepot().getName()); + item.put("Name", building.getName()); + item.put("Remark", building.getRemark()); + item.put("Enabled", building.getEnabled()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单元信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单元信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("ProjectId_n_eq", model.getProjectId()); + condition.put("Name_s_like", model.getName()); + condition.put("Id_s_order", "asc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public BuildingModel getModel() + { + return model; + } + public void setBuildingService(BuildingIService buildingService) + { + this.buildingService = buildingService; + } +} diff --git a/src/com/jsh/action/materials/DepotHeadAction.java b/src/com/jsh/action/materials/DepotHeadAction.java new file mode 100644 index 00000000..4205c95e --- /dev/null +++ b/src/com/jsh/action/materials/DepotHeadAction.java @@ -0,0 +1,439 @@ +package com.jsh.action.materials; + +import java.io.IOException; +import java.sql.Timestamp; +import java.text.ParseException; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Basicuser; +import com.jsh.model.po.Building; +import com.jsh.model.po.Depot; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.DepotItem; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.Person; +import com.jsh.model.po.Supplier; +import com.jsh.model.vo.materials.DepotHeadModel; +import com.jsh.service.materials.DepotHeadIService; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.Tools; + +@SuppressWarnings("serial") +public class DepotHeadAction extends BaseAction +{ + private DepotHeadIService depotHeadService; + private DepotHeadModel model = new DepotHeadModel(); + + /* + * 获取MaxId + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public String getMaxId() + { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + depotHeadService.find(pageUtil,"maxId"); + mapData.put("depotHeadMax", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找最大的Id信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } + + /** + * 增加仓管通 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加仓管通信息信息方法create()==================="); + Boolean flag = false; + try + { + DepotHead depotHead = new DepotHead(); + depotHead.setType(model.getType()); + depotHead.setSubType(model.getSubType()); + depotHead.setProjectId(new Depot(model.getProjectId())); + depotHead.setNumber(model.getNumber()); + depotHead.setOperPersonName(getUser().getUsername()); + depotHead.setCreateTime(new Timestamp(new Date().getTime())); + try + { + depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd").getTime())); + } + catch (ParseException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e); + } + if(model.getOrganId()!=null){depotHead.setOrganId(new Supplier(model.getOrganId()));} + if(model.getHandsPersonId()!=null){depotHead.setHandsPersonId(new Person(model.getHandsPersonId()));} + if(model.getWareHousePersonId()!=null){depotHead.setWareHousePersonId(new Person(model.getWareHousePersonId()));} + if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));} + if(model.getBuildingId()!=null){depotHead.setBuildingId(new Building(model.getBuildingId()));} + depotHead.setSettlementWay(model.getSettlementWay()); + depotHead.setRemark(model.getRemark()); + depotHead.setState("草稿"); + depotHeadService.create(depotHead); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓管通信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加仓管通信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加仓管通", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加仓管通编号为 "+ model.getNumber() + " " + tipMsg + "!", "增加仓管通" + tipMsg)); + Log.infoFileSync("==================结束调用增加仓管通方法create()==================="); + } + + /** + * 删除仓管通 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除仓管通信息方法delete()================"); + try + { + depotHeadService.delete(model.getDepotHeadID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotHeadID() + " 的仓管通异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除仓管通", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除仓管通ID为 "+ model.getDepotHeadID() + " " + tipMsg + "!", "删除仓管通" + tipMsg)); + Log.infoFileSync("====================结束调用删除仓管通信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新仓管通 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + DepotHead depotHead = depotHeadService.get(model.getDepotHeadID()); + depotHead.setType(model.getType()); + depotHead.setSubType(model.getSubType()); + depotHead.setProjectId(new Depot(model.getProjectId())); + depotHead.setNumber(model.getNumber()); + depotHead.setOperPersonName(getUser().getUsername()); + try + { + depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd").getTime())); + } + catch (ParseException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>解析入库时间格式异常", e); + } + if(model.getOrganId()!=null){depotHead.setOrganId(new Supplier(model.getOrganId()));} + if(model.getHandsPersonId()!=null){depotHead.setHandsPersonId(new Person(model.getHandsPersonId()));} + if(model.getWareHousePersonId()!=null){depotHead.setWareHousePersonId(new Person(model.getWareHousePersonId()));} + if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));} + if(model.getBuildingId()!=null){depotHead.setBuildingId(new Building(model.getBuildingId()));} + depotHead.setSettlementWay(model.getSettlementWay()); + depotHead.setRemark(model.getRemark()); + depotHeadService.update(depotHead); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改仓管通ID为 : " + model.getDepotHeadID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改仓管通回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新仓管通", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新仓管通ID为 "+ model.getDepotHeadID() + " " + tipMsg + "!", "更新仓管通" + tipMsg)); + } + + /** + * 更新状态 + * @return + */ + public void submit() + { + Log.infoFileSync("====================开始调用更新状态仓管通信息方法submit()================"); + Boolean flag = false; + String changeId=""; + try + { + String DepotHeadIDs=model.getDepotHeadIDs(); + String[] DepotHeadID=DepotHeadIDs.split(","); + for(int i=0;i>>>>>>>>>>>>更新状态仓管通ID为 : " + model.getDepotHeadID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>更新状态仓管通回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新状态仓管通", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新状态-"+model.getState()+"-ID为 "+ changeId + " " + tipMsg + "!", "更新状态仓管通" + tipMsg)); + Log.infoFileSync("====================结束调用更新状态仓管通信息方法submit()================"); + } + + /** + * 批量删除指定ID仓管通 + * @return + */ + public String batchDelete() + { + try + { + depotHeadService.batchDelete(model.getDepotHeadIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除仓管通ID为:" + model.getDepotHeadIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除仓管通", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除仓管通ID为 "+ model.getDepotHeadIDs() + " " + tipMsg + "!", "批量删除仓管通" + tipMsg)); + return SUCCESS; + } + + /** + * 查找仓管通信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + depotHeadService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(DepotHead depotHead:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", depotHead.getId()); + item.put("ProjectId", depotHead.getProjectId()==null?"":depotHead.getProjectId().getId()); + item.put("ProjectName", depotHead.getProjectId()==null?"":depotHead.getProjectId().getName()); + item.put("Number", depotHead.getNumber()); + item.put("OperPersonName", depotHead.getOperPersonName()); + item.put("CreateTime", Tools.getCurrentMonth(depotHead.getCreateTime())); + item.put("OperTime", Tools.getCurrentMonth(depotHead.getOperTime())); + item.put("OrganId", depotHead.getOrganId()==null?"":depotHead.getOrganId().getId()); + item.put("OrganName", depotHead.getOrganId()==null?"":depotHead.getOrganId().getSupplier()); + item.put("HandsPersonId", depotHead.getHandsPersonId()==null?"":depotHead.getHandsPersonId().getId()); + item.put("HandsPersonName", depotHead.getHandsPersonId()==null?"":depotHead.getHandsPersonId().getName()); + item.put("WareHousePersonId", depotHead.getWareHousePersonId()==null?"":depotHead.getWareHousePersonId().getId()); + item.put("WareHousePersonName", depotHead.getWareHousePersonId()==null?"":depotHead.getWareHousePersonId().getName()); + item.put("AllocationProjectId", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getId()); + item.put("AllocationProjectName", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getName()); + item.put("BuildingId", depotHead.getBuildingId()==null?"":depotHead.getBuildingId().getId()); + item.put("BuildingName", depotHead.getBuildingId()==null?"":depotHead.getBuildingId().getName()); //单元名称 + item.put("SettlementWay", depotHead.getSettlementWay()); + item.put("Remark", depotHead.getRemark()); + item.put("State", depotHead.getState()); + item.put("ReAuditPersonName", depotHead.getReAuditPersonName()); + item.put("Reason", depotHead.getReason()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e); + } + } + + /** + * 查找进销存_根据月份(报表) + * @return + */ + public void findByMonth() { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(1000); + pageUtil.setCurPage(1); + pageUtil.setAdvSearch(getConditionHead()); + depotHeadService.find(pageUtil); + List dataList = pageUtil.getPageList(); + JSONObject outer = new JSONObject(); + String headId = ""; + if(null != dataList) + { + for(DepotHead depotHead:dataList) + { + headId = headId + depotHead.getId() + ","; + } + } + if(headId!="") { + headId = headId.substring(0, headId.lastIndexOf(",")); + } + outer.put("HeadIds", headId); + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + if(model.getAllocationProjectId()!=null) + {condition.put("AllocationProjectId_n_eq", model.getAllocationProjectId());} + if(model.getProjectId()!=null) + {condition.put("ProjectId_n_eq", model.getProjectId());} + condition.put("Type_s_eq",model.getType()); + condition.put("SubType_s_eq",model.getSubType()); + condition.put("Number_s_like",model.getNumber()); + condition.put("OperTime_s_gteq",model.getBeginTime()); + condition.put("OperTime_s_lteq",model.getEndTime()); + condition.put("State_s_eq", model.getState()); + condition.put("Id_s_order","desc"); + return condition; + } + + private Map getConditionHead() + { + Map condition = new HashMap(); + condition.put("OperTime_s_lteq",model.getMonthTime() + "-31 00:00:00"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public DepotHeadModel getModel() + { + return model; + } + public void setDepotHeadService(DepotHeadIService depotHeadService) + { + this.depotHeadService = depotHeadService; + } +} diff --git a/src/com/jsh/action/materials/DepotItemAction.java b/src/com/jsh/action/materials/DepotItemAction.java new file mode 100644 index 00000000..944edcb6 --- /dev/null +++ b/src/com/jsh/action/materials/DepotItemAction.java @@ -0,0 +1,395 @@ +package com.jsh.action.materials; + +import java.io.File; +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.constants.asset.AssetConstants; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.DepotItem; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.Material; +import com.jsh.model.vo.materials.DepotItemModel; +import com.jsh.service.materials.DepotHeadIService; +import com.jsh.service.materials.DepotItemIService; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.Tools; + +@SuppressWarnings("serial") +public class DepotItemAction extends BaseAction +{ + private DepotItemIService depotItemService; + private DepotItemModel model = new DepotItemModel(); + /** + * action返回excel结果 + */ + public static final String EXCEL = "excel"; + + /** + * 保存明细 + * @return + */ + public void saveDetials() + { + Log.infoFileSync("==================开始调用保存仓管通明细信息方法saveDetials()==================="); + Boolean flag = false; + try + { + Long headerId=model.getHeaderId(); + String inserted=model.getInserted(); + String deleted=model.getDeleted(); + String updated=model.getUpdated(); + //转为json + JSONArray insertedJson = JSONArray.fromObject(inserted); + JSONArray deletedJson = JSONArray.fromObject(deleted); + JSONArray updatedJson = JSONArray.fromObject(updated); + if(null != insertedJson) + { + for(int i = 0;i < insertedJson.size(); i++) + { + DepotItem depotItem = new DepotItem(); + JSONObject tempInsertedJson = JSONObject.fromObject(insertedJson.get(i)); + depotItem.setHeaderId(new DepotHead(headerId)); + depotItem.setMaterialId(new Material(tempInsertedJson.getLong("MaterialId"))); + depotItem.setOperNumber(tempInsertedJson.getDouble("OperNumber")); + if(tempInsertedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempInsertedJson.getDouble("UnitPrice"));} + if(tempInsertedJson.get("Incidentals")!=null){depotItem.setIncidentals(0.0);} + depotItem.setRemark(tempInsertedJson.getString("Remark")); + depotItem.setImg(tempInsertedJson.getString("Img")); + depotItemService.create(depotItem); + } + } + if(null != deletedJson) + { + for(int i = 0;i < deletedJson.size(); i++) + { + JSONObject tempDeletedJson = JSONObject.fromObject(deletedJson.get(i)); + depotItemService.delete(tempDeletedJson.getLong("Id")); + } + } + if(null != updatedJson) + { + for(int i = 0;i < updatedJson.size(); i++) + { + JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i)); + DepotItem depotItem = depotItemService.get(tempUpdatedJson.getLong("Id")); + depotItem.setMaterialId(new Material(tempUpdatedJson.getLong("MaterialId"))); + depotItem.setOperNumber(tempUpdatedJson.getDouble("OperNumber")); + if(tempUpdatedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempUpdatedJson.getDouble("UnitPrice"));} + if(tempUpdatedJson.get("Incidentals")!=null){depotItem.setIncidentals(0.0);} + depotItem.setRemark(tempUpdatedJson.getString("Remark")); + depotItem.setImg(tempUpdatedJson.getString("Img")); + depotItemService.create(depotItem); + } + } + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>保存仓管通明细信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>保存仓管通明细信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "保存仓管通明细", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "保存仓管通明细对应主表编号为 "+ model.getHeaderId() + " " + tipMsg + "!", "保存仓管通明细" + tipMsg)); + Log.infoFileSync("==================结束调用保存仓管通明细方法saveDetials()==================="); + } + + + /** + * 查找仓管通信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + depotItemService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(DepotItem depotItem:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", depotItem.getId()); + item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialName", ((depotItem.getMaterialId().getModel().equals(""))?"":""+depotItem.getMaterialId().getModel())+" "+depotItem.getMaterialId().getName()+((depotItem.getMaterialId().getColor() == null)?"(":"("+depotItem.getMaterialId().getColor()) + ")"); + item.put("OperNumber", depotItem.getOperNumber()); + item.put("UnitPrice", depotItem.getUnitPrice()); + item.put("Incidentals", depotItem.getIncidentals()); + item.put("Remark", depotItem.getRemark()); + item.put("Img", depotItem.getImg()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e); + } + } + + /** + * 查找进销存 + * @return + */ + public void findByAll() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getConditionALL()); + depotItemService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(DepotItem depotItem:dataList) + { + JSONObject item = new JSONObject(); + Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true); + Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false); + Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false); + item.put("Id", depotItem.getId()); + item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialName", depotItem.getMaterialId().getName()); + item.put("MaterialModel", depotItem.getMaterialId().getModel()); + item.put("MaterialColor", depotItem.getMaterialId().getColor()); + item.put("prevSum", prevSum); + item.put("InSum", InSum); + item.put("OutSum", OutSum); + item.put("thisSum", prevSum + InSum - OutSum); + item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum)); + item.put("UnitPrice", depotItem.getUnitPrice()); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); + } + } + + /** + * 统计总计金额 + * @return + */ + public void totalCountMoney() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getConditionALL()); + depotItemService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + JSONObject outer = new JSONObject(); + Double thisAllPrice = 0.0; + if(null != dataList) + { + for(DepotItem depotItem:dataList) + { + Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true); + Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false); + Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false); + thisAllPrice = thisAllPrice + depotItem.getUnitPrice() * (prevSum + InSum - OutSum); + } + } + outer.put("totalCount", thisAllPrice); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); + } + } + + /** + * 导出excel表格 + * @return + */ + @SuppressWarnings("unchecked") + public String exportExcel() + { + Log.infoFileSync("===================调用导出信息action方法exportExcel开始======================="); + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getConditionALL()); + depotItemService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(DepotItem depotItem:dataList) + { + JSONObject item = new JSONObject(); + Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true); + Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false); + Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false); + item.put("Id", depotItem.getId()); + item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialName", depotItem.getMaterialId().getName()); + item.put("MaterialModel", depotItem.getMaterialId().getModel()); + item.put("MaterialColor", depotItem.getMaterialId().getColor()); + item.put("prevSum", prevSum); + item.put("InSum", InSum); + item.put("OutSum", OutSum); + item.put("thisSum", prevSum + InSum - OutSum); + item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum)); + item.put("UnitPrice", depotItem.getUnitPrice()); + dataArray.add(item); + } + } + String isCurrentPage = "allPage"; + model.setFileName(Tools.changeUnicode("report.xls",model.getBrowserType())); + model.setExcelStream(depotItemService.exmportExcel(isCurrentPage,dataArray)); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常",e); + model.getShowModel().setMsgTip("export excel exception"); + } + Log.infoFileSync("===================调用导出信息action方法exportExcel结束=================="); + return EXCEL; + } + + @SuppressWarnings("unchecked") + public Integer sumNumber(String type,Long MId,String MonthTime, Boolean isPrev) { + Integer sumNumber = 0; + String allNumber = ""; + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try { + depotItemService.findByType(pageUtil, type, MId, MonthTime, isPrev); + allNumber = pageUtil.getPageList().toString(); + allNumber = allNumber.substring(1,allNumber.length()-1); + if(allNumber.equals("null")){ + allNumber = "0"; + } + allNumber = allNumber.replace(".0", ""); + } catch (AmsException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + sumNumber = Integer.parseInt(allNumber); + return sumNumber; + } + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("HeaderId_n_eq", model.getHeaderId()); + condition.put("Id_s_order","asc"); + return condition; + } + + private Map getConditionALL() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("HeaderId_s_in", model.getHeadIds()); + condition.put("MaterialId_s_in", model.getMaterialIds()); + condition.put("MaterialId_s_gb","aaa"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public DepotItemModel getModel() + { + return model; + } + public void setDepotItemService(DepotItemIService depotItemService) + { + this.depotItemService = depotItemService; + } +} diff --git a/src/com/jsh/action/materials/MaterialAction.java b/src/com/jsh/action/materials/MaterialAction.java new file mode 100644 index 00000000..4b6ccaea --- /dev/null +++ b/src/com/jsh/action/materials/MaterialAction.java @@ -0,0 +1,391 @@ +package com.jsh.action.materials; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.Material; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.MaterialCategory; +import com.jsh.model.po.Supplier; +import com.jsh.model.vo.materials.MaterialModel; +import com.jsh.service.materials.MaterialIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class MaterialAction extends BaseAction +{ + private MaterialIService materialService; + private MaterialModel model = new MaterialModel(); + + /** + * 增加物料 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加物料信息方法create()==================="); + Boolean flag = false; + try + { + Material material = new Material(); + material.setMaterialCategory(new MaterialCategory(model.getCategoryId())); + + material.setName(model.getName()); + material.setModel(model.getModel()); + material.setColor(model.getColor()); + material.setUnit(model.getUnit()); + material.setRemark(model.getRemark()); + materialService.create(material); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加物料信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加物料信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加物料", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加物料名称为 "+ model.getName() + " " + tipMsg + "!", "增加物料" + tipMsg)); + Log.infoFileSync("==================结束调用增加物料方法create()==================="); + } + + /** + * 删除物料 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除物料信息方法delete()================"); + try + { + materialService.delete(model.getMaterialID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialID() + " 的物料异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除物料", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除物料ID为 "+ model.getMaterialID() + " " + tipMsg + "!", "删除物料" + tipMsg)); + Log.infoFileSync("====================结束调用删除物料信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新物料 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Material material = materialService.get(model.getMaterialID()); + material.setMaterialCategory(new MaterialCategory(model.getCategoryId())); + + material.setName(model.getName()); + material.setModel(model.getModel()); + material.setColor(model.getColor()); + material.setUnit(model.getUnit()); + material.setRemark(model.getRemark()); + material.setName(model.getName()); + materialService.update(material); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改物料ID为 : " + model.getMaterialID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改物料回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新物料", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新物料ID为 "+ model.getMaterialID() + " " + tipMsg + "!", "更新物料" + tipMsg)); + } + + /** + * 批量删除指定ID物料 + * @return + */ + public String batchDelete() + { + try + { + materialService.batchDelete(model.getMaterialIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除物料ID为:" + model.getMaterialIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除物料", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除物料ID为 "+ model.getMaterialIDs() + " " + tipMsg + "!", "批量删除物料" + tipMsg)); + return SUCCESS; + } + + /** + * 查找物料信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + Long lei=model.getCategoryId(); + if(1==lei) //判断值还真不能用String类型的判断 + { + pageUtil.setAdvSearch(getCondition_all()); + } + else if(1!=lei) + { + pageUtil.setAdvSearch(getCondition()); + } + materialService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Material material:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", material.getId()); + item.put("Name", material.getName()); + item.put("Model", material.getModel()); + item.put("Color", material.getColor()); + item.put("Unit", material.getUnit()); + item.put("Remark", material.getRemark()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找物料信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询物料信息结果异常", e); + } + } + + /** + * 查找物料信息-下拉框 + * @return + */ + public void findBySelect() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getCondition_Select()); + materialService.find(pageUtil); + List dataList = pageUtil.getPageList(); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Material material:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", material.getId()); + //供应商名称 + item.put("MaterialName", ((material.getModel().equals(""))?"":""+material.getModel()) +" "+ material.getName() + ((material.getColor() == null)?"":"("+material.getColor() + ")")); + dataArray.add(item); + } + } + //回写查询结果 + toClient(dataArray.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e); + } + } + + /** + * 查找物料信息-统计排序 + * @return + */ + public void findByOrder() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getCondition_Order()); + materialService.find(pageUtil); + List dataList = pageUtil.getPageList(); + //存放数据json数组 + JSONObject outer = new JSONObject(); + String mId = ""; + if(null != dataList) + { + for(Material material:dataList) + { + mId = mId + material.getId() + ","; + } + } + if(mId!="") { + mId = mId.substring(0, mId.lastIndexOf(",")); + } + outer.put("mIds", mId); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e); + } + } + + /** + * 拼接搜索条件(查全部) + * @return + */ + private Map getCondition_all() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Id_s_order", "asc"); + return condition; + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("CategoryId_s_in", model.getCategoryIds()); + condition.put("Id_s_order", "asc"); + return condition; + } + + /** + * 拼接搜索条件-下拉框 + * @return + */ + private Map getCondition_Select() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Id_s_order", "asc"); + return condition; + } + + /** + * 拼接搜索条件-下拉框 + * @return + */ + private Map getCondition_Order() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Name,Model_s_order", "asc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public MaterialModel getModel() + { + return model; + } + public void setMaterialService(MaterialIService materialService) + { + this.materialService = materialService; + } +} diff --git a/src/com/jsh/action/materials/MaterialCategoryAction.java b/src/com/jsh/action/materials/MaterialCategoryAction.java new file mode 100644 index 00000000..32b8af89 --- /dev/null +++ b/src/com/jsh/action/materials/MaterialCategoryAction.java @@ -0,0 +1,275 @@ +package com.jsh.action.materials; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.MaterialCategory; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.materials.MaterialCategoryModel; +import com.jsh.service.materials.MaterialCategoryIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class MaterialCategoryAction extends BaseAction +{ + private MaterialCategoryIService materialCategoryService; + private MaterialCategoryModel model = new MaterialCategoryModel(); + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public String getBasicData() + { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + Map condition = pageUtil.getAdvSearch(); + condition.put("ParentId_n_eq", model.getParentId()); + condition.put("Id_n_neq", 1); + condition.put("Id_s_order", "asc"); + materialCategoryService.find(pageUtil); + mapData.put("materialCategoryList", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找物料类别信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } + + /** + * 增加物料类别 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加物料类别信息方法create()==================="); + Boolean flag = false; + try + { + MaterialCategory materialCategory = new MaterialCategory(); + materialCategory.setMaterialCategory(new MaterialCategory(model.getParentId())); + + materialCategory.setCategoryLevel(model.getCategoryLevel()); + materialCategory.setName(model.getName()); + materialCategoryService.create(materialCategory); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加物料类别信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加物料类别信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加物料类别", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加物料类别名称为 "+ model.getName() + " " + tipMsg + "!", "增加物料类别" + tipMsg)); + Log.infoFileSync("==================结束调用增加物料类别方法create()==================="); + } + + /** + * 删除物料类别 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除物料类别信息方法delete()================"); + try + { + materialCategoryService.delete(model.getMaterialCategoryID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialCategoryID() + " 的物料类别异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除物料类别", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除物料类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "!", "删除物料类别" + tipMsg)); + Log.infoFileSync("====================结束调用删除物料类别信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新物料类别 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + MaterialCategory materialCategory = materialCategoryService.get(model.getMaterialCategoryID()); + materialCategory.setMaterialCategory(new MaterialCategory(model.getParentId())); + + materialCategory.setCategoryLevel(model.getCategoryLevel()); + materialCategory.setName(model.getName()); + materialCategoryService.update(materialCategory); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改物料类别ID为 : " + model.getMaterialCategoryID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改物料类别回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新物料类别", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新物料类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "!", "更新物料类别" + tipMsg)); + } + + /** + * 批量删除指定ID物料类别 + * @return + */ + public String batchDelete() + { + try + { + materialCategoryService.batchDelete(model.getMaterialCategoryIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除物料类别ID为:" + model.getMaterialCategoryIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除物料类别", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除物料类别ID为 "+ model.getMaterialCategoryIDs() + " " + tipMsg + "!", "批量删除物料类别" + tipMsg)); + return SUCCESS; + } + + /** + * 查找物料类别信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + materialCategoryService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(MaterialCategory materialCategory:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", materialCategory.getId()); + item.put("ParentId", materialCategory.getMaterialCategory().getId()); + item.put("ParentName", materialCategory.getMaterialCategory().getName()); + item.put("CategoryLevel", materialCategory.getCategoryLevel()); + item.put("Name", materialCategory.getName()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找物料类别信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询物料类别信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("ParentId_n_eq", model.getParentId()); + condition.put("Id_n_neq", 1); + condition.put("Id_s_order", "asc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public MaterialCategoryModel getModel() + { + return model; + } + public void setMaterialCategoryService(MaterialCategoryIService materialCategoryService) + { + this.materialCategoryService = materialCategoryService; + } +} diff --git a/src/com/jsh/action/materials/PersonAction.java b/src/com/jsh/action/materials/PersonAction.java new file mode 100644 index 00000000..c3064623 --- /dev/null +++ b/src/com/jsh/action/materials/PersonAction.java @@ -0,0 +1,273 @@ +package com.jsh.action.materials; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.springframework.dao.DataAccessException; + +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Depot; +import com.jsh.model.po.Person; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.materials.PersonModel; +import com.jsh.service.materials.PersonIService; +import com.jsh.util.common.PageUtil; + +@SuppressWarnings("serial") +public class PersonAction extends BaseAction +{ + private PersonIService personService; + private PersonModel model = new PersonModel(); + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public String getBasicData() + { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + Map condition = pageUtil.getAdvSearch(); + condition.put("ProjectId_n_eq", model.getProjectId()); + condition.put("Id_s_order", "asc"); + personService.find(pageUtil); + mapData.put("personList", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } + + /** + * 增加经手人 + * @return + */ + public void create() + { + Log.infoFileSync("==================开始调用增加经手人信息方法create()==================="); + Boolean flag = false; + try + { + Person person = new Person(); + person.setDepot(new Depot(model.getProjectId())); + + person.setType(model.getType()); + person.setName(model.getName()); + personService.create(person); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加经手人信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>增加经手人信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加经手人", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加经手人名称为 "+ model.getName() + " " + tipMsg + "!", "增加经手人" + tipMsg)); + Log.infoFileSync("==================结束调用增加经手人方法create()==================="); + } + + /** + * 删除经手人 + * @return + */ + public String delete() + { + Log.infoFileSync("====================开始调用删除经手人信息方法delete()================"); + try + { + personService.delete(model.getPersonID()); + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getPersonID() + " 的经手人异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除经手人", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除经手人ID为 "+ model.getPersonID() + " " + tipMsg + "!", "删除经手人" + tipMsg)); + Log.infoFileSync("====================结束调用删除经手人信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新经手人 + * @return + */ + public void update() + { + Boolean flag = false; + try + { + Person person = personService.get(model.getPersonID()); + person.setDepot(new Depot(model.getProjectId())); + + person.setType(model.getType()); + person.setName(model.getName()); + personService.update(person); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改经手人ID为 : " + model.getPersonID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改经手人回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新经手人", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新经手人ID为 "+ model.getPersonID() + " " + tipMsg + "!", "更新经手人" + tipMsg)); + } + + /** + * 批量删除指定ID经手人 + * @return + */ + public String batchDelete() + { + try + { + personService.batchDelete(model.getPersonIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>批量删除经手人ID为:" + model.getPersonIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } + + logService.create(new Logdetails(getUser(), "批量删除经手人", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除经手人ID为 "+ model.getPersonIDs() + " " + tipMsg + "!", "批量删除经手人" + tipMsg)); + return SUCCESS; + } + + /** + * 查找经手人信息 + * @return + */ + public void findBy() + { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + personService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + //开始拼接json数据 +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Person person:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", person.getId()); + item.put("ProjectId", person.getDepot().getId()); + item.put("ProjectName", person.getDepot().getName()); + item.put("Type", person.getType()); + item.put("Name", person.getName()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找经手人信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询经手人信息结果异常", e); + } + } + + /** + * 拼接搜索条件 + * @return + */ + private Map getCondition() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("ProjectId_n_eq", model.getProjectId()); + condition.put("Type_s_eq", model.getType()); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public PersonModel getModel() + { + return model; + } + public void setPersonService(PersonIService personService) + { + this.personService = personService; + } +} diff --git a/src/com/jsh/base/BaseAction.java b/src/com/jsh/base/BaseAction.java new file mode 100644 index 00000000..3a5df3c9 --- /dev/null +++ b/src/com/jsh/base/BaseAction.java @@ -0,0 +1,116 @@ +package com.jsh.base; + +import java.io.IOException; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts2.ServletActionContext; + +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.ActionSupport; +import com.opensymphony.xwork2.ModelDriven; +import com.jsh.model.po.Basicuser; +import com.jsh.service.basic.LogIService; +/** + * struts2工具类 + * @author andy + * struts2 base action 一些常用方法获取 + */ +@SuppressWarnings("serial") +public abstract class BaseAction extends ActionSupport implements ModelDriven +{ + public LogIService logService; + + /** + * 操作日志使用 是否成功表示 + */ + public String tipMsg = "成功"; + + /** + * 操作日志使用 是否成功表示 0 ==成功 1==失败 + */ + public short tipType = 0; + + public void setLogService(LogIService logService) + { + this.logService = logService; + } + + /** + * 获取session + * @return + */ + public static Map getSession() + { + return ActionContext.getContext().getSession(); + } + + /** + * 获取request + * @return + */ + public static HttpServletRequest getRequest() + { + return ServletActionContext.getRequest(); + } + /** + * 获取response + * @return response + */ + public static HttpServletResponse getResponse() + { + return ServletActionContext.getResponse(); + } + + /** + * 添加错误信息 + * @param anErrorMessage + */ + public void addActionError(String anErrorMessage) + { + super.addActionError(anErrorMessage); + } + + /** + * 添加消息 + * @param aMessage + */ + public void addActionMessage(String aMessage) + { + clearErrorsAndMessages(); + super.addActionMessage(aMessage); + } + + /** + * 添加字段错误 + * @param fieldName + * @param errorMessage + */ + public void addFieldError(String fieldName, String errorMessage) + { + clearErrorsAndMessages(); + super.addFieldError(fieldName, errorMessage); + } + + /** + * 登录用户信息 + * @return 登录用户对象 + */ + public Basicuser getUser() + { + return (Basicuser)getSession().get("user"); + } + + /** + * 回写客户端数据 + * @throws IOException + */ + public void toClient(String jsonData) throws IOException + { + HttpServletResponse response = ServletActionContext.getResponse(); + response.setContentType("text/html;charset=utf-8"); + response.getWriter().print(jsonData); + } +} \ No newline at end of file diff --git a/src/com/jsh/base/BaseDAO.java b/src/com/jsh/base/BaseDAO.java new file mode 100644 index 00000000..314d7c75 --- /dev/null +++ b/src/com/jsh/base/BaseDAO.java @@ -0,0 +1,137 @@ +package com.jsh.base; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import org.hibernate.Query; +import org.springframework.dao.DataAccessException; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.SearchConditionUtil; + +public class BaseDAO extends HibernateDaoSupport implements BaseIDAO +{ + protected Class entityClass; + + public void setPoJoClass(Class c) + { + this.entityClass = c; + } + + protected Class getEntityClass() + { + return this.entityClass; + } + + @Override + public Serializable create(T t) throws DataAccessException + { + return this.getHibernateTemplate().save(t); + } + + @Override + public void delete(T t) throws DataAccessException + { + this.getHibernateTemplate().delete(t); + } + + @Override + public T get(Long objID) throws DataAccessException + { + return (T) this.getHibernateTemplate().get(getEntityClass(), objID); + } + + @Override + public void update(T t) throws DataAccessException + { + this.getHibernateTemplate().update(t); + } + + @Override + public void batchDelete(String objIDs) throws DataAccessException + { + this.getHibernateTemplate().bulkUpdate("delete from " + getEntityClass().getName() + " where id in ("+ objIDs + ")"); + } + + @SuppressWarnings("unchecked") + @Override + public void find(PageUtil pageUtil) throws DataAccessException + { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + pageUtil.setTotalCount(query.list().size()); + + // 分页查询 + int pageNo = pageUtil.getCurPage(); + int pageSize = pageUtil.getPageSize(); + if (0 != pageNo && 0 != pageSize) + { + query.setFirstResult((pageNo - 1) * pageSize); + query.setMaxResults(pageSize); + } + pageUtil.setPageList(query.list()); + } + + @SuppressWarnings("unchecked") + @Override + public List find(Map conditon)throws DataAccessException + { + return this.getHibernateTemplate().find(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon)); + } + + @SuppressWarnings("unchecked") + @Override + public List find(String hql) throws DataAccessException + { + return this.getHibernateTemplate().find(" from " + getEntityClass().getName() + " where 1=1 "+ hql); + } + + @SuppressWarnings("unchecked") + @Override + public List find(Map conditon, int pageSize, int pageNo)throws DataAccessException + { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon)); + query.setFirstResult((pageNo - 1) * pageSize); + query.setMaxResults(pageSize); + return query.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List find(String hql, int pageSize, int pageNo)throws DataAccessException + { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql); + query.setFirstResult((pageNo - 1) * pageSize); + query.setMaxResults(pageSize); + return query.list(); + } + + @SuppressWarnings("unchecked") + @Override + public Integer countSum(Map conditon)throws DataAccessException + { + List dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon)).list(); + return dataList ==null?0:dataList.size(); + } + + @SuppressWarnings("unchecked") + @Override + public Integer countSum(String hql) throws DataAccessException + { + List dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql).list(); + return dataList ==null?0:dataList.size(); + } + + @Override + public void save(T t) throws DataAccessException + { + this.getHibernateTemplate().save(t); + } +} diff --git a/src/com/jsh/base/BaseIDAO.java b/src/com/jsh/base/BaseIDAO.java new file mode 100644 index 00000000..4fe52bf2 --- /dev/null +++ b/src/com/jsh/base/BaseIDAO.java @@ -0,0 +1,124 @@ +package com.jsh.base; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import org.springframework.dao.DataAccessException; + +import com.jsh.util.common.PageUtil; + +/** + * 常用增删改查操作 + * @author andy + * @param + */ +public interface BaseIDAO +{ + + /** + * 设置操作类对象 + * @param paramClass + */ + void setPoJoClass(Class paramClass); + + /** + * 增加 + * @param t 对象 + * @throws DataAccessException + */ + Serializable create(T t)throws DataAccessException; + + /** + * 增加 + * @param t 对象 + * @throws DataAccessException + */ + void save(T t)throws DataAccessException; + + /** + * 删除 + * @param t 对象 + * @throws DataAccessException + */ + void delete(T t)throws DataAccessException; + + /** + * 获取 + * @param objID ID + * @return 对象 + * @throws DataAccessException + */ + T get(Long objID)throws DataAccessException; + + /** + * 修改信息 + * @param t 要修改的对象 + * @throws DataAccessException + */ + void update(T t)throws DataAccessException; + + /** + * 批量删除信息 + * @param 以逗号分割的ID + * @throws DataAccessException + */ + void batchDelete(String objIDs)throws DataAccessException; + + /** + * 查找列表 + * @param pageUtil 分页工具类 + * @throws DataAccessException + */ + void find(PageUtil pageUtil)throws DataAccessException; + + /** + * 根据条件查询列表--没有分页信息 + * @param conditon 查询条件 + * @return 查询列表数据 + */ + List find(Map conditon)throws DataAccessException; + + /** + * 根据hql查询 --没有分页信息 + * @param hql hibernate查询 + * @return 查询列表数据 + */ + List find(String hql)throws DataAccessException; + + /** + * 根据搜索条件查询--分页 + * @param conditon 查询条件 + * @param pageSize 每页个数 + * @param pageNo 页码 + * @return 查询列表数据 + * @throws DataAccessException + */ + List find(Map conditon,int pageSize,int pageNo)throws DataAccessException; + + /** + * 根据hql查询--分页 + * @param hql hibernate查询语句 + * @param pageSize 每页个数 + * @param pageNo 页码 + * @return 查询列表数据 + * @throws DataAccessException + */ + List find(String hql,int pageSize,int pageNo)throws DataAccessException; + + /** + * 查找符合条件的总数 + * @param conditon + * @return + * @throws DataAccessException + */ + Integer countSum(Map conditon)throws DataAccessException; + + /** + * 查找符合条件的总数 + * @param hql + * @return + * @throws DataAccessException + */ + Integer countSum(String hql)throws DataAccessException; +} diff --git a/src/com/jsh/base/BaseIService.java b/src/com/jsh/base/BaseIService.java new file mode 100644 index 00000000..2f0de3ae --- /dev/null +++ b/src/com/jsh/base/BaseIService.java @@ -0,0 +1,105 @@ +package com.jsh.base; + +import java.io.Serializable; + +import org.springframework.dao.DataAccessException; + +import com.jsh.util.common.PageUtil; + +public interface BaseIService +{ + /** + * 增加 + * @param t 对象 + * @throws DataAccessException + */ + Serializable create(T t)throws DataAccessException; + + /** + * 增加 + * @param t 对象 + * @throws DataAccessException + */ + void save(T t)throws DataAccessException; + + /** + * 删除 + * @param t 对象 + * @throws DataAccessException + */ + void delete(T t)throws DataAccessException; + + /** + * 删除 + * @param id 对象ID + * @throws DataAccessException + */ + void delete(Long id)throws DataAccessException; + + /** + * 获取 + * @param objID ID + * @return 对象 + * @throws DataAccessException + */ + T get(Long objID)throws DataAccessException; + + /** + * 修改信息 + * @param t 要修改的对象 + * @throws DataAccessException + */ + void update(T t)throws DataAccessException; + + /** + * 批量删除信息 + * @param 以逗号分割的ID + * @throws DataAccessException + */ + void batchDelete(String objIDs)throws DataAccessException; + + /** + * 查找列表 + * @param pageUtil 分页工具类 + * @throws DataAccessException + */ + void find(PageUtil pageUtil) throws DataAccessException; + + /** + * 检查名称是否存在,页面唯一性效验使用 + * @param filedName 效验的字段名称 + * @param filedVale 校验值 + * @param idFiled ID字段名称 + * @param objectID 修改时对象ID + * @return true==存在 false==不存在 + * @throws DataAccessException + */ + Boolean checkIsNameExist(String filedName,String filedVale,String idFiled,Long objectID) throws DataAccessException; + + /** + * 检查UserBusiness是否存在,页面唯一性效验使用 + * @param TypeName 类型名称 + * @param TypeVale 类型值 + * @param KeyIdName 关键id + * @param KeyIdValue 关键值 + * @param UBName 关系名称 + * @param UBValue 关系值 + * @return true==存在 false==不存在 + * @throws DataAccessException + */ + Boolean checkIsUserBusinessExist(String TypeName,String TypeVale,String KeyIdName,String KeyIdValue,String UBName,String UBValue) throws DataAccessException; + + /** + * 检查UserBusiness是否存在,页面唯一性效验使用 + * @param TypeName 类型名称 + * @param TypeVale 类型值 + * @param KeyIdName 关键id + * @param KeyIdValue 关键值 + * @return true==存在 false==不存在 + * @throws DataAccessException + */ + Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException; + + + +} diff --git a/src/com/jsh/base/BaseService.java b/src/com/jsh/base/BaseService.java new file mode 100644 index 00000000..e47b2948 --- /dev/null +++ b/src/com/jsh/base/BaseService.java @@ -0,0 +1,137 @@ +package com.jsh.base; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.dao.DataAccessException; + +import com.jsh.exception.AmsException; +import com.jsh.model.po.Basicuser; +import com.jsh.util.common.PageUtil; + +public abstract class BaseService implements BaseIService +{ + /** + * Dao对象 + */ + private BaseIDAO baseDao; + + protected Class entityClass; + + public void setBaseDao(BaseIDAO baseDao) + { + this.baseDao = baseDao; + setPoJoClass(getEntityClass()); + } + + protected BaseIDAO getBaseDao() + { + return this.baseDao; + } + + private void setPoJoClass(Class c) + { + this.baseDao.setPoJoClass(c); + } + + protected abstract Class getEntityClass(); + + @Override + public Serializable create(T t) throws DataAccessException + { + return baseDao.create(t); + } + + @Override + public void save(T t) throws DataAccessException + { + baseDao.save(t); + } + + @Override + public void delete(T t) throws DataAccessException + { + baseDao.delete(t); + } + + @Override + public void delete(Long id) throws DataAccessException + { + baseDao.batchDelete(id.toString()); + } + + @Override + public T get(Long objID) throws DataAccessException + { + return baseDao.get(objID); + } + + @Override + public void update(T t) throws DataAccessException + { + baseDao.update(t); + } + + @Override + public void batchDelete(String objIDs) throws DataAccessException + { + baseDao.batchDelete(objIDs); + } + + @Override + public void find(PageUtil pageUtil) throws DataAccessException + { + baseDao.find(pageUtil); + } + + @Override + public Boolean checkIsNameExist(String filedName, String filedVale,String idFiled,Long objectID) throws DataAccessException + { + PageUtil pageUtil = new PageUtil(); + Map condition = new HashMap(); + condition.put(filedName + "_s_eq", filedVale); + condition.put(idFiled + "_n_neq", objectID); + pageUtil.setAdvSearch(condition); + baseDao.find(pageUtil); + + List dataList = pageUtil.getPageList(); + if(null != dataList && dataList.size() > 0) + return true; + return false; + } + + @Override + public Boolean checkIsUserBusinessExist(String TypeName,String TypeVale,String KeyIdName,String KeyIdValue,String UBName,String UBValue) throws DataAccessException + { + PageUtil pageUtil = new PageUtil(); + Map condition = new HashMap(); + condition.put(TypeName + "_s_eq", TypeVale); + condition.put(KeyIdName + "_s_eq", KeyIdValue); + condition.put(UBName + "_s_like", UBValue); + pageUtil.setAdvSearch(condition); + baseDao.find(pageUtil); + + List dataList = pageUtil.getPageList(); + if(null != dataList && dataList.size() > 0) + return true; + return false; + } + + @Override + public Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException + { + PageUtil pageUtil = new PageUtil(); + Map condition = new HashMap(); + condition.put(TypeName + "_s_eq", TypeVale); + condition.put(KeyIdName + "_s_eq", KeyIdValue); + pageUtil.setAdvSearch(condition); + baseDao.find(pageUtil); + + List dataList = pageUtil.getPageList(); + if(null != dataList && dataList.size() > 0) + return true; + return false; + } +} diff --git a/src/com/jsh/base/Log.java b/src/com/jsh/base/Log.java new file mode 100644 index 00000000..dbd51db8 --- /dev/null +++ b/src/com/jsh/base/Log.java @@ -0,0 +1,174 @@ +package com.jsh.base; + +import org.apache.log4j.Logger; + +/** + * 封装log4j日志信息,打印日志信息类 + * @author andy + * @since 2014-01-22 + */ +public class Log +{ + /** + * 根据异常信息获取调用类的信息 + */ + private static final Exception ex = new Exception(); + + /** + * 获取Log4j实例 + */ + private static final Logger log = Logger.getLogger("ams"); + + /** + * Info级别日志前缀 + */ + public static final String LOG_INFO_PREFIX = "=========="; + + /** + * error级别日志前缀 + */ + public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>"; + + /** + * debug级别日志前缀 + */ + public static final String LOG_DEBUG_PREFIX = "-----------"; + + /** + * fatal级别日志前缀 + */ + public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$"; + + /** + * warn级别日志前缀 + */ + public static final String LOG_WARN_PREFIX = "##########"; + + /** + * 打印deug日期信息 + * @param msg 日志信息 + */ + public static void debugFileSync(Object msg) + { + log.debug(getLogDetail(msg)); + } + + /** + * 打印debug异常信息 + * @param msg 日志信息 + * @param e 异常堆栈 + */ + public static void debugFileSync(Object msg, Throwable e) + { + log.debug(getLogDetail(msg), e); + } + + /** + * 打印info日志信息 + * @param msg 日志信息 + */ + public static void infoFileSync(Object msg) + { + log.info(getLogDetail(msg)); + } + + /** + * 打印 info日志带异常信息 + * @param msg 日志信息 + * @param e 异常堆栈 + */ + public static void infoFileSync(Object msg, Throwable e) + { + log.info(getLogDetail(msg), e); + } + + /** + * 打印warn日期信息 + * @param msg 日志信息 + */ + public static void warnFileSync(Object msg) + { + log.warn(getLogDetail(msg)); + } + + /** + * 打印warn日志信息带异常 + * @param msg日志信息 + * @param e 异常堆栈 + */ + public static void warnFileSync(Object msg, Throwable e) + { + log.warn(getLogDetail(msg), e); + } + + /** + * 打印error日志信息 + * @param msg 日志信息 + */ + public static void errorFileSync(Object msg) + { + log.error(getLogDetail(msg)); + } + + /** + * 打印error日志信息带异常 + * @param msg 日志信息 + * @param e 异常堆栈 + */ + public static void errorFileSync(Object msg, Throwable e) + { + log.error(getLogDetail(msg), e); + } + + /** + * 打印fatal日志信息 + * @param msg 日志信息 + */ + public static void fatalFileSync(Object msg) + { + log.fatal(getLogDetail(msg)); + } + + /** + * 打印fatal日志信息带异常 + * @param msg 日志信息 + * @param e 异常堆栈 + */ + public static void fatalFileSync(Object msg, Throwable e) + { + log.fatal(getLogDetail(msg), e); + } + + /** + * 拼装日志详细信息 + * @param message 要打印的日志信息 + * @return 封装后的日志详细信息 + */ + private static synchronized String getLogDetail(Object message) + { + String msg = ""; + if (null != message) + msg = message.toString(); + StringBuffer bf = new StringBuffer(); + try + { + ex.fillInStackTrace(); + throw ex; + } + catch (Exception ex) + { + StackTraceElement[] trace = ex.getStackTrace(); + //获取异常堆栈中的调用类信息 + final int pos = 2; + bf.append(msg); + bf.append(" [class:"); + bf.append(trace[pos].getClassName()); + bf.append(" method:"); + bf.append(trace[pos].getMethodName()); + bf.append(" line:"); + bf.append(trace[pos].getLineNumber()); + bf.append("]"); + } + return bf.toString(); + } +} \ No newline at end of file diff --git a/src/com/jsh/constants/asset/AssetConstants.java b/src/com/jsh/constants/asset/AssetConstants.java new file mode 100644 index 00000000..943b24dd --- /dev/null +++ b/src/com/jsh/constants/asset/AssetConstants.java @@ -0,0 +1,119 @@ +package com.jsh.constants.asset; + +/** + * 定义资产管理常量 + * @author andy + */ +public interface AssetConstants +{ + /** + * 公共常量 + * @author andy + */ + public class Common + { + + } + + /** + * 资产常量--导入导出excel表格业务相关 + * @author andy + */ + public class BusinessForExcel + { + /** + * 资产名称常量 + */ + public static final int EXCEL_ASSETNAME = 0; + + /** + * 资产类型常量 + */ + public static final int EXCEL_CATEGORY = 1; + + /** + * 资产单价 + */ + public static final int EXCEL_PRICE = 2; + + /** + * 用户 + */ + public static final int EXCEL_USER = 3; + + /** + * 购买日期 + */ + public static final int EXCEL_PURCHASE_DATE = 4; + + /** + * 资产状态 + */ + public static final int EXCEL_STATUS = 5; + + /** + * 位置 + */ + public static final int EXCEL_LOCATION = 6; + + /** + * 资产编号 + */ + public static final int EXCEL_NUM = 7; + + /** + * 序列号 + */ + public static final int EXCEL_SERIALNO = 8; + + /** + * 有效日期 + */ + public static final int EXCEL_EXPIRATION_DATE = 9; + + /** + * 保修日期 + */ + public static final int EXCEL_WARRANTY_DATE = 10; + + /** + * 供应商 + */ + public static final int EXCEL_SUPPLIER = 11; + + /** + * 标签 + */ + public static final int EXCEL_LABLE = 12; + + /** + * 描述 + */ + public static final int EXCEL_DESC = 13; + + /** + * 表头 + */ + public static final int EXCEL_TABLE_HEAD = 0; + + /** + * 状态 --在库 + */ + public static final int EXCEl_STATUS_ZAIKU = 0; + + /** + * 状态 --在用 + */ + public static final int EXCEl_STATUS_INUSE = 1; + + /** + * 状态 -- 消费 + */ + public static final int EXCEl_STATUS_CONSUME = 2; + + /** + * action返回excel结果 + */ + public static final String EXCEL = "excel"; + } +} diff --git a/src/com/jsh/constants/asset/ExcelConstantsCode.java b/src/com/jsh/constants/asset/ExcelConstantsCode.java new file mode 100644 index 00000000..88e0a163 --- /dev/null +++ b/src/com/jsh/constants/asset/ExcelConstantsCode.java @@ -0,0 +1,35 @@ +package com.jsh.constants.asset; + +public interface ExcelConstantsCode +{ + /** + * 导入excel表格常量定义 + */ + public class ImportExcelCode + { + /** + * 表格正确 + */ + public static final String RIGHT = "right"; + + /** + * 表格错误 + */ + public static final String WRONG = "wrong"; + + /** + * 表格警告 + */ + public static final String WARN = "warn"; + } + + /** + * 导出excel表格常量定义 + * @author angel + * + */ + public class ExportExcelCode + { + + } +} diff --git a/src/com/jsh/constants/common/AmsConstants.java b/src/com/jsh/constants/common/AmsConstants.java new file mode 100644 index 00000000..c5acce52 --- /dev/null +++ b/src/com/jsh/constants/common/AmsConstants.java @@ -0,0 +1,36 @@ +package com.jsh.constants.common; + +public interface AmsConstants +{ + /** + * 定义资产管理公共常量 + * @author andy + */ + public class Common + { + /** + * Info级别日志前缀 + */ + public static final String LOG_INFO_PREFIX = "=========="; + + /** + * error级别日志前缀 + */ + public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>"; + + /** + * debug级别日志前缀 + */ + public static final String LOG_DEBUG_PREFIX = "-----------"; + + /** + * fatal级别日志前缀 + */ + public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$"; + + /** + * warn级别日志前缀 + */ + public static final String LOG_WARN_PREFIX = "##########"; + } +} diff --git a/src/com/jsh/constants/common/ExceptionCodeConstants.java b/src/com/jsh/constants/common/ExceptionCodeConstants.java new file mode 100644 index 00000000..2fcc70bc --- /dev/null +++ b/src/com/jsh/constants/common/ExceptionCodeConstants.java @@ -0,0 +1,35 @@ +package com.jsh.constants.common; + +public interface ExceptionCodeConstants +{ + /** + * 用户错误码定义 + */ + public class UserExceptionCode + { + /** + * 用户不存在 + */ + public static final int USER_NOT_EXIST = 1; + + /** + * 用户密码错误 + */ + public static final int USER_PASSWORD_ERROR = 2; + + /** + * 被加入黑名单 + */ + public static final int BLACK_USER = 3; + + /** + * 可以登录 + */ + public static final int USER_CONDITION_FIT = 4; + + /** + * 访问数据库异常 + */ + public static final int USER_ACCESS_EXCEPTION = 5; + } +} diff --git a/src/com/jsh/constants/common/LogModuleConstants.java b/src/com/jsh/constants/common/LogModuleConstants.java new file mode 100644 index 00000000..36f9c063 --- /dev/null +++ b/src/com/jsh/constants/common/LogModuleConstants.java @@ -0,0 +1,65 @@ +package com.jsh.constants.common; + +public interface LogModuleConstants +{ + /** + * 系统管理模块名称定义 + * @author andy + */ + public class ManageModuleNameCode + { + /** + * 管理模块资产名称 + */ + public static final String MODULE_MANAGE_ASSETNAME = "资产名称"; + + /** + * 管理模块供应商 + */ + public static final String MODULE_MANAGE_SUPPLIER = "供应商"; + + /** + * 管理模块资产类型 + */ + public static final String MODULE_MANAGE_CATEGORY = "资产类型"; + + /** + * 管理模块用户管理 + */ + public static final String MODULE_MANAGE_USER = "用户管理"; + } + + /** + * 资产管理模块名称定义 + * @author andy + */ + public class AssetModuleNameCode + { + /** + * 资产管理模块资产管理 + */ + public static final String MODULE_ASSET_MANAGE = "资产管理"; + + /** + * 资产管理模块资产报表 + */ + public static final String MODULE_ASSET_REPORT = "资产报表"; + + /** + * 资产管理模块资产概况 + */ + public static final String MODULE_ASSET_GENERAL = "资产概况"; + } + + /** + * 日志管理模块名称定义 + * @author andy + */ + public class LogModuleNameCode + { + /** + * 日志管理模块日志管理 + */ + public static final String MODULE_LOG_MANAGE = "日志管理"; + } +} \ No newline at end of file diff --git a/src/com/jsh/dao/asset/AssetDAO.java b/src/com/jsh/dao/asset/AssetDAO.java new file mode 100644 index 00000000..7df4bdcb --- /dev/null +++ b/src/com/jsh/dao/asset/AssetDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.asset; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Asset; + +public class AssetDAO extends BaseDAO implements AssetIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Asset.class; + } +} diff --git a/src/com/jsh/dao/asset/AssetIDAO.java b/src/com/jsh/dao/asset/AssetIDAO.java new file mode 100644 index 00000000..8bd454fe --- /dev/null +++ b/src/com/jsh/dao/asset/AssetIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.asset; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Asset; + +public interface AssetIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/asset/ReportDAO.java b/src/com/jsh/dao/asset/ReportDAO.java new file mode 100644 index 00000000..6eb6b4e9 --- /dev/null +++ b/src/com/jsh/dao/asset/ReportDAO.java @@ -0,0 +1,21 @@ +package com.jsh.dao.asset; + +import org.hibernate.Query; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.SearchConditionUtil; + +public class ReportDAO extends HibernateDaoSupport implements ReportIDAO +{ + @SuppressWarnings("unchecked") + @Override + public void find(PageUtil pageUtil,String reportType,String reportName) throws AmsException + { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(" + reportType +") as dataSum, " + reportName + " from Asset asset where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + pageUtil.setTotalCount(query.list().size()); + pageUtil.setPageList(query.list()); + } +} diff --git a/src/com/jsh/dao/asset/ReportIDAO.java b/src/com/jsh/dao/asset/ReportIDAO.java new file mode 100644 index 00000000..6df8b1c4 --- /dev/null +++ b/src/com/jsh/dao/asset/ReportIDAO.java @@ -0,0 +1,16 @@ +package com.jsh.dao.asset; + +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.util.common.PageUtil; + +public interface ReportIDAO +{ + /** + * 查找资产列表 + * @param pageUtil 分页工具类 + * @param reportType 报表统计字段 + * @throws AmsException + */ + void find(PageUtil pageUtil,String reportType,String reportName) throws AmsException; +} diff --git a/src/com/jsh/dao/basic/AppDAO.java b/src/com/jsh/dao/basic/AppDAO.java new file mode 100644 index 00000000..82bf34ee --- /dev/null +++ b/src/com/jsh/dao/basic/AppDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.App; + +public class AppDAO extends BaseDAO implements AppIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return App.class; + } +} diff --git a/src/com/jsh/dao/basic/AppIDAO.java b/src/com/jsh/dao/basic/AppIDAO.java new file mode 100644 index 00000000..954c447b --- /dev/null +++ b/src/com/jsh/dao/basic/AppIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.App; + +public interface AppIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/basic/AssetNameDAO.java b/src/com/jsh/dao/basic/AssetNameDAO.java new file mode 100644 index 00000000..acf3b783 --- /dev/null +++ b/src/com/jsh/dao/basic/AssetNameDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Assetname; + +public class AssetNameDAO extends BaseDAO implements AssetNameIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Assetname.class; + } +} diff --git a/src/com/jsh/dao/basic/AssetNameIDAO.java b/src/com/jsh/dao/basic/AssetNameIDAO.java new file mode 100644 index 00000000..7942aae8 --- /dev/null +++ b/src/com/jsh/dao/basic/AssetNameIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Assetname; + +public interface AssetNameIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/basic/CategoryDAO.java b/src/com/jsh/dao/basic/CategoryDAO.java new file mode 100644 index 00000000..b63ce3ec --- /dev/null +++ b/src/com/jsh/dao/basic/CategoryDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Category; + +public class CategoryDAO extends BaseDAO implements CategoryIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Category.class; + } +} diff --git a/src/com/jsh/dao/basic/CategoryIDAO.java b/src/com/jsh/dao/basic/CategoryIDAO.java new file mode 100644 index 00000000..75869021 --- /dev/null +++ b/src/com/jsh/dao/basic/CategoryIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Category; + +public interface CategoryIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/basic/DepotDAO.java b/src/com/jsh/dao/basic/DepotDAO.java new file mode 100644 index 00000000..5cba5386 --- /dev/null +++ b/src/com/jsh/dao/basic/DepotDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Depot; + +public class DepotDAO extends BaseDAO implements DepotIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Depot.class; + } +} diff --git a/src/com/jsh/dao/basic/DepotIDAO.java b/src/com/jsh/dao/basic/DepotIDAO.java new file mode 100644 index 00000000..fbf407b7 --- /dev/null +++ b/src/com/jsh/dao/basic/DepotIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Depot; + +public interface DepotIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/basic/FunctionsDAO.java b/src/com/jsh/dao/basic/FunctionsDAO.java new file mode 100644 index 00000000..f163b695 --- /dev/null +++ b/src/com/jsh/dao/basic/FunctionsDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Functions; + +public class FunctionsDAO extends BaseDAO implements FunctionsIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Functions.class; + } +} diff --git a/src/com/jsh/dao/basic/FunctionsIDAO.java b/src/com/jsh/dao/basic/FunctionsIDAO.java new file mode 100644 index 00000000..53d4cd0c --- /dev/null +++ b/src/com/jsh/dao/basic/FunctionsIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Functions; + +public interface FunctionsIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/basic/LogDAO.java b/src/com/jsh/dao/basic/LogDAO.java new file mode 100644 index 00000000..4d065409 --- /dev/null +++ b/src/com/jsh/dao/basic/LogDAO.java @@ -0,0 +1,18 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Logdetails; + +public class LogDAO extends BaseDAO implements LogIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Logdetails.class; + } + +} diff --git a/src/com/jsh/dao/basic/LogIDAO.java b/src/com/jsh/dao/basic/LogIDAO.java new file mode 100644 index 00000000..9a86c2c6 --- /dev/null +++ b/src/com/jsh/dao/basic/LogIDAO.java @@ -0,0 +1,13 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Logdetails; + +/** + * 日志相关处理接口 + * @author angel + */ +public interface LogIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/basic/RoleDAO.java b/src/com/jsh/dao/basic/RoleDAO.java new file mode 100644 index 00000000..bdc6c384 --- /dev/null +++ b/src/com/jsh/dao/basic/RoleDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Role; + +public class RoleDAO extends BaseDAO implements RoleIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Role.class; + } +} diff --git a/src/com/jsh/dao/basic/RoleIDAO.java b/src/com/jsh/dao/basic/RoleIDAO.java new file mode 100644 index 00000000..c11ee2aa --- /dev/null +++ b/src/com/jsh/dao/basic/RoleIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Role; + +public interface RoleIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/basic/SupplierDAO.java b/src/com/jsh/dao/basic/SupplierDAO.java new file mode 100644 index 00000000..4710ba26 --- /dev/null +++ b/src/com/jsh/dao/basic/SupplierDAO.java @@ -0,0 +1,19 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Supplier; + +public class SupplierDAO extends BaseDAO implements SupplierIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Supplier.class; + } + + +} diff --git a/src/com/jsh/dao/basic/SupplierIDAO.java b/src/com/jsh/dao/basic/SupplierIDAO.java new file mode 100644 index 00000000..199dac0c --- /dev/null +++ b/src/com/jsh/dao/basic/SupplierIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Supplier; + +public interface SupplierIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/basic/UserBusinessDAO.java b/src/com/jsh/dao/basic/UserBusinessDAO.java new file mode 100644 index 00000000..7766efd0 --- /dev/null +++ b/src/com/jsh/dao/basic/UserBusinessDAO.java @@ -0,0 +1,32 @@ +package com.jsh.dao.basic; + +import org.hibernate.Query; + +import com.jsh.base.BaseDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.model.po.UserBusiness; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.SearchConditionUtil; + +public class UserBusinessDAO extends BaseDAO implements UserBusinessIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return UserBusiness.class; + } + + @SuppressWarnings("unchecked") + @Override + public void find(PageUtil pageUtil,String ceshi) throws AmsException + { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(id),sum(id) from UserBusiness userBusiness where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + pageUtil.setTotalCount(query.list().size()); + pageUtil.setPageList(query.list()); + } +} diff --git a/src/com/jsh/dao/basic/UserBusinessIDAO.java b/src/com/jsh/dao/basic/UserBusinessIDAO.java new file mode 100644 index 00000000..72f5e9b9 --- /dev/null +++ b/src/com/jsh/dao/basic/UserBusinessIDAO.java @@ -0,0 +1,14 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.UserBusiness; +import com.jsh.util.common.PageUtil; + +public interface UserBusinessIDAO extends BaseIDAO +{ + /* + * 测试hql语句 + */ + void find(PageUtil pageUtil,String ceshi) throws AmsException; +} diff --git a/src/com/jsh/dao/basic/UserDAO.java b/src/com/jsh/dao/basic/UserDAO.java new file mode 100644 index 00000000..1f6dcc47 --- /dev/null +++ b/src/com/jsh/dao/basic/UserDAO.java @@ -0,0 +1,19 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Basicuser; + +public class UserDAO extends BaseDAO implements UserIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Basicuser.class; + } + + +} diff --git a/src/com/jsh/dao/basic/UserIDAO.java b/src/com/jsh/dao/basic/UserIDAO.java new file mode 100644 index 00000000..1910baa6 --- /dev/null +++ b/src/com/jsh/dao/basic/UserIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Basicuser; + +public interface UserIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/basic/VisitAccountDAO.java b/src/com/jsh/dao/basic/VisitAccountDAO.java new file mode 100644 index 00000000..e37ec20d --- /dev/null +++ b/src/com/jsh/dao/basic/VisitAccountDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.VisitAccount; + +public class VisitAccountDAO extends BaseDAO implements VisitAccountIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return VisitAccount.class; + } +} diff --git a/src/com/jsh/dao/basic/VisitAccountIDAO.java b/src/com/jsh/dao/basic/VisitAccountIDAO.java new file mode 100644 index 00000000..212b0c8b --- /dev/null +++ b/src/com/jsh/dao/basic/VisitAccountIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.basic; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.VisitAccount; + +public interface VisitAccountIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/materials/BuildingDAO.java b/src/com/jsh/dao/materials/BuildingDAO.java new file mode 100644 index 00000000..50d48de6 --- /dev/null +++ b/src/com/jsh/dao/materials/BuildingDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Building; + +public class BuildingDAO extends BaseDAO implements BuildingIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Building.class; + } +} diff --git a/src/com/jsh/dao/materials/BuildingIDAO.java b/src/com/jsh/dao/materials/BuildingIDAO.java new file mode 100644 index 00000000..f97df09d --- /dev/null +++ b/src/com/jsh/dao/materials/BuildingIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Building; + +public interface BuildingIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/materials/DepotHeadDAO.java b/src/com/jsh/dao/materials/DepotHeadDAO.java new file mode 100644 index 00000000..50ce9f3a --- /dev/null +++ b/src/com/jsh/dao/materials/DepotHeadDAO.java @@ -0,0 +1,32 @@ +package com.jsh.dao.materials; + +import org.hibernate.Query; + +import com.jsh.base.BaseDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.UserBusiness; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.SearchConditionUtil; + +public class DepotHeadDAO extends BaseDAO implements DepotHeadIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return DepotHead.class; + } + + @SuppressWarnings("unchecked") + @Override + public void find(PageUtil pageUtil,String maxid) throws AmsException + { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from DepotHead depotHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + pageUtil.setTotalCount(query.list().size()); + pageUtil.setPageList(query.list()); + } +} diff --git a/src/com/jsh/dao/materials/DepotHeadIDAO.java b/src/com/jsh/dao/materials/DepotHeadIDAO.java new file mode 100644 index 00000000..a2eec1a9 --- /dev/null +++ b/src/com/jsh/dao/materials/DepotHeadIDAO.java @@ -0,0 +1,15 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseIDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.UserBusiness; +import com.jsh.util.common.PageUtil; + +public interface DepotHeadIDAO extends BaseIDAO +{ + /* + * 获取MaxId + */ + void find(PageUtil pageUtil,String maxid) throws AmsException; +} diff --git a/src/com/jsh/dao/materials/DepotItemDAO.java b/src/com/jsh/dao/materials/DepotItemDAO.java new file mode 100644 index 00000000..c8937009 --- /dev/null +++ b/src/com/jsh/dao/materials/DepotItemDAO.java @@ -0,0 +1,59 @@ +package com.jsh.dao.materials; + +import org.hibernate.Query; + +import com.jsh.base.BaseDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.DepotItem; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.SearchConditionUtil; + +public class DepotItemDAO extends BaseDAO implements DepotItemIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return DepotItem.class; + } + + @SuppressWarnings("unchecked") + @Override + public void findByType(PageUtil pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws AmsException + { + //多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便 + Query query; + if(isPrev) { + query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + } + else { + query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + } + pageUtil.setTotalCount(query.list().size()); + pageUtil.setPageList(query.list()); + } + + + @SuppressWarnings("unchecked") + @Override + public void findOrderByMaterial(PageUtil pageUtil) throws AmsException + { + //多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便 + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select * from jsh_depotitem where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + pageUtil.setTotalCount(query.list().size()); + + // 分页查询 + int pageNo = pageUtil.getCurPage(); + int pageSize = pageUtil.getPageSize(); + if (0 != pageNo && 0 != pageSize) + { + query.setFirstResult((pageNo - 1) * pageSize); + query.setMaxResults(pageSize); + } + pageUtil.setPageList(query.list()); + } +} diff --git a/src/com/jsh/dao/materials/DepotItemIDAO.java b/src/com/jsh/dao/materials/DepotItemIDAO.java new file mode 100644 index 00000000..a1a72e0b --- /dev/null +++ b/src/com/jsh/dao/materials/DepotItemIDAO.java @@ -0,0 +1,14 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseIDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.DepotItem; +import com.jsh.util.common.PageUtil; + +public interface DepotItemIDAO extends BaseIDAO +{ + void findByType(PageUtil pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws AmsException; + + void findOrderByMaterial(PageUtil pageUtil) throws AmsException; +} diff --git a/src/com/jsh/dao/materials/MaterialCategoryDAO.java b/src/com/jsh/dao/materials/MaterialCategoryDAO.java new file mode 100644 index 00000000..121ecbb1 --- /dev/null +++ b/src/com/jsh/dao/materials/MaterialCategoryDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.MaterialCategory; + +public class MaterialCategoryDAO extends BaseDAO implements MaterialCategoryIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return MaterialCategory.class; + } +} diff --git a/src/com/jsh/dao/materials/MaterialCategoryIDAO.java b/src/com/jsh/dao/materials/MaterialCategoryIDAO.java new file mode 100644 index 00000000..39058cea --- /dev/null +++ b/src/com/jsh/dao/materials/MaterialCategoryIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.MaterialCategory; + +public interface MaterialCategoryIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/materials/MaterialDAO.java b/src/com/jsh/dao/materials/MaterialDAO.java new file mode 100644 index 00000000..bbefa62a --- /dev/null +++ b/src/com/jsh/dao/materials/MaterialDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Material; + +public class MaterialDAO extends BaseDAO implements MaterialIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Material.class; + } +} diff --git a/src/com/jsh/dao/materials/MaterialIDAO.java b/src/com/jsh/dao/materials/MaterialIDAO.java new file mode 100644 index 00000000..962ef83a --- /dev/null +++ b/src/com/jsh/dao/materials/MaterialIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Material; + +public interface MaterialIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/dao/materials/PersonDAO.java b/src/com/jsh/dao/materials/PersonDAO.java new file mode 100644 index 00000000..d397673e --- /dev/null +++ b/src/com/jsh/dao/materials/PersonDAO.java @@ -0,0 +1,17 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseDAO; +import com.jsh.model.po.Person; + +public class PersonDAO extends BaseDAO implements PersonIDAO +{ + /** + * 设置dao映射基类 + * @return + */ + @Override + public Class getEntityClass() + { + return Person.class; + } +} diff --git a/src/com/jsh/dao/materials/PersonIDAO.java b/src/com/jsh/dao/materials/PersonIDAO.java new file mode 100644 index 00000000..1a5c121b --- /dev/null +++ b/src/com/jsh/dao/materials/PersonIDAO.java @@ -0,0 +1,9 @@ +package com.jsh.dao.materials; + +import com.jsh.base.BaseIDAO; +import com.jsh.model.po.Person; + +public interface PersonIDAO extends BaseIDAO +{ + +} diff --git a/src/com/jsh/exception/AmsException.java b/src/com/jsh/exception/AmsException.java new file mode 100644 index 00000000..94bde3b2 --- /dev/null +++ b/src/com/jsh/exception/AmsException.java @@ -0,0 +1,73 @@ +package com.jsh.exception; + +/** + * @title: 平台异常基类 + * @description: 用于包装一些异常信息,打印日志等服务 + * @author andy + * @since: 2014-01-24 + */ +@SuppressWarnings("serial") +public class AmsException extends Exception +{ + public long errorCode = -1; + + public String message ; + + public AmsException() + { + super(); + } + + public AmsException(String message) + { + super(message); + this.message = message; + } + + public AmsException(String message, Throwable cause) + { + super(message, cause); + this.message = message; + } + + public AmsException(Throwable cause) + { + super(cause); + } + + public AmsException(long errorCode) + { + super(); + this.errorCode = errorCode; + } + + public AmsException(String message, long errorCode) + { + super(message); + this.errorCode = errorCode; + this.message = message; + } + + public AmsException(String message, long errorCode, Throwable cause) + { + super(message, cause); + this.errorCode = errorCode; + this.message = message; + } + + public AmsException(long errorCode, Throwable cause) + { + super(cause); + this.errorCode = errorCode; + } + + public long getErrorCode() + { + return errorCode; + } + + public String getMessage() + { + return message; + } +} diff --git a/src/com/jsh/filter/common/OpenSessionInViewFilterExtend.java b/src/com/jsh/filter/common/OpenSessionInViewFilterExtend.java new file mode 100644 index 00000000..877fa5c2 --- /dev/null +++ b/src/com/jsh/filter/common/OpenSessionInViewFilterExtend.java @@ -0,0 +1,24 @@ +package com.jsh.filter.common; + +import org.hibernate.FlushMode; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.springframework.dao.DataAccessResourceFailureException; +import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter; + +public class OpenSessionInViewFilterExtend extends OpenSessionInViewFilter +{ + @Override + protected Session getSession(SessionFactory sessionFactory) + throws DataAccessResourceFailureException + { + this.setFlushMode(FlushMode.AUTO); + return super.getSession(sessionFactory); + } + @Override + protected void closeSession(Session session, SessionFactory sessionFactory) + { + session.flush(); + super.closeSession(session, sessionFactory); + } +} diff --git a/src/com/jsh/filter/user/UserFilter.java b/src/com/jsh/filter/user/UserFilter.java new file mode 100644 index 00000000..79f91cf7 --- /dev/null +++ b/src/com/jsh/filter/user/UserFilter.java @@ -0,0 +1,83 @@ +package com.jsh.filter.user; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +/** + * 用户登录session处理类 + * 过滤session是否超时 + * @author andy + * @version [版本号, 2012-3-6] + * @see [相关类/方法] + * @since + */ +public class UserFilter implements Filter +{ + /** + * 初始化过滤器 暂不处理 + * 重载方法 + * @param arg0 + * @throws ServletException + */ + + public void init(FilterConfig arg0) + throws ServletException + { + + } + /** + * 判断用户session是否存在 不存在则跳转到登录页面 + * 重载方法 + * @param srequest + * @param sresponse + * @param chain + * @throws IOException + * @throws ServletException + */ + public void doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain chain) + throws IOException, ServletException + { + HttpServletRequest request = (HttpServletRequest) srequest; + HttpServletResponse response = (HttpServletResponse) sresponse; + HttpSession session = request.getSession(); +// //定义登录页面不被过滤===后续考虑 +// List notFilterFile = new ArrayList(); +// notFilterFile.add("/login.jsp"); +// notFilterFile.add("/logout.jsp"); +// notFilterFile.add("/css/*"); +// notFilterFile.add("/css/zTreeStyle/*"); +// notFilterFile.add("/css/zTreeStyle/img/*"); +// notFilterFile.add("/css/zTreeStyle/img/diy/*"); + + //获取工程路径 + String path = request.getContextPath(); + String requestURl = request.getRequestURI(); + + //提示用户没有权限操作 +// response.setCharacterEncoding("utf-8"); +// PrintWriter pw=response.getWriter(); +// pw.write(""); + //session中有值则不进行处理 + if(requestURl.contains("/pages") &&null != session.getAttribute("user")) + chain.doFilter(request, response); + else + response.sendRedirect(path + "/logout.jsp"); + } + + /** + * 销毁过滤器 + */ + public void destroy() + { + + } +} \ No newline at end of file diff --git a/src/com/jsh/junitest/AmsTAsset.hbm.xml b/src/com/jsh/junitest/AmsTAsset.hbm.xml new file mode 100644 index 00000000..b8f0a942 --- /dev/null +++ b/src/com/jsh/junitest/AmsTAsset.hbm.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 位置 + + + + + 标签:以空格为分隔符 + + + + + 资产的状态:0==在库,1==在用,2==消费 + + + + + 购买价格 + + + + + 购买日期 + + + + + 有效日期 + + + + + 保修日期 + + + + + 资产编号 + + + + + 资产序列号 + + + + + 描述信息 + + + + + 资产添加时间,统计报表使用 + + + + + + + + + + diff --git a/src/com/jsh/junitest/common/ExtendsTest.java b/src/com/jsh/junitest/common/ExtendsTest.java new file mode 100644 index 00000000..4a043e3a --- /dev/null +++ b/src/com/jsh/junitest/common/ExtendsTest.java @@ -0,0 +1,10 @@ +package com.jsh.junitest.common; + +import junit.framework.TestCase; + +public class ExtendsTest extends TestCase +{ + public void testExtends() + { + } +} diff --git a/src/com/jsh/junitest/common/ForTest.java b/src/com/jsh/junitest/common/ForTest.java new file mode 100644 index 00000000..7c8bef84 --- /dev/null +++ b/src/com/jsh/junitest/common/ForTest.java @@ -0,0 +1,14 @@ +package com.jsh.junitest.common; + +import junit.framework.TestCase; + +public class ForTest extends TestCase +{ + public void testrrr() + { + String[] aa= {"111","222","333"}; + for(String str:aa) + System.out.println(str); + System.out.println("bbb"); + } +} diff --git a/src/com/jsh/junitest/common/ImportExcelTest.java b/src/com/jsh/junitest/common/ImportExcelTest.java new file mode 100644 index 00000000..284651ff --- /dev/null +++ b/src/com/jsh/junitest/common/ImportExcelTest.java @@ -0,0 +1,156 @@ +package com.jsh.junitest.common; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; + +import com.jsh.model.po.Asset; + +public class ImportExcelTest +{ + + /** + * 文件路径 + */ + private static final String excelPath = "D:/movie/qq.xls"; + + /** + * 解析后的data + */ + private static Map data = new LinkedHashMap(); + + + /** + * 解析数据格式 + */ + public static void paseData() + { + int total = 0; + try + { + //创建对Excel工作簿文件的引用 + HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(excelPath)); + //创建对工作表的引用,获取第一个工作表的内容 + HSSFSheet sheet = workbook.getSheetAt(0); + /** + * ===================================== + * 1、此处要增加报盘文件的验证,如果不是报盘文件需要进行特殊的处理,3列 + * 2、报盘文件内容为空处理 + * 3、如果是修改过的报盘文件内容 + */ + Iterator itsheet = sheet.rowIterator(); + while(itsheet.hasNext()) + { + System.out.println(); + Row row = itsheet.next(); + + //excel表格第几行数据 从1开始 0 是表头 + int rowNum = row.getRowNum(); + /** + * 表头跳过不读 + */ + if(0 == rowNum) + continue; + total ++; + Iterator it = row.cellIterator(); +// PreAuthExcelTip preAuth = new PreAuthExcelTip(); +// preAuth.setAuthState(authState); +// preAuth.setWrongRow(rowNum); + Cell cell = null; + String preAuthMacAddr = ""; + //判断行号 + int i = 0; + while(it.hasNext()) + { + cell = it.next(); + i = cell.getColumnIndex(); + + System.out.print(cell.getCellType() + " " + cell.getStringCellValue()); + if(1 == i) + { + String contentValue = cell.getStringCellValue(); + if(null == contentValue || "".equals(contentValue)) + break; +// preAuth.setSnNo(cell.getStringCellValue()); + } + if(2 == i) + { + String contentValue = cell.getStringCellValue(); + if(null == contentValue || "".equals(contentValue)) + break; + preAuthMacAddr = contentValue; +// preAuth.setMacAddr(PreAuthUtil.changeMacFormt(preAuthMacAddr)); + } + } + System.out.println("此行总共有" + i + "列"); + //报盘文件为3列,否则不是报盘文件 +// if(i != 2) +// { +// PreAuthUtil.showMessageDialog("导入文件格式不合法,请重新选择文件进行操作!"); +// return null; +// } +// //MAC地址合法添加到正确的MAC地址数组 +// if(PreAuthUtil.isMacAddress(preAuthMacAddr)) +// { +// if(allMacAddress.contains(preAuthMacAddr)) +// { +// repeatPreAuth.add(preAuth); +// } +// else +// { +// allMacAddress.add(preAuthMacAddr); +// rightPreAuth.add(preAuth); +// } +// } +// else +// { +// wrongPreAuth.add(preAuth); +// } + } + +// if((null==rightPreAuth || rightPreAuth.size()==0)&& (null == wrongPreAuth|| wrongPreAuth.size() ==0)&&(null == repeatPreAuth ||repeatPreAuth.size() ==0)) +// { +// PreAuthUtil.showMessageDialog("报盘文件内容为空,请重新选择!"); +// return map; +// } +// //处理完读取文件,返回处理结果 +// map.put("rightMacAddr", rightPreAuth); +// map.put("wrongMacAddr", wrongPreAuth); +// map.put("repeatMacAddr", repeatPreAuth); + } + catch (FileNotFoundException e) + { + System.out.println("预授权读取文件异常 : " + e ); + e.printStackTrace(); +// PreAuthUtil.showMessageDialog("预授权读取excel文件异常:找不到指定文件!"); +// return map; + } + catch (IOException e) + { + System.out.println("预授权读取文件IO异常 : " + e ); + e.printStackTrace(); +// PreAuthUtil.showMessageDialog("读取excel文件异常,请确认文件格式是否正确!"); +// return map; + } + + System.out.println("excel表格总共有 " + total + " 条记录!"); + } + + /** + * @param args + */ + public static void main(String[] args) + { + // TODO Auto-generated method stub + new ImportExcelTest().paseData(); + } + +} diff --git a/src/com/jsh/junitest/common/SumTest.java b/src/com/jsh/junitest/common/SumTest.java new file mode 100644 index 00000000..7556abbf --- /dev/null +++ b/src/com/jsh/junitest/common/SumTest.java @@ -0,0 +1,72 @@ +package com.jsh.junitest.common; + +import junit.framework.TestCase; + +public class SumTest extends TestCase +{ + public void testSum() + { + //================宋芳==================== + int[] songfang = {6,6,6,-4,-4,-6,3,12,6,-6,6,-12,3,-6,12}; + int songfangSum = 0; + int songying = 0; + int songshu = 0; + for(int i = 0 ;i < songfang.length;i ++) + { + songfangSum += songfang[i]; + if(songfang[i] > 0) + songying ++; + else + songshu ++; + } + + System.out.println("宋芳斗地主局数:" + songfang.length + ",赢" + songying + "局,输" + songshu +"局,统计玩牌的计分是:" + songfangSum); + //================宋芳==================== + + //===============王维======================== + int[] wangwei = {-3,-3,-3,8,2,12,-6,-6,6,3,-3,6,-6,3,-6}; + int wangweiSum = 0; + int wangweiying = 0; + int wangweishu = 0; + for(int i = 0 ;i < wangwei.length;i ++) + { + wangweiSum += wangwei[i]; + if(wangwei[i] > 0) + wangweiying ++; + else + wangweishu ++; + } + System.out.println("王维斗地主局数:" + wangwei.length + ",赢" + wangweiying + "局,输" + wangweishu +"局,统计玩牌的计分是:" + wangweiSum); + //===============王维======================== + + //===============王鹏======================== + int[] wangpeng = {-3,-3,-3,-4,2,-6,3,-6,-12,3,-3,6,3,3,-6}; + int wangpengSum = 0; + int wangpengying = 0; + int wangpengshu = 0; + for(int i = 0 ;i < wangpeng.length;i ++) + { + wangpengSum += wangpeng[i]; + if(wangpeng[i] > 0) + wangpengying ++; + else + wangpengshu ++; + } + System.out.println("王鹏斗地主局数:" + wangwei.length + ",赢" + wangpengying + "局,输" + wangpengshu +"局,统计玩牌的计分是:" + wangpengSum); + //===============王鹏======================== + + int[] jishenghua={3,-6,2,5,-9,4,7,-8,-6,-1,4}; + int jishenghuaSum=0; + int jishenghuaYing=0; + int jishenghuaShu=0; + for(int i=0;i0) + jishenghuaYing++; + else + jishenghuaShu++; + } + System.out.println("季圣华斗地主局数:"+jishenghua.length+",赢"+jishenghuaYing+"局,输"+jishenghuaShu+"局,统计玩牌的计分是:"+jishenghuaSum); + } +} diff --git a/src/com/jsh/junitest/common/whileTest.java b/src/com/jsh/junitest/common/whileTest.java new file mode 100644 index 00000000..088c9eb7 --- /dev/null +++ b/src/com/jsh/junitest/common/whileTest.java @@ -0,0 +1,18 @@ +package com.jsh.junitest.common; + +import net.sf.json.JSONArray; +import junit.framework.TestCase; + +public class whileTest extends TestCase +{ + public void testWhile() + { + int i = 0; + for(;;i ++) + { + while(i == 10) + System.out.println("aa" + i); + break; + } + } +} diff --git a/src/com/jsh/junitest/json/CableStream.java b/src/com/jsh/junitest/json/CableStream.java new file mode 100644 index 00000000..365e81e4 --- /dev/null +++ b/src/com/jsh/junitest/json/CableStream.java @@ -0,0 +1,127 @@ +package com.jsh.junitest.json; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class CableStream implements Serializable +{ + /** + * ID + */ + private Long id; + + /** + * 频点频率 + */ + private Integer cablehz; + + /** + * 符号率 + */ + private Integer symbolrate; + + /** + * 调制方式 + */ + private Integer cableMode; + + /** + * 传输编号 + */ + private Integer transNum; + + /** + * 服务编号 + */ + private Integer serviceNum; + + /** + * 码率 + */ + private Float rate; + + /** + * 规格 + */ + private Short cablenorms; + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public Integer getCablehz() + { + return cablehz; + } + + public void setCablehz(Integer cablehz) + { + this.cablehz = cablehz; + } + + public Integer getSymbolrate() + { + return symbolrate; + } + + public void setSymbolrate(Integer symbolrate) + { + this.symbolrate = symbolrate; + } + + public Integer getCableMode() + { + return cableMode; + } + + public void setCableMode(Integer cableMode) + { + this.cableMode = cableMode; + } + + public Integer getTransNum() + { + return transNum; + } + + public void setTransNum(Integer transNum) + { + this.transNum = transNum; + } + + public Integer getServiceNum() + { + return serviceNum; + } + + public void setServiceNum(Integer serviceNum) + { + this.serviceNum = serviceNum; + } + + public Float getRate() + { + return rate; + } + + public void setRate(Float rate) + { + this.rate = rate; + } + + public Short getCablenorms() + { + return cablenorms; + } + + public void setCablenorms(Short cablenorms) + { + this.cablenorms = cablenorms; + } +} \ No newline at end of file diff --git a/src/com/jsh/junitest/json/Channel.java b/src/com/jsh/junitest/json/Channel.java new file mode 100644 index 00000000..3eeeba37 --- /dev/null +++ b/src/com/jsh/junitest/json/Channel.java @@ -0,0 +1,185 @@ +package com.jsh.junitest.json; + +import java.io.Serializable; +import java.util.List; + +@SuppressWarnings("serial") +public class Channel implements Serializable +{ + /** + * 频道ID + */ + private Long id; + + /** + * 频道名称 + */ + private String channelName ; + + /** + * 分类 + */ + private Long category; + + /** + * 台标路径 + */ + private String tvLogo; + + /** + * 地区 + */ + private Long area; + + /** + * 频道类型 0==直播 1==虚拟 + */ + private Short type; + + /** + * json字符串 + */ + private String ipStreamJson; + + /** + * ip流列表 + */ + private List ipStream; + + /** + * json字符串 + */ + private String cableStreamJson; + + /** + * cable流列表 + */ + private List cableStream; + + + public Channel() + { + super(); + } + + + + public Channel(String channelName, Long category, String tvLogo, + Long area, Short type, String ipStreamJson, + List ipStream, String cableStreamJson, + List cableStream) + { + super(); + this.channelName = channelName; + this.category = category; + this.tvLogo = tvLogo; + this.area = area; + this.type = type; + this.ipStreamJson = ipStreamJson; + this.ipStream = ipStream; + this.cableStreamJson = cableStreamJson; + this.cableStream = cableStream; + } + + + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getChannelName() + { + return channelName; + } + + public void setChannelName(String channelName) + { + this.channelName = channelName; + } + + public Long getCategory() + { + return category; + } + + public void setCategory(Long category) + { + this.category = category; + } + + public String getTvLogo() + { + return tvLogo; + } + + public void setTvLogo(String tvLogo) + { + this.tvLogo = tvLogo; + } + + public Long getArea() + { + return area; + } + + public void setArea(Long area) + { + this.area = area; + } + + public Short getType() + { + return type; + } + + public void setType(Short type) + { + this.type = type; + } + + public List getIpStream() + { + return ipStream; + } + + public void setIpStream(List ipStream) + { + this.ipStream = ipStream; + } + + public List getCableStream() + { + return cableStream; + } + + public void setCableStream(List cableStream) + { + this.cableStream = cableStream; + } + + public String getIpStreamJson() + { + return ipStreamJson; + } + + public void setIpStreamJson(String ipStreamJson) + { + this.ipStreamJson = ipStreamJson; + } + + public String getCableStreamJson() + { + return cableStreamJson; + } + + public void setCableStreamJson(String cableStreamJson) + { + this.cableStreamJson = cableStreamJson; + } +} diff --git a/src/com/jsh/junitest/json/ChannelUtil.java b/src/com/jsh/junitest/json/ChannelUtil.java new file mode 100644 index 00000000..16bbb540 --- /dev/null +++ b/src/com/jsh/junitest/json/ChannelUtil.java @@ -0,0 +1,75 @@ +package com.jsh.junitest.json; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +public class ChannelUtil +{ + /** + * 解析页面json字符串为IPStream对象列表 + * @param ipStreamStr json字符串 + * @return IPStream对象列表 + */ + public static List parseJson2IPStream(String ipStreamStr) + { + List ipList = new ArrayList(); + JSONArray ipJson = JSONObject.fromObject(ipStreamStr).getJSONArray("ipJsonData"); + if(null != ipJson) + { + for(int i = 0;i < ipJson.size(); i ++) + { + JSONObject tempJson = JSONObject.fromObject(ipJson.get(i)); + IPStream ip = new IPStream(); + ip.setIPformat(Short.parseShort(tempJson.getString("ipFomate"))); + ip.setIPnorms(Short.parseShort(tempJson.getString("IPnorms"))); + ip.setIPUrl(tempJson.getString("IPAddress")); + ip.setPort(tempJson.getInt("port")); + ip.setProtocol(Short.parseShort(tempJson.getString("protocol"))); + ip.setRate(Float.parseFloat(tempJson.getString("iprate"))); + ip.setType(Short.parseShort(tempJson.getString("inOrout"))); + ipList.add(ip); + } + } + return ipList; + } + + /** + * 解析页面json字符串为cableStream对象列表 + * @param cableStreamStr json字符串 + * @return cableStream对象列表 + */ + public static List parseJson2CableStream(String cableStreamStr) + { + List cableList = new ArrayList(); + JSONArray cableJson = JSONObject.fromObject(cableStreamStr).getJSONArray("cableJsonData"); + if(null != cableJson) + { + for(int i = 0;i < cableJson.size(); i ++) + { + JSONObject tempJson = JSONObject.fromObject(cableJson.get(i)); + CableStream cable = new CableStream(); + cable.setCablehz(tempJson.getInt("cablehz")); + cable.setCableMode(tempJson.getInt("cableMode")); + cable.setCablenorms(Short.parseShort(tempJson.getString("cablenorms"))); + cable.setRate(Float.parseFloat(tempJson.getString("cablerate"))); + cable.setServiceNum(tempJson.getInt("serviceNum")); + cable.setSymbolrate(tempJson.getInt("symbolrate")); + cable.setTransNum(tempJson.getInt("transNum")); + cableList.add(cable); + } + } + return cableList; + } + + public static void main(String[] args) + { + String ipStreamStr = "{ipJsonData : [{\"iprate\":\"512.00\",\"IPnorms\":\"0\",\"ipFomate\":\"0\",\"inOrout\":\"0\",\"port\":\"512\",\"IPAddress\":\"11.03.12.23\",\"protocol\":\"0\",\"ipJsonIndex\":0}]}"; + ChannelUtil.parseJson2IPStream(ipStreamStr); + + String cableStreamStr = "{cableJsonData:[{\"cablenorms\":\"0\",\"cablerate\":\"54\",\"serviceNum\":\"45\",\"transNum\":\"57\",\"cableMode\":\"64\",\"symbolrate\":\"56\",\"cablehz\":\"45\",\"cableJsonIndex\":0},{\"cablenorms\":\"0\",\"cablerate\":\"548\",\"serviceNum\":\"236\",\"transNum\":\"256\",\"cableMode\":\"64\",\"symbolrate\":\"56\",\"cablehz\":\"85\",\"cableJsonIndex\":1}]}"; + ChannelUtil.parseJson2CableStream(cableStreamStr); + } +} diff --git a/src/com/jsh/junitest/json/IPStream.java b/src/com/jsh/junitest/json/IPStream.java new file mode 100644 index 00000000..53a86fa0 --- /dev/null +++ b/src/com/jsh/junitest/json/IPStream.java @@ -0,0 +1,127 @@ +package com.jsh.junitest.json; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class IPStream implements Serializable +{ + /** + * ID + */ + private Long id; + + /** + * 协议 + */ + private Short protocol; + + /** + *IP地址 + */ + private String IPUrl; + + /** + * 端口 + */ + private Integer port; + + /** + * 类型--输入输出 0==输入 1==输出 + */ + private Short type; + + /** + * 视频格式 + */ + private Short IPformat; + + /** + * 视频规格 0==标清 1==高清 + */ + private Short IPnorms; + + /** + * 码率 + */ + private Float rate; + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public Short getProtocol() + { + return protocol; + } + + public void setProtocol(Short protocol) + { + this.protocol = protocol; + } + + public String getIPUrl() + { + return IPUrl; + } + + public void setIPUrl(String iPUrl) + { + IPUrl = iPUrl; + } + + public Integer getPort() + { + return port; + } + + public void setPort(Integer port) + { + this.port = port; + } + + public Short getType() + { + return type; + } + + public void setType(Short type) + { + this.type = type; + } + + public Short getIPformat() + { + return IPformat; + } + + public void setIPformat(Short iPformat) + { + IPformat = iPformat; + } + + public Short getIPnorms() + { + return IPnorms; + } + + public void setIPnorms(Short iPnorms) + { + IPnorms = iPnorms; + } + + public Float getRate() + { + return rate; + } + + public void setRate(Float rate) + { + this.rate = rate; + } +} diff --git a/src/com/jsh/junitest/json/JsonTest.java b/src/com/jsh/junitest/json/JsonTest.java new file mode 100644 index 00000000..14dfb052 --- /dev/null +++ b/src/com/jsh/junitest/json/JsonTest.java @@ -0,0 +1,28 @@ +package com.jsh.junitest.json; + +import junit.framework.TestCase; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +public class JsonTest extends TestCase +{ + public void testJson() + { + JSONObject outer = new JSONObject(); + outer.put("total", 8); + JSONArray json = new JSONArray(); +// {"total":28,"rows":[ +// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} +// ]} + + for(int i = 0 ;i < 10 ;i ++) + { + JSONObject jo = new JSONObject(); + jo.put("name", "andy" + i); + jo.put("sex", "false" + i); + json.add(jo); + } + outer.put("rows", json); + System.out.println(outer.toString()); + } +} diff --git a/src/com/jsh/junitest/spring/SpringTest.java b/src/com/jsh/junitest/spring/SpringTest.java new file mode 100644 index 00000000..9f1cae78 --- /dev/null +++ b/src/com/jsh/junitest/spring/SpringTest.java @@ -0,0 +1,37 @@ +package com.jsh.junitest.spring; + +import junit.framework.TestCase; + +public class SpringTest extends TestCase +{ + public static void main(String[] args) + { + +// @SuppressWarnings({ "unchecked", "rawtypes" }) +// public BaseService() +// { +// // //加载 已经加载过的 spring配置文件内容 +// // WebApplicationContext wac = +// // ContextLoader.getCurrentWebApplicationContext(); +// // // wac.getBean(beanID); +// // ApplicationContext factory = new +// // ClassPathXmlApplicationContext("spring/*-applicationContext.xml"); +// // ApplicationContext factory = new ClassPathXmlApplicationContext(new +// // String[]{"spring/basic-applicationContext.xml", +// // "spring/dao-applicationContext.xml"}); +// // this.baseDao = (BaseIDAO) factory.getBean("baseDao"); +// // // this.baseDao = +// // ((BaseIDAO)BeanFactoryUtil.getBeanByClassPathAndBeanName("spring/dao-applicationContext.xml", +// // "baseDao")); +// BeanFactoryUtil util = BeanFactoryUtil.getInstance(); +// +// this.baseDao = ((BaseIDAO) util.getBean("baseDao")); +//// ApplicationContext factory = new ClassPathXmlApplicationContext(new +//// String[]{"spring/basic-applicationContext.xml", +//// "spring/dao-applicationContext.xml"}); +//// this.baseDao = (BaseIDAO) factory.getBean("baseDao"); +// Class c = getEntityClass(); +// setPoJoClass(c); +// } + } +} diff --git a/src/com/jsh/model/po/App.hbm.xml b/src/com/jsh/model/po/App.hbm.xml new file mode 100644 index 00000000..6daa362f --- /dev/null +++ b/src/com/jsh/model/po/App.hbm.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + 代号 + + + + + 名称 + + + + + 类型 + + + + + 图标 + + + + + 链接 + + + + + 宽度 + + + + + 高度 + + + + + 拉伸 + + + + + 最大化 + + + + + Flash + + + + + 种类 + + + + + 排序号 + + + + + 备注 + + + + + 启用 + + + + diff --git a/src/com/jsh/model/po/App.java b/src/com/jsh/model/po/App.java new file mode 100644 index 00000000..80e3ee34 --- /dev/null +++ b/src/com/jsh/model/po/App.java @@ -0,0 +1,174 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class App implements java.io.Serializable +{ + private Long Id; + private String Number; + private String Name; + private String Type; + private String Icon; + private String URL; + private String Width; + private String Height; + private Boolean ReSize; + private Boolean OpenMax; + private Boolean Flash; + private String ZL; + private String Sort; + private String Remark; + private Boolean Enabled; + + + public App() + { + + } + + public App(Long Id) + { + this.Id = Id ; + } + + public App(String Number, String Name, String Type, String Icon, String URL, String Width, + String Height, Boolean ReSize, Boolean OpenMax, Boolean Flash, String ZL, String Sort, + String Remark, Boolean Enabled) + { + this.Number = Number; + this.Name = Name; + this.Type = Type; + this.Icon = Icon; + this.URL = URL; + this.Width = Width; + this.Height = Height; + this.ReSize = ReSize; + this.OpenMax = OpenMax; + this.Flash = Flash; + this.ZL = ZL; + this.Sort = Sort; + this.Remark = Remark; + this.Enabled = Enabled; + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public String getNumber() { + return Number; + } + + public void setNumber(String number) { + Number = number; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public String getIcon() { + return Icon; + } + + public void setIcon(String icon) { + Icon = icon; + } + + public String getURL() { + return URL; + } + + public void setURL(String uRL) { + URL = uRL; + } + + public String getWidth() { + return Width; + } + + public void setWidth(String width) { + Width = width; + } + + public String getHeight() { + return Height; + } + + public void setHeight(String height) { + Height = height; + } + + public Boolean getReSize() { + return ReSize; + } + + public void setReSize(Boolean reSize) { + ReSize = reSize; + } + + public Boolean getOpenMax() { + return OpenMax; + } + + public void setOpenMax(Boolean openMax) { + OpenMax = openMax; + } + + public Boolean getFlash() { + return Flash; + } + + public void setFlash(Boolean flash) { + Flash = flash; + } + + public String getZL() { + return ZL; + } + + public void setZL(String zL) { + ZL = zL; + } + + public String getSort() { + return Sort; + } + + public void setSort(String sort) { + Sort = sort; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public Boolean getEnabled() { + return Enabled; + } + + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } + + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Asset.hbm.xml b/src/com/jsh/model/po/Asset.hbm.xml new file mode 100644 index 00000000..f0566059 --- /dev/null +++ b/src/com/jsh/model/po/Asset.hbm.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + 位置 + + + + + 标签:以空格为分隔符 + + + + + 资产的状态:0==在库,1==在用,2==消费 + + + + + + + + + + 购买价格 + + + + + 购买日期 + + + + + 有效日期 + + + + + 保修日期 + + + + + 资产编号 + + + + + 资产序列号 + + + + + + + + + + 描述信息 + + + + + 资产添加时间,统计报表使用 + + + + + + + + + + + + + + + + + + + diff --git a/src/com/jsh/model/po/Asset.java b/src/com/jsh/model/po/Asset.java new file mode 100644 index 00000000..d4b448ac --- /dev/null +++ b/src/com/jsh/model/po/Asset.java @@ -0,0 +1,379 @@ +package com.jsh.model.po; + +import java.sql.Timestamp; +import java.util.Map; + +@SuppressWarnings("serial") +public class Asset implements java.io.Serializable +{ + private Long id; + private Assetname assetname; + private String location; + private Short status; + private Basicuser user; + private Double price; + private Timestamp purchasedate; + private Timestamp periodofvalidity; + private Timestamp warrantydate; + private String assetnum; + private String serialnum; + private Supplier supplier; + private String labels; + private String description; + private String addMonth; + private Timestamp createtime; + private Basicuser creator; + private Timestamp updatetime; + private Basicuser updator; + + //----------以下属性导入exel表格使用-------------------- + /** + * 类型 right--正确 warn--警告 wrong--错误 + */ + private Map cellInfo; + + /** + * 行号 + */ + private Integer rowLineNum; + + /** + * 保存价格 + */ + private String priceStr; + + /** + * 资产名称 + */ + private String assetnameStr; + + /** + * 资产类型 + */ + private String category; + + /** + * 购买日期 + */ + private String purchasedateStr; + + /** + * 有效日期 + */ + private String periodofvalidityStr; + + /** + * 保修日期 + */ + private String warrantydateStr; + + public Asset() + { + + } + + public Asset(Long id) + { + this.id = id; + } + + public Asset(Assetname assetname, String location, + Short status, Basicuser user, Double price, Timestamp purchasedate, + Timestamp periodofvalidity, Timestamp warrantydate, + String assetnum, String serialnum, Supplier supplier, + String description, Timestamp createtime, Basicuser creator, + Timestamp updatetime,String labels, Basicuser updator,String addMonth) + { + super(); + this.assetname = assetname; + this.location = location; + this.status = status; + this.user = user; + this.price = price; + this.purchasedate = purchasedate; + this.periodofvalidity = periodofvalidity; + this.warrantydate = warrantydate; + this.assetnum = assetnum; + this.serialnum = serialnum; + this.supplier = supplier; + this.description = description; + this.createtime = createtime; + this.creator = creator; + this.updatetime = updatetime; + this.updator = updator; + this.labels = labels; + this.addMonth = addMonth; + } + + + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public Assetname getAssetname() + { + return assetname; + } + + public void setAssetname(Assetname assetname) + { + this.assetname = assetname; + } + + public String getLocation() + { + return location; + } + + public void setLocation(String location) + { + this.location = location; + } + + public Short getStatus() + { + return status; + } + + public void setStatus(Short status) + { + this.status = status; + } + + public Basicuser getUser() + { + return user; + } + + public void setUser(Basicuser user) + { + this.user = user; + } + + public Double getPrice() + { + return price; + } + + public void setPrice(Double price) + { + this.price = price; + } + + public Timestamp getPurchasedate() + { + return purchasedate; + } + + public void setPurchasedate(Timestamp purchasedate) + { + this.purchasedate = purchasedate; + } + + public Timestamp getPeriodofvalidity() + { + return periodofvalidity; + } + + public void setPeriodofvalidity(Timestamp periodofvalidity) + { + this.periodofvalidity = periodofvalidity; + } + + public Timestamp getWarrantydate() + { + return warrantydate; + } + + public void setWarrantydate(Timestamp warrantydate) + { + this.warrantydate = warrantydate; + } + + public String getAssetnum() + { + return assetnum; + } + + public void setAssetnum(String assetnum) + { + this.assetnum = assetnum; + } + + public String getSerialnum() + { + return serialnum; + } + + public void setSerialnum(String serialnum) + { + this.serialnum = serialnum; + } + + public Supplier getSupplier() + { + return supplier; + } + + public void setSupplier(Supplier supplier) + { + this.supplier = supplier; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Timestamp getCreatetime() + { + return createtime; + } + + public void setCreatetime(Timestamp createtime) + { + this.createtime = createtime; + } + + public Basicuser getCreator() + { + return creator; + } + + public void setCreator(Basicuser creator) + { + this.creator = creator; + } + + public Timestamp getUpdatetime() + { + return updatetime; + } + + public void setUpdatetime(Timestamp updatetime) + { + this.updatetime = updatetime; + } + + public Basicuser getUpdator() + { + return updator; + } + + public void setUpdator(Basicuser updator) + { + this.updator = updator; + } + + public String getLabels() + { + return labels; + } + + public void setLabels(String labels) + { + this.labels = labels; + } + + public String getAddMonth() + { + return addMonth; + } + + public void setAddMonth(String addMonth) + { + this.addMonth = addMonth; + } + + public Integer getRowLineNum() + { + return rowLineNum; + } + + public void setRowLineNum(Integer rowLineNum) + { + this.rowLineNum = rowLineNum; + } + + public Map getCellInfo() + { + return cellInfo; + } + + public void setCellInfo(Map cellInfo) + { + this.cellInfo = cellInfo; + } + + public String getPriceStr() + { + return priceStr; + } + + public void setPriceStr(String priceStr) + { + this.priceStr = priceStr; + } + + public String getAssetnameStr() + { + return assetnameStr; + } + + public void setAssetnameStr(String assetnameStr) + { + this.assetnameStr = assetnameStr; + } + + public String getCategory() + { + return category; + } + + public void setCategory(String category) + { + this.category = category; + } + + public String getPurchasedateStr() + { + return purchasedateStr; + } + + public void setPurchasedateStr(String purchasedateStr) + { + this.purchasedateStr = purchasedateStr; + } + + public String getPeriodofvalidityStr() + { + return periodofvalidityStr; + } + + public void setPeriodofvalidityStr(String periodofvalidityStr) + { + this.periodofvalidityStr = periodofvalidityStr; + } + + public String getWarrantydateStr() + { + return warrantydateStr; + } + + public void setWarrantydateStr(String warrantydateStr) + { + this.warrantydateStr = warrantydateStr; + } +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Assetcategory.hbm.xml b/src/com/jsh/model/po/Assetcategory.hbm.xml new file mode 100644 index 00000000..37bf86db --- /dev/null +++ b/src/com/jsh/model/po/Assetcategory.hbm.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + 资产类型名称 + + + + + 是否系统自带 0==系统 1==非系统 + + + + + 描述信息 + + + + diff --git a/src/com/jsh/model/po/Assetcategory.java b/src/com/jsh/model/po/Assetcategory.java new file mode 100644 index 00000000..302c6971 --- /dev/null +++ b/src/com/jsh/model/po/Assetcategory.java @@ -0,0 +1,67 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Assetcategory implements java.io.Serializable +{ + private Long id; + private String assetname; + private Short isystem; + private String description; + + public Assetcategory() + { + + } + + public Assetcategory(Long id) + { + this.id = id ; + } + + public Assetcategory(String assetname, Short isystem, String description) + { + this.assetname = assetname; + this.isystem = isystem; + this.description = description; + } + + public Long getId() + { + return this.id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getAssetname() + { + return this.assetname; + } + + public void setAssetname(String assetname) + { + this.assetname = assetname; + } + + public Short getIsystem() + { + return this.isystem; + } + + public void setIsystem(Short isystem) + { + this.isystem = isystem; + } + + public String getDescription() + { + return this.description; + } + + public void setDescription(String description) + { + this.description = description; + } +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Assetname.hbm.xml b/src/com/jsh/model/po/Assetname.hbm.xml new file mode 100644 index 00000000..efc9b10d --- /dev/null +++ b/src/com/jsh/model/po/Assetname.hbm.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + 资产名称 + + + + + + + + 是否系统自带 0==系统 1==非系统 + + + + + 描述信息 + + + + + 是否为耗材 0==否 1==是 耗材状态只能是消费 + + + + diff --git a/src/com/jsh/model/po/Assetname.java b/src/com/jsh/model/po/Assetname.java new file mode 100644 index 00000000..28b84039 --- /dev/null +++ b/src/com/jsh/model/po/Assetname.java @@ -0,0 +1,93 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Assetname implements java.io.Serializable +{ + private Long id; + private String assetname; + private Short isystem; + private Category category; + private String description; + private Short isconsumables; + + public Assetname() + { + + } + + public Assetname(Long id) + { + this.id = id; + } + + public Assetname(String assetname, Short isystem, String description, + Short isconsumables,Category category) + { + this.assetname = assetname; + this.isystem = isystem; + this.description = description; + this.isconsumables = isconsumables; + this.category = category; + } + + public Long getId() + { + return this.id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getAssetname() + { + return this.assetname; + } + + public void setAssetname(String assetname) + { + this.assetname = assetname; + } + + public Short getIsystem() + { + return this.isystem; + } + + public void setIsystem(Short isystem) + { + this.isystem = isystem; + } + + public String getDescription() + { + return this.description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Short getIsconsumables() + { + return this.isconsumables; + } + + public void setIsconsumables(Short isconsumables) + { + this.isconsumables = isconsumables; + } + + public Category getCategory() + { + return category; + } + + public void setCategory(Category category) + { + this.category = category; + } + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Basicuser.hbm.xml b/src/com/jsh/model/po/Basicuser.hbm.xml new file mode 100644 index 00000000..20a86162 --- /dev/null +++ b/src/com/jsh/model/po/Basicuser.hbm.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + 用户姓名--例如张三 + + + + + 登录用户名--可能为空 + + + + + 登陆密码 + + + + + 职位 + + + + + 所属部门 + + + + + 电子邮箱 + + + + + 手机号码 + + + + + 是否为管理者 0==管理者 1==员工 + + + + + 是否系统自带数据 + + + + + 用户状态 + + + + + 用户描述信息 + + + + + + + diff --git a/src/com/jsh/model/po/Basicuser.java b/src/com/jsh/model/po/Basicuser.java new file mode 100644 index 00000000..97f85be2 --- /dev/null +++ b/src/com/jsh/model/po/Basicuser.java @@ -0,0 +1,177 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Basicuser implements java.io.Serializable +{ + private Long id; + private String username; + private String loginame; + private String password; + private String position; + private String department; + private String email; + private String phonenum; + private Short ismanager; + private Short isystem; + private Short status; + private String description; + private String remark; + + public Basicuser() + { + } + + public Basicuser(Long id) + { + this.id = id; + } + + public Basicuser(String username, String loginame, String password, + String position, String department, String email, String phonenum, + Short ismanager, Short isystem, Short status, String description, + String remark) + { + this.username = username; + this.loginame = loginame; + this.password = password; + this.position = position; + this.department = department; + this.email = email; + this.phonenum = phonenum; + this.ismanager = ismanager; + this.isystem = isystem; + this.status = status; + this.description = description; + this.remark = remark; + } + + public Long getId() + { + return this.id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getUsername() + { + return this.username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getLoginame() + { + return this.loginame; + } + + public void setLoginame(String loginame) + { + this.loginame = loginame; + } + + public String getPassword() + { + return this.password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getPosition() + { + return this.position; + } + + public void setPosition(String position) + { + this.position = position; + } + + public String getDepartment() + { + return this.department; + } + + public void setDepartment(String department) + { + this.department = department; + } + + public String getEmail() + { + return this.email; + } + + public void setEmail(String email) + { + this.email = email; + } + + public String getPhonenum() + { + return this.phonenum; + } + + public void setPhonenum(String phonenum) + { + this.phonenum = phonenum; + } + + public Short getIsmanager() + { + return this.ismanager; + } + + public void setIsmanager(Short ismanager) + { + this.ismanager = ismanager; + } + + public Short getIsystem() + { + return this.isystem; + } + + public void setIsystem(Short isystem) + { + this.isystem = isystem; + } + + public Short getStatus() + { + return this.status; + } + + public void setStatus(Short status) + { + this.status = status; + } + + public String getDescription() + { + return this.description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getRemark() + { + return this.remark; + } + + public void setRemark(String remark) + { + this.remark = remark; + } +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Building.hbm.xml b/src/com/jsh/model/po/Building.hbm.xml new file mode 100644 index 00000000..99f39b7a --- /dev/null +++ b/src/com/jsh/model/po/Building.hbm.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + 名称 + + + + + 备注 + + + + + 启用 + + + + diff --git a/src/com/jsh/model/po/Building.java b/src/com/jsh/model/po/Building.java new file mode 100644 index 00000000..dbf38e3b --- /dev/null +++ b/src/com/jsh/model/po/Building.java @@ -0,0 +1,70 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Building implements java.io.Serializable +{ + private Long Id; + private Depot depot; + private String Name; + private String Remark; + private Boolean Enabled; + + public Building() + { + + } + + public Building(Long Id) + { + this.Id = Id; + } + + public Building(Depot depot, String name, String remark, Boolean enabled) { + super(); + this.depot = depot; + Name = name; + Remark = remark; + Enabled = enabled; + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public Depot getDepot() { + return depot; + } + + public void setDepot(Depot depot) { + this.depot = depot; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public Boolean getEnabled() { + return Enabled; + } + + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Category.hbm.xml b/src/com/jsh/model/po/Category.hbm.xml new file mode 100644 index 00000000..7f456983 --- /dev/null +++ b/src/com/jsh/model/po/Category.hbm.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + 资产类型名称 + + + + + 是否系统自带 0==系统 1==非系统 + + + + + 描述信息 + + + + diff --git a/src/com/jsh/model/po/Category.java b/src/com/jsh/model/po/Category.java new file mode 100644 index 00000000..09a41f08 --- /dev/null +++ b/src/com/jsh/model/po/Category.java @@ -0,0 +1,67 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Category implements java.io.Serializable +{ + private Long id; + private String assetname; + private Short isystem; + private String description; + + public Category() + { + + } + + public Category(Long id) + { + this.id = id ; + } + + public Category(String assetname, Short isystem, String description) + { + this.assetname = assetname; + this.isystem = isystem; + this.description = description; + } + + public Long getId() + { + return this.id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getAssetname() + { + return this.assetname; + } + + public void setAssetname(String assetname) + { + this.assetname = assetname; + } + + public Short getIsystem() + { + return this.isystem; + } + + public void setIsystem(Short isystem) + { + this.isystem = isystem; + } + + public String getDescription() + { + return this.description; + } + + public void setDescription(String description) + { + this.description = description; + } +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Department.hbm.xml b/src/com/jsh/model/po/Department.hbm.xml new file mode 100644 index 00000000..75cead12 --- /dev/null +++ b/src/com/jsh/model/po/Department.hbm.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + 部门名称 + + + + + 部门描述 + + + + + 是否系统自带 0==系统 1==非系统 + + + + diff --git a/src/com/jsh/model/po/Department.java b/src/com/jsh/model/po/Department.java new file mode 100644 index 00000000..1f81577a --- /dev/null +++ b/src/com/jsh/model/po/Department.java @@ -0,0 +1,69 @@ +package com.jsh.model.po; + + +@SuppressWarnings("serial") +public class Department implements java.io.Serializable +{ + private Long id; + private String deptname; + private Short isystem; + private String description; + + public Department() + { + + } + + public Department(Long id) + { + this.id = id; + } + + public Department(String deptname, Short isystem, String description) + { + super(); + this.deptname = deptname; + this.isystem = isystem; + this.description = description; + } + + public Short getIsystem() + { + return isystem; + } + + public void setIsystem(Short isystem) + { + this.isystem = isystem; + } + + public Long getId() + { + return this.id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getDeptname() + { + return this.deptname; + } + + public void setDeptname(String deptname) + { + this.deptname = deptname; + } + + public String getDescription() + { + return this.description; + } + + public void setDescription(String description) + { + this.description = description; + } +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Depot.hbm.xml b/src/com/jsh/model/po/Depot.hbm.xml new file mode 100644 index 00000000..e739cc73 --- /dev/null +++ b/src/com/jsh/model/po/Depot.hbm.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + 仓库名称 + + + + + 排序 + + + + + 描述 + + + + diff --git a/src/com/jsh/model/po/Depot.java b/src/com/jsh/model/po/Depot.java new file mode 100644 index 00000000..7e8c69c1 --- /dev/null +++ b/src/com/jsh/model/po/Depot.java @@ -0,0 +1,60 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Depot implements java.io.Serializable +{ + private Long id; + private String name; + private String sort; + private String remark; + + public Depot() + { + + } + + public Depot(Long id) + { + this.id = id ; + } + + public Depot(String name, String sort, String remark) + { + this.name = name; + this.sort = sort; + this.remark = remark; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/DepotHead.hbm.xml b/src/com/jsh/model/po/DepotHead.hbm.xml new file mode 100644 index 00000000..d98fafd1 --- /dev/null +++ b/src/com/jsh/model/po/DepotHead.hbm.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + 类型(出库/入库) + + + + + 出入库分类 + + + + + 项目Id + + + + + 票据号 + + + + + 操作员名字 + + + + + 创建时间 + + + + + 出入库时间 + + + + + 供应商Id + + + + + 采购/领料-经手人Id + + + + + 仓管员-经手人Id + + + + + 现金/记账 + + + + + 单元Id + + + + + 调拨时,对方项目Id + + + + + 备注 + + + + + 草稿/已生效/废弃/待审核/未通过 + + + + + 撤审人 + + + + + 撤审原因 + + + + diff --git a/src/com/jsh/model/po/DepotHead.java b/src/com/jsh/model/po/DepotHead.java new file mode 100644 index 00000000..4b645303 --- /dev/null +++ b/src/com/jsh/model/po/DepotHead.java @@ -0,0 +1,210 @@ +package com.jsh.model.po; + +import java.sql.Timestamp; + +@SuppressWarnings("serial") +public class DepotHead implements java.io.Serializable +{ + private Long Id; + private String Type; + private String SubType; + private Depot ProjectId; + private String Number; + private String OperPersonName; + private Timestamp CreateTime; + private Timestamp OperTime; + private Supplier OrganId; + private Person HandsPersonId; + private Person WareHousePersonId; + private String SettlementWay; + private Building BuildingId; + private Depot AllocationProjectId; + private String Remark; + private String State; + private String ReAuditPersonName; + private String Reason; + + + public DepotHead() + { + + } + + public DepotHead(Long Id) + { + this.Id = Id ; + } + + public DepotHead(String type, String subType, Depot projectId, + String number, String operPersonName, Timestamp createTime, + Timestamp operTime, Supplier organId, Person handsPersonId, + Person wareHousePersonId, String settlementWay, + Building buildingId, Depot allocationProjectId, String remark, + String state, String reAuditPersonName, String reason) { + super(); + Type = type; + SubType = subType; + ProjectId = projectId; + Number = number; + OperPersonName = operPersonName; + CreateTime = createTime; + OperTime = operTime; + OrganId = organId; + HandsPersonId = handsPersonId; + WareHousePersonId = wareHousePersonId; + SettlementWay = settlementWay; + BuildingId = buildingId; + AllocationProjectId = allocationProjectId; + Remark = remark; + State = state; + ReAuditPersonName = reAuditPersonName; + Reason = reason; + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public String getSubType() { + return SubType; + } + + public void setSubType(String subType) { + SubType = subType; + } + + public Depot getProjectId() { + return ProjectId; + } + + public void setProjectId(Depot projectId) { + ProjectId = projectId; + } + + public String getNumber() { + return Number; + } + + public void setNumber(String number) { + Number = number; + } + + public String getOperPersonName() { + return OperPersonName; + } + + public void setOperPersonName(String operPersonName) { + OperPersonName = operPersonName; + } + + public Timestamp getCreateTime() { + return CreateTime; + } + + public void setCreateTime(Timestamp createTime) { + CreateTime = createTime; + } + + public Timestamp getOperTime() { + return OperTime; + } + + public void setOperTime(Timestamp operTime) { + OperTime = operTime; + } + + public Supplier getOrganId() { + return OrganId; + } + + public void setOrganId(Supplier organId) { + OrganId = organId; + } + + public Person getHandsPersonId() { + return HandsPersonId; + } + + public void setHandsPersonId(Person handsPersonId) { + HandsPersonId = handsPersonId; + } + + public Person getWareHousePersonId() { + return WareHousePersonId; + } + + public void setWareHousePersonId(Person wareHousePersonId) { + WareHousePersonId = wareHousePersonId; + } + + public String getSettlementWay() { + return SettlementWay; + } + + public void setSettlementWay(String settlementWay) { + SettlementWay = settlementWay; + } + + public Building getBuildingId() { + return BuildingId; + } + + public void setBuildingId(Building buildingId) { + BuildingId = buildingId; + } + + public Depot getAllocationProjectId() { + return AllocationProjectId; + } + + public void setAllocationProjectId(Depot allocationProjectId) { + AllocationProjectId = allocationProjectId; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public String getState() { + return State; + } + + public void setState(String state) { + State = state; + } + + public String getReAuditPersonName() { + return ReAuditPersonName; + } + + public void setReAuditPersonName(String reAuditPersonName) { + ReAuditPersonName = reAuditPersonName; + } + + public String getReason() { + return Reason; + } + + public void setReason(String reason) { + Reason = reason; + } + + + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/DepotItem.hbm.xml b/src/com/jsh/model/po/DepotItem.hbm.xml new file mode 100644 index 00000000..558018e2 --- /dev/null +++ b/src/com/jsh/model/po/DepotItem.hbm.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + 表头Id + + + + + 材料Id + + + + + 数量 + + + + + 单价 + + + + + 运杂费 + + + + + 描述 + + + + + 图片 + + + + diff --git a/src/com/jsh/model/po/DepotItem.java b/src/com/jsh/model/po/DepotItem.java new file mode 100644 index 00000000..dc832b9f --- /dev/null +++ b/src/com/jsh/model/po/DepotItem.java @@ -0,0 +1,103 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class DepotItem implements java.io.Serializable +{ + private Long Id; + private DepotHead HeaderId; + private Material MaterialId; + private Double OperNumber; + private Double UnitPrice; + private Double Incidentals; + private String Remark; + private String Img; + + public DepotItem() + { + + } + + public DepotItem(Long Id) + { + this.Id = Id ; + } + + public DepotItem(DepotHead headerId, Material materialId, + Double operNumber, Double unitPrice, Double incidentals, + String remark, String img) { + super(); + HeaderId = headerId; + MaterialId = materialId; + OperNumber = operNumber; + UnitPrice = unitPrice; + Incidentals = incidentals; + Remark = remark; + Img = img; + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public DepotHead getHeaderId() { + return HeaderId; + } + + public void setHeaderId(DepotHead headerId) { + HeaderId = headerId; + } + + public Material getMaterialId() { + return MaterialId; + } + + public void setMaterialId(Material materialId) { + MaterialId = materialId; + } + + public Double getOperNumber() { + return OperNumber; + } + + public void setOperNumber(Double operNumber) { + OperNumber = operNumber; + } + + public Double getUnitPrice() { + return UnitPrice; + } + + public void setUnitPrice(Double unitPrice) { + UnitPrice = unitPrice; + } + + public Double getIncidentals() { + return Incidentals; + } + + public void setIncidentals(Double incidentals) { + Incidentals = incidentals; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public String getImg() { + return Img; + } + + public void setImg(String img) { + Img = img; + } + + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Functions.hbm.xml b/src/com/jsh/model/po/Functions.hbm.xml new file mode 100644 index 00000000..2a8923bc --- /dev/null +++ b/src/com/jsh/model/po/Functions.hbm.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + 编号 + + + + + 名称 + + + + + 上级编号 + + + + + 链接 + + + + + 收缩 + + + + + 排序 + + + + + 启用 + + + + + 类型 + + + + + + + diff --git a/src/com/jsh/model/po/Functions.java b/src/com/jsh/model/po/Functions.java new file mode 100644 index 00000000..121c661c --- /dev/null +++ b/src/com/jsh/model/po/Functions.java @@ -0,0 +1,93 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Functions implements java.io.Serializable +{ + private Long Id; + private String Number; + private String Name; + private String PNumber; + private String URL; + private Boolean State; + private String Sort; + private Boolean Enabled; + private String Type; + + public Functions() + { + + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public String getNumber() { + return Number; + } + + public void setNumber(String number) { + Number = number; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getPNumber() { + return PNumber; + } + + public void setPNumber(String pNumber) { + PNumber = pNumber; + } + + public String getURL() { + return URL; + } + + public void setURL(String uRL) { + URL = uRL; + } + + public Boolean getState() { + return State; + } + + public void setState(Boolean state) { + State = state; + } + + public String getSort() { + return Sort; + } + + public void setSort(String sort) { + Sort = sort; + } + + public Boolean getEnabled() { + return Enabled; + } + + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Logdetails.hbm.xml b/src/com/jsh/model/po/Logdetails.hbm.xml new file mode 100644 index 00000000..c9ab0139 --- /dev/null +++ b/src/com/jsh/model/po/Logdetails.hbm.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + 操作模块名称 + + + + + 客户端IP + + + + + 创建时间 + + + + + 操作状态 0==成功,1==失败 + + + + + 操作详情 + + + + + 备注信息 + + + + diff --git a/src/com/jsh/model/po/Logdetails.java b/src/com/jsh/model/po/Logdetails.java new file mode 100644 index 00000000..df9ad7bb --- /dev/null +++ b/src/com/jsh/model/po/Logdetails.java @@ -0,0 +1,119 @@ +package com.jsh.model.po; + +import java.sql.Timestamp; + +@SuppressWarnings("serial") +public class Logdetails implements java.io.Serializable +{ + + private Long id; + private Basicuser user; + private String operation; + private String clientIp; + private Timestamp createtime; + private Short status; + private String contentdetails; + private String remark; + + public Logdetails() + { + + } + + public Logdetails(Long id) + { + this.id = id; + } + + public Logdetails(Basicuser user, String operation, String clientIp, + Timestamp createtime, Short status, String contentdetails, + String remark) + { + this.user = user; + this.operation = operation; + this.clientIp = clientIp; + this.createtime = createtime; + this.status = status; + this.contentdetails = contentdetails; + this.remark = remark; + } + + public Long getId() + { + return this.id; + } + + public void setId(Long id) + { + this.id = id; + } + + public Basicuser getUser() { + return user; + } + + public void setUser(Basicuser user) { + this.user = user; + } + + public String getOperation() + { + return this.operation; + } + + public void setOperation(String operation) + { + this.operation = operation; + } + + public String getClientIp() + { + return this.clientIp; + } + + public void setClientIp(String clientIp) + { + this.clientIp = clientIp; + } + + public Timestamp getCreatetime() + { + return this.createtime; + } + + public void setCreatetime(Timestamp createtime) + { + this.createtime = createtime; + } + + public Short getStatus() + { + return this.status; + } + + public void setStatus(Short status) + { + this.status = status; + } + + public String getContentdetails() + { + return this.contentdetails; + } + + public void setContentdetails(String contentdetails) + { + this.contentdetails = contentdetails; + } + + public String getRemark() + { + return this.remark; + } + + public void setRemark(String remark) + { + this.remark = remark; + } + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Material.hbm.xml b/src/com/jsh/model/po/Material.hbm.xml new file mode 100644 index 00000000..19a0d8e8 --- /dev/null +++ b/src/com/jsh/model/po/Material.hbm.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + 名称 + + + + + 型号 + + + + + 颜色 + + + + + 单位 + + + + + 备注 + + + + diff --git a/src/com/jsh/model/po/Material.java b/src/com/jsh/model/po/Material.java new file mode 100644 index 00000000..5861586e --- /dev/null +++ b/src/com/jsh/model/po/Material.java @@ -0,0 +1,91 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Material implements java.io.Serializable +{ + private Long Id; + private MaterialCategory materialCategory; + private String Name; + private String Model; + private String Color; + private String Unit; + private String Remark; + + public Material() + { + + } + + public Material(Long Id) + { + this.Id = Id; + } + + public Material(MaterialCategory materialCategory, String name, + String model, String color, String unit, String remark) { + super(); + this.materialCategory = materialCategory; + Name = name; + Model = model; + Color = color; + Unit = unit; + Remark = remark; + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public MaterialCategory getMaterialCategory() { + return materialCategory; + } + + public void setMaterialCategory(MaterialCategory materialCategory) { + this.materialCategory = materialCategory; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getModel() { + return Model; + } + + public void setModel(String model) { + Model = model; + } + + public String getColor() { + return Color; + } + + public void setColor(String color) { + Color = color; + } + + public String getUnit() { + return Unit; + } + + public void setUnit(String unit) { + Unit = unit; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/MaterialCategory.hbm.xml b/src/com/jsh/model/po/MaterialCategory.hbm.xml new file mode 100644 index 00000000..211cd14b --- /dev/null +++ b/src/com/jsh/model/po/MaterialCategory.hbm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + 名称 + + + + + 等级 + + + + + + + diff --git a/src/com/jsh/model/po/MaterialCategory.java b/src/com/jsh/model/po/MaterialCategory.java new file mode 100644 index 00000000..7aac5457 --- /dev/null +++ b/src/com/jsh/model/po/MaterialCategory.java @@ -0,0 +1,61 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class MaterialCategory implements java.io.Serializable +{ + private Long Id; + private String Name; + private Short CategoryLevel; + private MaterialCategory materialCategory; + + + public MaterialCategory() + { + + } + + public MaterialCategory(Long Id) + { + this.Id = Id; + } + + public MaterialCategory(String name, Short categoryLevel, + MaterialCategory materialCategory) { + Name = name; + CategoryLevel = categoryLevel; + this.materialCategory = materialCategory; + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public Short getCategoryLevel() { + return CategoryLevel; + } + + public void setCategoryLevel(Short categoryLevel) { + CategoryLevel = categoryLevel; + } + + public MaterialCategory getMaterialCategory() { + return materialCategory; + } + + public void setMaterialCategory(MaterialCategory materialCategory) { + this.materialCategory = materialCategory; + } + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Measureunit.hbm.xml b/src/com/jsh/model/po/Measureunit.hbm.xml new file mode 100644 index 00000000..e3daccea --- /dev/null +++ b/src/com/jsh/model/po/Measureunit.hbm.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + 计量名称 + + + + + 计量描述 + + + + + 是否系统自带 0==系统 1==非系统 + + + + diff --git a/src/com/jsh/model/po/Measureunit.java b/src/com/jsh/model/po/Measureunit.java new file mode 100644 index 00000000..995e156f --- /dev/null +++ b/src/com/jsh/model/po/Measureunit.java @@ -0,0 +1,72 @@ +package com.jsh.model.po; + +import java.sql.Timestamp; + +@SuppressWarnings("serial") +public class Measureunit implements java.io.Serializable +{ + private Long id; + private String unitname; + private String description; + private Short isystem; + + public Measureunit() + { + + } + + public Measureunit(Long id) + { + this.id = id; + } + + public Measureunit(String unitname, Timestamp createtime, Long creator, + Timestamp updatetime, Long updator, String description, + Short isystem) + { + this.unitname = unitname; + this.description = description; + this.isystem = isystem; + } + + public Long getId() + { + return this.id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getUnitname() + { + return this.unitname; + } + + public void setUnitname(String unitname) + { + this.unitname = unitname; + } + + public String getDescription() + { + return this.description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Short getIsystem() + { + return this.isystem; + } + + public void setIsystem(Short isystem) + { + this.isystem = isystem; + } + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Person.hbm.xml b/src/com/jsh/model/po/Person.hbm.xml new file mode 100644 index 00000000..8b71ec75 --- /dev/null +++ b/src/com/jsh/model/po/Person.hbm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + 类型 + + + + + 姓名 + + + + diff --git a/src/com/jsh/model/po/Person.java b/src/com/jsh/model/po/Person.java new file mode 100644 index 00000000..7d9566d6 --- /dev/null +++ b/src/com/jsh/model/po/Person.java @@ -0,0 +1,59 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Person implements java.io.Serializable +{ + private Long Id; + private Depot depot; + private String Type; + private String Name; + + public Person() + { + + } + + public Person(Long Id) + { + this.Id = Id; + } + + public Person(Depot depot, String type, String name) { + this.depot = depot; + Type = type; + Name = name; + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public Depot getDepot() { + return depot; + } + + public void setDepot(Depot depot) { + this.depot = depot; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Role.hbm.xml b/src/com/jsh/model/po/Role.hbm.xml new file mode 100644 index 00000000..a76e27f1 --- /dev/null +++ b/src/com/jsh/model/po/Role.hbm.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + 角色名称 + + + + diff --git a/src/com/jsh/model/po/Role.java b/src/com/jsh/model/po/Role.java new file mode 100644 index 00000000..1e82eb27 --- /dev/null +++ b/src/com/jsh/model/po/Role.java @@ -0,0 +1,31 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Role implements java.io.Serializable +{ + private Long Id; + private String Name; + + public Role() + { + + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/Supplier.hbm.xml b/src/com/jsh/model/po/Supplier.hbm.xml new file mode 100644 index 00000000..a68578a1 --- /dev/null +++ b/src/com/jsh/model/po/Supplier.hbm.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + 供应商名称 + + + + + 类型 + + + + + 联系人 + + + + + 联系电话 + + + + + 电子邮箱 + + + + + + + + 是否系统自带 0==系统 1==非系统 + + + + + 启用 + + + + \ No newline at end of file diff --git a/src/com/jsh/model/po/Supplier.java b/src/com/jsh/model/po/Supplier.java new file mode 100644 index 00000000..0d297f9e --- /dev/null +++ b/src/com/jsh/model/po/Supplier.java @@ -0,0 +1,114 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class Supplier implements java.io.Serializable +{ + private Long id; + private String supplier; + private String type; + private String contacts; + private String phonenum; + private String email; + private Short isystem; + private String description; + private Boolean enabled; + + public Supplier() + { + + } + + public Supplier(Long id) + { + this.id = id; + } + + public Supplier(String supplier, String type, String contacts, + String phonenum, String email, Short isystem, String description, + Boolean enabled) { + super(); + this.supplier = supplier; + this.type = type; + this.contacts = contacts; + this.phonenum = phonenum; + this.email = email; + this.isystem = isystem; + this.description = description; + this.enabled = enabled; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSupplier() { + return supplier; + } + + public void setSupplier(String supplier) { + this.supplier = supplier; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getContacts() { + return contacts; + } + + public void setContacts(String contacts) { + this.contacts = contacts; + } + + public String getPhonenum() { + return phonenum; + } + + public void setPhonenum(String phonenum) { + this.phonenum = phonenum; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Short getIsystem() { + return isystem; + } + + public void setIsystem(Short isystem) { + this.isystem = isystem; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/UserBusiness.hbm.xml b/src/com/jsh/model/po/UserBusiness.hbm.xml new file mode 100644 index 00000000..98b9201b --- /dev/null +++ b/src/com/jsh/model/po/UserBusiness.hbm.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + 类别 + + + + + 主ID + + + + + + + + + diff --git a/src/com/jsh/model/po/UserBusiness.java b/src/com/jsh/model/po/UserBusiness.java new file mode 100644 index 00000000..0505abdf --- /dev/null +++ b/src/com/jsh/model/po/UserBusiness.java @@ -0,0 +1,49 @@ +package com.jsh.model.po; + +@SuppressWarnings("serial") +public class UserBusiness implements java.io.Serializable +{ + private Long Id; + private String Type; + private String KeyId; + private String Value; + + public UserBusiness() + { + + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public String getKeyId() { + return KeyId; + } + + public void setKeyId(String keyId) { + KeyId = keyId; + } + + public String getValue() { + return Value; + } + + public void setValue(String value) { + Value = value; + } + + +} \ No newline at end of file diff --git a/src/com/jsh/model/po/VisitAccount.hbm.xml b/src/com/jsh/model/po/VisitAccount.hbm.xml new file mode 100644 index 00000000..fb1bfab5 --- /dev/null +++ b/src/com/jsh/model/po/VisitAccount.hbm.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + 楼号 + + + + + 户号 + + + + + 回访情况 + + + + + 落实情况 + + + + + 住户姓名 + + + + + 电话 + + + + + 时间 + + + + diff --git a/src/com/jsh/model/po/VisitAccount.java b/src/com/jsh/model/po/VisitAccount.java new file mode 100644 index 00000000..be972e85 --- /dev/null +++ b/src/com/jsh/model/po/VisitAccount.java @@ -0,0 +1,114 @@ +package com.jsh.model.po; + +import java.sql.Timestamp; + +@SuppressWarnings("serial") +public class VisitAccount implements java.io.Serializable +{ + private Long Id; + private Depot depot; + private String LouHao; + private String HuHao; + private String HuiFang; + private String LuoShi; + private String Name; + private String Tel; + private Timestamp AddTime; + + public VisitAccount() + { + + } + + public VisitAccount(Long Id) + { + this.Id = Id; + } + + public VisitAccount(Depot depot, String LouHao, String HuHao, + String HuiFang,String LuoShi,String Name,String Tel,Timestamp AddTime) + { + this.depot = depot; + this.LouHao = LouHao; + this.HuHao = HuHao; + this.HuiFang = HuiFang; + this.LuoShi = LuoShi; + this.Name = Name; + this.Tel = Tel; + this.AddTime = AddTime; + } + + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public Depot getDepot() { + return depot; + } + + public void setDepot(Depot depot) { + this.depot = depot; + } + + public String getLouHao() { + return LouHao; + } + + public void setLouHao(String louHao) { + LouHao = louHao; + } + + public String getHuHao() { + return HuHao; + } + + public void setHuHao(String huHao) { + HuHao = huHao; + } + + public String getHuiFang() { + return HuiFang; + } + + public void setHuiFang(String huiFang) { + HuiFang = huiFang; + } + + public String getLuoShi() { + return LuoShi; + } + + public void setLuoShi(String luoShi) { + LuoShi = luoShi; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getTel() { + return Tel; + } + + public void setTel(String tel) { + Tel = tel; + } + + public Timestamp getAddTime() { + return AddTime; + } + + public void setAddTime(Timestamp addTime) { + AddTime = addTime; + } + + +} \ No newline at end of file diff --git a/src/com/jsh/model/vo/asset/AssetModel.java b/src/com/jsh/model/vo/asset/AssetModel.java new file mode 100644 index 00000000..8b361f33 --- /dev/null +++ b/src/com/jsh/model/vo/asset/AssetModel.java @@ -0,0 +1,429 @@ +package com.jsh.model.vo.asset; + +import java.io.File; +import java.io.InputStream; +import java.io.Serializable; + +@SuppressWarnings("serial") +public class AssetModel implements Serializable +{ + private AssetShowModel showModel = new AssetShowModel(); + + + /**======开始接受页面参数=================**/ + /** + * 资产名称ID + */ + private Long assetNameID ; + + /** + * 资产类型ID + */ + private Long assetCategoryID ; + + /** + * 位置属性 + */ + private String location = ""; + + /** + * 状态属性 + */ + private Short status ; + + /** + * 用户ID + */ + private Long userID ; + + /** + * 资产单价 + */ + private double price = 0; + + /** + * 购买日期 + */ + private String purchasedate = ""; + + /** + * 有效日期 + */ + private String periodofvalidity = ""; + + /** + * 保修日期 + */ + private String warrantydate = ""; + + /** + * 资产编号 + */ + private String assetnum = ""; + + /** + * 资产序列号 + */ + private String serialnum = ""; + + /** + * 标签 + */ + private String labels = ""; + + /** + * 资产ID + */ + private Long supplierID; + + /** + * 描述信息 + */ + private String description = ""; + + + /** + * 资产ID + */ + private Long assetID; + + /** + * 资产IDs 批量操作使用 + */ + private String assetIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + /** + * 输入流,导出excel文件 + */ + private InputStream excelStream; + + /** + * 文件名称 + */ + private String fileName = ""; + + /** + * 是否全部数据--根据搜索条件 + */ + private String isAllData = ""; + + /** + * 浏览器类型--中文字符乱码问题解决,火狐和IE下字符类型不一样 + */ + private String browserType = ""; + + /** + * 导入excel文件 + */ + private File assetFile; + + /** + * 文件类型 + */ + private String assetFileContentType; + + /** + * 文件名称 + */ + private String assetFileFileName; + + /** + * 是否只手工检查数据 0==检查 1==不检查直接导入数据库中 + */ + private Integer isCheck; + + public AssetShowModel getShowModel() + { + return showModel; + } + + public void setShowModel(AssetShowModel showModel) + { + this.showModel = showModel; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Long getAssetID() + { + return assetID; + } + + public void setAssetID(Long assetID) + { + this.assetID = assetID; + } + + public String getAssetIDs() + { + return assetIDs; + } + + public void setAssetIDs(String assetIDs) + { + this.assetIDs = assetIDs; + } + + public int getPageSize() + { + return pageSize; + } + + public void setPageSize(int pageSize) + { + this.pageSize = pageSize; + } + + public int getPageNo() + { + return pageNo; + } + + public void setPageNo(int pageNo) + { + this.pageNo = pageNo; + } + + public String getClientIp() + { + return clientIp; + } + + public void setClientIp(String clientIp) + { + this.clientIp = clientIp; + } + + public Long getAssetNameID() + { + return assetNameID; + } + + public void setAssetNameID(Long assetNameID) + { + this.assetNameID = assetNameID; + } + + public Long getAssetCategoryID() + { + return assetCategoryID; + } + + public void setAssetCategoryID(Long assetCategoryID) + { + this.assetCategoryID = assetCategoryID; + } + + public String getLocation() + { + return location; + } + + public void setLocation(String location) + { + this.location = location; + } + + public Short getStatus() + { + return status; + } + + public void setStatus(Short status) + { + this.status = status; + } + + public Long getUserID() + { + return userID; + } + + public void setUserID(Long userID) + { + this.userID = userID; + } + + public double getPrice() + { + return price; + } + + public void setPrice(double price) + { + this.price = price; + } + + public String getPurchasedate() + { + return purchasedate; + } + + public void setPurchasedate(String purchasedate) + { + this.purchasedate = purchasedate; + } + + public String getPeriodofvalidity() + { + return periodofvalidity; + } + + public void setPeriodofvalidity(String periodofvalidity) + { + this.periodofvalidity = periodofvalidity; + } + + public String getWarrantydate() + { + return warrantydate; + } + + public void setWarrantydate(String warrantydate) + { + this.warrantydate = warrantydate; + } + + public String getLabels() + { + return labels; + } + + public void setLabels(String labels) + { + this.labels = labels; + } + + public Long getSupplierID() + { + return supplierID; + } + + public void setSupplierID(Long supplierID) + { + this.supplierID = supplierID; + } + + public String getAssetnum() + { + return assetnum; + } + + public void setAssetnum(String assetnum) + { + this.assetnum = assetnum; + } + + public String getSerialnum() + { + return serialnum; + } + + public void setSerialnum(String serialnum) + { + this.serialnum = serialnum; + } + + public InputStream getExcelStream() + { + return excelStream; + } + + public void setExcelStream(InputStream excelStream) + { + this.excelStream = excelStream; + } + + public String getFileName() + { + return fileName; + } + + public void setFileName(String fileName) + { + this.fileName = fileName; + } + + public String getIsAllData() + { + return isAllData; + } + + public void setIsAllData(String isAllData) + { + this.isAllData = isAllData; + } + + public String getBrowserType() + { + return browserType; + } + + public void setBrowserType(String browserType) + { + this.browserType = browserType; + } + + public File getAssetFile() + { + return assetFile; + } + + public void setAssetFile(File assetFile) + { + this.assetFile = assetFile; + } + + public Integer getIsCheck() + { + return isCheck; + } + + public void setIsCheck(Integer isCheck) + { + this.isCheck = isCheck; + } + + public String getAssetFileContentType() + { + return assetFileContentType; + } + + public void setAssetFileContentType(String assetFileContentType) + { + this.assetFileContentType = assetFileContentType; + } + + public String getAssetFileFileName() + { + return assetFileFileName; + } + + public void setAssetFileFileName(String assetFileFileName) + { + this.assetFileFileName = assetFileFileName; + } +} diff --git a/src/com/jsh/model/vo/asset/AssetShowModel.java b/src/com/jsh/model/vo/asset/AssetShowModel.java new file mode 100644 index 00000000..6ee4a371 --- /dev/null +++ b/src/com/jsh/model/vo/asset/AssetShowModel.java @@ -0,0 +1,43 @@ +package com.jsh.model.vo.asset; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings({ "serial" }) +public class AssetShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() + { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) + { + this.map = map; + } +} diff --git a/src/com/jsh/model/vo/asset/ReportModel.java b/src/com/jsh/model/vo/asset/ReportModel.java new file mode 100644 index 00000000..52468229 --- /dev/null +++ b/src/com/jsh/model/vo/asset/ReportModel.java @@ -0,0 +1,321 @@ +package com.jsh.model.vo.asset; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class ReportModel implements Serializable +{ + private ReportShowModel showModel = new ReportShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 资产名称ID + */ + private Long assetNameID ; + + /** + * 资产类型ID + */ + private Long assetCategoryID ; + + /** + * 位置属性 + */ + private String location = ""; + + /** + * 状态属性 + */ + private Short status ; + + /** + * 用户ID + */ + private Long usernameID ; + + /** + * 资产单价 + */ + private float price = 0; + + /** + * 购买日期 + */ + private String purchasedate = ""; + + /** + * 有效日期 + */ + private String periodofvalidity = ""; + + /** + * 保修日期 + */ + private String warrantydate = ""; + + /** + * 资产编号 + */ + private String assetnum = ""; + + /** + * 资产序列号 + */ + private String serialnum = ""; + + /** + * 标签 + */ + private String labels = ""; + + /** + * 资产ID + */ + private Long supplierID; + + /** + * 描述信息 + */ + private String description = ""; + + + /** + * 资产ID + */ + private Long assetID; + + /** + * 资产IDs 批量操作使用 + */ + private String assetIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + /** + * 报表类型 + */ + private Integer reportType; + + public ReportShowModel getShowModel() + { + return showModel; + } + + public void setShowModel(ReportShowModel showModel) + { + this.showModel = showModel; + } + + public Long getAssetNameID() + { + return assetNameID; + } + + public void setAssetNameID(Long assetNameID) + { + this.assetNameID = assetNameID; + } + + public Long getAssetCategoryID() + { + return assetCategoryID; + } + + public void setAssetCategoryID(Long assetCategoryID) + { + this.assetCategoryID = assetCategoryID; + } + + public String getLocation() + { + return location; + } + + public void setLocation(String location) + { + this.location = location; + } + + public Short getStatus() + { + return status; + } + + public void setStatus(Short status) + { + this.status = status; + } + + public Long getUsernameID() + { + return usernameID; + } + + public void setUsernameID(Long usernameID) + { + this.usernameID = usernameID; + } + + public float getPrice() + { + return price; + } + + public void setPrice(float price) + { + this.price = price; + } + + public String getPurchasedate() + { + return purchasedate; + } + + public void setPurchasedate(String purchasedate) + { + this.purchasedate = purchasedate; + } + + public String getPeriodofvalidity() + { + return periodofvalidity; + } + + public void setPeriodofvalidity(String periodofvalidity) + { + this.periodofvalidity = periodofvalidity; + } + + public String getWarrantydate() + { + return warrantydate; + } + + public void setWarrantydate(String warrantydate) + { + this.warrantydate = warrantydate; + } + + public String getAssetnum() + { + return assetnum; + } + + public void setAssetnum(String assetnum) + { + this.assetnum = assetnum; + } + + public String getSerialnum() + { + return serialnum; + } + + public void setSerialnum(String serialnum) + { + this.serialnum = serialnum; + } + + public String getLabels() + { + return labels; + } + + public void setLabels(String labels) + { + this.labels = labels; + } + + public Long getSupplierID() + { + return supplierID; + } + + public void setSupplierID(Long supplierID) + { + this.supplierID = supplierID; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Long getAssetID() + { + return assetID; + } + + public void setAssetID(Long assetID) + { + this.assetID = assetID; + } + + public String getAssetIDs() + { + return assetIDs; + } + + public void setAssetIDs(String assetIDs) + { + this.assetIDs = assetIDs; + } + + public int getPageSize() + { + return pageSize; + } + + public void setPageSize(int pageSize) + { + this.pageSize = pageSize; + } + + public int getPageNo() + { + return pageNo; + } + + public void setPageNo(int pageNo) + { + this.pageNo = pageNo; + } + + public String getClientIp() + { + return clientIp; + } + + public void setClientIp(String clientIp) + { + this.clientIp = clientIp; + } + + public Integer getReportType() + { + return reportType; + } + + public void setReportType(Integer reportType) + { + this.reportType = reportType; + } +} diff --git a/src/com/jsh/model/vo/asset/ReportShowModel.java b/src/com/jsh/model/vo/asset/ReportShowModel.java new file mode 100644 index 00000000..ac77a242 --- /dev/null +++ b/src/com/jsh/model/vo/asset/ReportShowModel.java @@ -0,0 +1,34 @@ +package com.jsh.model.vo.asset; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +@SuppressWarnings({"serial","rawtypes"}) +public class ReportShowModel implements Serializable +{ + //保存报表数据 + private List reportData = new ArrayList(); + //保存提示信息 + private String msgTip = ""; + + public List getReportData() + { + return reportData; + } + + public void setReportData(List reportData) + { + this.reportData = reportData; + } + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } +} diff --git a/src/com/jsh/model/vo/basic/AppModel.java b/src/com/jsh/model/vo/basic/AppModel.java new file mode 100644 index 00000000..63187b8e --- /dev/null +++ b/src/com/jsh/model/vo/basic/AppModel.java @@ -0,0 +1,294 @@ +package com.jsh.model.vo.basic; + +import java.io.File; +import java.io.Serializable; + +@SuppressWarnings("serial") +public class AppModel implements Serializable +{ + private AppShowModel showModel = new AppShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 代号 + */ + private String Number = ""; + + /** + * 名称 + */ + private String Name = ""; + + /** + * 类型 + */ + private String Type = ""; + + /** + * 图标 + */ + private String Icon = ""; + + /** + * 链接 + */ + private String URL = ""; + + /** + * 宽度 + */ + private String Width = ""; + + /** + * 高度 + */ + private String Height = ""; + + /** + * 拉伸 + */ + private Boolean ReSize = false; + + /** + * 最大化 + */ + private Boolean OpenMax = false; + + /** + * Flash + */ + private Boolean Flash = false; + + /** + * 种类 + */ + private String ZL = ""; + + /** + * 排序号 + */ + private String Sort = ""; + + /** + * 备注 + */ + private String Remark = ""; + + /** + * 启用 + */ + private Boolean Enabled = false; + + /** + * 分类ID + */ + private Long appID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String appIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + /** + * UBType,UserBusiness类型 + */ + private String UBType = ""; + + /** + * UBKeyId,UserBusiness关键id + */ + private String UBKeyId = ""; + + + public AppShowModel getShowModel() { + return showModel; + } + + public void setShowModel(AppShowModel showModel) { + this.showModel = showModel; + } + + public String getNumber() { + return Number; + } + + public void setNumber(String number) { + Number = number; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public String getIcon() { + return Icon; + } + + public void setIcon(String icon) { + Icon = icon; + } + + public String getURL() { + return URL; + } + + public void setURL(String uRL) { + URL = uRL; + } + + public String getWidth() { + return Width; + } + + public void setWidth(String width) { + Width = width; + } + + public String getHeight() { + return Height; + } + + public void setHeight(String height) { + Height = height; + } + + public Boolean getReSize() { + return ReSize; + } + + public void setReSize(Boolean reSize) { + ReSize = reSize; + } + + public Boolean getOpenMax() { + return OpenMax; + } + + public void setOpenMax(Boolean openMax) { + OpenMax = openMax; + } + + public Boolean getFlash() { + return Flash; + } + + public void setFlash(Boolean flash) { + Flash = flash; + } + + public String getZL() { + return ZL; + } + + public void setZL(String zL) { + ZL = zL; + } + + public String getSort() { + return Sort; + } + + public void setSort(String sort) { + Sort = sort; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public Boolean getEnabled() { + return Enabled; + } + + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } + + public Long getAppID() { + return appID; + } + + public void setAppID(Long appID) { + this.appID = appID; + } + + public String getAppIDs() { + return appIDs; + } + + public void setAppIDs(String appIDs) { + this.appIDs = appIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + + public String getUBType() { + return UBType; + } + + public void setUBType(String uBType) { + UBType = uBType; + } + + public String getUBKeyId() { + return UBKeyId; + } + + public void setUBKeyId(String uBKeyId) { + UBKeyId = uBKeyId; + } + +} diff --git a/src/com/jsh/model/vo/basic/AppShowModel.java b/src/com/jsh/model/vo/basic/AppShowModel.java new file mode 100644 index 00000000..ebaf0c18 --- /dev/null +++ b/src/com/jsh/model/vo/basic/AppShowModel.java @@ -0,0 +1,22 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class AppShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } +} diff --git a/src/com/jsh/model/vo/basic/AssetNameModel.java b/src/com/jsh/model/vo/basic/AssetNameModel.java new file mode 100644 index 00000000..a1d09481 --- /dev/null +++ b/src/com/jsh/model/vo/basic/AssetNameModel.java @@ -0,0 +1,154 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class AssetNameModel implements Serializable +{ + private AssetNameShowModel showModel = new AssetNameShowModel(); + /**======开始接受页面参数=================**/ + /** + * 名称 + */ + private String assetName = ""; + + /** + * 是否易耗品 + */ + private Short consumable; + + /** + * 描述信息 + */ + private String description = ""; + + /** + * 分类ID + */ + private Long categoryID; + + /** + * ID + */ + private Long assetNameID = 0l; + + /** + * IDs 批量操作使用 + */ + private String assetNameIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + public AssetNameShowModel getShowModel() + { + return showModel; + } + + public void setShowModel(AssetNameShowModel showModel) + { + this.showModel = showModel; + } + + public String getAssetName() + { + return assetName; + } + + public void setAssetName(String assetName) + { + this.assetName = assetName; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Long getAssetNameID() + { + return assetNameID; + } + + public void setAssetNameID(Long assetNameID) + { + this.assetNameID = assetNameID; + } + + public String getAssetNameIDs() + { + return assetNameIDs; + } + + public void setAssetNameIDs(String assetNameIDs) + { + this.assetNameIDs = assetNameIDs; + } + + public int getPageSize() + { + return pageSize; + } + + public void setPageSize(int pageSize) + { + this.pageSize = pageSize; + } + + public int getPageNo() + { + return pageNo; + } + + public void setPageNo(int pageNo) + { + this.pageNo = pageNo; + } + + public String getClientIp() + { + return clientIp; + } + + public void setClientIp(String clientIp) + { + this.clientIp = clientIp; + } + + public Short getConsumable() + { + return consumable; + } + + public void setConsumable(Short consumable) + { + this.consumable = consumable; + } + + public Long getCategoryID() + { + return categoryID; + } + + public void setCategoryID(Long categoryID) + { + this.categoryID = categoryID; + } +} diff --git a/src/com/jsh/model/vo/basic/AssetNameShowModel.java b/src/com/jsh/model/vo/basic/AssetNameShowModel.java new file mode 100644 index 00000000..dd28afad --- /dev/null +++ b/src/com/jsh/model/vo/basic/AssetNameShowModel.java @@ -0,0 +1,22 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class AssetNameShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } +} diff --git a/src/com/jsh/model/vo/basic/CategoryModel.java b/src/com/jsh/model/vo/basic/CategoryModel.java new file mode 100644 index 00000000..1ec5ca99 --- /dev/null +++ b/src/com/jsh/model/vo/basic/CategoryModel.java @@ -0,0 +1,125 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class CategoryModel implements Serializable +{ + private CategoryShowModel showModel = new CategoryShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 分类名称 + */ + private String categoryName = ""; + + /** + * 描述信息 + */ + private String description = ""; + + /** + * 分类ID + */ + private Long categoryID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String categoryIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + public CategoryShowModel getShowModel() + { + return showModel; + } + + public void setShowModel(CategoryShowModel showModel) + { + this.showModel = showModel; + } + + public String getCategoryName() + { + return categoryName; + } + + public void setCategoryName(String categoryName) + { + this.categoryName = categoryName; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Long getCategoryID() + { + return categoryID; + } + + public void setCategoryID(Long categoryID) + { + this.categoryID = categoryID; + } + + public String getCategoryIDs() + { + return categoryIDs; + } + + public void setCategoryIDs(String categoryIDs) + { + this.categoryIDs = categoryIDs; + } + + public int getPageSize() + { + return pageSize; + } + + public void setPageSize(int pageSize) + { + this.pageSize = pageSize; + } + + public int getPageNo() + { + return pageNo; + } + + public void setPageNo(int pageNo) + { + this.pageNo = pageNo; + } + + public String getClientIp() + { + return clientIp; + } + + public void setClientIp(String clientIp) + { + this.clientIp = clientIp; + } +} diff --git a/src/com/jsh/model/vo/basic/CategoryShowModel.java b/src/com/jsh/model/vo/basic/CategoryShowModel.java new file mode 100644 index 00000000..f1e9d73b --- /dev/null +++ b/src/com/jsh/model/vo/basic/CategoryShowModel.java @@ -0,0 +1,22 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class CategoryShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } +} diff --git a/src/com/jsh/model/vo/basic/DepotModel.java b/src/com/jsh/model/vo/basic/DepotModel.java new file mode 100644 index 00000000..2856a6d8 --- /dev/null +++ b/src/com/jsh/model/vo/basic/DepotModel.java @@ -0,0 +1,150 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class DepotModel implements Serializable +{ + private DepotShowModel showModel = new DepotShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 仓库名称 + */ + private String name = ""; + + /** + * 排序 + */ + private String sort = ""; + + /** + * 描述 + */ + private String remark = ""; + + /** + * 分类ID + */ + private Long depotID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String depotIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + /** + * UBType,UserBusiness类型 + */ + private String UBType = ""; + + /** + * UBKeyId,UserBusiness关键id + */ + private String UBKeyId = ""; + + public DepotShowModel getShowModel() { + return showModel; + } + + public void setShowModel(DepotShowModel showModel) { + this.showModel = showModel; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Long getDepotID() { + return depotID; + } + + public void setDepotID(Long depotID) { + this.depotID = depotID; + } + + public String getDepotIDs() { + return depotIDs; + } + + public void setDepotIDs(String depotIDs) { + this.depotIDs = depotIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + + public String getUBType() { + return UBType; + } + + public void setUBType(String uBType) { + UBType = uBType; + } + + public String getUBKeyId() { + return UBKeyId; + } + + public void setUBKeyId(String uBKeyId) { + UBKeyId = uBKeyId; + } + + +} diff --git a/src/com/jsh/model/vo/basic/DepotShowModel.java b/src/com/jsh/model/vo/basic/DepotShowModel.java new file mode 100644 index 00000000..a56a4206 --- /dev/null +++ b/src/com/jsh/model/vo/basic/DepotShowModel.java @@ -0,0 +1,43 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class DepotShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + + +} diff --git a/src/com/jsh/model/vo/basic/FunctionsModel.java b/src/com/jsh/model/vo/basic/FunctionsModel.java new file mode 100644 index 00000000..ccc3315a --- /dev/null +++ b/src/com/jsh/model/vo/basic/FunctionsModel.java @@ -0,0 +1,219 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class FunctionsModel implements Serializable +{ + private FunctionsShowModel showModel = new FunctionsShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 编号 + */ + private String Number = ""; + /** + * 名称 + */ + private String Name = ""; + /** + * 上级编号 + */ + private String PNumber = ""; + /** + * 链接 + */ + private String URL = ""; + /** + * 收缩 + */ + private Boolean State = false; + /** + * 排序 + */ + private String Sort = ""; + /** + * 启用 + */ + private Boolean Enabled = false; + /** + * 类型 + */ + private String Type = ""; + /** + * 拥有的功能列表 + */ + private String hasFunctions= ""; + /** + * 分类ID + */ + private Long functionsID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String functionsIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + /** + * UBType,UserBusiness类型 + */ + private String UBType = ""; + + /** + * UBKeyId,UserBusiness关键id + */ + private String UBKeyId = ""; + + public FunctionsShowModel getShowModel() { + return showModel; + } + + public void setShowModel(FunctionsShowModel showModel) { + this.showModel = showModel; + } + + public String getNumber() { + return Number; + } + + public void setNumber(String number) { + Number = number; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getPNumber() { + return PNumber; + } + + public void setPNumber(String pNumber) { + PNumber = pNumber; + } + + public String getURL() { + return URL; + } + + public void setURL(String uRL) { + URL = uRL; + } + + public Boolean getState() { + return State; + } + + public void setState(Boolean state) { + State = state; + } + + public String getSort() { + return Sort; + } + + public void setSort(String sort) { + Sort = sort; + } + + public Boolean getEnabled() { + return Enabled; + } + + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public Long getFunctionsID() { + return functionsID; + } + + public void setFunctionsID(Long functionsID) { + this.functionsID = functionsID; + } + + public String getFunctionsIDs() { + return functionsIDs; + } + + public void setFunctionsIDs(String functionsIDs) { + this.functionsIDs = functionsIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + + public String getUBType() { + return UBType; + } + + public void setUBType(String uBType) { + UBType = uBType; + } + + public String getUBKeyId() { + return UBKeyId; + } + + public void setUBKeyId(String uBKeyId) { + UBKeyId = uBKeyId; + } + + public String getHasFunctions() { + return hasFunctions; + } + + public void setHasFunctions(String hasFunctions) { + this.hasFunctions = hasFunctions; + } + + +} diff --git a/src/com/jsh/model/vo/basic/FunctionsShowModel.java b/src/com/jsh/model/vo/basic/FunctionsShowModel.java new file mode 100644 index 00000000..778b445c --- /dev/null +++ b/src/com/jsh/model/vo/basic/FunctionsShowModel.java @@ -0,0 +1,22 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class FunctionsShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } +} diff --git a/src/com/jsh/model/vo/basic/LogModel.java b/src/com/jsh/model/vo/basic/LogModel.java new file mode 100644 index 00000000..bdd5f2e4 --- /dev/null +++ b/src/com/jsh/model/vo/basic/LogModel.java @@ -0,0 +1,200 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class LogModel implements Serializable +{ + private LogShowModel showModel = new LogShowModel(); + /**======开始接受页面参数=================**/ + /** + * 用户ID + */ + private Long usernameID ; + + /** + * 操作 + */ + private String operation; + + /** + * 开始时间 + */ + private String beginTime; + + /** + * 结束时间 + */ + private String endTime; + + /** + * 是否成功 0==成功 1==失败 + */ + private Short status; + + /** + * 操作具体内容 + */ + private String contentdetails; + + /** + * 描述信息 + */ + private String remark = ""; + + /** + * 日志ID + */ + private Long logID = 0l; + + /** + * 日志IDs 批量操作使用 + */ + private String logIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + public LogShowModel getShowModel() { + return showModel; + } + + public void setShowModel(LogShowModel showModel) { + this.showModel = showModel; + } + + public Long getLogID() + { + return logID; + } + + public void setLogID(Long logID) + { + this.logID = logID; + } + + public String getLogIDs() + { + return logIDs; + } + + public void setLogIDs(String logIDs) + { + this.logIDs = logIDs; + } + + public int getPageSize() + { + return pageSize; + } + + public void setPageSize(int pageSize) + { + this.pageSize = pageSize; + } + + public int getPageNo() + { + return pageNo; + } + + public void setPageNo(int pageNo) + { + this.pageNo = pageNo; + } + + public String getClientIp() + { + return clientIp; + } + + public void setClientIp(String clientIp) + { + this.clientIp = clientIp; + } + + public Long getUsernameID() + { + return usernameID; + } + + public void setUsernameID(Long usernameID) + { + this.usernameID = usernameID; + } + + public String getOperation() + { + return operation; + } + + public void setOperation(String operation) + { + this.operation = operation; + } + + public String getBeginTime() + { + if(null == beginTime || beginTime.length() == 0) + return beginTime; + return beginTime + " 00:00:00"; + } + + public void setBeginTime(String beginTime) + { + this.beginTime = beginTime; + } + + public String getEndTime() + { + if(null == endTime || endTime.length() ==0) + return endTime; + return endTime + " 23:59:59"; + } + + public void setEndTime(String endTime) + { + this.endTime = endTime; + } + + public Short getStatus() + { + return status; + } + + public void setStatus(Short status) + { + this.status = status; + } + + public String getContentdetails() + { + return contentdetails; + } + + public void setContentdetails(String contentdetails) + { + this.contentdetails = contentdetails; + } + + public String getRemark() + { + return remark; + } + + public void setRemark(String remark) + { + this.remark = remark; + } +} diff --git a/src/com/jsh/model/vo/basic/LogShowModel.java b/src/com/jsh/model/vo/basic/LogShowModel.java new file mode 100644 index 00000000..1dbb43b3 --- /dev/null +++ b/src/com/jsh/model/vo/basic/LogShowModel.java @@ -0,0 +1,43 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class LogShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() + { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) + { + this.map = map; + } +} diff --git a/src/com/jsh/model/vo/basic/RoleModel.java b/src/com/jsh/model/vo/basic/RoleModel.java new file mode 100644 index 00000000..481fd4d0 --- /dev/null +++ b/src/com/jsh/model/vo/basic/RoleModel.java @@ -0,0 +1,123 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class RoleModel implements Serializable +{ + private RoleShowModel showModel = new RoleShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 角色名称 + */ + private String Name = ""; + + /** + * 分类ID + */ + private Long roleID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String roleIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + /** + * UBType,UserBusiness类型 + */ + private String UBType = ""; + + /** + * UBKeyId,UserBusiness关键id + */ + private String UBKeyId = ""; + + public RoleShowModel getShowModel() { + return showModel; + } + + public void setShowModel(RoleShowModel showModel) { + this.showModel = showModel; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public Long getRoleID() { + return roleID; + } + + public void setRoleID(Long roleID) { + this.roleID = roleID; + } + + public String getRoleIDs() { + return roleIDs; + } + + public void setRoleIDs(String roleIDs) { + this.roleIDs = roleIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + + public String getUBType() { + return UBType; + } + + public void setUBType(String uBType) { + UBType = uBType; + } + + public String getUBKeyId() { + return UBKeyId; + } + + public void setUBKeyId(String uBKeyId) { + UBKeyId = uBKeyId; + } + +} diff --git a/src/com/jsh/model/vo/basic/RoleShowModel.java b/src/com/jsh/model/vo/basic/RoleShowModel.java new file mode 100644 index 00000000..f61b6c41 --- /dev/null +++ b/src/com/jsh/model/vo/basic/RoleShowModel.java @@ -0,0 +1,22 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class RoleShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } +} diff --git a/src/com/jsh/model/vo/basic/SupplierModel.java b/src/com/jsh/model/vo/basic/SupplierModel.java new file mode 100644 index 00000000..53ab8962 --- /dev/null +++ b/src/com/jsh/model/vo/basic/SupplierModel.java @@ -0,0 +1,177 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class SupplierModel implements Serializable +{ + private SupplierShowModel showModel = new SupplierShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 供应商名称 + */ + private String supplier = ""; + + /** + * 类型 + */ + private String type = ""; + + /** + * 联系人 + */ + private String contacts = ""; + + /** + * 联系电话 + */ + private String phonenum = ""; + + /** + * 电子邮箱 + */ + private String email = ""; + + /** + * 描述信息 + */ + private String description = ""; + + /** + * 启用 + */ + private Boolean enabled = false; + + /** + * 供应商ID + */ + private Long supplierID = 0l; + + /** + * 供应商IDs 批量操作使用 + */ + private String supplierIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + public SupplierShowModel getShowModel() { + return showModel; + } + + public void setShowModel(SupplierShowModel showModel) { + this.showModel = showModel; + } + + public String getSupplier() { + return supplier; + } + + public void setSupplier(String supplier) { + this.supplier = supplier; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getContacts() { + return contacts; + } + + public void setContacts(String contacts) { + this.contacts = contacts; + } + + public String getPhonenum() { + return phonenum; + } + + public void setPhonenum(String phonenum) { + this.phonenum = phonenum; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public Long getSupplierID() { + return supplierID; + } + + public void setSupplierID(Long supplierID) { + this.supplierID = supplierID; + } + + public String getSupplierIDs() { + return supplierIDs; + } + + public void setSupplierIDs(String supplierIDs) { + this.supplierIDs = supplierIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + + + +} diff --git a/src/com/jsh/model/vo/basic/SupplierShowModel.java b/src/com/jsh/model/vo/basic/SupplierShowModel.java new file mode 100644 index 00000000..9a0cffe7 --- /dev/null +++ b/src/com/jsh/model/vo/basic/SupplierShowModel.java @@ -0,0 +1,42 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class SupplierShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + +} diff --git a/src/com/jsh/model/vo/basic/UserBusinessModel.java b/src/com/jsh/model/vo/basic/UserBusinessModel.java new file mode 100644 index 00000000..f44f0d8b --- /dev/null +++ b/src/com/jsh/model/vo/basic/UserBusinessModel.java @@ -0,0 +1,123 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class UserBusinessModel implements Serializable +{ + private UserBusinessShowModel showModel = new UserBusinessShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 角色名称 + */ + private String Type = ""; + + /** + * 主ID + */ + private String KeyId = ""; + + /** + * 值 + */ + private String Value = ""; + + /** + * 分类ID + */ + private Long userBusinessID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String userBusinessIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + public UserBusinessShowModel getShowModel() { + return showModel; + } + + public void setShowModel(UserBusinessShowModel showModel) { + this.showModel = showModel; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public String getKeyId() { + return KeyId; + } + + public void setKeyId(String keyId) { + KeyId = keyId; + } + + public String getValue() { + return Value; + } + + public void setValue(String value) { + Value = value; + } + + public Long getUserBusinessID() { + return userBusinessID; + } + + public void setUserBusinessID(Long userBusinessID) { + this.userBusinessID = userBusinessID; + } + + public String getUserBusinessIDs() { + return userBusinessIDs; + } + + public void setUserBusinessIDs(String userBusinessIDs) { + this.userBusinessIDs = userBusinessIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + +} diff --git a/src/com/jsh/model/vo/basic/UserBusinessShowModel.java b/src/com/jsh/model/vo/basic/UserBusinessShowModel.java new file mode 100644 index 00000000..65dc4b27 --- /dev/null +++ b/src/com/jsh/model/vo/basic/UserBusinessShowModel.java @@ -0,0 +1,43 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class UserBusinessShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + + +} diff --git a/src/com/jsh/model/vo/basic/UserModel.java b/src/com/jsh/model/vo/basic/UserModel.java new file mode 100644 index 00000000..42c8cf0e --- /dev/null +++ b/src/com/jsh/model/vo/basic/UserModel.java @@ -0,0 +1,255 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class UserModel implements Serializable +{ + private UserShowModel showModel = new UserShowModel(); + + /*+++++用户登录开始+++++++++++*/ + private String username = "" ; + private String password = "" ; + /*+++++用户登录结束+++++++++++*/ + + /** + * ===============以下处理用户管理部分=============== + */ + /** + * 用户登录名称 + */ + private String loginame; + + /** + * 职位 + */ + private String position; + + /** + * 部门 + */ + private String department; + + /** + * 电子邮件 + */ + private String email; + + /** + * 电话号码 + */ + private String phonenum; + + /** + * 是否管理员 0 ==管理员 1==非管理员 + */ + private Short ismanager = 1; + + /** + * 用户描述 + */ + private String description; + + /** + * 用户ID + */ + private Long userID = 0l; + + /** + * 用户IDs 批量操作使用 + */ + private String userIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + /** + * 根据标识判断是校验登录名称还是用户名称 0==用户名称 1==登录名称 + */ + private int checkFlag = 0; + + private String orgpwd = ""; + + public String getClientIp() + { + return clientIp; + } + + public void setClientIp(String clientIp) + { + this.clientIp = clientIp; + } + + 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 UserShowModel getShowModel() + { + return showModel; + } + + public void setShowModel(UserShowModel showModel) + { + this.showModel = showModel; + } + + public String getLoginame() + { + return loginame; + } + + public void setLoginame(String loginame) + { + this.loginame = loginame; + } + + public String getPosition() + { + return position; + } + + public void setPosition(String position) + { + this.position = position; + } + + public String getDepartment() + { + return department; + } + + public void setDepartment(String department) + { + this.department = department; + } + + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + + public String getPhonenum() + { + return phonenum; + } + + public void setPhonenum(String phonenum) + { + this.phonenum = phonenum; + } + + public Short getIsmanager() + { + return ismanager; + } + + public void setIsmanager(Short ismanager) + { + this.ismanager = ismanager; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public Long getUserID() + { + return userID; + } + + public void setUserID(Long userID) + { + this.userID = userID; + } + + public String getUserIDs() + { + return userIDs; + } + + public void setUserIDs(String userIDs) + { + this.userIDs = userIDs; + } + + public int getPageSize() + { + return pageSize; + } + + public void setPageSize(int pageSize) + { + this.pageSize = pageSize; + } + + public int getPageNo() + { + return pageNo; + } + + public void setPageNo(int pageNo) + { + this.pageNo = pageNo; + } + + public int getCheckFlag() + { + return checkFlag; + } + + public void setCheckFlag(int checkFlag) + { + this.checkFlag = checkFlag; + } + + public String getOrgpwd() + { + return orgpwd; + } + + public void setOrgpwd(String orgpwd) + { + this.orgpwd = orgpwd; + } + +} diff --git a/src/com/jsh/model/vo/basic/UserShowModel.java b/src/com/jsh/model/vo/basic/UserShowModel.java new file mode 100644 index 00000000..3a62dc44 --- /dev/null +++ b/src/com/jsh/model/vo/basic/UserShowModel.java @@ -0,0 +1,22 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class UserShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } +} diff --git a/src/com/jsh/model/vo/basic/VisitAccountModel.java b/src/com/jsh/model/vo/basic/VisitAccountModel.java new file mode 100644 index 00000000..8b0f5214 --- /dev/null +++ b/src/com/jsh/model/vo/basic/VisitAccountModel.java @@ -0,0 +1,184 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class VisitAccountModel implements Serializable +{ + private VisitAccountShowModel showModel = new VisitAccountShowModel(); + + /**======开始接受页面参数=================**/ + /** + * ProjectId + */ + private Long ProjectId; + /** + * 楼号 + */ + private String LouHao = ""; + /** + * 户号 + */ + private String HuHao = ""; + /** + * 回访情况 + */ + private String HuiFang = ""; + /** + * 落实情况 + */ + private String LuoShi = ""; + /** + * 住户姓名 + */ + private String Name = ""; + /** + * 电话 + */ + private String Tel = ""; + /** + * 时间 + */ + private String AddTime = ""; + + /** + * 分类ID + */ + private Long visitAccountID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String visitAccountIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + + public VisitAccountShowModel getShowModel() { + return showModel; + } + + public void setShowModel(VisitAccountShowModel showModel) { + this.showModel = showModel; + } + + public Long getProjectId() { + return ProjectId; + } + + public void setProjectId(Long projectId) { + ProjectId = projectId; + } + + public String getLouHao() { + return LouHao; + } + + public void setLouHao(String louHao) { + LouHao = louHao; + } + + public String getHuHao() { + return HuHao; + } + + public void setHuHao(String huHao) { + HuHao = huHao; + } + + public String getHuiFang() { + return HuiFang; + } + + public void setHuiFang(String huiFang) { + HuiFang = huiFang; + } + + public String getLuoShi() { + return LuoShi; + } + + public void setLuoShi(String luoShi) { + LuoShi = luoShi; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getTel() { + return Tel; + } + + public void setTel(String tel) { + Tel = tel; + } + + public String getAddTime() { + return AddTime; + } + + public void setAddTime(String addTime) { + AddTime = addTime; + } + + public Long getVisitAccountID() { + return visitAccountID; + } + + public void setVisitAccountID(Long visitAccountID) { + this.visitAccountID = visitAccountID; + } + + public String getVisitAccountIDs() { + return visitAccountIDs; + } + + public void setVisitAccountIDs(String visitAccountIDs) { + this.visitAccountIDs = visitAccountIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + + + +} diff --git a/src/com/jsh/model/vo/basic/VisitAccountShowModel.java b/src/com/jsh/model/vo/basic/VisitAccountShowModel.java new file mode 100644 index 00000000..e34890ba --- /dev/null +++ b/src/com/jsh/model/vo/basic/VisitAccountShowModel.java @@ -0,0 +1,22 @@ +package com.jsh.model.vo.basic; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class VisitAccountShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } +} diff --git a/src/com/jsh/model/vo/materials/BuildingModel.java b/src/com/jsh/model/vo/materials/BuildingModel.java new file mode 100644 index 00000000..c3365b7d --- /dev/null +++ b/src/com/jsh/model/vo/materials/BuildingModel.java @@ -0,0 +1,133 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class BuildingModel implements Serializable +{ + private BuildingShowModel showModel = new BuildingShowModel(); + + /**======开始接受页面参数=================**/ + /** + * ProjectId + */ + private Long ProjectId; + /** + * 名称 + */ + private String Name = ""; + /** + * 备注 + */ + private String Remark = ""; + /** + * 启用 + */ + private Boolean Enabled = false; + + /** + * 分类ID + */ + private Long buildingID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String buildingIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + public BuildingShowModel getShowModel() { + return showModel; + } + + public void setShowModel(BuildingShowModel showModel) { + this.showModel = showModel; + } + + public Long getProjectId() { + return ProjectId; + } + + public void setProjectId(Long projectId) { + ProjectId = projectId; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public Boolean getEnabled() { + return Enabled; + } + + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } + + public Long getBuildingID() { + return buildingID; + } + + public void setBuildingID(Long buildingID) { + this.buildingID = buildingID; + } + + public String getBuildingIDs() { + return buildingIDs; + } + + public void setBuildingIDs(String buildingIDs) { + this.buildingIDs = buildingIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + +} diff --git a/src/com/jsh/model/vo/materials/BuildingShowModel.java b/src/com/jsh/model/vo/materials/BuildingShowModel.java new file mode 100644 index 00000000..2363433f --- /dev/null +++ b/src/com/jsh/model/vo/materials/BuildingShowModel.java @@ -0,0 +1,37 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class BuildingShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + +} diff --git a/src/com/jsh/model/vo/materials/DepotHeadModel.java b/src/com/jsh/model/vo/materials/DepotHeadModel.java new file mode 100644 index 00000000..5860f703 --- /dev/null +++ b/src/com/jsh/model/vo/materials/DepotHeadModel.java @@ -0,0 +1,257 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; +import com.sun.jmx.snmp.Timestamp; + +@SuppressWarnings("serial") +public class DepotHeadModel implements Serializable +{ + private DepotHeadShowModel showModel = new DepotHeadShowModel(); + + /**======开始接受页面参数=================**/ + private String Type = ""; + private String SubType = ""; + private Long ProjectId; + private String Number = ""; + private String OperPersonName = ""; + private String OperTime; + private Long OrganId; + private Long HandsPersonId; + private Long WareHousePersonId; + private String SettlementWay = ""; + private Long BuildingId; + private Long AllocationProjectId; + private String Remark = ""; + private String State = ""; + private String ReAuditPersonName = ""; + private String Reason = ""; + + private String BeginTime; //查询开始时间 + private String EndTime; //查询结束时间 + private String MonthTime; //查询月份 + /** + * 分类ID + */ + private Long depotHeadID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String depotHeadIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + public DepotHeadShowModel getShowModel() { + return showModel; + } + + public void setShowModel(DepotHeadShowModel showModel) { + this.showModel = showModel; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public String getSubType() { + return SubType; + } + + public void setSubType(String subType) { + SubType = subType; + } + + public Long getProjectId() { + return ProjectId; + } + + public void setProjectId(Long projectId) { + ProjectId = projectId; + } + + public String getNumber() { + return Number; + } + + public void setNumber(String number) { + Number = number; + } + + public String getOperPersonName() { + return OperPersonName; + } + + public void setOperPersonName(String operPersonName) { + OperPersonName = operPersonName; + } + + public Long getOrganId() { + return OrganId; + } + + public void setOrganId(Long organId) { + OrganId = organId; + } + + public Long getHandsPersonId() { + return HandsPersonId; + } + + public void setHandsPersonId(Long handsPersonId) { + HandsPersonId = handsPersonId; + } + + public Long getWareHousePersonId() { + return WareHousePersonId; + } + + public void setWareHousePersonId(Long wareHousePersonId) { + WareHousePersonId = wareHousePersonId; + } + + public String getSettlementWay() { + return SettlementWay; + } + + public void setSettlementWay(String settlementWay) { + SettlementWay = settlementWay; + } + + public Long getBuildingId() { + return BuildingId; + } + + public void setBuildingId(Long buildingId) { + BuildingId = buildingId; + } + + public Long getAllocationProjectId() { + return AllocationProjectId; + } + + public void setAllocationProjectId(Long allocationProjectId) { + AllocationProjectId = allocationProjectId; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public String getState() { + return State; + } + + public void setState(String state) { + State = state; + } + + public String getReAuditPersonName() { + return ReAuditPersonName; + } + + public void setReAuditPersonName(String reAuditPersonName) { + ReAuditPersonName = reAuditPersonName; + } + + public String getReason() { + return Reason; + } + + public void setReason(String reason) { + Reason = reason; + } + + public Long getDepotHeadID() { + return depotHeadID; + } + + public void setDepotHeadID(Long depotHeadID) { + this.depotHeadID = depotHeadID; + } + + public String getDepotHeadIDs() { + return depotHeadIDs; + } + + public void setDepotHeadIDs(String depotHeadIDs) { + this.depotHeadIDs = depotHeadIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + + public String getBeginTime() { + return BeginTime; + } + + public void setBeginTime(String beginTime) { + BeginTime = beginTime; + } + + public String getEndTime() { + return EndTime; + } + + public void setEndTime(String endTime) { + EndTime = endTime; + } + + public String getOperTime() { + return OperTime; + } + + public void setOperTime(String operTime) { + OperTime = operTime; + } + + public String getMonthTime() { + return MonthTime; + } + + public void setMonthTime(String monthTime) { + MonthTime = monthTime; + } + +} diff --git a/src/com/jsh/model/vo/materials/DepotHeadShowModel.java b/src/com/jsh/model/vo/materials/DepotHeadShowModel.java new file mode 100644 index 00000000..0c7289eb --- /dev/null +++ b/src/com/jsh/model/vo/materials/DepotHeadShowModel.java @@ -0,0 +1,42 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class DepotHeadShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + +} diff --git a/src/com/jsh/model/vo/materials/DepotItemModel.java b/src/com/jsh/model/vo/materials/DepotItemModel.java new file mode 100644 index 00000000..01e9b466 --- /dev/null +++ b/src/com/jsh/model/vo/materials/DepotItemModel.java @@ -0,0 +1,238 @@ +package com.jsh.model.vo.materials; + +import java.io.InputStream; +import java.io.Serializable; + +@SuppressWarnings("serial") +public class DepotItemModel implements Serializable +{ + private DepotItemShowModel showModel = new DepotItemShowModel(); + + /**======开始接受页面参数=================**/ + private Long HeaderId; + private Long MaterialId; + private Double OperNumber; + private Double UnitPrice; + private Double Incidentals; + private String Remark = ""; + private String Img = ""; + + private String Inserted = ""; //json插入记录 + private String Deleted = ""; //json删除记录 + private String Updated = ""; //json修改记录 + + private String HeadIds = ""; //表头集合列表 + private String MaterialIds = ""; //材料列表 + private String MonthTime = ""; //月份 + private String browserType = ""; + /** + * 文件名称 + */ + private String fileName = ""; + /** + * 分类ID + */ + private Long depotItemID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String depotItemIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 800; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + + /** + * 输入流,导出excel文件 + */ + private InputStream excelStream; + + public DepotItemShowModel getShowModel() { + return showModel; + } + + public void setShowModel(DepotItemShowModel showModel) { + this.showModel = showModel; + } + + public Long getHeaderId() { + return HeaderId; + } + + public void setHeaderId(Long headerId) { + HeaderId = headerId; + } + + public Long getMaterialId() { + return MaterialId; + } + + public void setMaterialId(Long materialId) { + MaterialId = materialId; + } + + public Double getOperNumber() { + return OperNumber; + } + + public void setOperNumber(Double operNumber) { + OperNumber = operNumber; + } + + public Double getUnitPrice() { + return UnitPrice; + } + + public void setUnitPrice(Double unitPrice) { + UnitPrice = unitPrice; + } + + public Double getIncidentals() { + return Incidentals; + } + + public void setIncidentals(Double incidentals) { + Incidentals = incidentals; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public String getImg() { + return Img; + } + + public void setImg(String img) { + Img = img; + } + + public Long getDepotItemID() { + return depotItemID; + } + + public void setDepotItemID(Long depotItemID) { + this.depotItemID = depotItemID; + } + + public String getDepotItemIDs() { + return depotItemIDs; + } + + public void setDepotItemIDs(String depotItemIDs) { + this.depotItemIDs = depotItemIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + + public String getInserted() { + return Inserted; + } + + public void setInserted(String inserted) { + Inserted = inserted; + } + + public String getDeleted() { + return Deleted; + } + + public void setDeleted(String deleted) { + Deleted = deleted; + } + + public String getUpdated() { + return Updated; + } + + public void setUpdated(String updated) { + Updated = updated; + } + + public String getHeadIds() { + return HeadIds; + } + + public void setHeadIds(String headIds) { + HeadIds = headIds; + } + + public String getMonthTime() { + return MonthTime; + } + + public void setMonthTime(String monthTime) { + MonthTime = monthTime; + } + + public String getMaterialIds() { + return MaterialIds; + } + + public void setMaterialIds(String materialIds) { + MaterialIds = materialIds; + } + + public String getBrowserType() { + return browserType; + } + + public void setBrowserType(String browserType) { + this.browserType = browserType; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public InputStream getExcelStream() { + return excelStream; + } + + public void setExcelStream(InputStream excelStream) { + this.excelStream = excelStream; + } +} diff --git a/src/com/jsh/model/vo/materials/DepotItemShowModel.java b/src/com/jsh/model/vo/materials/DepotItemShowModel.java new file mode 100644 index 00000000..60826dbd --- /dev/null +++ b/src/com/jsh/model/vo/materials/DepotItemShowModel.java @@ -0,0 +1,22 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class DepotItemShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } +} diff --git a/src/com/jsh/model/vo/materials/MaterialCategoryModel.java b/src/com/jsh/model/vo/materials/MaterialCategoryModel.java new file mode 100644 index 00000000..d63e32d9 --- /dev/null +++ b/src/com/jsh/model/vo/materials/MaterialCategoryModel.java @@ -0,0 +1,123 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class MaterialCategoryModel implements Serializable +{ + private MaterialCategoryShowModel showModel = new MaterialCategoryShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 名称 + */ + private String Name = ""; + + /** + * 等级 + */ + private Short CategoryLevel; + + /** + * ParentId + */ + private Long ParentId; + + /** + * 分类ID + */ + private Long materialCategoryID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String materialCategoryIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + public MaterialCategoryShowModel getShowModel() { + return showModel; + } + + public void setShowModel(MaterialCategoryShowModel showModel) { + this.showModel = showModel; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public Short getCategoryLevel() { + return CategoryLevel; + } + + public void setCategoryLevel(Short categoryLevel) { + CategoryLevel = categoryLevel; + } + + public Long getParentId() { + return ParentId; + } + + public void setParentId(Long parentId) { + ParentId = parentId; + } + + public Long getMaterialCategoryID() { + return materialCategoryID; + } + + public void setMaterialCategoryID(Long materialCategoryID) { + this.materialCategoryID = materialCategoryID; + } + + public String getMaterialCategoryIDs() { + return materialCategoryIDs; + } + + public void setMaterialCategoryIDs(String materialCategoryIDs) { + this.materialCategoryIDs = materialCategoryIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + +} diff --git a/src/com/jsh/model/vo/materials/MaterialCategoryShowModel.java b/src/com/jsh/model/vo/materials/MaterialCategoryShowModel.java new file mode 100644 index 00000000..01b0e6cc --- /dev/null +++ b/src/com/jsh/model/vo/materials/MaterialCategoryShowModel.java @@ -0,0 +1,43 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class MaterialCategoryShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + + +} diff --git a/src/com/jsh/model/vo/materials/MaterialModel.java b/src/com/jsh/model/vo/materials/MaterialModel.java new file mode 100644 index 00000000..d96f6b2c --- /dev/null +++ b/src/com/jsh/model/vo/materials/MaterialModel.java @@ -0,0 +1,175 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class MaterialModel implements Serializable +{ + private MaterialShowModel showModel = new MaterialShowModel(); + + /**======开始接受页面参数=================**/ + /** + * 名称 + */ + private String Name = ""; + + /** + * 型号 + */ + private String Model = ""; + + /** + * 颜色 + */ + private String Color = ""; + + /** + * 单位 + */ + private String Unit = ""; + + /** + * 备注 + */ + private String Remark = ""; + + /** + * CategoryId + */ + private Long CategoryId; + + /** + * CategoryIds 用于in子查询 + */ + private String CategoryIds = "1"; + + /** + * 分类ID + */ + private Long materialID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String materialIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + public MaterialShowModel getShowModel() { + return showModel; + } + + public void setShowModel(MaterialShowModel showModel) { + this.showModel = showModel; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getModel() { + return Model; + } + + public void setModel(String model) { + Model = model; + } + + public String getColor() { + return Color; + } + + public void setColor(String color) { + Color = color; + } + + public String getUnit() { + return Unit; + } + + public void setUnit(String unit) { + Unit = unit; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public Long getCategoryId() { + return CategoryId; + } + + public void setCategoryId(Long categoryId) { + CategoryId = categoryId; + } + + public Long getMaterialID() { + return materialID; + } + + public void setMaterialID(Long materialID) { + this.materialID = materialID; + } + + public String getMaterialIDs() { + return materialIDs; + } + + public void setMaterialIDs(String materialIDs) { + this.materialIDs = materialIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + + public String getCategoryIds() { + return CategoryIds; + } + + public void setCategoryIds(String categoryIds) { + CategoryIds = categoryIds; + } + +} diff --git a/src/com/jsh/model/vo/materials/MaterialShowModel.java b/src/com/jsh/model/vo/materials/MaterialShowModel.java new file mode 100644 index 00000000..bcfcd00e --- /dev/null +++ b/src/com/jsh/model/vo/materials/MaterialShowModel.java @@ -0,0 +1,43 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class MaterialShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + + +} diff --git a/src/com/jsh/model/vo/materials/PersonModel.java b/src/com/jsh/model/vo/materials/PersonModel.java new file mode 100644 index 00000000..251d4e43 --- /dev/null +++ b/src/com/jsh/model/vo/materials/PersonModel.java @@ -0,0 +1,121 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; + +@SuppressWarnings("serial") +public class PersonModel implements Serializable +{ + private PersonShowModel showModel = new PersonShowModel(); + + /**======开始接受页面参数=================**/ + /** + * ProjectId + */ + private Long ProjectId; + /** + * 类型 + */ + private String Type = ""; + /** + * 姓名 + */ + private String Name = ""; + + /** + * 分类ID + */ + private Long personID = 0l; + + /** + * 分类IDs 批量操作使用 + */ + private String personIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; + + public PersonShowModel getShowModel() { + return showModel; + } + + public void setShowModel(PersonShowModel showModel) { + this.showModel = showModel; + } + + public Long getProjectId() { + return ProjectId; + } + + public void setProjectId(Long projectId) { + ProjectId = projectId; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public Long getPersonID() { + return personID; + } + + public void setPersonID(Long personID) { + this.personID = personID; + } + + public String getPersonIDs() { + return personIDs; + } + + public void setPersonIDs(String personIDs) { + this.personIDs = personIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + +} diff --git a/src/com/jsh/model/vo/materials/PersonShowModel.java b/src/com/jsh/model/vo/materials/PersonShowModel.java new file mode 100644 index 00000000..5c638090 --- /dev/null +++ b/src/com/jsh/model/vo/materials/PersonShowModel.java @@ -0,0 +1,42 @@ +package com.jsh.model.vo.materials; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("serial") +public class PersonShowModel implements Serializable +{ + /** + * 提示信息 + */ + private String msgTip = ""; + + /** + * 系统数据 + */ + @SuppressWarnings("rawtypes") + private Map map = new HashMap(); + + public String getMsgTip() + { + return msgTip; + } + + public void setMsgTip(String msgTip) + { + this.msgTip = msgTip; + } + + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + +} diff --git a/src/com/jsh/service/asset/AssetIService.java b/src/com/jsh/service/asset/AssetIService.java new file mode 100644 index 00000000..c0724497 --- /dev/null +++ b/src/com/jsh/service/asset/AssetIService.java @@ -0,0 +1,30 @@ +package com.jsh.service.asset; + +import java.io.File; +import java.io.InputStream; + +import com.jsh.base.BaseIService; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.util.common.PageUtil; + +public interface AssetIService extends BaseIService +{ + /** + * 导出信息 + * @return + */ + InputStream exmportExcel(String isAllPage,PageUtil pageUtil)throws AmsException; + + /** + * 导入资产excel文件--表格格式 同 媒资列表 || 资产名称-资产类型-单价-用户-购买时间-状态-位置-资产编号-序列号-有效日期-保修日期-供应商-标签-描述 + * 业务规则:导入时,检查资产名称是否存在,如存在就不考虑表格中资产类型。如资产名不存在,就新建资产名,类型用表格中的,但类型必须是系统中存在的,不存在的不能导入。 + * 资产名称,用户可以添加,其他的应该不能填 + * + * @param assetFile excel表格文件 + * @param isCheck 是否检查 0--手工确定 1--直接导入数据库中 + * @return 错误的表格数据 + * @throws AmsException + */ + InputStream importExcel(File assetFile,int isCheck)throws AmsException; +} diff --git a/src/com/jsh/service/asset/AssetService.java b/src/com/jsh/service/asset/AssetService.java new file mode 100644 index 00000000..2be7bf25 --- /dev/null +++ b/src/com/jsh/service/asset/AssetService.java @@ -0,0 +1,746 @@ +package com.jsh.service.asset; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.Timestamp; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import jxl.Workbook; +import jxl.format.Colour; +import jxl.write.Label; +import jxl.write.WritableCellFormat; +import jxl.write.WritableSheet; +import jxl.write.WritableWorkbook; +import jxl.write.WriteException; + +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.Row; + +import com.jsh.base.BaseService; +import com.jsh.base.Log; +import com.jsh.constants.asset.AssetConstants; +import com.jsh.dao.asset.AssetIDAO; +import com.jsh.dao.basic.AssetNameIDAO; +import com.jsh.dao.basic.CategoryIDAO; +import com.jsh.dao.basic.SupplierIDAO; +import com.jsh.dao.basic.UserIDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.model.po.Assetname; +import com.jsh.model.po.Category; +import com.jsh.model.po.Supplier; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.Tools; + +public class AssetService extends BaseService implements AssetIService +{ + private AssetIDAO assetDao; + + private AssetNameIDAO assetNameDao; + + private CategoryIDAO categoryDao; + + private SupplierIDAO supplierDao; + + private UserIDAO userDao; + + /** + * 初始化加载所有系统基础数据 + */ + @SuppressWarnings({"rawtypes"}) + private static Map mapData = new HashMap(); + + /** + * 错误的表格数据 + */ + private static List wrongData = new ArrayList(); + + /** + * 导出Excel表格 + */ + @Override + public InputStream exmportExcel(String isAllPage,PageUtil pageUtil)throws AmsException + { + try + { + if("currentPage".equals(isAllPage)) + { + assetDao.find(pageUtil); + } + else + { + pageUtil.setCurPage(0); + pageUtil.setPageSize(0); + assetDao.find(pageUtil); + } + + //将OutputStream转化为InputStream + ByteArrayOutputStream out = new ByteArrayOutputStream(); + putDataOnOutputStream(out,pageUtil.getPageList()); + return new ByteArrayInputStream(out.toByteArray()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e); + throw new AmsException("export asset info to excel exception",e); + } + } + + @Override + public InputStream importExcel(File assetFile,int isCheck) throws AmsException + { + //全局变量--每次调用前需要清空数据 + mapData.clear(); + //1、加载系统基础数据 + loadSystemData(); + //2、解析文件成资产数据 + parseFile(assetFile); + + if(null != wrongData && wrongData.size()>0) + { + //将OutputStream转化为InputStream + ByteArrayOutputStream out = new ByteArrayOutputStream(); + putDataOnOutputStream(out,wrongData); + return new ByteArrayInputStream(out.toByteArray()); + } + else + return null; + //2、是否直接插入数据库中 +// if(0 == isCheck) +// System.out.println("手动检查"); +// else +// System.out.println("自动检查插入"); + } + + /** + * 初始加载系统基础数据--导入过程中,不用频繁查询数据库内容,影响系统性能。 + * @throws AmsException + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + private void loadSystemData()throws AmsException + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try + { + Map condition = pageUtil.getAdvSearch(); + condition.put("id_s_order", "desc"); + categoryDao.find(pageUtil); + mapData.put("categoryList", pageUtil.getPageList()); + + supplierDao.find(pageUtil); + mapData.put("supplierList", pageUtil.getPageList()); + + condition.put("isystem_n_eq", 1); + condition.put("id_s_order", "desc"); + userDao.find(pageUtil); + mapData.put("userList", pageUtil.getPageList()); + + //清除搜索条件 防止对查询有影响 + condition.remove("isystem_n_eq"); + + assetNameDao.find(pageUtil); + mapData.put("assetnameList", pageUtil.getPageList()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); + } + } + + /** + * 解析excel表格 + * @param assetFile + */ + @SuppressWarnings("unchecked") + private void parseFile(File assetFile) + { + //每次调用前清空 + wrongData.clear(); + int totalRow = 0; + try + { + //创建对Excel工作簿文件的引用 + HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(assetFile)); + //创建对工作表的引用,获取第一个工作表的内容 + HSSFSheet sheet = workbook.getSheetAt(0); + /** + * ===================================== + * 1、此处要增加文件的验证,如果不是资产文件需要进行特殊的处理,13列 + * 2、文件内容为空处理 + * 3、如果是修改过的文件内容 + */ + Iterator itsheet = sheet.rowIterator(); + while(itsheet.hasNext()) + { + //获取当前行数据 + Row row = itsheet.next(); + //获取一行有多少单元格 +// System.out.println(row.getLastCellNum()); + + //excel表格第几行数据 从1开始 0 是表头 + int rowNum = row.getRowNum(); + /** + * 表头跳过不读 + */ + if(AssetConstants.BusinessForExcel.EXCEL_TABLE_HEAD == rowNum) + continue; + + //开始处理excel表格内容 --每行数据读取,同时统计总共行数 + totalRow ++; + + //获取excel表格的每格数据内容 + Iterator it = row.cellIterator(); + //资产子类型--添加了一些excel表格数据 + Asset asset = new Asset(); + //保存每个单元格错误类型 + Map cellType = new HashMap(); + + //名称需要类型字段 + Assetname nameModel = null; + //资产名称 + @SuppressWarnings("unused") + String assetname = ""; + + //资产类型 + String categoryStr = ""; + //设置列号 + asset.setRowLineNum(rowNum); + + Cell cell = null; + //判断列号--从零开始 + int cellIndex = 0; + while(it.hasNext()) + { + //获取每个单元格对象 + cell = it.next(); + //获取列号 + cellIndex = cell.getColumnIndex(); + //设置此单元格为字符串类型 + cell.setCellType(Cell.CELL_TYPE_STRING); + + Log.infoFileSync("==================excel表格中第" + totalRow + "行的第 " + cellIndex + "列的值为" + cell.getStringCellValue()); + + //每行中数据顺序 资产名称-资产类型-单价-用户-购买时间-状态-位置-资产编号-序列号-有效日期-保修日期-供应商-标签-描述 + switch(cellIndex) + { + case AssetConstants.BusinessForExcel.EXCEL_ASSETNAME : + //资产名称是否存在 + boolean isAssetnameExist = false; + //此处添加资产名称处理 + String nameValue = cell.getStringCellValue(); + if(null == nameValue || "".equals(nameValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产名称没有填写"); + cellType.put(cellIndex, "wrong"); + break; + } + assetname = nameValue; + + List nameList = mapData.get("assetnameList"); + for(Assetname name:nameList) + { + //表示名称存在--直接进行保存,不需要判断类型字段 + if(nameValue.equals(name.getAssetname())) + { + isAssetnameExist = true; + //直接进行设置 + asset.setAssetname(name); + break; + } + } + //名称不存在 重新创建 + if(!isAssetnameExist) + { + isAssetnameExist = false; + nameModel = new Assetname(); + nameModel.setAssetname(nameValue); + nameModel.setIsconsumables((short)0); + nameModel.setIsystem((short)1); + nameModel.setDescription(""); + + asset.setAssetnameStr(nameValue); + } + break; + case AssetConstants.BusinessForExcel.EXCEL_CATEGORY : + //此处添加资产类型处理 + //类型信息是否存在 + boolean isCategoryExist = false; + String categoryValue = cell.getStringCellValue(); + if((null == categoryValue || "".equals(categoryValue)) && null != nameModel) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产名称没有指定类型"); + cellType.put(cellIndex, "wrong"); + break; + } + categoryStr = categoryValue; + + List categoryList = mapData.get("categoryList"); + for(Category category:categoryList) + { + //表示新创建 --名称设置过 不需要再进行处理 + if(category.getAssetname().equals(categoryValue) && null != nameModel) + { + isCategoryExist = true; + nameModel.setCategory(category); + asset.setAssetname(nameModel); + assetNameDao.create(nameModel); + break; + } + } + //重新创建 + if(null != nameModel && !isCategoryExist) + { + //首先创建类型信息 + Category canew = new Category(); + canew.setAssetname(categoryValue); + canew.setIsystem((short)1); + canew.setDescription(""); + categoryDao.create(canew); + + nameModel.setCategory(canew); + + assetNameDao.create(nameModel); + + asset.setAssetname(nameModel); + } + //nameModel为空表示 已经处理过类型信息 --此处不需要进行处理 + else + { + asset.setCategory(categoryStr); + } + break; + case AssetConstants.BusinessForExcel.EXCEL_PRICE: + //此处添加单价处理 + String priceValue = cell.getStringCellValue(); + //String priceValue = getCellFormatValue(cell); + if(null == priceValue || "".equals(priceValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写单价"); + break; + } + //解析价格 + if(Tools.checkStrIsNum(priceValue)) + asset.setPrice(Double.parseDouble(priceValue)); + else + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>资产价格不是数字格式"); + cellType.put(cellIndex, "wrong"); + asset.setPrice(0.00d); + asset.setPriceStr(priceValue); + } + break; + case AssetConstants.BusinessForExcel.EXCEL_USER : + //此处添加用户处理--用户信息不需要进行处理 + break; + case AssetConstants.BusinessForExcel.EXCEL_PURCHASE_DATE : + //此处添加购买时间处理--时间不需要处理 + String purchaseValue = cell.getStringCellValue(); + if(null == purchaseValue || "".equals(purchaseValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写购买日期"); + break; + } + try + { + asset.setPurchasedate(new Timestamp(Tools.parse(purchaseValue, "yyyy-MM-dd").getTime())); + } + catch (ParseException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>解析购买日期异常", e); + try + { + asset.setPurchasedate(new Timestamp(DateUtil.getJavaDate(Double.parseDouble(purchaseValue)).getTime())); + } + catch (Exception t) + { + asset.setPurchasedateStr(purchaseValue); + cellType.put(cellIndex, "wrong"); + } + } + break; + case AssetConstants.BusinessForExcel.EXCEL_STATUS : + //此处添加状态处理--默认为在库状态 + asset.setStatus((short)0); + break; + case AssetConstants.BusinessForExcel.EXCEL_LOCATION : + //此处添加位置处理--不需要进行处理 + String locationValue = cell.getStringCellValue(); + if(null == locationValue || "".equals(locationValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写位置信息"); + break; + } + asset.setLocation(locationValue); + break; + case AssetConstants.BusinessForExcel.EXCEL_NUM : + //此处添加资产编号处理 + String assetnumValue = cell.getStringCellValue(); + if(null == assetnumValue || "".equals(assetnumValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写资产编号"); + break; + } + //设置资产编号 + asset.setAssetnum(assetnumValue); + break; + case AssetConstants.BusinessForExcel.EXCEL_SERIALNO : + //此处添加序列号处理 + String assetseriValue = cell.getStringCellValue(); + if(null == assetseriValue || "".equals(assetseriValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写序列号"); + break; + } + //设置资产编号 + asset.setSerialnum(assetseriValue); + break; + case AssetConstants.BusinessForExcel.EXCEL_EXPIRATION_DATE : + //此处添加有效日期处理--不需要处理 + String expirationValue = cell.getStringCellValue(); + if(null == expirationValue || "".equals(expirationValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有有效日期"); + break; + } + + try + { + asset.setPeriodofvalidity(new Timestamp(Tools.parse(expirationValue, "yyyy-MM-dd").getTime())); + } + catch (ParseException e) + { + try + { + asset.setPeriodofvalidity(new Timestamp(DateUtil.getJavaDate(Double.parseDouble(expirationValue)).getTime())); + } + catch (Exception t) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>解析有效日期异常", t); + asset.setPeriodofvalidityStr(expirationValue); + cellType.put(cellIndex, "wrong"); + } + } + break; + case AssetConstants.BusinessForExcel.EXCEL_WARRANTY_DATE : + //此处添加保修日期处理--不需要处理 + String warrantyValue = cell.getStringCellValue(); + if(null == warrantyValue || "".equals(warrantyValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有保修日期"); + break; + } + try + { + asset.setWarrantydate(new Timestamp(Tools.parse(warrantyValue, "yyyy-MM-dd").getTime())); + } + catch (ParseException e) + { + try + { + asset.setWarrantydate(new Timestamp(DateUtil.getJavaDate(Double.parseDouble(warrantyValue)).getTime())); + } + catch (Exception t) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>解析保修日期异常", t); + asset.setWarrantydateStr(warrantyValue); + cellType.put(cellIndex, "wrong"); + } + } + break; + case AssetConstants.BusinessForExcel.EXCEL_SUPPLIER : + //此处添加供应商处理 + + String supplierValue = cell.getStringCellValue(); + if(null == supplierValue || "".equals(supplierValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写供应商"); + cellType.put(cellIndex, "wrong"); + break; + } + //供应商 + List supplierList = mapData.get("supplierList"); + boolean isSupplerExist =false; + for(Supplier supplier:supplierList) + { + if(supplierValue.equals(supplier.getSupplier())) + { + isSupplerExist =true; + asset.setSupplier(supplier); + break; + } + } + if(!isSupplerExist) + { + Supplier sup = new Supplier(); + sup.setIsystem((short)1); + sup.setSupplier(supplierValue); + sup.setDescription(""); + supplierDao.create(sup); + //保存供应商信息 + asset.setSupplier(sup); + } + break; + case AssetConstants.BusinessForExcel.EXCEL_LABLE : + //此处添加标签处理 + String lableValue = cell.getStringCellValue(); + if(null == lableValue || "".equals(lableValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写标签信息"); + break; + } + asset.setLabels(lableValue); + break; + case AssetConstants.BusinessForExcel.EXCEL_DESC : + //此处添加描述信息处理 + String descValue = cell.getStringCellValue(); + if(null == descValue || "".equals(descValue)) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写描述信息"); + break; + } + asset.setDescription(descValue); + break; + } + } + asset.setCreatetime(new Timestamp(Calendar.getInstance().getTime().getTime())); + asset.setUpdatetime(new Timestamp(Calendar.getInstance().getTime().getTime())); + asset.setCellInfo(cellType); + + Log.infoFileSync(totalRow + "行总共有" + cellIndex + "列"); + //资产文件为13列,否则不是资产模板文件--不输入的时候 判断会有问题 暂时去掉 +// if(cellIndex != 13) +// { +// Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>导入文件格式不合法,请重新选择文件进行操作!"); +// return; +// } + + //判断完成后增加数据 + if((null!=cellType && cellType.size() >0) + || asset.getAssetname() == null || asset.getAssetname().getCategory() == null) + wrongData.add(asset); + else + { + if(null == asset.getStatus()) + asset.setStatus((short)0); + assetDao.save(asset); + } + } + } + catch (FileNotFoundException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!",e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !",e); + } + Log.infoFileSync("===================excel表格总共有 " + totalRow + " 条记录!"); + } + + /** + * 生成excel表格 + * @param os + */ + private void putDataOnOutputStream(OutputStream os,List dataList) + { + WritableWorkbook workbook = null; + try + { + workbook = Workbook.createWorkbook(os); + WritableSheet sheet = workbook.createSheet("资产详细信息", 0); + //增加列头 + int[] colunmWidth = {30,30,10,15,20,10,30,30,30,20,20,20,30,80}; + String[] colunmName = {"资产名称","资产类型","单价","用户","购买时间","状态","位置","资产编号","序列号","有效日期","保修日期","供应商","标签","描述"}; + for(int i = 0 ;i < colunmWidth.length;i ++) + { + sheet.setColumnView(i,colunmWidth[i]); + sheet.addCell(new Label(i, 0, colunmName[i])); + } + + if (null != dataList &&dataList.size() > 0) + { + int i = 1; + for (Asset asset: dataList) + { + int j = 0; + Map cellInfo = asset.getCellInfo(); + + //第一列,填充 数据, Label(列,行,值) + sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getAssetname() == null ?"":asset.getAssetname().getAssetname(),asset)); + sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getAssetname() == null || asset.getAssetname().getCategory() == null ?"":asset.getAssetname().getCategory().getAssetname(),asset)); + sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getPrice() == null?"":asset.getPrice().toString(),asset)); + sheet.addCell(new Label(j++, i, asset.getUser()==null?"":asset.getUser().getUsername())); + sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getPurchasedate() == null ?"":Tools.getCurrentMonth(asset.getPurchasedate()),asset)); + Short status = asset.getStatus(); + if(null == status) + status = 0 ; + if(AssetConstants.BusinessForExcel.EXCEl_STATUS_ZAIKU == status) + sheet.addCell(new Label(j++, i, "在库")); + else if(AssetConstants.BusinessForExcel.EXCEl_STATUS_INUSE == status) + sheet.addCell(new Label(j++, i, "在用")); + else if(AssetConstants.BusinessForExcel.EXCEl_STATUS_CONSUME == status) + sheet.addCell(new Label(j++, i, "消费")); + sheet.addCell(new Label(j++, i, asset.getLocation())); + sheet.addCell(new Label(j++, i, asset.getAssetnum())); + sheet.addCell(new Label(j++, i, asset.getSerialnum())); + sheet.addCell(getLabelInfo(cellInfo,j++,i, asset.getPeriodofvalidity() == null ?"":Tools.getCurrentMonth(asset.getPeriodofvalidity()),asset)); + sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getWarrantydate() == null ?"":Tools.getCurrentMonth(asset.getWarrantydate()),asset)); + sheet.addCell(new Label(j++, i, asset.getSupplier()==null?"":asset.getSupplier().getSupplier())); + sheet.addCell(new Label(j++, i, asset.getLabels())); + sheet.addCell(new Label(j++, i, asset.getDescription())); + + i++; + } + } + workbook.write(); + workbook.close(); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e); + } + } + + /** + * 根据错误信息进行提示--execel表格背景设置为红色,表示导入信息有误 + * @param cellInfo + * @param cellNum + * @param columnNum + * @param value + * @return + */ + private Label getLabelInfo(Map cellInfo,int cellNum,int columnNum,String value,Asset asset) + { + Label label = null; + + //设置背景颜色 + WritableCellFormat cellFormat = new WritableCellFormat(); + try + { + cellFormat.setBackground(Colour.RED); + } + catch (WriteException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误", e); + } + + if(null == cellInfo || cellInfo.size() == 0) + { + if(cellNum == AssetConstants.BusinessForExcel.EXCEL_ASSETNAME) + { + if(null == asset.getAssetname() && null != asset.getAssetnameStr()) + label = new Label(cellNum, columnNum,asset.getAssetnameStr()); + else if(null != asset.getAssetname()) + label = new Label(cellNum, columnNum, value); + else + label = new Label(cellNum, columnNum, null,cellFormat); + } + else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_CATEGORY) + { + if(null != asset.getAssetnameStr() && null == asset.getAssetname()) + label = new Label(cellNum, columnNum, null,cellFormat); + else if(null == asset.getAssetnameStr() && null == asset.getAssetname() + && asset.getCategory() != null &&asset.getCategory().length()>0) + label = new Label(cellNum, columnNum, asset.getCategory()); + else + label = new Label(cellNum, columnNum, value); + } + else + label = new Label(cellNum, columnNum, value); + } + else + { + //表示此单元格有错误 + if(cellInfo.containsKey(cellNum)) + { + if(cellNum == AssetConstants.BusinessForExcel.EXCEL_ASSETNAME) + { + if(null == asset.getAssetname() && null != asset.getAssetnameStr()) + label = new Label(cellNum, columnNum,asset.getAssetnameStr()); + if(null != asset.getAssetname()) + label = new Label(cellNum, columnNum,asset.getAssetname().getAssetname()); + else + label = new Label(cellNum, columnNum, value,cellFormat); + } + else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_CATEGORY) + { + if(null != asset.getAssetnameStr() && null == asset.getAssetname()) + label = new Label(cellNum, columnNum, null,cellFormat); + else if(null == asset.getAssetnameStr() && null == asset.getAssetname() + && asset.getCategory() != null &&asset.getCategory().length()>0) + label = new Label(cellNum, columnNum, asset.getCategory()); + } + else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_PRICE) + label = new Label(cellNum, columnNum,asset.getPriceStr(),cellFormat); + else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_PURCHASE_DATE) + label = new Label(cellNum, columnNum,asset.getPurchasedateStr(),cellFormat); + else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_WARRANTY_DATE) + label = new Label(cellNum, columnNum,asset.getWarrantydateStr(),cellFormat); + else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_EXPIRATION_DATE) + label = new Label(cellNum, columnNum,asset.getPeriodofvalidityStr(),cellFormat); + else + label = new Label(cellNum, columnNum, value,cellFormat); + } + else + { + if(null == asset.getAssetname() && null != asset.getAssetnameStr()&& cellNum == 0) + label = new Label(cellNum, columnNum,asset.getAssetnameStr()); + else if(null == asset.getAssetnameStr() && null == asset.getAssetname() + && asset.getCategory() != null &&asset.getCategory().length()>0&& cellNum == 1) + label = new Label(cellNum, columnNum, asset.getCategory()); + else + label = new Label(cellNum, columnNum, value); + } + } + return label; + } + + /*=====================以下处理与业务无关的共用方法=================================*/ + public void setAssetDao(AssetIDAO assetDao) + { + this.assetDao = assetDao; + } + + public void setAssetNameDao(AssetNameIDAO assetNameDao) + { + this.assetNameDao = assetNameDao; + } + + public void setCategoryDao(CategoryIDAO categoryDao) + { + this.categoryDao = categoryDao; + } + + public void setSupplierDao(SupplierIDAO supplierDao) + { + this.supplierDao = supplierDao; + } + + public void setUserDao(UserIDAO userDao) + { + this.userDao = userDao; + } + + @Override + protected Class getEntityClass() + { + return Asset.class; + } +} diff --git a/src/com/jsh/service/asset/ReportIService.java b/src/com/jsh/service/asset/ReportIService.java new file mode 100644 index 00000000..a62e5705 --- /dev/null +++ b/src/com/jsh/service/asset/ReportIService.java @@ -0,0 +1,15 @@ +package com.jsh.service.asset; + +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.util.common.PageUtil; + +public interface ReportIService +{ + /** + * 查找报表数据 + * @param asset + * @throws AmsException + */ + void find(PageUtil asset,String reportType,String reportName)throws AmsException; +} diff --git a/src/com/jsh/service/asset/ReportService.java b/src/com/jsh/service/asset/ReportService.java new file mode 100644 index 00000000..a8a01a55 --- /dev/null +++ b/src/com/jsh/service/asset/ReportService.java @@ -0,0 +1,23 @@ +package com.jsh.service.asset; + +import com.jsh.dao.asset.ReportIDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.util.common.PageUtil; + +public class ReportService implements ReportIService +{ + private ReportIDAO reportDao; + + public void setReportDao(ReportIDAO reportDao) + { + this.reportDao = reportDao; + } + + @Override + public void find(PageUtil pageUtil, String reportType,String reportName) throws AmsException + { + reportDao.find(pageUtil, reportType,reportName); + } + +} diff --git a/src/com/jsh/service/basic/AppIService.java b/src/com/jsh/service/basic/AppIService.java new file mode 100644 index 00000000..84810fb6 --- /dev/null +++ b/src/com/jsh/service/basic/AppIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.App; + +public interface AppIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/basic/AppService.java b/src/com/jsh/service/basic/AppService.java new file mode 100644 index 00000000..dbb05645 --- /dev/null +++ b/src/com/jsh/service/basic/AppService.java @@ -0,0 +1,31 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.dao.basic.AppIDAO; +import com.jsh.dao.basic.UserBusinessIDAO; +import com.jsh.model.po.App; + +public class AppService extends BaseService implements AppIService +{ + @SuppressWarnings("unused") + private AppIDAO appDao; + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; + + + public void setAppDao(AppIDAO appDao) + { + this.appDao = appDao; + } + + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; + } + + @Override + protected Class getEntityClass() + { + return App.class; + } + +} diff --git a/src/com/jsh/service/basic/AssetNameIService.java b/src/com/jsh/service/basic/AssetNameIService.java new file mode 100644 index 00000000..35d4a5cd --- /dev/null +++ b/src/com/jsh/service/basic/AssetNameIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.Assetname; + +public interface AssetNameIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/basic/AssetNameService.java b/src/com/jsh/service/basic/AssetNameService.java new file mode 100644 index 00000000..ee12b168 --- /dev/null +++ b/src/com/jsh/service/basic/AssetNameService.java @@ -0,0 +1,22 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.dao.basic.AssetNameIDAO; +import com.jsh.model.po.Assetname; + +public class AssetNameService extends BaseService implements AssetNameIService +{ + @SuppressWarnings("unused") + private AssetNameIDAO assetNameDao; + + public void setAssetNameDao(AssetNameIDAO assetNameDao) + { + this.assetNameDao = assetNameDao; + } + + @Override + protected Class getEntityClass() + { + return Assetname.class; + } +} diff --git a/src/com/jsh/service/basic/CategoryIService.java b/src/com/jsh/service/basic/CategoryIService.java new file mode 100644 index 00000000..209832f4 --- /dev/null +++ b/src/com/jsh/service/basic/CategoryIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.Category; + +public interface CategoryIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/basic/CategoryService.java b/src/com/jsh/service/basic/CategoryService.java new file mode 100644 index 00000000..490b3efb --- /dev/null +++ b/src/com/jsh/service/basic/CategoryService.java @@ -0,0 +1,23 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.dao.basic.CategoryIDAO; +import com.jsh.model.po.Category; + +public class CategoryService extends BaseService implements CategoryIService +{ + @SuppressWarnings("unused") + private CategoryIDAO categoryDao; + + public void setCategoryDao(CategoryIDAO categoryDao) + { + this.categoryDao = categoryDao; + } + + @Override + protected Class getEntityClass() + { + return Category.class; + } + +} diff --git a/src/com/jsh/service/basic/DepotIService.java b/src/com/jsh/service/basic/DepotIService.java new file mode 100644 index 00000000..30489e1f --- /dev/null +++ b/src/com/jsh/service/basic/DepotIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.Depot; + +public interface DepotIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/basic/DepotService.java b/src/com/jsh/service/basic/DepotService.java new file mode 100644 index 00000000..7da7f5b8 --- /dev/null +++ b/src/com/jsh/service/basic/DepotService.java @@ -0,0 +1,32 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.dao.basic.DepotIDAO; +import com.jsh.dao.basic.UserBusinessIDAO; +import com.jsh.model.po.Depot; + +public class DepotService extends BaseService implements DepotIService +{ + @SuppressWarnings("unused") + private DepotIDAO depotDao; + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; + + + public void setDepotDao(DepotIDAO depotDao) + { + this.depotDao = depotDao; + } + + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; + } + + + @Override + protected Class getEntityClass() + { + return Depot.class; + } + +} diff --git a/src/com/jsh/service/basic/FunctionsIService.java b/src/com/jsh/service/basic/FunctionsIService.java new file mode 100644 index 00000000..3fb4c71b --- /dev/null +++ b/src/com/jsh/service/basic/FunctionsIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.Functions; + +public interface FunctionsIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/basic/FunctionsService.java b/src/com/jsh/service/basic/FunctionsService.java new file mode 100644 index 00000000..77567986 --- /dev/null +++ b/src/com/jsh/service/basic/FunctionsService.java @@ -0,0 +1,31 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.dao.basic.FunctionsIDAO; +import com.jsh.dao.basic.UserBusinessIDAO; +import com.jsh.model.po.Functions; + +public class FunctionsService extends BaseService implements FunctionsIService +{ + @SuppressWarnings("unused") + private FunctionsIDAO functionsDao; + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; + + + public void setFunctionsDao(FunctionsIDAO functionsDao) + { + this.functionsDao = functionsDao; + } + + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; + } + + @Override + protected Class getEntityClass() + { + return Functions.class; + } + +} diff --git a/src/com/jsh/service/basic/LogIService.java b/src/com/jsh/service/basic/LogIService.java new file mode 100644 index 00000000..b9effc18 --- /dev/null +++ b/src/com/jsh/service/basic/LogIService.java @@ -0,0 +1,16 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Logdetails; + +public interface LogIService extends BaseIService +{ + /** + * 增加 + * @param t 对象 + * @throws AmsException + */ + @Override + void save(Logdetails t); +} diff --git a/src/com/jsh/service/basic/LogService.java b/src/com/jsh/service/basic/LogService.java new file mode 100644 index 00000000..b0185c0e --- /dev/null +++ b/src/com/jsh/service/basic/LogService.java @@ -0,0 +1,36 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.base.Log; +import com.jsh.dao.basic.LogIDAO; +import com.jsh.model.po.Logdetails; + +public class LogService extends BaseService implements LogIService +{ + @SuppressWarnings("unused") + private LogIDAO logDao; + + public void setLogDao(LogIDAO logDao) + { + this.logDao = logDao; + } + + @Override + protected Class getEntityClass() + { + return Logdetails.class; + } + + @Override + public void save(Logdetails t) + { + try + { + super.save(t); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>创建操作日志异常", e); + } + } +} \ No newline at end of file diff --git a/src/com/jsh/service/basic/RoleIService.java b/src/com/jsh/service/basic/RoleIService.java new file mode 100644 index 00000000..6ee433ee --- /dev/null +++ b/src/com/jsh/service/basic/RoleIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.Role; + +public interface RoleIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/basic/RoleService.java b/src/com/jsh/service/basic/RoleService.java new file mode 100644 index 00000000..74b3b2b3 --- /dev/null +++ b/src/com/jsh/service/basic/RoleService.java @@ -0,0 +1,30 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.dao.basic.RoleIDAO; +import com.jsh.dao.basic.UserBusinessIDAO; +import com.jsh.model.po.Role; + +public class RoleService extends BaseService implements RoleIService +{ + @SuppressWarnings("unused") + private RoleIDAO roleDao; + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; + + public void setRoleDao(RoleIDAO roleDao) + { + this.roleDao = roleDao; + } + + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; + } + + @Override + protected Class getEntityClass() + { + return Role.class; + } + +} diff --git a/src/com/jsh/service/basic/SupplierIService.java b/src/com/jsh/service/basic/SupplierIService.java new file mode 100644 index 00000000..bf81a37f --- /dev/null +++ b/src/com/jsh/service/basic/SupplierIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.Supplier; + +public interface SupplierIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/basic/SupplierService.java b/src/com/jsh/service/basic/SupplierService.java new file mode 100644 index 00000000..96650a26 --- /dev/null +++ b/src/com/jsh/service/basic/SupplierService.java @@ -0,0 +1,25 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.dao.basic.SupplierIDAO; +import com.jsh.model.po.Supplier; + +public class SupplierService extends BaseService implements SupplierIService +{ + @SuppressWarnings("unused") + private SupplierIDAO supplierDao; + + public void setSupplierDao(SupplierIDAO supplierDao) + { + this.supplierDao = supplierDao; + } + /** + * 设置映射基类 + * @return + */ + @Override + protected Class getEntityClass() + { + return Supplier.class; + } +} diff --git a/src/com/jsh/service/basic/UserBusinessIService.java b/src/com/jsh/service/basic/UserBusinessIService.java new file mode 100644 index 00000000..8935951c --- /dev/null +++ b/src/com/jsh/service/basic/UserBusinessIService.java @@ -0,0 +1,15 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.exception.AmsException; +import com.jsh.model.po.UserBusiness; +import com.jsh.util.common.PageUtil; + +public interface UserBusinessIService extends BaseIService +{ + /* + * 测试一下自定义hql语句 + */ + void find(PageUtil userBusiness,String ceshi)throws AmsException; + +} diff --git a/src/com/jsh/service/basic/UserBusinessService.java b/src/com/jsh/service/basic/UserBusinessService.java new file mode 100644 index 00000000..6d7ada92 --- /dev/null +++ b/src/com/jsh/service/basic/UserBusinessService.java @@ -0,0 +1,32 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.dao.basic.UserBusinessIDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.UserBusiness; +import com.jsh.util.common.PageUtil; + +public class UserBusinessService extends BaseService implements UserBusinessIService +{ + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; + + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) + { + this.userBusinessDao = userBusinessDao; + } + + @Override + protected Class getEntityClass() + { + return UserBusiness.class; + } + + @Override + public void find(PageUtil pageUtil, String ceshi) throws AmsException + { + userBusinessDao.find(pageUtil, ceshi); + } + + +} diff --git a/src/com/jsh/service/basic/UserIService.java b/src/com/jsh/service/basic/UserIService.java new file mode 100644 index 00000000..34b59de9 --- /dev/null +++ b/src/com/jsh/service/basic/UserIService.java @@ -0,0 +1,33 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Basicuser; + +public interface UserIService extends BaseIService +{ + /** + * 判断用户名是否符合登录条件 + * @param username 用户名 String password + * @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常 + */ + int validateUser(String username,String password)throws AmsException; + + /** + * 获取用户信息 + * @param username + * @return 用户信息 + * @throws AmsException + */ + public Basicuser getUser(String username) throws AmsException; + + /** + * 检查用户名称是否存在 + * @param field 用户属性 + * @param username 用户名称 + * @param userID 供应商ID + * @return true==存在重名 false==不存在 + * @throws AmsException + */ + Boolean checkIsNameExist(String field,String username,Long userID)throws AmsException; +} diff --git a/src/com/jsh/service/basic/UserService.java b/src/com/jsh/service/basic/UserService.java new file mode 100644 index 00000000..eabe5788 --- /dev/null +++ b/src/com/jsh/service/basic/UserService.java @@ -0,0 +1,114 @@ +package com.jsh.service.basic; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.jsh.base.BaseService; +import com.jsh.base.Log; +import com.jsh.constants.common.ExceptionCodeConstants; +import com.jsh.dao.basic.UserBusinessIDAO; +import com.jsh.dao.basic.UserIDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Basicuser; +import com.jsh.util.common.PageUtil; + +public class UserService extends BaseService implements UserIService +{ + private PageUtil pageUtil = new PageUtil(); + private Map condition = new HashMap(); + private UserIDAO userDao; + + @Override + public int validateUser(String username, String password)throws AmsException + { + try + { + //全局变量 每次使用前清除 + condition.clear(); + + /**默认是可以登录的*/ + List list = null ; + try + { + + condition.put("loginame_s_eq", username); + pageUtil.setAdvSearch(condition); + userDao.find(pageUtil); + list = pageUtil.getPageList(); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>访问验证用户姓名是否存在后台信息异常",e); + return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; + } + + if(null !=list && list.size() == 0) + return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST ; + + try + { + condition.put("loginame_s_eq", username); + condition.put("password_s_eq", password); + pageUtil.setAdvSearch(condition); + userDao.find(pageUtil); + list = pageUtil.getPageList(); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>访问验证用户密码后台信息异常",e); + return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; + } + + if(null !=list && list.size() == 0) + return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR; + return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT; + } + catch (Exception e) + { + throw new AmsException("unknown exception",e); + } + } + + @Override + public Basicuser getUser(String username) throws AmsException + { + //全局变量 每次使用前清除 + condition.clear(); + condition.put("loginame_s_eq", username); + pageUtil.setAdvSearch(condition); + userDao.find(pageUtil); + List list = pageUtil.getPageList(); + if(null != list && list.size() >0) + return list.get(0); + else + throw new AmsException("no username exist"); + } + + @Override + public Boolean checkIsNameExist(String field,String username, Long userID)throws AmsException + { + condition.clear(); + condition.put(field + "_s_eq", username); + condition.put("id_n_neq", userID); + pageUtil.setAdvSearch(condition); + userDao.find(pageUtil); + + List dataList = pageUtil.getPageList(); + if(null != dataList && dataList.size() > 0) + return true; + return false; + } + + //==============spring注入等公共方法,与业务无关========================= + public void setUserDao(UserIDAO userDao) + { + this.userDao = userDao; + } + + @Override + protected Class getEntityClass() + { + return Basicuser.class; + } +} diff --git a/src/com/jsh/service/basic/VisitAccountIService.java b/src/com/jsh/service/basic/VisitAccountIService.java new file mode 100644 index 00000000..bb7a0908 --- /dev/null +++ b/src/com/jsh/service/basic/VisitAccountIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.VisitAccount; + +public interface VisitAccountIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/basic/VisitAccountService.java b/src/com/jsh/service/basic/VisitAccountService.java new file mode 100644 index 00000000..510dc9a5 --- /dev/null +++ b/src/com/jsh/service/basic/VisitAccountService.java @@ -0,0 +1,24 @@ +package com.jsh.service.basic; + +import com.jsh.base.BaseService; +import com.jsh.dao.basic.VisitAccountIDAO; +import com.jsh.model.po.VisitAccount; + +public class VisitAccountService extends BaseService implements VisitAccountIService +{ + @SuppressWarnings("unused") + private VisitAccountIDAO visitAccountDao; + + + public void setVisitAccountDao(VisitAccountIDAO visitAccountDao) { + this.visitAccountDao = visitAccountDao; + } + + + @Override + protected Class getEntityClass() + { + return VisitAccount.class; + } + +} diff --git a/src/com/jsh/service/materials/BuildingIService.java b/src/com/jsh/service/materials/BuildingIService.java new file mode 100644 index 00000000..746fa52d --- /dev/null +++ b/src/com/jsh/service/materials/BuildingIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.Building; + +public interface BuildingIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/materials/BuildingService.java b/src/com/jsh/service/materials/BuildingService.java new file mode 100644 index 00000000..acc1058b --- /dev/null +++ b/src/com/jsh/service/materials/BuildingService.java @@ -0,0 +1,24 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseService; +import com.jsh.dao.materials.BuildingIDAO; +import com.jsh.model.po.Building; + +public class BuildingService extends BaseService implements BuildingIService +{ + @SuppressWarnings("unused") + private BuildingIDAO buildingDao; + + + public void setBuildingDao(BuildingIDAO buildingDao) { + this.buildingDao = buildingDao; + } + + + @Override + protected Class getEntityClass() + { + return Building.class; + } + +} diff --git a/src/com/jsh/service/materials/DepotHeadIService.java b/src/com/jsh/service/materials/DepotHeadIService.java new file mode 100644 index 00000000..b80d4c39 --- /dev/null +++ b/src/com/jsh/service/materials/DepotHeadIService.java @@ -0,0 +1,15 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseIService; +import com.jsh.exception.AmsException; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.UserBusiness; +import com.jsh.util.common.PageUtil; + +public interface DepotHeadIService extends BaseIService +{ + /* + * 获取MaxId + */ + void find(PageUtil depotHead,String maxid)throws AmsException; +} diff --git a/src/com/jsh/service/materials/DepotHeadService.java b/src/com/jsh/service/materials/DepotHeadService.java new file mode 100644 index 00000000..3bdd15ab --- /dev/null +++ b/src/com/jsh/service/materials/DepotHeadService.java @@ -0,0 +1,32 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseService; +import com.jsh.dao.materials.DepotHeadIDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.UserBusiness; +import com.jsh.util.common.PageUtil; + +public class DepotHeadService extends BaseService implements DepotHeadIService +{ + @SuppressWarnings("unused") + private DepotHeadIDAO depotHeadDao; + + + public void setDepotHeadDao(DepotHeadIDAO depotHeadDao) { + this.depotHeadDao = depotHeadDao; + } + + + @Override + protected Class getEntityClass() + { + return DepotHead.class; + } + + @Override + public void find(PageUtil pageUtil, String maxid) throws AmsException + { + depotHeadDao.find(pageUtil, maxid); + } +} diff --git a/src/com/jsh/service/materials/DepotItemIService.java b/src/com/jsh/service/materials/DepotItemIService.java new file mode 100644 index 00000000..dcf591e4 --- /dev/null +++ b/src/com/jsh/service/materials/DepotItemIService.java @@ -0,0 +1,26 @@ +package com.jsh.service.materials; + +import java.io.InputStream; +import java.util.List; + +import net.sf.json.JSONArray; + +import com.jsh.base.BaseIService; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.DepotItem; +import com.jsh.util.common.PageUtil; + +public interface DepotItemIService extends BaseIService +{ + void findByType(PageUtil depotItem, String type, Long MId, String MonthTime,Boolean isPrev)throws AmsException; + + void findOrderByMaterial(PageUtil depotItem)throws AmsException; + + /** + * 导出信息 + * @return + */ + InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws AmsException; +} diff --git a/src/com/jsh/service/materials/DepotItemService.java b/src/com/jsh/service/materials/DepotItemService.java new file mode 100644 index 00000000..b89fec38 --- /dev/null +++ b/src/com/jsh/service/materials/DepotItemService.java @@ -0,0 +1,124 @@ +package com.jsh.service.materials; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.DecimalFormat; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import jxl.Workbook; +import jxl.write.Label; +import jxl.write.WritableSheet; +import jxl.write.WritableWorkbook; + +import com.jsh.base.BaseService; +import com.jsh.base.Log; +import com.jsh.constants.asset.AssetConstants; +import com.jsh.dao.materials.DepotItemIDAO; +import com.jsh.exception.AmsException; +import com.jsh.model.po.Asset; +import com.jsh.model.po.DepotHead; +import com.jsh.model.po.DepotItem; +import com.jsh.util.common.PageUtil; +import com.jsh.util.common.Tools; + +public class DepotItemService extends BaseService implements DepotItemIService +{ + @SuppressWarnings("unused") + private DepotItemIDAO depotItemDao; + + + public void setDepotItemDao(DepotItemIDAO depotItemDao) { + this.depotItemDao = depotItemDao; + } + + + @Override + protected Class getEntityClass() + { + return DepotItem.class; + } + + @Override + public void findByType(PageUtil pageUtil, String type,Long MId, String MonthTime,Boolean isPrev) throws AmsException + { + depotItemDao.findByType(pageUtil, type, MId, MonthTime,isPrev); + } + + @Override + public void findOrderByMaterial(PageUtil pageUtil) throws AmsException + { + depotItemDao.findOrderByMaterial(pageUtil); + } + + /** + * 导出Excel表格 + */ + @Override + public InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws AmsException + { + try + { + //将OutputStream转化为InputStream + ByteArrayOutputStream out = new ByteArrayOutputStream(); + putDataOnOutputStream(out,dataArray); + return new ByteArrayInputStream(out.toByteArray()); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e); + throw new AmsException("export asset info to excel exception",e); + } + } + + /** + * 生成excel表格 + * @param os + */ + @SuppressWarnings("deprecation") + private void putDataOnOutputStream(OutputStream os,JSONArray dataArray) + { + WritableWorkbook workbook = null; + try + { + workbook = Workbook.createWorkbook(os); + WritableSheet sheet = workbook.createSheet("进销存报表", 0); + //增加列头 + int[] colunmWidth = {10,10,10,10,15,15,15,15,15}; + String[] colunmName = {"名称","款号","颜色","单价","上月结存数量","入库数量","出库数量","本月结存数量","结存金额"}; + for(int i = 0 ;i < colunmWidth.length;i ++) + { + sheet.setColumnView(i,colunmWidth[i]); + sheet.addCell(new Label(i, 0, colunmName[i])); + } + if (null != dataArray &&dataArray.size() > 0) + { + for(int j=0; j < dataArray.size(); j++){ + JSONObject jo = JSONObject.fromObject(dataArray.get(j)); + sheet.addCell(new Label(0, j+1, jo.getString("MaterialName"))); + sheet.addCell(new Label(1, j+1, jo.getString("MaterialModel"))); + sheet.addCell(new Label(2, j+1, jo.getString("MaterialColor"))); + sheet.addCell(new Label(3, j+1, jo.getString("UnitPrice"))); + sheet.addCell(new Label(4, j+1, jo.getString("prevSum"))); + sheet.addCell(new Label(5, j+1, jo.getString("InSum"))); + sheet.addCell(new Label(6, j+1, jo.getString("OutSum"))); + sheet.addCell(new Label(7, j+1, jo.getString("thisSum"))); + double d = Double.parseDouble(jo.getString("thisAllPrice").toString()); + String s1 = String.format("%.2f", d); + sheet.addCell(new Label(8, j+1, s1)); + } + } + workbook.write(); + workbook.close(); + } + catch (Exception e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e); + } + } +} diff --git a/src/com/jsh/service/materials/MaterialCategoryIService.java b/src/com/jsh/service/materials/MaterialCategoryIService.java new file mode 100644 index 00000000..f5bbbbfa --- /dev/null +++ b/src/com/jsh/service/materials/MaterialCategoryIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.MaterialCategory; + +public interface MaterialCategoryIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/materials/MaterialCategoryService.java b/src/com/jsh/service/materials/MaterialCategoryService.java new file mode 100644 index 00000000..00805889 --- /dev/null +++ b/src/com/jsh/service/materials/MaterialCategoryService.java @@ -0,0 +1,24 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseService; +import com.jsh.dao.materials.MaterialCategoryIDAO; +import com.jsh.model.po.MaterialCategory; + +public class MaterialCategoryService extends BaseService implements MaterialCategoryIService +{ + @SuppressWarnings("unused") + private MaterialCategoryIDAO materialCategoryDao; + + + public void setMaterialCategoryDao(MaterialCategoryIDAO materialCategoryDao) { + this.materialCategoryDao = materialCategoryDao; + } + + + @Override + protected Class getEntityClass() + { + return MaterialCategory.class; + } + +} diff --git a/src/com/jsh/service/materials/MaterialIService.java b/src/com/jsh/service/materials/MaterialIService.java new file mode 100644 index 00000000..47802496 --- /dev/null +++ b/src/com/jsh/service/materials/MaterialIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.Material; + +public interface MaterialIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/materials/MaterialService.java b/src/com/jsh/service/materials/MaterialService.java new file mode 100644 index 00000000..a4d3921a --- /dev/null +++ b/src/com/jsh/service/materials/MaterialService.java @@ -0,0 +1,24 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseService; +import com.jsh.dao.materials.MaterialIDAO; +import com.jsh.model.po.Material; + +public class MaterialService extends BaseService implements MaterialIService +{ + @SuppressWarnings("unused") + private MaterialIDAO materialDao; + + + public void setMaterialDao(MaterialIDAO materialDao) { + this.materialDao = materialDao; + } + + + @Override + protected Class getEntityClass() + { + return Material.class; + } + +} diff --git a/src/com/jsh/service/materials/PersonIService.java b/src/com/jsh/service/materials/PersonIService.java new file mode 100644 index 00000000..8f49cd9b --- /dev/null +++ b/src/com/jsh/service/materials/PersonIService.java @@ -0,0 +1,9 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseIService; +import com.jsh.model.po.Person; + +public interface PersonIService extends BaseIService +{ + +} diff --git a/src/com/jsh/service/materials/PersonService.java b/src/com/jsh/service/materials/PersonService.java new file mode 100644 index 00000000..47563a23 --- /dev/null +++ b/src/com/jsh/service/materials/PersonService.java @@ -0,0 +1,24 @@ +package com.jsh.service.materials; + +import com.jsh.base.BaseService; +import com.jsh.dao.materials.PersonIDAO; +import com.jsh.model.po.Person; + +public class PersonService extends BaseService implements PersonIService +{ + @SuppressWarnings("unused") + private PersonIDAO personDao; + + + public void setPersonDao(PersonIDAO personDao) { + this.personDao = personDao; + } + + + @Override + protected Class getEntityClass() + { + return Person.class; + } + +} diff --git a/src/com/jsh/util/common/BeanFactoryUtil.java b/src/com/jsh/util/common/BeanFactoryUtil.java new file mode 100644 index 00000000..5d5a3171 --- /dev/null +++ b/src/com/jsh/util/common/BeanFactoryUtil.java @@ -0,0 +1,135 @@ +/** + * 项 目 名:HiTV + * 包 名:com.suma.hitv.utils + * 文 件 名:BeanFactoryUtil.java + * 版本信息:V1.0 + * 日 期:2011-12-30-下午01:25:00 + * Copyright (c) 2000-2011北京数码视讯有限公司版权所有 + * + */ +package com.jsh.util.common; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; + +/** + * 获取spring配置中的bean对象,是单例,只会加载一次,请注意使用 + * 注意:此工具类默认处理UI组件WEB-INF目录下的applicationContext.xml配置文件,请注意文件 名和路径 + * @author andy + * @version V1.0 + */ +public class BeanFactoryUtil +{ + private static BeanFactoryUtil defaultBeanFactory; + + private ApplicationContext defaultAC = null; + + //private ApplicationContext autoLoadAC = null; + + private static BeanFactoryUtil specialBeanFactory; + + private ApplicationContext specialAC = null; + + private static Map beanMap = new HashMap(); + + //private Logger log = Logger.getLogger(BeanFactoryUtil.class); + + /** + * 私有构造函数,默认为UI组件WEB-INF目录下的applicationContext.xml配置文件 + */ + private BeanFactoryUtil() + { + String fileUrl = PathTool.getWebinfPath(); + //这里只对UI组件WEB-INF目录下的applicationContext.xml配置文件 + defaultAC = new FileSystemXmlApplicationContext( new + String[]{fileUrl + + "spring/basic-applicationContext.xml", + fileUrl + "spring/dao-applicationContext.xml"}); + } + + /** + * 私有构造函数,带有文件的classpath路径,可能是非applicationContext.xml文件 + */ + private BeanFactoryUtil(String fileClassPath) + { + specialAC = new ClassPathXmlApplicationContext("classpath:" + + fileClassPath); + } + + /** + * 非web.xml方式加载spring配置文件方式的实体实例获取方式 + * @param fileClassPath + * @param beanName + * @return + */ + public synchronized static Object getBeanByClassPathAndBeanName( + String fileClassPath, String beanName) + { + ApplicationContext ac = beanMap.get(fileClassPath); + if (null == ac) + { + ac = new ClassPathXmlApplicationContext("classpath:" + + fileClassPath); + beanMap.put(fileClassPath, ac); + } + return ac.getBean(beanName); + } + + /** + * 获取类实例 + * 默认加载UI组件WEB-INF目录下的applicationContext.xml配置文件 + * @return + * + */ + public synchronized static BeanFactoryUtil getInstance() + { + if (null == defaultBeanFactory) + { + defaultBeanFactory = new BeanFactoryUtil(); + } + return defaultBeanFactory; + } + + /** + * 获取类实例,这种情况一定是在依赖其他组件时没有在applicationContext.xml加载器spring文件时使用 + * 这种情况请少用 + * @param fileClassPath + * @return + */ + @Deprecated + public synchronized static BeanFactoryUtil getInstance(String fileClassPath) + { + if (null == specialBeanFactory) + { + specialBeanFactory = new BeanFactoryUtil(fileClassPath); + } + return specialBeanFactory; + } + + /** + * 获取UI组件WEB-INF目录下的applicationContext.xml配置文件中配置的bean实例 + * @param beanName + * @return + */ + public Object getBean(String beanName) + { + return defaultAC.getBean(beanName); + } + + /** + * 获取没有在applicationContext.xml配置文件中引入的spring配置文件,即没有用容器加载过的配置文件 + * 这里为特殊情况下使用,不推荐使用 + * 推荐在applicationContext.xml配置文件中引入需要使用的spring配置文件,然后使用BeanFactoryUtil.getInstance().getBean("")方法 + * @param beanName + * @return + */ + @Deprecated + public Object getSpecialBean(String beanName) + { + return specialAC.getBean(beanName); + } +} diff --git a/src/com/jsh/util/common/PageUtil.java b/src/com/jsh/util/common/PageUtil.java new file mode 100644 index 00000000..e9596e06 --- /dev/null +++ b/src/com/jsh/util/common/PageUtil.java @@ -0,0 +1,198 @@ +package com.jsh.util.common; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +/** + * 分页工具类,实现分页功能 + * @author andy + * @version [版本号version01, 2012-1-25] + */ +@SuppressWarnings("serial") +public class PageUtil implements Serializable +{ + /** + * 总页数,根据总数和单页显示个数进行计算 + */ + private int totalPage = 0; + + /** + * 总个数 + */ + private int totalCount = 0 ; + + /** + * 当前页码 + */ + private int curPage = 1; + + /** + * 每页显示个数 + */ + private int pageSize = 10; + + /** + * 是否为第一页 + */ + private boolean isFirstPage = false; + /** + * 是否是最后一页 + */ + private boolean isLastPage = false; + + /** + * 是否有上一页 + */ + private boolean hasPrevious = false; + + /** + * 是否有下一页 + */ + private boolean hasNext = false; + + /** + * 返回页面list数组 + */ + private List pageList = new ArrayList(); + + /** + * 页面搜索条件,用map来实现 + */ + private Map advSearch = new Hashtable(); + + public PageUtil() + { + + } + + public PageUtil(int totalCount,int pageSize,int curPage,Map adv) + { + init(totalCount,pageSize,curPage,adv); + } + /** + * 初始化页面显示参数 + * @param totalCount 总数 + * @param pageSize 页面显示个数 + * @param curPage 当前页面 + */ + public void init(int totalCount,int pageSize,int curPage,Map adv) + { + this.totalCount = totalCount; + this.pageSize = pageSize ; + this.curPage = curPage; + this.advSearch = adv; + //计算总页数 + if(pageSize != 0) + { + this.totalPage = (totalCount+pageSize-1)/pageSize; + } + if(curPage <1) + { + this.curPage = 1; + } + if(curPage>this.totalPage) + { + this.curPage = this.totalPage; + } + if(curPage>0&&this.totalPage!=1&&curPage0&&this.totalPage!=1&&curPage>1&&curPage<=this.totalPage) + { + this.hasPrevious = true; + } + if(curPage == 1) + { + this.isFirstPage = true ; + } + if(curPage == this.totalPage) + { + this.isLastPage = true; + } + } + public int getTotalPage() + { + return totalPage; + } + public void setTotalPage(int totalPage) + { + this.totalPage = totalPage; + } + public int getTotalCount() + { + return totalCount; + } + public void setTotalCount(int totalCount) + { + this.totalCount = totalCount; + } + public int getCurPage() + { + return curPage; + } + public void setCurPage(int curPage) + { + this.curPage = curPage; + } + public int getPageSize() + { + return pageSize; + } + public void setPageSize(int pageSize) + { + this.pageSize = pageSize; + } + public boolean isFirstPage() + { + return isFirstPage; + } + public void setFirstPage(boolean isFirstPage) + { + this.isFirstPage = isFirstPage; + } + public boolean isLastPage() + { + return isLastPage; + } + public void setLastPage(boolean isLastPage) + { + this.isLastPage = isLastPage; + } + public boolean isHasPrevious() + { + return hasPrevious; + } + public void setHasPrevious(boolean hasPrevious) + { + this.hasPrevious = hasPrevious; + } + public boolean isHasNext() + { + return hasNext; + } + public void setHasNext(boolean hasNext) + { + this.hasNext = hasNext; + } + + public List getPageList() + { + return pageList; + } + public void setPageList(List pageList) + { + this.pageList = pageList; + } + + public Map getAdvSearch() + { + return advSearch; + } + public void setAdvSearch(Map advSearch) + { + this.advSearch = advSearch; + } +} \ No newline at end of file diff --git a/src/com/jsh/util/common/PathTool.java b/src/com/jsh/util/common/PathTool.java new file mode 100644 index 00000000..2c32f8a2 --- /dev/null +++ b/src/com/jsh/util/common/PathTool.java @@ -0,0 +1,84 @@ +package com.jsh.util.common; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; + +import com.jsh.base.Log; + +/** + * 获取应用系统路径 + * @author andy + */ +public class PathTool +{ + + /** + * 获取WEB-INF的绝对路径 + * @return + */ + public static String getWebinfPath() + { + String webinfPath = ""; + //获取URL对象 + URL url = PathTool.class.getClassLoader().getResource(""); + try + { + //获取路径 + webinfPath = url.toURI().getPath(); + //截取路径到WEB-INF结束 +// webinfPath = path.substring(0, path.indexOf("/WEB-INF") + 8); + } + catch (URISyntaxException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e); + } + return webinfPath; + } + + /** + * 获取webapp的绝对路径 + * @return + */ + public static String getWebappPath() + { + //先获取工程路径 + String projectPath = getProjectPath(); + //获取工程路径的上级路径 + File f = new File(projectPath); + //路径不存在就返回 + if (!f.exists()) + { + return projectPath; + } + else + { + //返回webapp路径 + return f.getParent(); + } + } + + /** + * 获取工程的绝对路径 + * @return + */ + public static String getProjectPath() + { + String projectPath = ""; + //获取URL对象 + URL url = PathTool.class.getClassLoader().getResource(""); + String path = null; + try + { + //获取路径 + path = url.toURI().getPath(); + //截取webapp路径 + projectPath = path.substring(0, path.indexOf("/WEB-INF")); + } + catch (URISyntaxException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e); + } + return projectPath; + } +} diff --git a/src/com/jsh/util/common/SearchConditionUtil.java b/src/com/jsh/util/common/SearchConditionUtil.java new file mode 100644 index 00000000..0f553bdf --- /dev/null +++ b/src/com/jsh/util/common/SearchConditionUtil.java @@ -0,0 +1,127 @@ +package com.jsh.util.common; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +/** + * 根据搜索条件拼装成查询hql语句 + * @author andy + */ +public class SearchConditionUtil +{ + //拼接字符串的前缀空格字符串 + private static final String emptyPrefix = " and "; + + /** + * 根据搜索条件自动拼接成hql搜索语句 + * @param condition 搜索条件 规则: + * 1、类型 n--数字 s--字符串 + * 2、属性 eq--等于 neq--不等于 like--像'%XX%' llike--左像'%XX' rlike--右像'XX%' in--包含 gt--大于 gteq--大于等于 lt--小于 lteq--小于等于 + * order--value desc asc gy-- group by + * 示例: + * Map condition = new HashMap(); + * condition.put("supplier_s_like", "aaa"); + * condition.put("contacts_s_llike", "186"); + * condition.put("contacts_s_rlike", "186"); + * condition.put("phonenum_s_eq", null); + * condition.put("email_n_neq", 23); + * condition.put("description_s_order", "desc"); + * @return 封装后的字符串 + */ + public static String getCondition(Map condition) + { + StringBuffer hql = new StringBuffer(); + Set key = condition.keySet(); + String groupbyInfo = ""; + String orderInfo = ""; + for(String keyInfo:key) + { + /* + * 1、数组为三个 第一个为对象实例的字段 第二个为字段类型 第三个为属性 + * 2、根据分解后的数组拼接搜索条件 + */ + Object valueInfo = condition.get(keyInfo); + if(null != valueInfo &&valueInfo.toString().length()>0) + { + String[] searchCondition = keyInfo.split("_"); + if(searchCondition[1].equals("n")) + hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + valueInfo); + else if(searchCondition[1].equals("s")) + { + if(searchCondition[2].equals("like")) + hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'%" + valueInfo + "%'"); + else if(searchCondition[2].equals("llike")) + hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'%" + valueInfo + "'"); + else if(searchCondition[2].equals("rlike")) + hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'" + valueInfo + "%'"); + else if(searchCondition[2].equals("in")) + hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "(" + valueInfo + ")"); + else if(searchCondition[2].equals("order")) + orderInfo = " order by " + searchCondition[0] + " " + valueInfo; + else if(searchCondition[2].equals("gb")) + groupbyInfo = " group by " + searchCondition[0]; + else + hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'" + valueInfo + "'"); + } + } + } + return hql.append(groupbyInfo).append(orderInfo).toString(); + } + + /** + * 获取指定类型的符号 + * 属性 eq--等于 neq--不等于 like--像 in--包含 gt--大于 gteq--大于等于 lt--小于 lteq--小于等于 order--value desc asc + * @param type + * @return 类型字符串 + */ + private static String getType(String type) + { + String typeStr = ""; + if(type.equals("eq")) + typeStr = " = "; + else if(type.equals("neq")) + typeStr = " != "; + else if(type.equals("like")) + typeStr = " like "; + else if(type.equals("llike")) + typeStr = " like "; + else if(type.equals("rlike")) + typeStr = " like "; + else if(type.equals("in")) + typeStr = " in "; + else if(type.equals("gt")) + typeStr = " > "; + else if(type.equals("gteq")) + typeStr = " >= "; + else if(type.equals("lt")) + typeStr = " < "; + else if(type.equals("lteq")) + typeStr = " <= "; + else if(type.equals("order")) + typeStr = " order "; + else if(type.equals("gy")) + typeStr = " group by "; + else + typeStr = "unknown"; + return typeStr; + } + + public static void main(String[] args) + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("supplier_s_like", "aaa"); + condition.put("contacts_s_llike", "186"); + condition.put("contacts_s_rlike", "186"); + condition.put("phonenum_s_eq", null); + condition.put("email_n_neq", 23); + condition.put("description_s_order", "desc"); + condition.put("description_s_gb", "aaa"); + + //获取搜索条件拼接 + System.out.println(getCondition(condition)); + } +} diff --git a/src/com/jsh/util/common/Tools.java b/src/com/jsh/util/common/Tools.java new file mode 100644 index 00000000..8736f2c3 --- /dev/null +++ b/src/com/jsh/util/common/Tools.java @@ -0,0 +1,555 @@ +package com.jsh.util.common; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.InetAddress; +import java.net.URLEncoder; +import java.net.UnknownHostException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; +import java.util.UUID; +import java.util.regex.Pattern; + +import sun.misc.BASE64Encoder; + +public class Tools +{ + /** + * 获得32位唯一序列号 + * @return 32为ID字符串 + */ + public static String getUUID_32() + { + return UUID.randomUUID().toString().replaceAll("-", ""); + } + /** + * 获得当天时间,格式为yyyy-MM-dd + * @return 格式化后的日期格式 + */ + public static String getNow() + { + return new SimpleDateFormat("yyyy-MM-dd").format(new Date()); + } + + /** + * 获取当前月 yyyy-MM + * @return + */ + public static String getCurrentMonth() + { + return new SimpleDateFormat("yyyy-MM").format(new Date()); + } + + /** + * 获取指定日期格式 yyyy-MM + * @return + */ + public static String getCurrentMonth(Date date) + { + return new SimpleDateFormat("yyyy-MM-dd").format(date); + } + + /** + * 获得当天时间,格式为yyyyMMddHHmmss + * @return 格式化后的日期格式 + */ + public static String getNow2(Date date) + { + return new SimpleDateFormat("yyyyMMddHHmmss").format(date); + } + /** + * 获得当天时间,格式为yyyy-MM-dd HH:mm:ss + * @return 格式化后的日期格式 + */ + public static String getNow3() + { + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); + } + /** + * 获得指定时间,格式为yyyy-MM-dd HH:mm:ss + * @return 格式化后的日期格式 + */ + public static String getCenternTime(Date date) + { + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date); + } + + /** + * 获得指定时间,格式为mm:ss + * @return 格式化后的日期格式 + */ + public static String getTimeInfo(Date date) + { + return new SimpleDateFormat("mm:ss").format(date); + } + /** + * 获取当前日期是星期几 + * return 星期几 + */ + public static String getWeekDay() + { + Calendar c = Calendar.getInstance(Locale.CHINA); + c.setTime(new Date()); + int day=c.get(Calendar.DAY_OF_WEEK); + String weekDay = ""; + switch (day) + { + case 1: + weekDay = "星期日"; + break; + case 2: + weekDay = "星期一"; + break; + case 3: + weekDay = "星期二"; + break; + case 4: + weekDay = "星期三"; + break; + case 5: + weekDay = "星期四"; + break; + case 6: + weekDay = "星期五"; + break; + case 7: + weekDay = "星期六"; + break; + default: + break; + } + return weekDay; + } + /** + * 判断字符串是否全部为数字 + * @param accountWaste + * @return boolean值 + */ + public static boolean checkStrIsNum(String checkStr) + { + if(checkStr == null || checkStr.length() ==0) + return false; + return Pattern.compile("^[0-9]*.{1}[0-9]*$").matcher(checkStr).matches(); +// return Pattern.compile(":^[0-9]+(.[0-9])*$").matcher(checkStr).matches(); + } + /** + * 获得前一天的时间 + * @return 前一天日期 + */ + public static String getPreviousDate() + { + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.DATE, -1); + return new SimpleDateFormat("yyyy-MM").format(cal.getTime()); + } + + /** + * 截取字符串长度 + * @param beforeStr + * @param cutLeng + * @return 截取后的字符串 + */ + public static String subStr(String beforeStr,int cutLeng){ + if(beforeStr.length()>cutLeng) + return beforeStr.substring(0,cutLeng)+ "..." ; + return beforeStr ; + } + /** + * 生成随机字符串,字母和数字混合 + * @return 组合后的字符串 ^[0-9a-zA-Z] + */ + public static String getRandomChar(){ + //生成一个0、1、2的随机数字 + int rand = (int)Math.round(Math.random() * 1); + long itmp = 0; + char ctmp = '\u0000'; + switch (rand) + { + //生成大写字母 + 1000以内数字 + case 1: + itmp = Math.round(Math.random() * 25 + 65); + ctmp = (char)itmp; + return String.valueOf(ctmp) + (int)Math.random()*1000; + //生成小写字母 + case 2: + itmp = Math.round(Math.random() * 25 + 97); + ctmp = (char)itmp; + return String.valueOf(ctmp)+ (int)Math.random()*1000; + //生成数字 + default : + itmp = Math.round(Math.random() * 1000); + return itmp + ""; + } + } + + /** + * 判断首字母以数字开头,字符串包括数字、字母%以及空格 + * @param str 检查字符串 + * @return 是否以数字开头 + */ + public static boolean CheckIsStartWithNum(String str) + { + return Pattern.compile("^[0-9][a-zA-Z0-9%,\\s]*$").matcher(str).matches(); + } + /** + * 判断首字母以","开头,字符串包括数字、字母%以及空格 + * @param str 检查字符串 + * @return 是否以数字开头 + */ + public static boolean CheckIsStartWithSpec(String str) + { + return Pattern.compile("^[,][a-zA-Z0-9%,\\s]*$").matcher(str).matches(); + } + /** + * 字符转码 + * @param aValue + * @return + * @see 转码后的字符串 + */ + public static String encodeValue(String aValue) + { + if(aValue.trim().length() ==0) + { + return ""; + } + String valueAfterTransCode = null; + try + { + valueAfterTransCode = URLEncoder.encode(aValue, "UTF-8"); + } + catch (UnsupportedEncodingException e) + { + e.getMessage(); + } + return valueAfterTransCode; + } + /** + * 去除str中的' + * @param str + * @return 除去'后的字符串 + * @see [类、类#方法、类#成员] + */ + public static String afterDealStr(String str) + { + return str.replace("'", ""); + } + /** + * 获取用户IP地址 + * @return 用户IP + * @see [类、类#方法、类#成员] + */ + public static String getCurrentUserIP() + { + try + { + return InetAddress.getLocalHost().getHostAddress(); + } + catch (UnknownHostException e) + { + e.printStackTrace(); + return "127.0.0.1"; + } + } + + /** + * 转化前台批量传入的ID值 + * @param data + * @return 转化后的ID值数组 + */ + public static int[] changeDataForm(String data) + { + String[] dataStr = data.split(","); + int[] dataInt = new int[dataStr.length]; + for(int i = 0 ;i < dataStr.length;i ++) + dataInt[i] = Integer.parseInt(dataStr[i]); + return dataInt; + } + + /** + * 解决导出文件中文乱码问题firefox和ie下中文乱码 + */ + public static String changeUnicode(String fileName,String browserType) + { + String returnFileName = ""; + try + { + if(browserType.equalsIgnoreCase("MSIE")) + { + returnFileName = URLEncoder.encode(fileName, "ISO8859-1"); + returnFileName = returnFileName.replace(" ","%20"); + if (returnFileName.length() > 150) + { + returnFileName = new String(fileName.getBytes("GB2312"), "ISO8859-1"); + returnFileName = returnFileName.replace(" ", "%20"); + } + } + else if(browserType.equalsIgnoreCase("Firefox")) + { + returnFileName = new String(fileName.getBytes("ISO8859-1"),"ISO8859-1"); + returnFileName = returnFileName.replace(" ", "%20"); + } + else + { + returnFileName = URLEncoder.encode(fileName, "ISO8859-1"); + returnFileName = returnFileName.replace(" ","%20"); + if (returnFileName.length() > 150) + { + + returnFileName = new String(returnFileName.getBytes("GB2312"), "ISO8859-1"); + returnFileName = returnFileName.replace(" ", "%20"); + } + } + } + catch (UnsupportedEncodingException e) + { + e.printStackTrace(); + } + return returnFileName; + } + + /** + * 写理财日志内容转化特殊字符 + * @param str 需要转化的字符 + * @return 转化后的字符 + */ + public static String htmlspecialchars(String str) + { + str = str.replaceAll("&", "&"); + str = str.replaceAll("<", "<"); + str = str.replaceAll(">", ">"); + str = str.replaceAll("\"", """); + return str; + } + + /** + * 根据消费日期获取消费月 + * @param consumeDate 消费日期 + * @return 返回消费月信息 + */ + public static String getConsumeMonth(String consumeDate) + { + return consumeDate.substring(0,7); + } + + /** + * 获取当前日期的前XX个月 + * @param 之前的第几个月 + * @return 前XX个月字符串 + */ + public static String getBeforeMonth(int beforeMonth) + { + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, -beforeMonth); + return new SimpleDateFormat("yyyy-MM").format(c.getTime()); + } + + + /** + * 获取email用户姓名 + * @param args + */ + public static String getEmailUserName(String emailAddress) + { + return emailAddress.substring(0,emailAddress.lastIndexOf("@")); + } + + /** + * 获取中文编码,邮件附件乱码问题解决 + * @param str + * @return + */ + public static String getChineseString(String emailAttchmentTitle) + { + if(emailAttchmentTitle!=null&&!emailAttchmentTitle.equals("")) + { + try + { + return new String(emailAttchmentTitle.getBytes(),"ISO-8859-1"); + } + catch (UnsupportedEncodingException e) + { + e.printStackTrace(); + } + } + return emailAttchmentTitle; + } + + /** + * 判断userTel是否合法,userTel只能是数字 + * @param userTel + * @return true 合法 false不合法 + */ + public static boolean isTelNumber(String userTel) + { + String reg_phone="^(\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}$"; + String reg_tel="^(1[0-9][0-9]|1[0-9][0|3|6|8|9])\\d{8}$"; + boolean b_phpne=Pattern.compile(reg_phone).matcher(userTel).matches(); + boolean b_tel=Pattern.compile(reg_tel).matcher(userTel).matches(); + return (b_phpne || b_tel); + } + + /** + * 模糊判断电话号码是否合法,只能是数字 + * @param macAddress + * @return + */ + public static boolean isTelNumberBySlur(String userTel) + { + return Pattern.compile("^([\\s0-9]{0,12}$)").matcher(userTel).matches(); + } + + /** + * 获取当前时间的字符串类型 + * @return 处理后的字符串类型 + */ + public static String getNowTime() + { + return new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime()); + } + + /** + * 开打指定文件 + * @param filePath 文件的绝对路径 + */ + public static void openFile(String filePath) + { + String viewFilePath = filePath.replace("\\", "/"); + // Runtime.getRuntime().exec("cmd /c start "+filePath); + // 解决路径中带空格问题 + Runtime r = Runtime.getRuntime(); + String[] cmdArray = new String[] { "cmd.exe", "/c", viewFilePath }; + try + { + r.exec(cmdArray); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + /** + * 判断字符串中是否含有中文 + * @author andy + * @param str + * @return + */ + public static boolean isContainsChinese(String str) + { + return Pattern.compile("[\u4e00-\u9fa5]").matcher(str).matches(); + } + + /** + * 过滤html文件中的文本 + * @param content + * @return过滤后的文本 + */ + public static String filterText(String content) + { + return content.replace("/<(?:.|\\s)*?>/g",""); + } + + /** + * 去掉字符串中所有符号,不论是全角,还是半角的,或是货币符号或者空格等 + * @author andy + * @param s + * @return + * + */ + public static String removeSymbolForString(String s) + { + StringBuffer buffer = new StringBuffer(); + char[] chars = s.toCharArray(); + for (int i = 0; i < chars.length; i++) + { + if ((chars[i] >= 19968 && chars[i] <= 40869) || (chars[i] >= 97 && chars[i] <= 122) || (chars[i] >= 65 && chars[i] <= 90)) + { + buffer.append(chars[i]); + } + } + return buffer.toString(); + } + + /** + * 获取一个字符串的MD5 + * @param msg + * @return 加密后的MD5字符串 + * @throws NoSuchAlgorithmException + */ + public static String md5Encryp(String msg) throws NoSuchAlgorithmException + { + return new BASE64Encoder().encode(MessageDigest.getInstance("MD5").digest(msg.getBytes())); + } + + /** + * 处理字符串null值 + * @param beforeStr 处理前字符串 + * @return 处理后的字符串 + */ + public static String dealNullStr(String beforeStr) + { + if(null == beforeStr || beforeStr.length()==0) + return ""; + return beforeStr; + } + + /** + * 使用参数Format将字符串转为Date + * @author andy + * @param strDate + * @param pattern + * @return + * @throws ParseException + * + */ + public static Date parse(String strDate, String pattern) + throws ParseException + { + return new SimpleDateFormat(pattern).parse(strDate); + } + +// /** +// * 过滤html文件中的图片文件 +// * @param content +// * @return +// */ +// public static String filterImg(String content) +// { +// return content.matches("//g"); +// } + + public static void main(String[] args) + { + String aa = "的付的反对法的发的说法"; + char[] bb = aa.toCharArray(); + for(char c : bb) + { + System.out.println(c); + } + System.out.println(getBeforeMonth(1)); + + try + { + System.out.println(md5Encryp("guest")); + System.out.println(md5Encryp("admin")); + } + catch (NoSuchAlgorithmException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + String value = "2333"; + System.out.println(checkStrIsNum(value)); + + for(int i = 0 ;i < 100;i ++) + { + System.out.print(getRandomChar() + " || "); + } + } +} \ No newline at end of file