Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai
Conflicts:
cloud-server-management/src/main/java/com/dsh/course/mapper/StoreMapper.java
cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IStoreService.java
cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
cloud-server-other/src/main/resources/mapper/SiteMapper.xml
| | |
| | | <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> |
| | | <outputRelativeToContentRoot value="true" /> |
| | | <module name="mb-cloud-account" /> |
| | | <module name="mb-cloud-gateway" /> |
| | | <module name="mb-cloud-course" /> |
| | | <module name="mb-cloud-management" /> |
| | | <module name="mb-cloud-activity" /> |
| | | <module name="mb-cloud-other" /> |
| | | <module name="mb-cloud-competition" /> |
| | | <module name="mb-cloud-auth" /> |
| | | <module name="mb-cloud-communityWorldCup" /> |
| | | <module name="mb-cloud-competition" /> |
| | | <module name="mb-cloud-course" /> |
| | | <module name="mb-cloud-gateway" /> |
| | | <module name="mb-cloud-management" /> |
| | | <module name="mb-cloud-other" /> |
| | | </profile> |
| | | </annotationProcessing> |
| | | <bytecodeTargetLevel target="8" /> |
| | |
| | | <file url="file://$PROJECT_DIR$/cloud-server-account" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/cloud-server-activity" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/cloud-server-auth" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/cloud-server-communityWorldCup" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/cloud-server-competition" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/cloud-server-course" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/cloud-server-gateway" charset="UTF-8" /> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="ExternalStorageConfigurationManager" enabled="true" /> |
| | | <component name="JavaScriptSettings"> |
| | |
| | | <option value="$PROJECT_DIR$/cloud-server-auth/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-activity/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-account/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/pom.xml" /> |
| | | </list> |
| | | </option> |
| | | </component> |
| | |
| | | </component> |
| | | <component name="ChangeListManager"> |
| | | <list default="true" id="cb08d02f-fd4f-4fa2-85fe-abd508fa83ac" name="Default Changelist" comment="11.27,9"> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-account/src/main/java/com/dsh/account/entity/TStudent.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-account/src/main/java/com/dsh/account/entity/TStudent.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/feignclient/account/StudentClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/feignclient/account/StudentClient.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/feignclient/account/model/Student.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/feignclient/account/model/Student.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/service/impl/CoursePackageSchedulingServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/service/impl/CoursePackageSchedulingServiceImpl.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/other/GameClient.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/other/model/TGame.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/GDMapGeocodingUtil.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/HttpRequestUtil.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCup.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupListAll.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/Model/WorldCupStore.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupStoreClient.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/store.html" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup.html" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_info.html" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/static/modular/system/worldCup/store.js" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js" afterDir="false" /> |
| | | <change afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/course/CoursePackageOrderStudentClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/course/CoursePackageOrderStudentClient.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/DeductionClassHour.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/DeductionClassHour.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackageOrderStudentController.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackageOrderStudentController.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/model/DeductionClassHour.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/model/DeductionClassHour.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/service/ICoursePackageOrderStudentService.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/service/ICoursePackageOrderStudentService.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/service/impl/CoursePackageOrderStudentServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/service/impl/CoursePackageOrderStudentServiceImpl.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/course/mapper/StoreMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/course/mapper/StoreMapper.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TStoreController.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TStoreController.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IStoreService.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IStoreService.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/StoreServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/StoreServiceImpl.java" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/WEB-INF/view/system/referee/referee.html" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/WEB-INF/view/system/referee/referee.html" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js" afterDir="false" /> |
| | | <change beforePath="$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java" beforeDir="false" afterPath="$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java" afterDir="false" /> |
| | | </list> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-competition/target/" /> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-other/target/" /> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-activity/target/" /> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-account/target/" /> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-auth/target/" /> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-management/target/" /> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-course/target/" /> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-gateway/target/" /> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-parent/target/" /> |
| | | <ignored path="$PROJECT_DIR$/cloud-server-communityWorldCup/target/" /> |
| | | <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> |
| | | <option name="SHOW_DIALOG" value="false" /> |
| | | <option name="HIGHLIGHT_CONFLICTS" value="true" /> |
| | | <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> |
| | |
| | | <option value="directory" /> |
| | | </option> |
| | | </component> |
| | | <component name="FUSProjectUsageTrigger"> |
| | | <session id="1283956588"> |
| | | <usages-collector id="statistics.lifecycle.project"> |
| | | <counts> |
| | | <entry key="project.closed" value="1" /> |
| | | <entry key="project.open.time.7" value="1" /> |
| | | <entry key="project.opened" value="1" /> |
| | | </counts> |
| | | </usages-collector> |
| | | <usages-collector id="statistics.vcs.git.usages"> |
| | | <counts> |
| | | <entry key="git.branch.checkout.remote" value="1" /> |
| | | </counts> |
| | | </usages-collector> |
| | | <usages-collector id="statistics.file.extensions.open"> |
| | | <counts> |
| | | <entry key="xml" value="1" /> |
| | | </counts> |
| | | </usages-collector> |
| | | <usages-collector id="statistics.file.types.open"> |
| | | <counts> |
| | | <entry key="XML" value="1" /> |
| | | </counts> |
| | | </usages-collector> |
| | | </session> |
| | | <session id="-908660615"> |
| | | <usages-collector id="statistics.lifecycle.project"> |
| | | <counts> |
| | | <entry key="project.open.time.4" value="1" /> |
| | | <entry key="project.opened" value="1" /> |
| | | </counts> |
| | | </usages-collector> |
| | | <usages-collector id="statistics.file.extensions.open"> |
| | | <counts> |
| | | <entry key="java" value="50" /> |
| | | <entry key="properties" value="4" /> |
| | | <entry key="xml" value="5" /> |
| | | </counts> |
| | | </usages-collector> |
| | | <usages-collector id="statistics.file.types.open"> |
| | | <counts> |
| | | <entry key="JAVA" value="50" /> |
| | | <entry key="Properties" value="4" /> |
| | | <entry key="XML" value="5" /> |
| | | </counts> |
| | | </usages-collector> |
| | | <usages-collector id="statistics.file.extensions.edit"> |
| | | <counts> |
| | | <entry key="java" value="425" /> |
| | | <entry key="txt" value="17" /> |
| | | <entry key="xml" value="16" /> |
| | | </counts> |
| | | </usages-collector> |
| | | <usages-collector id="statistics.file.types.edit"> |
| | | <counts> |
| | | <entry key="JAVA" value="425" /> |
| | | <entry key="PLAIN_TEXT" value="17" /> |
| | | <entry key="SQL" value="3" /> |
| | | <entry key="XML" value="13" /> |
| | | </counts> |
| | | </usages-collector> |
| | | </session> |
| | | </component> |
| | | <component name="FileEditorManager"> |
| | | <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> |
| | | <file pinned="false" current-in-tab="true"> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="-836"> |
| | | <caret line="436" column="46" selection-start-line="436" selection-start-column="46" selection-end-line="436" selection-end-column="46" /> |
| | | <folding> |
| | | <element signature="e#22578#22579#0" expanded="true" /> |
| | | <element signature="e#22634#22635#0" expanded="true" /> |
| | | <element signature="e#24096#24097#0" expanded="true" /> |
| | | <element signature="e#24146#24147#0" expanded="true" /> |
| | | <element signature="e#24683#24684#0" expanded="true" /> |
| | | <element signature="e#24739#24740#0" expanded="true" /> |
| | | </folding> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | </file> |
| | | <file pinned="false" current-in-tab="false"> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="180"> |
| | | <caret line="70" column="15" selection-start-line="70" selection-start-column="15" selection-end-line="70" selection-end-column="15" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | </file> |
| | | <file pinned="false" current-in-tab="false"> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="84"> |
| | | <caret line="617" column="60" selection-start-line="617" selection-start-column="60" selection-end-line="617" selection-end-column="60" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | </file> |
| | | <file pinned="false" current-in-tab="false"> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="354"> |
| | | <caret line="47" column="34" selection-start-line="47" selection-start-column="34" selection-end-line="47" selection-end-column="34" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | </file> |
| | | <file pinned="false" current-in-tab="false"> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="230"> |
| | | <caret line="42" column="19" selection-start-line="42" selection-start-column="19" selection-end-line="42" selection-end-column="19" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | </file> |
| | | <file pinned="false" current-in-tab="false"> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="414"> |
| | | <caret line="127" column="19" selection-start-line="127" selection-start-column="19" selection-end-line="127" selection-end-column="19" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | </file> |
| | | <file pinned="false" current-in-tab="false"> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/MyWorldCupInfo.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="171"> |
| | | <caret line="44" column="54" selection-start-line="44" selection-start-column="54" selection-end-line="44" selection-end-column="54" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | </file> |
| | | <file pinned="false" current-in-tab="false"> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupInfo.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="125"> |
| | | <caret line="37" column="20" selection-start-line="37" selection-start-column="20" selection-end-line="37" selection-end-column="20" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | </file> |
| | | </leaf> |
| | | </component> |
| | | <component name="FileTemplateManagerImpl"> |
| | | <option name="RECENT_TEMPLATES"> |
| | | <list> |
| | |
| | | </list> |
| | | </option> |
| | | </component> |
| | | <component name="FindInProjectRecents"> |
| | | <findStrings> |
| | | <find>2.0</find> |
| | | <find>getWorldCupListCoach</find> |
| | | <find>queryParticipantList</find> |
| | | <find>getWorldCupListAll</find> |
| | | <find>getAppUserIds</find> |
| | | <find>getWorldCupInfo</find> |
| | | <find>getMyWorldCupList</find> |
| | | <find>queryAppUser1</find> |
| | | <find>/getWorldCupInfo</find> |
| | | <find>/getParticipant</find> |
| | | </findStrings> |
| | | <dirStrings> |
| | | <dir>E:\IDEA Workspaces\PlayPai\code</dir> |
| | | <dir>E:\IDEA Workspaces\PlayPai\code\cloud-server-account</dir> |
| | | </dirStrings> |
| | | </component> |
| | | <component name="Git.Settings"> |
| | | <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> |
| | | <option name="RECENT_BRANCH_BY_REPOSITORY"> |
| | | <map> |
| | | <entry key="$PROJECT_DIR$" value="master" /> |
| | | </map> |
| | | </option> |
| | | </component> |
| | | <component name="IdeDocumentHistory"> |
| | | <option name="CHANGED_PATHS"> |
| | | <list> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/TaskUtil.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/DeductionCompetitionsClient.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/TaskUtilCompetition.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/CommunityWorldCupApplication.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-gateway/src/main/java/cn/mb/cloud/gateway/filter/PermissionsFilter.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-other/src/main/resources/mapper/BannerMapper.xml" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/controller/HomeModuleController.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/entity/HomeModule.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPayment.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupCompetitor.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/AppUserClient.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListVo.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupInfo.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCup.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/MyWorldCupInfo.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java" /> |
| | | <option value="$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java" /> |
| | | </list> |
| | | </option> |
| | | </component> |
| | | <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" /> |
| | | <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" /> |
| | | <component name="JsGulpfileManager"> |
| | | <detection-done>true</detection-done> |
| | | <sorting>DEFINITION_ORDER</sorting> |
| | | </component> |
| | | <component name="MarkdownSettingsMigration"> |
| | | <option name="stateVersion" value="1" /> |
| | |
| | | <component name="MavenImportPreferences"> |
| | | <option name="generalSettings"> |
| | | <MavenGeneralSettings> |
| | | <option name="localRepository" value="C:\Users\44323\.m2\repository" /> |
| | | <option name="userSettingsFile" value="C:\Users\44323\.m2\settings.xml" /> |
| | | <option name="mavenHome" value="$APPLICATION_HOME_DIR$/plugins/maven/lib/maven3" /> |
| | | <option name="userSettingsFile" value="E:\apache-maven\apache-maven-3.6.1\conf\settings.xml" /> |
| | | </MavenGeneralSettings> |
| | | </option> |
| | | <option name="enabledProfiles"> |
| | |
| | | </list> |
| | | </option> |
| | | </component> |
| | | <component name="MavenProjectNavigator"> |
| | | <treeState> |
| | | <expand> |
| | | <path> |
| | | <item name="" type="16c1761:MavenProjectsStructure$RootNode" /> |
| | | <item name="社区世界杯" type="9519ce18:MavenProjectsStructure$ProjectNode" /> |
| | | </path> |
| | | <path> |
| | | <item name="" type="16c1761:MavenProjectsStructure$RootNode" /> |
| | | <item name="社区世界杯" type="9519ce18:MavenProjectsStructure$ProjectNode" /> |
| | | <item name="Lifecycle" type="58874e2:MavenProjectsStructure$LifecycleNode" /> |
| | | </path> |
| | | </expand> |
| | | <select /> |
| | | </treeState> |
| | | </component> |
| | | <component name="MavenRunner"> |
| | | <option name="skipTests" value="true" /> |
| | | </component> |
| | | <component name="NodePackageJsonFileManager"> |
| | | <packageJsonPaths> |
| | | <path value="$PROJECT_DIR$/package.json" /> |
| | | </packageJsonPaths> |
| | | </component> |
| | | <component name="PackageJsonUpdateNotifier"> |
| | | <dismissed value="$PROJECT_DIR$/package.json" /> |
| | |
| | | <component name="ProblemsViewState"> |
| | | <option name="selectedTabId" value="CurrentFile" /> |
| | | </component> |
| | | <component name="ProjectFrameBounds" extendedState="6"> |
| | | <option name="x" value="-7" /> |
| | | <option name="y" value="1" /> |
| | | <option name="width" value="1932" /> |
| | | <option name="height" value="1046" /> |
| | | </component> |
| | | <component name="ProjectId" id="2T0poWYlZShlnPso29uxjn4gQQo" /> |
| | | <component name="ProjectLevelVcsManager" settingsEditedManually="true"> |
| | | <ConfirmationsSetting value="2" id="Add" /> |
| | | </component> |
| | | <component name="ProjectView"> |
| | | <navigator proportions="" version="1"> |
| | | <foldersAlwaysOnTop value="true" /> |
| | | </navigator> |
| | | <panes> |
| | | <pane id="PackagesPane" /> |
| | | <pane id="AndroidView" /> |
| | | <pane id="Scope" /> |
| | | <pane id="ProjectPane"> |
| | | <subPane> |
| | | <expand> |
| | | <path> |
| | | <item name="code" type="b2602c69:ProjectViewProjectNode" /> |
| | | <item name="code" type="462c0819:PsiDirectoryNode" /> |
| | | </path> |
| | | </expand> |
| | | <select /> |
| | | </subPane> |
| | | </pane> |
| | | </panes> |
| | | </component> |
| | | <component name="ProjectViewState"> |
| | | <option name="hideEmptyMiddlePackages" value="true" /> |
| | | <option name="showLibraryContents" value="true" /> |
| | | </component> |
| | | <component name="PropertiesComponent"><![CDATA[{ |
| | | "keyToString": { |
| | | "git-widget-placeholder": "正在合并 master", |
| | | "node.js.selected.package.tslint": "(autodetect)" |
| | | } |
| | | }]]></component> |
| | | <component name="PropertiesComponent"> |
| | | <property name="RequestMappingsPanelOrder0" value="0" /> |
| | | <property name="RequestMappingsPanelOrder1" value="1" /> |
| | | <property name="RequestMappingsPanelWidth0" value="75" /> |
| | | <property name="RequestMappingsPanelWidth1" value="75" /> |
| | | <property name="WebServerToolWindowFactoryState" value="false" /> |
| | | <property name="aspect.path.notification.shown" value="true" /> |
| | | <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1709619211990" /> |
| | | <property name="last_opened_file_path" value="$PROJECT_DIR$" /> |
| | | <property name="project.structure.last.edited" value="Project" /> |
| | | <property name="project.structure.proportion" value="0.0" /> |
| | | <property name="project.structure.side.proportion" value="0.0" /> |
| | | <property name="settings.editor.selected.configurable" value="MavenSettings" /> |
| | | </component> |
| | | <component name="ReactorSettings"> |
| | | <option name="notificationShown" value="true" /> |
| | | </component> |
| | |
| | | <option value="SpringBootApplicationConfigurationType" /> |
| | | </set> |
| | | </option> |
| | | <option name="ruleStates"> |
| | | <list> |
| | | <RuleState> |
| | | <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> |
| | | </RuleState> |
| | | <RuleState> |
| | | <option name="name" value="StatusDashboardGroupingRule" /> |
| | | </RuleState> |
| | | </list> |
| | | </option> |
| | | <option name="contentProportion" value="0.24296537" /> |
| | | </component> |
| | | <component name="RunManager" selected="JUnit.AccountApplicationTests.contextLoads"> |
| | | <component name="RunManager" selected="Spring Boot.CommunityWorldCupApplication"> |
| | | <configuration default="true" type="JUnit" factoryName="JUnit"> |
| | | <shortenClasspath name="MANIFEST" /> |
| | | <option name="TEST_OBJECT" value="class" /> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="AccountApplicationTests" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> |
| | | <option name="MAIN_CLASS_NAME" value="com.dsh.AccountApplicationTests" /> |
| | | <module name="mb-cloud-account" /> |
| | | <extension name="coverage"> |
| | | <pattern> |
| | | <option name="PATTERN" value="com.dsh.*" /> |
| | | <option name="ENABLED" value="true" /> |
| | | </pattern> |
| | | </extension> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="AntMerchantExpandIndirectImageUpload" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> |
| | | <option name="MAIN_CLASS_NAME" value="com.dsh.guns.modular.system.api.AntMerchantExpandIndirectImageUpload" /> |
| | | <module name="mb-cloud-management" /> |
| | | <extension name="coverage"> |
| | | <pattern> |
| | | <option name="PATTERN" value="com.dsh.guns.modular.system.api.*" /> |
| | | <option name="ENABLED" value="true" /> |
| | | </pattern> |
| | | </extension> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="BigDecimalToChineseWords" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> |
| | | <option name="MAIN_CLASS_NAME" value="com.dsh.guns.modular.system.util.BigDecimalToChineseWords" /> |
| | | <module name="mb-cloud-management" /> |
| | | <extension name="coverage"> |
| | | <pattern> |
| | | <option name="PATTERN" value="com.dsh.guns.modular.system.util.*" /> |
| | | <option name="ENABLED" value="true" /> |
| | | </pattern> |
| | | </extension> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="OperatorController" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> |
| | | <option name="MAIN_CLASS_NAME" value="com.dsh.guns.modular.system.controller.code.OperatorController" /> |
| | | <module name="mb-cloud-management" /> |
| | | <extension name="coverage"> |
| | | <pattern> |
| | | <option name="PATTERN" value="com.dsh.guns.modular.system.controller.code.*" /> |
| | | <option name="ENABLED" value="true" /> |
| | | </pattern> |
| | | </extension> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="SaticScheduleTask" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> |
| | | <option name="MAIN_CLASS_NAME" value="com.dsh.guns.modular.system.api.SaticScheduleTask" /> |
| | | <module name="mb-cloud-management" /> |
| | | <extension name="coverage"> |
| | | <pattern> |
| | | <option name="PATTERN" value="com.dsh.guns.modular.system.api.*" /> |
| | | <option name="ENABLED" value="true" /> |
| | | </pattern> |
| | | </extension> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="WeChatUtil" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> |
| | | <option name="MAIN_CLASS_NAME" value="com.dsh.guns.modular.system.util.WeChatUtil" /> |
| | | <module name="mb-cloud-management" /> |
| | | <extension name="coverage"> |
| | | <pattern> |
| | | <option name="PATTERN" value="com.dsh.guns.modular.system.util.*" /> |
| | | <option name="ENABLED" value="true" /> |
| | | </pattern> |
| | | </extension> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="AccountApplicationTests.contextLoads" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true"> |
| | | <module name="mb-cloud-account" /> |
| | | <shortenClasspath name="MANIFEST" /> |
| | |
| | | </configuration> |
| | | <configuration default="true" type="JUnit" factoryName="JUnit"> |
| | | <shortenClasspath name="MANIFEST" /> |
| | | <option name="TEST_OBJECT" value="class" /> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="AccountApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> |
| | | <module name="mb-cloud-account" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <option name="SPRING_BOOT_MAIN_CLASS" value="com.dsh.AccountApplication" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | |
| | | </configuration> |
| | | <configuration name="ActivityApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> |
| | | <module name="mb-cloud-activity" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <option name="SPRING_BOOT_MAIN_CLASS" value="com.dsh.ActivityApplication" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | |
| | | <configuration name="AuthApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> |
| | | <module name="mb-cloud-auth" /> |
| | | <option name="SPRING_BOOT_MAIN_CLASS" value="cn.mb.cloud.auth.AuthApplication" /> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="CommunityWorldCupApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> |
| | | <module name="mb-cloud-communityWorldCup" /> |
| | | <option name="SPRING_BOOT_MAIN_CLASS" value="com.dsh.CommunityWorldCupApplication" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | | </configuration> |
| | | <configuration name="CompetitionApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> |
| | | <module name="mb-cloud-competition" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <option name="SPRING_BOOT_MAIN_CLASS" value="com.dsh.CompetitionApplication" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | |
| | | </configuration> |
| | | <configuration name="CourseApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> |
| | | <module name="mb-cloud-course" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <option name="SPRING_BOOT_MAIN_CLASS" value="com.dsh.CourseApplication" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | |
| | | </method> |
| | | </configuration> |
| | | <configuration name="ManagementApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> |
| | | <option name="ENABLE_JMX_AGENT" value="false" /> |
| | | <module name="mb-cloud-management" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <option name="SPRING_BOOT_MAIN_CLASS" value="com.dsh.ManagementApplication" /> |
| | | <option name="ENABLE_JMX_AGENT" value="false" /> |
| | | <option name="SHORTEN_COMMAND_LINE" value="MANIFEST" /> |
| | | <method v="2"> |
| | | <option name="Make" enabled="true" /> |
| | | </method> |
| | |
| | | </method> |
| | | </configuration> |
| | | <list> |
| | | <item itemvalue="JUnit.AccountApplicationTests.contextLoads" /> |
| | | <item itemvalue="Spring Boot.CourseApplication" /> |
| | | <item itemvalue="Spring Boot.AuthApplication" /> |
| | | <item itemvalue="Spring Boot.AccountApplication" /> |
| | |
| | | <item itemvalue="Spring Boot.OtherApplication" /> |
| | | <item itemvalue="Spring Boot.ActivityApplication" /> |
| | | <item itemvalue="Spring Boot.CompetitionApplication" /> |
| | | <item itemvalue="应用程序.AccountApplicationTests" /> |
| | | <item itemvalue="应用程序.AntMerchantExpandIndirectImageUpload" /> |
| | | <item itemvalue="应用程序.BigDecimalToChineseWords" /> |
| | | <item itemvalue="应用程序.OperatorController" /> |
| | | <item itemvalue="应用程序.SaticScheduleTask" /> |
| | | <item itemvalue="应用程序.WeChatUtil" /> |
| | | <item itemvalue="Spring Boot.CommunityWorldCupApplication" /> |
| | | <item itemvalue="JUnit.AccountApplicationTests.contextLoads" /> |
| | | </list> |
| | | <recent_temporary> |
| | | <list> |
| | |
| | | <component name="ShelveChangesManager"> |
| | | <option name="remove_strategy" value="true" /> |
| | | </component> |
| | | <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="false" /> |
| | | <component name="SpellCheckerSettings" BundledDictionaries="0" Folders="0" CustomDictionaries="0" Dictionaries="0" CorrectionsLimit="5" DefaultDictionary="应用程序级" UseSingleDictionary="true" /> |
| | | <component name="SvnConfiguration"> |
| | | <configuration>C:\Users\luo\AppData\Roaming\Subversion</configuration> |
| | | </component> |
| | |
| | | <workItem from="1698325880893" duration="54542000" /> |
| | | <workItem from="1698455150596" duration="11287000" /> |
| | | <workItem from="1698627531587" duration="2092000" /> |
| | | </task> |
| | | <task id="LOCAL-00047" summary="10.12"> |
| | | <option name="closed" value="true" /> |
| | | <created>1697011234286</created> |
| | | <option name="number" value="00047" /> |
| | | <option name="presentableId" value="LOCAL-00047" /> |
| | | <option name="project" value="LOCAL" /> |
| | | <updated>1697011234286</updated> |
| | | </task> |
| | | <task id="LOCAL-00048" summary="10.13"> |
| | | <option name="closed" value="true" /> |
| | | <created>1697024509448</created> |
| | | <option name="number" value="00048" /> |
| | | <option name="presentableId" value="LOCAL-00048" /> |
| | | <option name="project" value="LOCAL" /> |
| | | <updated>1697024509448</updated> |
| | | </task> |
| | | <task id="LOCAL-00049" summary="10.13bug1"> |
| | | <option name="closed" value="true" /> |
| | | <created>1697186903441</created> |
| | | <option name="number" value="00049" /> |
| | | <option name="presentableId" value="LOCAL-00049" /> |
| | | <option name="project" value="LOCAL" /> |
| | | <updated>1697186903441</updated> |
| | | </task> |
| | | <task id="LOCAL-00050" summary="10.13bug2"> |
| | | <option name="closed" value="true" /> |
| | | <created>1697187817778</created> |
| | | <option name="number" value="00050" /> |
| | | <option name="presentableId" value="LOCAL-00050" /> |
| | | <option name="project" value="LOCAL" /> |
| | | <updated>1697187817778</updated> |
| | | <workItem from="1708947562373" duration="284000" /> |
| | | <workItem from="1708947995181" duration="6987000" /> |
| | | </task> |
| | | <task id="LOCAL-00051" summary="10.13bug2"> |
| | | <option name="closed" value="true" /> |
| | |
| | | <option name="project" value="LOCAL" /> |
| | | <updated>1701174292128</updated> |
| | | </task> |
| | | <option name="localTasksCounter" value="96" /> |
| | | <task id="LOCAL-00096" summary="修改bug"> |
| | | <created>1709112234344</created> |
| | | <option name="number" value="00096" /> |
| | | <option name="presentableId" value="LOCAL-00096" /> |
| | | <option name="project" value="LOCAL" /> |
| | | <updated>1709112234345</updated> |
| | | </task> |
| | | <task id="LOCAL-00097" summary="合并代码"> |
| | | <created>1709534778085</created> |
| | | <option name="number" value="00097" /> |
| | | <option name="presentableId" value="LOCAL-00097" /> |
| | | <option name="project" value="LOCAL" /> |
| | | <updated>1709534778085</updated> |
| | | </task> |
| | | <task id="LOCAL-00098" summary="合并代码"> |
| | | <created>1709534897759</created> |
| | | <option name="number" value="00098" /> |
| | | <option name="presentableId" value="LOCAL-00098" /> |
| | | <option name="project" value="LOCAL" /> |
| | | <updated>1709534897759</updated> |
| | | </task> |
| | | <task id="LOCAL-00099" summary="合并代码"> |
| | | <created>1709619248636</created> |
| | | <option name="number" value="00099" /> |
| | | <option name="presentableId" value="LOCAL-00099" /> |
| | | <option name="project" value="LOCAL" /> |
| | | <updated>1709619248636</updated> |
| | | </task> |
| | | <option name="localTasksCounter" value="100" /> |
| | | <servers /> |
| | | </component> |
| | | <component name="TimeTrackingManager"> |
| | | <option name="totallyTimeSpent" value="16463000" /> |
| | | </component> |
| | | <component name="ToolWindowManager"> |
| | | <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> |
| | | <layout> |
| | | <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25266525" /> |
| | | <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> |
| | | <window_info id="Designer" order="2" /> |
| | | <window_info id="Image Layers" order="3" /> |
| | | <window_info id="UI Designer" order="4" /> |
| | | <window_info id="Favorites" order="5" side_tool="true" /> |
| | | <window_info id="Capture Tool" order="6" /> |
| | | <window_info id="Web" order="7" side_tool="true" /> |
| | | <window_info anchor="bottom" id="Message" order="0" /> |
| | | <window_info anchor="bottom" id="Find" order="1" /> |
| | | <window_info anchor="bottom" id="Run" order="2" weight="0.32899022" /> |
| | | <window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> |
| | | <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> |
| | | <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> |
| | | <window_info anchor="bottom" id="TODO" order="6" /> |
| | | <window_info anchor="bottom" id="Terminal" order="7" /> |
| | | <window_info anchor="bottom" id="Event Log" order="8" side_tool="true" /> |
| | | <window_info anchor="bottom" id="Statistic" order="9" /> |
| | | <window_info anchor="bottom" id="Java Enterprise" order="10" /> |
| | | <window_info anchor="bottom" id="Database Changes" order="11" show_stripe_button="false" /> |
| | | <window_info active="true" anchor="bottom" id="Version Control" order="12" visible="true" weight="0.32899022" /> |
| | | <window_info anchor="bottom" id="Run Dashboard" order="13" weight="0.19652551" /> |
| | | <window_info anchor="bottom" id="Spring" order="14" /> |
| | | <window_info anchor="bottom" id="Messages" order="15" weight="0.32899022" /> |
| | | <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> |
| | | <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> |
| | | <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> |
| | | <window_info anchor="right" id="Palette" order="3" /> |
| | | <window_info anchor="right" id="Capture Analysis" order="4" /> |
| | | <window_info anchor="right" id="Maven Projects" order="5" weight="0.21321961" /> |
| | | <window_info anchor="right" id="Database" order="6" /> |
| | | <window_info anchor="right" id="Palette	" order="7" /> |
| | | <window_info anchor="right" id="Theme Preview" order="8" /> |
| | | <window_info anchor="right" id="Bean Validation" order="9" /> |
| | | </layout> |
| | | </component> |
| | | <component name="TypeScriptGeneratedFilesManager"> |
| | | <option name="version" value="1" /> |
| | | </component> |
| | | <component name="Vcs.Log.Tabs.Properties"> |
| | | <option name="TAB_STATES"> |
| | | <map> |
| | | <entry key="MAIN"> |
| | | <value> |
| | | <State /> |
| | | <State> |
| | | <option name="RECENTLY_FILTERED_USER_GROUPS"> |
| | | <collection /> |
| | | </option> |
| | | <option name="RECENTLY_FILTERED_BRANCH_GROUPS"> |
| | | <collection /> |
| | | </option> |
| | | </State> |
| | | </value> |
| | | </entry> |
| | | </map> |
| | | </option> |
| | | </component> |
| | | <component name="VcsContentAnnotationSettings"> |
| | | <option name="myLimit" value="2678400000" /> |
| | | </component> |
| | | <component name="VcsManagerConfiguration"> |
| | | <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> |
| | | <MESSAGE value="9.26。11" /> |
| | | <MESSAGE value="9.26。12" /> |
| | | <MESSAGE value="9.26。13" /> |
| | | <MESSAGE value="9.26。14" /> |
| | | <MESSAGE value="9.26。15" /> |
| | |
| | | <MESSAGE value="10.20" /> |
| | | <MESSAGE value="商户认证" /> |
| | | <MESSAGE value="11.27,9" /> |
| | | <option name="LAST_COMMIT_MESSAGE" value="11.27,9" /> |
| | | <MESSAGE value="修改bug" /> |
| | | <MESSAGE value="合并代码" /> |
| | | <option name="LAST_COMMIT_MESSAGE" value="合并代码" /> |
| | | </component> |
| | | <component name="XDebuggerManager"> |
| | | <breakpoint-manager> |
| | | <breakpoints> |
| | | <line-breakpoint type="java-line"> |
| | | <url>file://$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/LoginController.java</url> |
| | | <line>145</line> |
| | | <line>264</line> |
| | | <properties /> |
| | | <option name="timeStamp" value="1" /> |
| | | </line-breakpoint> |
| | | <line-breakpoint type="java-line"> |
| | | <url>file://$PROJECT_DIR$/cloud-server-auth/src/main/java/cn/mb/cloud/auth/service/UserDetailsServiceImpl.java</url> |
| | | <line>111</line> |
| | | <properties /> |
| | | <option name="timeStamp" value="2" /> |
| | | </line-breakpoint> |
| | | <line-breakpoint type="java-line"> |
| | | <url>file://$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/CoursePackageService.java</url> |
| | | <line>458</line> |
| | | <properties /> |
| | | <option name="timeStamp" value="9" /> |
| | | </line-breakpoint> |
| | | <line-breakpoint type="java-line"> |
| | | <url>file://$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java</url> |
| | | <line>1382</line> |
| | | <option name="timeStamp" value="14" /> |
| | | </line-breakpoint> |
| | | <line-breakpoint enabled="true" type="java-line"> |
| | | <url>file://$PROJECT_DIR$/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java</url> |
| | | <line>282</line> |
| | | <properties /> |
| | | <option name="timeStamp" value="50" /> |
| | | </line-breakpoint> |
| | | <line-breakpoint enabled="true" type="java-line"> |
| | | <url>file://$PROJECT_DIR$/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java</url> |
| | | <line>172</line> |
| | | <line>584</line> |
| | | <properties /> |
| | | <option name="timeStamp" value="111" /> |
| | | </line-breakpoint> |
| | | </breakpoints> |
| | | </breakpoint-manager> |
| | | <pin-to-top-manager> |
| | | <pinned-members> |
| | | <PinnedItemInfo parentTag="com.baomidou.mybatisplus.extension.plugins.pagination.Page" memberName="total" /> |
| | | <PinnedItemInfo parentTag="com.dsh.account.feignclient.activity.model.PointMerchandiseVo" memberName="merchandises" /> |
| | | <PinnedItemInfo parentTag="com.dsh.competition.model.PaymentCompetitionVo" memberName="id" /> |
| | | <PinnedItemInfo parentTag="com.alipay.api.response.AlipayTradeAppPayResponse" memberName="body" /> |
| | | <PinnedItemInfo parentTag="java.lang.Long" memberName="value" /> |
| | | <PinnedItemInfo parentTag="com.dsh.other.util.ResultUtil" memberName="msg" /> |
| | | </pinned-members> |
| | | </pin-to-top-manager> |
| | | </component> |
| | | <component name="XSLT-Support.FileAssociations.UIState"> |
| | | <expand /> |
| | | <select /> |
| | | </component> |
| | | <component name="editorHistoryManager"> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-parent/pom.xml"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="225"> |
| | | <caret line="9" selection-start-line="9" selection-end-line="9" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/TaskUtil.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="593"> |
| | | <caret line="29" selection-start-line="29" selection-end-line="29" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/DeductionCompetitionsClient.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="175"> |
| | | <caret line="13" selection-start-line="13" selection-end-line="13" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/util/TaskUtilCompetition.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="148"> |
| | | <caret line="19" column="13" selection-start-line="19" selection-start-column="13" selection-end-line="19" selection-end-column="13" /> |
| | | <folding> |
| | | <element signature="imports" expanded="true" /> |
| | | </folding> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/CommunityWorldCupApplication.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="125"> |
| | | <caret line="17" column="3" lean-forward="true" selection-start-line="17" selection-start-column="3" selection-end-line="17" selection-end-column="3" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-gateway/src/main/java/cn/mb/cloud/gateway/filter/RequestParamFilter.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="-26"> |
| | | <caret line="21" column="13" selection-start-line="21" selection-start-column="13" selection-end-line="21" selection-end-column="13" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-gateway/src/main/java/cn/mb/cloud/gateway/filter/ResponseParamFilter.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="-876"> |
| | | <caret line="29" column="13" selection-start-line="29" selection-start-column="13" selection-end-line="29" selection-end-column="13" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-gateway/src/main/java/cn/mb/cloud/gateway/filter/WrapperResponseGlobalFilter.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="-476"> |
| | | <caret line="21" column="13" selection-start-line="21" selection-start-column="13" selection-end-line="21" selection-end-column="13" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-gateway/src/main/java/cn/mb/cloud/gateway/filter/PermissionsFilter.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="139"> |
| | | <caret line="124" column="19" selection-start-line="124" selection-start-column="19" selection-end-line="124" selection-end-column="19" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-gateway/src/main/java/cn/mb/cloud/gateway/model/HeaderParams.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="125"> |
| | | <caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-gateway/src/main/java/cn/mb/cloud/gateway/handler/AppTypeContextHolder.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="261"> |
| | | <caret line="17" selection-start-line="17" selection-end-line="17" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="195"> |
| | | <caret line="12" column="13" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/model/BannerVo.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="372"> |
| | | <caret line="23" column="31" lean-forward="true" selection-start-line="23" selection-start-column="31" selection-end-line="23" selection-end-column="31" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-other/src/main/resources/mapper/BannerMapper.xml"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="372"> |
| | | <caret line="51" column="63" selection-start-line="51" selection-start-column="59" selection-end-line="51" selection-end-column="63" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-gateway/src/main/java/cn/mb/cloud/gateway/filter/QueryParamsUtil.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="-1828"> |
| | | <caret line="18" column="13" selection-start-line="18" selection-start-column="13" selection-end-line="18" selection-end-column="13" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/pom.xml"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="325"> |
| | | <caret line="13" column="22" selection-start-line="13" selection-start-column="22" selection-end-line="13" selection-end-column="22" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="2130"> |
| | | <caret line="125" lean-forward="true" selection-start-line="125" selection-end-line="125" /> |
| | | <folding> |
| | | <element signature="e#5114#5115#0" expanded="true" /> |
| | | <element signature="e#5197#5198#0" expanded="true" /> |
| | | </folding> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/controller/HomeModuleController.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="350"> |
| | | <caret line="30" column="24" lean-forward="true" selection-start-line="30" selection-start-column="24" selection-end-line="30" selection-end-column="24" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-other/src/main/java/com/dsh/other/entity/HomeModule.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="254"> |
| | | <caret line="30" column="7" lean-forward="true" selection-start-line="30" selection-start-column="7" selection-end-line="30" selection-end-column="7" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/.idea/workspace.xml"> |
| | | <provider selected="true" editor-type-id="text-editor" /> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/target/classes/bootstrap.properties"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="150"> |
| | | <caret line="12" column="51" selection-start-line="12" selection-start-column="51" selection-end-line="12" selection-end-column="51" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/resources/sharding-jdbc.properties"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="175"> |
| | | <caret line="7" column="32" lean-forward="true" selection-start-line="7" selection-start-column="32" selection-end-line="7" selection-end-column="32" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="282"> |
| | | <caret line="123" column="13" lean-forward="true" selection-start-line="123" selection-start-column="13" selection-end-line="123" selection-end-column="13" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-competition/src/main/java/com/dsh/competition/feignclient/course/CoursePackagePaymentClient.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="251"> |
| | | <caret line="25" column="12" selection-start-line="25" selection-start-column="12" selection-end-line="25" selection-end-column="12" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="401"> |
| | | <caret line="141" column="50" lean-forward="true" selection-start-line="141" selection-start-column="50" selection-end-line="141" selection-end-column="50" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-competition/src/main/java/com/dsh/competition/service/IParticipantService.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="260"> |
| | | <caret line="39" column="24" selection-start-line="39" selection-start-column="24" selection-end-line="39" selection-end-column="24" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="292"> |
| | | <caret line="88" column="79" selection-start-line="88" selection-start-column="79" selection-end-line="88" selection-end-column="79" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-competition/src/main/java/com/dsh/competition/entity/PaymentCompetition.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="320"> |
| | | <caret line="21" column="45" selection-start-line="21" selection-start-column="41" selection-end-line="21" selection-end-column="45" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupCompetitor.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="320"> |
| | | <caret line="20" column="45" selection-start-line="20" selection-start-column="45" selection-end-line="20" selection-end-column="45" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPayment.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="85"> |
| | | <caret line="21" column="45" selection-start-line="21" selection-start-column="45" selection-end-line="21" selection-end-column="45" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/account/AppUserClient.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="421"> |
| | | <caret line="37" column="45" selection-start-line="37" selection-start-column="32" selection-end-line="37" selection-end-column="45" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="307"> |
| | | <caret line="116" column="28" selection-start-line="116" selection-start-column="15" selection-end-line="116" selection-end-column="28" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListVo.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="252"> |
| | | <caret line="14" column="22" lean-forward="true" selection-start-line="14" selection-start-column="22" selection-end-line="14" selection-end-column="22" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="50"> |
| | | <caret line="2" column="63" lean-forward="true" selection-start-line="2" selection-start-column="63" selection-end-line="2" selection-end-column="63" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupMapper.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="170"> |
| | | <caret line="14" column="56" lean-forward="true" selection-start-line="14" selection-start-column="56" selection-end-line="14" selection-end-column="56" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCup.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="200"> |
| | | <caret line="110" column="7" lean-forward="true" selection-start-line="102" selection-start-column="32" selection-end-line="122" selection-end-column="28" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="19"> |
| | | <caret line="16" column="33" selection-start-line="16" selection-start-column="16" selection-end-line="16" selection-end-column="33" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupPaymentParticipantMapper.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="340"> |
| | | <caret line="33" column="42" selection-start-line="33" selection-start-column="25" selection-end-line="33" selection-end-column="42" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="326"> |
| | | <caret line="604" column="49" selection-start-line="604" selection-start-column="27" selection-end-line="604" selection-end-column="49" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupInfo.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="125"> |
| | | <caret line="37" column="20" selection-start-line="37" selection-start-column="20" selection-end-line="37" selection-end-column="20" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentParticipantService.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="230"> |
| | | <caret line="42" column="19" selection-start-line="42" selection-start-column="19" selection-end-line="42" selection-end-column="19" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/MyWorldCupInfo.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="171"> |
| | | <caret line="44" column="54" selection-start-line="44" selection-start-column="54" selection-end-line="44" selection-end-column="54" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="414"> |
| | | <caret line="127" column="19" selection-start-line="127" selection-start-column="19" selection-end-line="127" selection-end-column="19" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="180"> |
| | | <caret line="70" column="15" selection-start-line="70" selection-start-column="15" selection-end-line="70" selection-end-column="15" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupPaymentParticipant.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="354"> |
| | | <caret line="47" column="34" selection-start-line="47" selection-start-column="34" selection-end-line="47" selection-end-column="34" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="84"> |
| | | <caret line="617" column="60" selection-start-line="617" selection-start-column="60" selection-end-line="617" selection-end-column="60" /> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | <entry file="file://$PROJECT_DIR$/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java"> |
| | | <provider selected="true" editor-type-id="text-editor"> |
| | | <state relative-caret-position="-836"> |
| | | <caret line="436" column="46" selection-start-line="436" selection-start-column="46" selection-end-line="436" selection-end-column="46" /> |
| | | <folding> |
| | | <element signature="e#22578#22579#0" expanded="true" /> |
| | | <element signature="e#22634#22635#0" expanded="true" /> |
| | | <element signature="e#24096#24097#0" expanded="true" /> |
| | | <element signature="e#24146#24147#0" expanded="true" /> |
| | | <element signature="e#24683#24684#0" expanded="true" /> |
| | | <element signature="e#24739#24740#0" expanded="true" /> |
| | | </folding> |
| | | </state> |
| | | </provider> |
| | | </entry> |
| | | </component> |
| | | <component name="masterDetails"> |
| | | <states> |
| | | <state key="ArtifactsStructureConfigurable.UI"> |
| | | <settings> |
| | | <artifact-editor /> |
| | | <splitter-proportions> |
| | | <option name="proportions"> |
| | | <list> |
| | | <option value="0.2" /> |
| | | </list> |
| | | </option> |
| | | </splitter-proportions> |
| | | </settings> |
| | | </state> |
| | | <state key="FacetStructureConfigurable.UI"> |
| | | <settings> |
| | | <last-edited>Spring</last-edited> |
| | | <splitter-proportions> |
| | | <option name="proportions"> |
| | | <list> |
| | | <option value="0.2" /> |
| | | </list> |
| | | </option> |
| | | </splitter-proportions> |
| | | </settings> |
| | | </state> |
| | | <state key="GlobalLibrariesConfigurable.UI"> |
| | | <settings> |
| | | <splitter-proportions> |
| | | <option name="proportions"> |
| | | <list> |
| | | <option value="0.2" /> |
| | | </list> |
| | | </option> |
| | | </splitter-proportions> |
| | | </settings> |
| | | </state> |
| | | <state key="JdkListConfigurable.UI"> |
| | | <settings> |
| | | <last-edited>1.8</last-edited> |
| | | <splitter-proportions> |
| | | <option name="proportions"> |
| | | <list> |
| | | <option value="0.2" /> |
| | | </list> |
| | | </option> |
| | | </splitter-proportions> |
| | | </settings> |
| | | </state> |
| | | <state key="ModuleStructureConfigurable.UI"> |
| | | <settings> |
| | | <last-edited>PlayPai</last-edited> |
| | | <splitter-proportions> |
| | | <option name="proportions"> |
| | | <list> |
| | | <option value="0.2" /> |
| | | <option value="0.6" /> |
| | | </list> |
| | | </option> |
| | | </splitter-proportions> |
| | | </settings> |
| | | </state> |
| | | <state key="ProjectLibrariesConfigurable.UI"> |
| | | <settings> |
| | | <last-edited>Maven: antlr:antlr:2.7.7</last-edited> |
| | | <splitter-proportions> |
| | | <option name="proportions"> |
| | | <list> |
| | | <option value="0.2" /> |
| | | </list> |
| | | </option> |
| | | </splitter-proportions> |
| | | </settings> |
| | | </state> |
| | | </states> |
| | | </component> |
| | | </project> |
| | |
| | | .eq("cityCode", cityCode) |
| | | ); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据城市code获取用户的id集合 |
| | | * @param cityCode 城市code |
| | | * @return |
| | | */ |
| | | @PostMapping("/appUser/getAppUserIds") |
| | | public List<Integer> getAppUserIds(@RequestBody String cityCode){ |
| | | List<TAppUser> list = appUserService.list(new QueryWrapper<TAppUser>().eq("cityCode", cityCode).eq("state", 1)); |
| | | return list.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/weeksOfCourseDetailsList") |
| | | @ApiOperation(value = "上课首页-课程列表2.0", tags = {"APP-开始上课"}) |
| | | @ApiOperation(value = "上课首页-课程列表", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "查询时间yyyy-MM-dd", name = "time", required = true, dataType = "string"), |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | TAppGift one = appGiftService.getOne(new LambdaQueryWrapper<TAppGift>().eq(TAppGift::getUserId, appUserId)); |
| | | Boolean b = false; |
| | | Integer i = 0; |
| | | if (one != null && one.getNum() > 0) { |
| | | i = appGiftService.weeksOfAddHours(packetId, appUserId, one.getNum()); |
| | | |
| | | } |
| | | if (i == 1) { |
| | | // 送完清0 |
| | |
| | | }) |
| | | public ResultUtil<List<StuMedalVo>> queryStuMedal(Integer stuId) { |
| | | try { |
| | | |
| | | |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if (null == appUserId) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(honorService.queryHonorDetails(stuId)); |
| | | return ResultUtil.success(honorService.queryHonorDetails(appUserId)); |
| | | } catch (Exception e) { |
| | | return ResultUtil.runErr(); |
| | | } |
New file |
| | |
| | | package com.dsh.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.account.entity.Referee; |
| | | import com.dsh.account.model.RefereeList; |
| | | import com.dsh.account.service.IRefereeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/1 14:28 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class RefereeController { |
| | | |
| | | @Autowired |
| | | private IRefereeService refereeService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取裁判管理列表 |
| | | * @param refereeList |
| | | * @return |
| | | */ |
| | | @PostMapping("/referee/getRefereeList") |
| | | public Map<String, Object> getRefereeList(@RequestBody RefereeList refereeList){ |
| | | return refereeService.getRefereeList(refereeList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加裁判 |
| | | * @param referee |
| | | */ |
| | | @PostMapping("/referee/addReferee") |
| | | public void addReferee(@RequestBody Referee referee){ |
| | | referee.setState(1); |
| | | referee.setCreateTime(new Date()); |
| | | refereeService.save(referee); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/referee/getRefereeById") |
| | | public Referee getRefereeById(@RequestBody Integer id){ |
| | | return refereeService.getById(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改裁判数据 |
| | | * @param referee |
| | | */ |
| | | @PostMapping("/referee/editReferee") |
| | | public void editReferee(@RequestBody Referee referee){ |
| | | refereeService.updateById(referee); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.account.entity.StudentHonor; |
| | | import com.dsh.account.feignclient.other.HonorRulesClient; |
| | | import com.dsh.account.feignclient.other.model.HonorRules; |
| | | import com.dsh.account.service.StudentHonorService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * 勋章 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/studentHonor") |
| | | public class StudentHonorController { |
| | | |
| | | @Autowired |
| | | private StudentHonorService studentHonorService; |
| | | |
| | | @Resource |
| | | private HonorRulesClient honorRulesClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存用户勋章 |
| | | * @param studentHonor |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/saveStudentHonor") |
| | | public void saveStudentHonor(@RequestBody StudentHonor studentHonor){ |
| | | StudentHonor one = studentHonorService.getOne(new QueryWrapper<StudentHonor>() |
| | | .eq("appUserId", studentHonor.getAppUserId()).eq("honorType", studentHonor.getHonorType())); |
| | | if(null == one){ |
| | | one = new StudentHonor(); |
| | | } |
| | | //获取荣耀规则 |
| | | HonorRules honorRules = new HonorRules(); |
| | | honorRules.setType(studentHonor.getHonorType()); |
| | | honorRules.setCondition(studentHonor.getNumber()); |
| | | HonorRules honorRules1 = honorRulesClient.getHonorRules(honorRules); |
| | | if(null != honorRules1){ |
| | | one.setAppUserId(studentHonor.getAppUserId()); |
| | | one.setHonorType(studentHonor.getHonorType()); |
| | | one.setNumber(studentHonor.getNumber()); |
| | | one.setHonorRuleId(honorRules1.getId()); |
| | | one.setHonorLevel(honorRules1.getLevel()); |
| | | one.setInsertTime(new Date()); |
| | | studentHonorService.saveOrUpdate(one); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/indexOfAppUser") |
| | | @ApiOperation(value = "福利主页", tags = {"APP-使用福利"}) |
| | | @ApiOperation(value = "福利主页【2.0】", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "lat", value = "经度", dataType = "string"), |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家) |
| | | * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家,5=赢家,6=次数) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
New file |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 裁判 |
| | | * @author 39373 |
| | | * @Date 2024/2/8 14:57 |
| | | */ |
| | | @Data |
| | | @TableName("t_referee") |
| | | public class Referee { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 手机号 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | } |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 学员id |
| | | * 用户id |
| | | */ |
| | | @TableField("stuId") |
| | | private Integer stuId; |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 荣耀规则id |
| | | */ |
| | |
| | | @TableField("honorLevel") |
| | | private Integer honorLevel; |
| | | /** |
| | | * 当前次数 |
| | | */ |
| | | @TableField("number") |
| | | private Integer number; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | |
| | | public List<PurchaseRecordVo> queryAppUsersofIntroduce(@RequestBody IntrduceOfUserRequest request); |
| | | |
| | | @PostMapping("/base/introduce/getGiftList") |
| | | IntroduceRewards getGiftList(@RequestBody String cityCode); |
| | | List<IntroduceRewards> getGiftList(@RequestBody String cityCode); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.feignclient.communityWorldCup; |
| | | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/1 10:04 |
| | | */ |
| | | @FeignClient("mb-cloud-communityWorldCup") |
| | | public interface WorldCupCompetitorClient { |
| | | |
| | | |
| | | /** |
| | | * 获取学员参与世界杯次数 |
| | | * @param studentId |
| | | * @return |
| | | */ |
| | | @PostMapping("/worldCup/count") |
| | | Integer count(Integer studentId); |
| | | |
| | | |
| | | /** |
| | | * 获取学员世界杯胜利次数 |
| | | * @param studentId |
| | | * @return |
| | | */ |
| | | @PostMapping("/worldCup/winCount") |
| | | Integer winCount(Integer studentId); |
| | | } |
New file |
| | |
| | | package com.dsh.account.feignclient.other; |
| | | |
| | | import com.dsh.account.feignclient.other.model.HonorRules; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | |
| | | /** |
| | | * 荣耀规则 |
| | | */ |
| | | @FeignClient("mb-cloud-other") |
| | | public interface HonorRulesClient { |
| | | |
| | | |
| | | /** |
| | | * 获取合适的规则 |
| | | * @param honorRules |
| | | * @return |
| | | */ |
| | | @PostMapping("/honorRules/getHonorRules") |
| | | HonorRules getHonorRules(HonorRules honorRules); |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/honorRules/getHonorRulesById") |
| | | HonorRules getHonorRulesById(Integer id); |
| | | } |
New file |
| | |
| | | package com.dsh.account.feignclient.other.model; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class HonorRules { |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家,5=赢家,6=次数) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 等级 |
| | | */ |
| | | private Integer level; |
| | | /** |
| | | * 满足条件值 |
| | | */ |
| | | private Integer condition; |
| | | } |
New file |
| | |
| | | package com.dsh.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.account.entity.Referee; |
| | | import com.dsh.account.model.RefereeList; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 裁判 |
| | | * @author 39373 |
| | | * @Date 2024/2/8 15:02 |
| | | */ |
| | | public interface RefereeMapper extends BaseMapper<Referee> { |
| | | |
| | | |
| | | /** |
| | | * 获取裁判管理列表数据 |
| | | * @param refereeList |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getRefereeList(@Param("item") RefereeList refereeList); |
| | | |
| | | int getRefereeListCount(@Param("item") RefereeList refereeList); |
| | | } |
New file |
| | |
| | | package com.dsh.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/1 14:26 |
| | | */ |
| | | @Data |
| | | public class RefereeList { |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | | /** |
| | | * 页条数 |
| | | */ |
| | | private Integer limit; |
| | | } |
| | |
| | | @Data |
| | | public class GongVo { |
| | | |
| | | @ApiModelProperty(value = "勋章类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家)") |
| | | @ApiModelProperty(value = "勋章类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家,5=赢家,6=次数)") |
| | | private Integer medalType; |
| | | |
| | | @ApiModelProperty(value = "勋章名称 例如:俱乐部之星") |
| | |
| | | @Data |
| | | public class StuMedalVo { |
| | | |
| | | @ApiModelProperty(value = "勋章类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家)") |
| | | @ApiModelProperty(value = "勋章类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家,5=赢家,6=次数)") |
| | | private Integer medalType; |
| | | |
| | | @ApiModelProperty(value = "勋章名称 例如:俱乐部之星") |
| | |
| | | @ApiModelProperty(value = "banners") |
| | | private UserBenefitImage image; |
| | | |
| | | @ApiModelProperty("是否是裁判(0=否,1=是)") |
| | | private Integer referee; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.account.entity.Referee; |
| | | import com.dsh.account.model.RefereeList; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author 39373 |
| | | * @Date 2024/2/8 15:03 |
| | | */ |
| | | public interface IRefereeService extends IService<Referee> { |
| | | |
| | | |
| | | /** |
| | | * 获取裁判管理列表数据 |
| | | * @param refereeList |
| | | * @return |
| | | */ |
| | | Map<String, Object> getRefereeList(RefereeList refereeList); |
| | | } |
| | |
| | | |
| | | List<GongVo> queryStuOfMedalData(Integer stuId); |
| | | |
| | | List<StuMedalVo> queryHonorDetails(Integer stuId); |
| | | List<StuMedalVo> queryHonorDetails(Integer appUserId); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.Referee; |
| | | import com.dsh.account.mapper.RefereeMapper; |
| | | import com.dsh.account.model.RefereeList; |
| | | import com.dsh.account.service.IRefereeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author 39373 |
| | | * @Date 2024/2/8 15:04 |
| | | */ |
| | | @Service |
| | | public class RefereeServiceImpl extends ServiceImpl<RefereeMapper, Referee> implements IRefereeService { |
| | | |
| | | |
| | | /** |
| | | * 获取裁判管理列表数据 |
| | | * @param refereeList |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getRefereeList(RefereeList refereeList) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> list = this.baseMapper.getRefereeList(refereeList); |
| | | int count = this.baseMapper.getRefereeListCount(refereeList); |
| | | map.put("rows", list); |
| | | map.put("total", count); |
| | | return map; |
| | | } |
| | | } |
| | |
| | | import com.dsh.account.entity.HonorRules; |
| | | import com.dsh.account.entity.StudentHonor; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.feignclient.communityWorldCup.WorldCupCompetitorClient; |
| | | import com.dsh.account.feignclient.competition.ParticipantClient; |
| | | import com.dsh.account.feignclient.course.CoursePackageClient; |
| | | import com.dsh.account.feignclient.course.model.CoursePackage; |
| | | import com.dsh.account.feignclient.other.HonorDeClient; |
| | | import com.dsh.account.feignclient.other.HonorRulesClient; |
| | | import com.dsh.account.feignclient.other.SiteClient; |
| | | import com.dsh.account.mapper.StudentHonorMapper; |
| | | import com.dsh.account.model.vo.medalDetail.GongVo; |
| | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | @Autowired |
| | | private HonorDeClient honorDeClient; |
| | | |
| | | |
| | | @Autowired |
| | | private TStudentService studentService; |
| | | |
| | | @Autowired |
| | | private HonorRulesClient honorRulesClient; |
| | | |
| | | @Resource |
| | | private WorldCupCompetitorClient worldCupCompetitorClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<GongVo> queryStuOfMedalData(Integer stuId) { |
| | |
| | | voList.add(vo); |
| | | } |
| | | |
| | | Integer count5 = worldCupCompetitorClient.winCount(stuId); |
| | | if (count5 > 0) { |
| | | GongVo vo = new GongVo(); |
| | | vo.setMedalType(5); |
| | | vo.setMedalName("赢家"); |
| | | voList.add(vo); |
| | | } |
| | | |
| | | Integer count6 = worldCupCompetitorClient.count(stuId); |
| | | if (count6 > 0) { |
| | | GongVo vo = new GongVo(); |
| | | vo.setMedalType(6); |
| | | vo.setMedalName("次数"); |
| | | voList.add(vo); |
| | | } |
| | | |
| | | return voList; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<StuMedalVo> queryHonorDetails(Integer stuId) { |
| | | List<StuMedalVo> studentHonors = new ArrayList<>(); |
| | | // List<Integer> collect = studentHonors.stream().map(StudentHonor::getHonorRuleId).collect(Collectors.toList()); |
| | | |
| | | Integer count1 = coursePackageClient.counts(stuId); |
| | | if (count1 > 0) { |
| | | public List<StuMedalVo> queryHonorDetails(Integer appUserId) { |
| | | List<StuMedalVo> list = new ArrayList<>(); |
| | | List<StudentHonor> studentHonors = this.list(new QueryWrapper<StudentHonor>().eq("appUserId", appUserId)); |
| | | for (StudentHonor studentHonor : studentHonors) { |
| | | StuMedalVo vo = new StuMedalVo(); |
| | | vo.setMedalType(1); |
| | | vo.setMedalType(studentHonor.getHonorType()); |
| | | switch (studentHonor.getHonorType()){ |
| | | case 1: |
| | | vo.setMedalName("俱乐部之星"); |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(1); |
| | | integers.add(count1); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count1 < Integer.valueOf(honorRules.getCondition())) { |
| | | vo.setLevelNum(Integer.valueOf(honorRules.getLevel()) - 1); |
| | | vo.setNextLevel(Integer.valueOf(honorRules.getLevel())); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition()) - count1)); |
| | | vo.setIsTopLevel(0); |
| | | } else { |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | } |
| | | |
| | | Integer count2 = participantClient.counts(stuId); |
| | | if (count2 > 0) { |
| | | StuMedalVo vo = new StuMedalVo(); |
| | | vo.setMedalType(2); |
| | | break; |
| | | case 2: |
| | | vo.setMedalName("运动达人"); |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(2); |
| | | integers.add(count2); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count2 < Integer.valueOf(honorRules.getCondition())) { |
| | | vo.setLevelNum(Integer.valueOf(honorRules.getLevel()) - 1); |
| | | vo.setNextLevel(Integer.valueOf(honorRules.getLevel())); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition()) - count2)); |
| | | vo.setIsTopLevel(0); |
| | | } else { |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | } |
| | | TStudent student = studentService.getById(stuId); |
| | | |
| | | Integer count3 = siteClient.counts(student.getAppUserId()); |
| | | if (count3 > 0) { |
| | | StuMedalVo vo = new StuMedalVo(); |
| | | vo.setMedalType(3); |
| | | break; |
| | | case 3: |
| | | vo.setMedalName("社区之王"); |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(3); |
| | | integers.add(count3); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count3 < Integer.valueOf(honorRules.getCondition())) { |
| | | vo.setLevelNum(Integer.valueOf(honorRules.getLevel()) - 1); |
| | | vo.setNextLevel(Integer.valueOf(honorRules.getLevel())); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition()) - count3)); |
| | | vo.setIsTopLevel(0); |
| | | } else { |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | } |
| | | |
| | | |
| | | Integer count4 = coursePackageClient.counts1(stuId); |
| | | if (count4 > 0) { |
| | | StuMedalVo vo = new StuMedalVo(); |
| | | vo.setMedalType(4); |
| | | break; |
| | | case 4: |
| | | vo.setMedalName("深度玩家"); |
| | | break; |
| | | case 5: |
| | | vo.setMedalName("赢家"); |
| | | break; |
| | | case 6: |
| | | vo.setMedalName("次数"); |
| | | break; |
| | | } |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(4); |
| | | integers.add(count4); |
| | | integers.add(studentHonor.getHonorType()); |
| | | integers.add(studentHonor.getNumber()); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count4 < Integer.valueOf(honorRules.getCondition())) { |
| | | if (studentHonor.getNumber() < Integer.valueOf(honorRules.getCondition())) { |
| | | vo.setLevelNum(Integer.valueOf(honorRules.getLevel()) - 1); |
| | | vo.setNextLevel(Integer.valueOf(honorRules.getLevel())); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition()) - count4)); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition()) - studentHonor.getNumber())); |
| | | vo.setIsTopLevel(0); |
| | | } else { |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | list.add(vo); |
| | | } |
| | | |
| | | |
| | | return studentHonors; |
| | | return list; |
| | | } |
| | | } |
| | |
| | | import com.dsh.account.model.vo.classDetails.RegisteredCourse; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.*; |
| | | import com.dsh.account.service.IRefereeService; |
| | | import com.dsh.account.service.TAppGiftService; |
| | | import com.dsh.account.service.TAppUserService; |
| | | import com.dsh.account.util.*; |
| | |
| | | @Resource |
| | | private ImgConfigClient icfgClient; |
| | | |
| | | |
| | | @Resource |
| | | private VideoOfCourseListClient voclClient; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private UserCouponPaymentClient userCouponPaymentClient; |
| | | |
| | | @Autowired |
| | | private IRefereeService refereeService; |
| | | |
| | | |
| | | |
| | |
| | | return ResultUtil.error("请先开启定位", ""); |
| | | } |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(addAppUserVo.getLon(), addAppUserVo.getLat()); |
| | | Integer num = 0; |
| | | Integer activityId = null; |
| | | if (null != geocode) { |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | // 根据所在市code 查询是否有介绍有礼活动 |
| | | IntroduceRewards res = introduceRewardsClient.getGiftList(cityCode); |
| | | List<IntroduceRewards> res = introduceRewardsClient.getGiftList(cityCode); |
| | | if (res != null) { |
| | | num = res.getGiveClass(); |
| | | activityId = res.getId(); |
| | | for (IntroduceRewards re : res) { |
| | | Integer num = re.getGiveClass(); |
| | | Integer activityId = re.getId(); |
| | | if (ToolUtil.isNotEmpty(addAppUserVo.getInvitePhone())) { |
| | | List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>() |
| | | .eq(TAppUser::getPhone, addAppUserVo.getInvitePhone())); |
| | |
| | | tAppGift.setActivityId(activityId); |
| | | tAppGift.setInsertTime(new Date()); |
| | | appGiftService.save(tAppGift); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public IndexOfUserBenefirVo queryBenefitDetails(Integer appUserId, String lon, String lat) { |
| | | IndexOfUserBenefirVo benefirVo = new IndexOfUserBenefirVo(); |
| | | |
| | | TAppUser appUser = this.getById(appUserId); |
| | | if (appUser.getHeadImg() != null) { |
| | | benefirVo.setUserHeadImg(appUser.getHeadImg()); |
| | |
| | | List<IntegralCommodity> convertibleGoods = mcClient.getConvertibleGoods(location); |
| | | benefirVo.setCommodities(convertibleGoods); |
| | | benefirVo.setImage(icfgClient.getImageConfig()); |
| | | Referee referee = refereeService.getOne(new QueryWrapper<Referee>().eq("phone", appUser.getPhone()).eq("state", 1)); |
| | | benefirVo.setReferee(null == referee ? 0 : 1); |
| | | return benefirVo; |
| | | } |
| | | |
| | |
| | | if (tAppUser.getState() == 2) { |
| | | return ResultUtil.error("您的账号已被冻结"); |
| | | } |
| | | boolean newUser = false; |
| | | List<TAppUser> tAppUsers1 = appUserMapper.selectList(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getPhone()).eq(TAppUser::getState, 1)); |
| | | if (tAppUsers1.size() > 0) { |
| | | TAppUser tAppUser1 = tAppUsers1.get(0); |
| | |
| | | appUserMapper.updateById(tAppUser); |
| | | token = getToken(tAppUser); |
| | | map.put("token", token); |
| | | |
| | | newUser = true; |
| | | } |
| | | |
| | | // tAppUser.setPhone(dto.getPhone()); |
| | | |
| | | if (ToolUtil.isNotEmpty(dto.getInvitePhone())) { |
| | | if (newUser && ToolUtil.isNotEmpty(dto.getInvitePhone())) { |
| | | if (ToolUtil.isEmpty(dto.getLat()) || ToolUtil.isEmpty(dto.getLon())) { |
| | | return ResultUtil.error("请先开启定位"); |
| | | } |
| | | TAppUser tAppUser1 = appUserMapper.selectOne(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getInvitePhone()).eq(TAppUser::getState, 1)); |
| | | if (tAppUser1 != null) { |
| | | TAppUser tAppUser1 = appUserMapper.selectOne(new LambdaQueryWrapper<TAppUser>() |
| | | .eq(TAppUser::getPhone, dto.getInvitePhone()).eq(TAppUser::getState, 1)); |
| | | if(null == tAppUser1){ |
| | | return ResultUtil.error("邀请人还未注册账号"); |
| | | } |
| | | Map<String, String> geocode = null; |
| | | try { |
| | | geocode = gdMapGeocodingUtil.geocode(dto.getLon(), dto.getLat()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Integer num = 0; |
| | | if (null != geocode) { |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | IntroduceRewards giftList = introduceRewardsClient.getGiftList(cityCode); |
| | | num = giftList.getGiveClass(); |
| | | } |
| | | Integer userId = null; |
| | | if (ToolUtil.isNotEmpty(dto.getInvitePhone())) { |
| | | List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getInvitePhone())); |
| | | if (tAppUsers.size() > 0) { |
| | | userId = tAppUsers.get(0).getId(); |
| | | } |
| | | } |
| | | if (userId != null) { |
| | | TAppGift one = appGiftService.getOne(new LambdaQueryWrapper<TAppGift>().eq(TAppGift::getUserId, userId)); |
| | | if (one != null) { |
| | | one.setNum(one.getNum() + num); |
| | | appGiftService.updateById(one); |
| | | } else { |
| | | // 根据所在市code 查询是否有介绍有礼活动 |
| | | List<IntroduceRewards> res = introduceRewardsClient.getGiftList(cityCode); |
| | | if (res != null) { |
| | | for (IntroduceRewards re : res) { |
| | | Integer num = re.getGiveClass(); |
| | | Integer activityId = re.getId(); |
| | | if (num != 0) { |
| | | TAppGift tAppGift = new TAppGift(); |
| | | tAppGift.setUserId(userId); |
| | | tAppGift.setUserName(tAppUser1.getName()); |
| | | tAppGift.setUserPhone(tAppUser1.getPhone()); |
| | | tAppGift.setUserId(tAppUser1.getId()); |
| | | tAppGift.setNum(num); |
| | | tAppGift.setShareUserId(tAppUser.getId()); |
| | | tAppGift.setShareUserName(tAppUser.getPhone()); |
| | | tAppGift.setShareUserPhone(tAppUser.getPhone()); |
| | | tAppGift.setActivityId(activityId); |
| | | tAppGift.setInsertTime(new Date()); |
| | | appGiftService.save(tAppGift); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // appUserMapper.updateById(tAppUser); |
| | | |
| | | } |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public ResultUtil addStuOfAppUser(StuDetailsReq stu, Integer appUserId) throws Exception { |
| | | TStudent student = new TStudent(); |
| | | if (ToolUtil.isNotEmpty(stu.getName()) && ToolUtil.isNotEmpty(stu.getIdCard())) { |
| | | if(ToolUtil.isEmpty(stu.getIdCard())){ |
| | | return ResultUtil.error("请填写身份证号"); |
| | | } |
| | | Boolean aBoolean = JuHeUtil.idcardAuthentication(stu.getIdCard(), stu.getName()); |
| | | if (!aBoolean) { |
| | | return ResultUtil.error("身份证和姓名不匹配"); |
| | | } |
| | | } |
| | | student.setAppUserId(appUserId); |
| | | student.setName(stu.getName()); |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.account.mapper.RefereeMapper"> |
| | | |
| | | |
| | | |
| | | <select id="getRefereeList" resultType="map"> |
| | | select |
| | | id, |
| | | name, |
| | | phone, |
| | | CONCAT(province, city) as province, |
| | | state |
| | | from t_referee where state != 3 |
| | | <if test="null != item.name and '' != item.name"> |
| | | and name like CONCAT('%', #{item.name}, '%') |
| | | </if> |
| | | <if test="null != item.phone and '' != item.phone"> |
| | | and phone like CONCAT('%', #{item.phone}, '%') |
| | | </if> |
| | | <if test="null != item.provinceCode and '' != item.provinceCode"> |
| | | and provinceCode = #{item.provinceCode} |
| | | </if> |
| | | <if test="null != item.cityCode and '' != item.cityCode"> |
| | | and provinceCode = #{cityCode} |
| | | </if> |
| | | order by createTime desc limit #{item.offset}, #{item.limit} |
| | | </select> |
| | | |
| | | |
| | | <select id="getRefereeListCount" resultType="int"> |
| | | select |
| | | count(*) |
| | | from t_referee where state != 3 |
| | | <if test="null != item.name and '' != item.name"> |
| | | and name like CONCAT('%', #{item.name}, '%') |
| | | </if> |
| | | <if test="null != item.phone and '' != item.phone"> |
| | | and phone like CONCAT('%', #{item.phone}, '%') |
| | | </if> |
| | | <if test="null != item.provinceCode and '' != item.provinceCode"> |
| | | and provinceCode = #{item.provinceCode} |
| | | </if> |
| | | <if test="null != item.cityCode and '' != item.cityCode"> |
| | | and provinceCode = #{cityCode} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | #datasource.names=master0 |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_account?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=123456 |
| | | #datasource.master0.maxActive=20 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=5 |
| | | #datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | | datasource.names=master0 |
| | | datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | datasource.master0.url=jdbc:mysql://192.168.110.80/playpai_account?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_account?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.username=root |
| | | datasource.master0.password=123456 |
| | | datasource.master0.maxActive=20 |
| | |
| | | |
| | | |
| | | |
| | | #datasource.names=master0 |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://192.168.110.80/playpai_account?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=123456 |
| | | #datasource.master0.maxActive=20 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=5 |
| | | #datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | |
| | | |
| | | @PostMapping("/base/introduce/getGiftList") |
| | | @ResponseBody |
| | | public IntroduceRewards getGiftList(@RequestBody String cityCode) { |
| | | public List<IntroduceRewards> getGiftList(@RequestBody String cityCode) { |
| | | List<IntroduceRewards> list = idrService.list(new LambdaQueryWrapper<IntroduceRewards>() |
| | | .eq(IntroduceRewards::getCityCode, cityCode) |
| | | .le(IntroduceRewards::getStartTime, new Date()) |
| | | .ge(IntroduceRewards::getEndTime, new Date()) |
| | | .eq(IntroduceRewards::getState, 1) |
| | | .orderByDesc(IntroduceRewards::getInsertTime) |
| | | .last("LIMIT 1")); |
| | | if (list.size() > 0) { |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | ); |
| | | return list; |
| | | } |
| | | |
| | | } |
| | |
| | | detailsVo.setGoodName(coursePackage.getName()); |
| | | detailsVo.setBelongsScope(merchandise.getUserPopulation()); |
| | | int coursePackageNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() |
| | | .eq("pointsMerchandiseId", merchandise.getId())); |
| | | .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | detailsVo.setRedeemedNum(coursePackageNums); |
| | | detailsVo.setResidueNum(Math.max(merchandise.getQuantityIssued() - coursePackageNums, 0)); |
| | | detailsVo.setPerLimit(merchandise.getPickUpQuantity()); |
| | |
| | | detailsVo.setGoodName(merchandise.getName()); |
| | | detailsVo.setBelongsScope(merchandise.getUserPopulation()); |
| | | int count = upmseService.count(new QueryWrapper<UserPointsMerchandise>() |
| | | .eq("pointsMerchandiseId", merchandise.getId())); |
| | | .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | detailsVo.setRedeemedNum(count); |
| | | detailsVo.setResidueNum(Math.max(merchandise.getQuantityIssued() - count, 0)); |
| | | detailsVo.setPerLimit(merchandise.getPickUpQuantity()); |
| | |
| | | detailsVo.setGoodName(coupon.getName()); |
| | | detailsVo.setBelongsScope(coupon.getUserPopulation()); |
| | | int couponNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() |
| | | .eq("pointsMerchandiseId", merchandise.getId())); |
| | | .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | detailsVo.setRedeemedNum(couponNums); |
| | | detailsVo.setResidueNum(Math.max(coupon.getQuantityIssued() - couponNums, 0)); |
| | | detailsVo.setPerLimit(coupon.getPickUpQuantity()); |
| | |
| | | detailsVo.setGoodName(coursePackage.getName()); |
| | | detailsVo.setBelongsScope(merchandise.getUserPopulation()); |
| | | int coursePackageNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() |
| | | .eq("pointsMerchandiseId", merchandise.getId())); |
| | | .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | detailsVo.setRedeemedNum(coursePackageNums); |
| | | detailsVo.setResidueNum(Math.max(merchandise.getQuantityIssued() - coursePackageNums, 0)); |
| | | detailsVo.setPerLimit(merchandise.getPickUpQuantity()); |
| | |
| | | detailsVo.setGoodName(merchandise.getName()); |
| | | detailsVo.setBelongsScope(merchandise.getUserPopulation()); |
| | | int count = upmseService.count(new QueryWrapper<UserPointsMerchandise>() |
| | | .eq("pointsMerchandiseId", merchandise.getId())); |
| | | .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | detailsVo.setRedeemedNum(count); |
| | | detailsVo.setResidueNum(Math.max(merchandise.getQuantityIssued() - count, 0)); |
| | | detailsVo.setPerLimit(merchandise.getPickUpQuantity()); |
| | |
| | | public int queryUserHasGoodsNums(@RequestBody AppUserGoodResp goodResp) { |
| | | int count = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() |
| | | .eq(UserPointsMerchandise::getUserId, goodResp.getAppUserId()) |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, goodResp.getGoodId())); |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, goodResp.getGoodId()) |
| | | .eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1)); |
| | | System.out.println(count); |
| | | return count; |
| | | } |
| | |
| | | @PostMapping("/base/pointMerchars/queryUserHasGoodsNums1") |
| | | public int queryUserHasGoodsNums1(@RequestBody AppUserGoodResp goodResp) { |
| | | int count = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, goodResp.getGoodId())); |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, goodResp.getGoodId()) |
| | | .eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1)); |
| | | System.out.println(count); |
| | | return count; |
| | | } |
| | |
| | | consumeAmount |
| | | FROM t_user_points_merchandise pm |
| | | LEFT JOIN t_points_merchandise tm ON tm.id = pm.pointsMerchandiseId |
| | | WHERE pm.pointsMerchandiseId IN( |
| | | WHERE pm.payStatus = 2 and pm.state = 1 and pm.pointsMerchandiseId IN( |
| | | SELECT id |
| | | FROM t_points_merchandise WHERE redemptionMethod IN (2,3) |
| | | |
| | |
| | | #datasource.names=master0 |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_activity?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=123456 |
| | | #datasource.master0.maxActive=20 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=5 |
| | | #datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | | datasource.names=master0 |
| | | datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | datasource.master0.url=jdbc:mysql://127.0.0.1:3306/playpai_activity?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_activity?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.username=root |
| | | datasource.master0.password=playpai2023! |
| | | datasource.master0.password=123456 |
| | | datasource.master0.maxActive=20 |
| | | datasource.master0.maxWait=60000 |
| | | datasource.master0.minIdle=5 |
| | |
| | | |
| | | |
| | | |
| | | #datasource.names=master0 |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://127.0.0.1:3306/playpai_activity?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=playpai2023! |
| | | #datasource.master0.maxActive=20 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=5 |
| | | #datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <parent> |
| | | <groupId>cn.mb.cloud</groupId> |
| | | <artifactId>mb-cloud-parent</artifactId> |
| | | <version>1.1.3</version> |
| | | <relativePath>../cloud-server-parent/pom.xml</relativePath> |
| | | </parent> |
| | | <artifactId>mb-cloud-communityWorldCup</artifactId> |
| | | <packaging>jar</packaging> |
| | | <version>${parent.version}</version> |
| | | <name>社区世界杯</name> |
| | | <description>社区世界杯</description> |
| | | <dependencies> |
| | | <!--日志处理--> |
| | | <dependency> |
| | | <groupId>cn.mb.cloud</groupId> |
| | | <artifactId>mb-cloud-common-log</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.mb.cloud</groupId> |
| | | <artifactId>mb-cloud-common-data</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.mb.cloud</groupId> |
| | | <artifactId>mb-cloud-common-api</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.mb.cloud</groupId> |
| | | <artifactId>mb-cloud-common-sentinel</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.flywaydb</groupId> |
| | | <artifactId>flyway-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | <version>2.9.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.jdom</groupId> |
| | | <artifactId>jdom</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-beanutils</groupId> |
| | | <artifactId>commons-beanutils</artifactId> |
| | | <version>1.9.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | <version>2.9.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>2.9.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpclient</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-httpclient</groupId> |
| | | <artifactId>commons-httpclient</artifactId> |
| | | <version>3.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpmime</artifactId> |
| | | <version>4.5.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.gavaghan</groupId> |
| | | <artifactId>geodesy</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.shardingsphere</groupId> |
| | | <artifactId>shardingsphere-jdbc-core</artifactId> |
| | | <version>5.2.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>dom4j</groupId> |
| | | <artifactId>dom4j</artifactId> |
| | | <version>1.6.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alipay.sdk</groupId> |
| | | <artifactId>alipay-sdk-java</artifactId> |
| | | <version>4.38.10.ALL</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <version>2.3.4.RELEASE</version> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | </plugins> |
| | | </build> |
| | | <repositories> |
| | | <repository> |
| | | <id>magic-beans-releases</id> |
| | | <url>http://maven.magic-beans.cn/nexus/content/repositories/releases/</url> |
| | | </repository> |
| | | <repository> |
| | | <id>aliyun</id> |
| | | <name>aliyun</name> |
| | | <url>https://maven.aliyun.com/repository/public</url> |
| | | </repository> |
| | | <repository> |
| | | <id>magic-beans-thirdparty</id> |
| | | <url>http://maven.magic-beans.cn/nexus/content/repositories/thirdparty/</url> |
| | | </repository> |
| | | |
| | | </repositories> |
| | | </project> |
New file |
| | |
| | | package com.dsh; |
| | | |
| | | |
| | | import cn.mb.cloud.common.core.annotation.MBCloudApplication; |
| | | import cn.mb.cloud.common.data.web.WebConfig; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.cloud.openfeign.EnableFeignClients; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Import; |
| | | import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.TimeZone; |
| | | |
| | | /** |
| | | * @author jason |
| | | */ |
| | | @EnableSwagger2 |
| | | @EnableScheduling |
| | | @EnableFeignClients |
| | | @MBCloudApplication |
| | | @Import({WebConfig.class}) |
| | | @MapperScan("com.dsh.communityWorldCup.mapper") |
| | | public class CommunityWorldCupApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(CommunityWorldCupApplication.class, args); |
| | | } |
| | | |
| | | @Bean |
| | | public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { |
| | | PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer(); |
| | | c.setIgnoreUnresolvablePlaceholders(true); |
| | | return c; |
| | | } |
| | | |
| | | @PostConstruct |
| | | void started() { |
| | | TimeZone.setDefault(TimeZone.getTimeZone("GMT+8")); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.advice; |
| | | |
| | | import cn.mb.cloud.common.core.constant.enums.ErrorCodeConstants; |
| | | import cn.mb.cloud.common.core.exception.BusinessException; |
| | | import cn.mb.cloud.common.core.util.ResponseData; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @Slf4j |
| | | @RestControllerAdvice |
| | | public class ControllerException { |
| | | |
| | | @ExceptionHandler(BusinessException.class) |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ResponseBody |
| | | public ResponseData bussiness(BusinessException e) { |
| | | log.error("业务异常 message= " + e.getMessage() + " code= " + e.getErrorCode(), e); |
| | | return ResponseData.builder().code(ErrorCodeConstants.FAIL.getValue()). |
| | | msg(e.getMessage()).build(); |
| | | } |
| | | |
| | | @ExceptionHandler(RuntimeException.class) |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ResponseBody |
| | | public ResponseData runtimeException(RuntimeException e) { |
| | | log.error("运行时异常信息" + e.getMessage(), e); |
| | | return ResponseData.builder().code(ErrorCodeConstants.FAIL.getValue()).msg(e.getMessage()).build(); |
| | | } |
| | | |
| | | /** |
| | | * 全局异常. |
| | | * |
| | | * @param e the e |
| | | * @return R |
| | | */ |
| | | |
| | | @ExceptionHandler(Exception.class) |
| | | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
| | | @ResponseBody |
| | | public ResponseData exception(Exception e) { |
| | | log.error("全局异常信息" + e.getMessage(), e); |
| | | return ResponseData.fail(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.communityWorldCup.entity.*; |
| | | import com.dsh.communityWorldCup.feignclient.account.AppUserClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | | import com.dsh.communityWorldCup.feignclient.other.SiteClient; |
| | | import com.dsh.communityWorldCup.feignclient.other.StoreClient; |
| | | import com.dsh.communityWorldCup.feignclient.other.model.Site; |
| | | import com.dsh.communityWorldCup.feignclient.other.model.Store; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import com.dsh.communityWorldCup.service.*; |
| | | import com.dsh.communityWorldCup.util.GDMapGeocodingUtil; |
| | | import com.dsh.communityWorldCup.util.PayMoneyUtil; |
| | | import com.dsh.communityWorldCup.util.ResultUtil; |
| | | import com.dsh.communityWorldCup.util.TokenUtil; |
| | | import groovy.util.logging.Log4j; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 社区世界杯 |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 17:13 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class WorldCupController { |
| | | |
| | | Logger log = LoggerFactory.getLogger(WorldCupController.class); |
| | | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | | |
| | | @Autowired |
| | | private IWorldCupService worldCupService; |
| | | |
| | | @Autowired |
| | | private IWorldCupStoreService worldCupListCoach; |
| | | |
| | | @Autowired |
| | | private IWorldCupPaymentParticipantService worldCupPaymentParticipantService; |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | |
| | | @Resource |
| | | private ParticipantClient participantClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private IWorldCupStoreService worldCupStoreService; |
| | | |
| | | @Autowired |
| | | private IWorldCupCompetitorService worldCupCompetitorService; |
| | | |
| | | @Autowired |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | |
| | | @Autowired |
| | | private IWorldCupPaymentService worldCupPaymentService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getWorldCupStore") |
| | | @ApiOperation(value = "裁判获取社区世界杯赛点列表【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<Map<String, Object>>> getWorldCupStore(){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> worldCupStore = worldCupListCoach.getWorldCupStore(); |
| | | return ResultUtil.success(worldCupStore); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getWorldCupListCoach") |
| | | @ApiOperation(value = "裁判获取社区世界杯列表【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WorldCupListCoachVo>> getWorldCupListCoach(WorldCupListCoach worldCupListCoach){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<WorldCupListCoachVo> worldCupListCoach1 = worldCupService.getWorldCupListCoach(worldCupListCoach); |
| | | return ResultUtil.success(worldCupListCoach1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getWorldCupPeople") |
| | | @ApiOperation(value = "裁判扫码获取参赛人信息【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<WorldCupPeopleVo> getWorldCupPeople(WorldCupPeople worldCupPeople){ |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = worldCupPaymentParticipantService.getById(worldCupPeople.getCode()); |
| | | if(null == worldCupPaymentParticipant){ |
| | | return ResultUtil.error("无效二维码"); |
| | | } |
| | | if(worldCupPaymentParticipant.getWorldCupId().compareTo(worldCupPeople.getWorldCupId()) != 0){ |
| | | return ResultUtil.error("报名失败,当前用户未报名当前比赛"); |
| | | } |
| | | WorldCupPeopleVo worldCupPeopleVo = new WorldCupPeopleVo(); |
| | | worldCupPeopleVo.setId(worldCupPaymentParticipant.getId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | if(worldCupPaymentParticipant.getParticipantType() == 1){ |
| | | //学员 |
| | | TStudent tStudent = studentClient.queryById(worldCupPaymentParticipant.getParticipantId()); |
| | | worldCupPeopleVo.setName(tStudent.getName()); |
| | | worldCupPeopleVo.setAge(null == tStudent.getBirthday() ? 0 : Integer.valueOf(sdf.format(new Date())) -Integer.valueOf(sdf.format(tStudent.getBirthday()))); |
| | | worldCupPeopleVo.setAvatar(tStudent.getHeadImg()); |
| | | worldCupPeopleVo.setParticipantType(1); |
| | | }else{ |
| | | AppUser appUser = appUserClient.getAppUser(worldCupPaymentParticipant.getAppUserId()); |
| | | //参赛人员 |
| | | Participant participant = participantClient.getParticipant(worldCupPaymentParticipant.getParticipantId()); |
| | | worldCupPeopleVo.setName(participant.getName()); |
| | | worldCupPeopleVo.setAge(null == participant.getBirthday() ? 0 : Integer.valueOf(sdf.format(new Date())) -Integer.valueOf(sdf.format(participant.getBirthday()))); |
| | | worldCupPeopleVo.setAvatar(appUser.getHeadImg()); |
| | | worldCupPeopleVo.setParticipantType(2); |
| | | } |
| | | return ResultUtil.success(worldCupPeopleVo); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getDeviceInformation") |
| | | @ApiOperation(value = "裁判扫码获取设备信息【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "code", value = "扫码结果", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<Map<String, String>> getDeviceInformation(String code){ |
| | | /** |
| | | * { |
| | | * "scan_type": 0, // 扫码类型:1000:游戏,1001:课程,1002:场地 |
| | | * "space_id": 0, //场地ID |
| | | * "sutu_id": 0, // 设备ID |
| | | * "id": 0 //课程/场地/游戏ID |
| | | * } |
| | | */ |
| | | JSONObject jsonObject = JSON.parseObject(code); |
| | | Integer scan_type = jsonObject.getInteger("scan_type"); |
| | | if(scan_type != 1000){ |
| | | return ResultUtil.error("二维码不正确"); |
| | | } |
| | | Integer space_id = jsonObject.getInteger("space_id"); |
| | | Site site = siteClient.getSite(space_id); |
| | | if(null == site){ |
| | | return ResultUtil.error("无法获取场地信息"); |
| | | } |
| | | Store store = storeClient.queryStoreById(site.getStoreId()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("name", store.getName()); |
| | | map.put("address", site.getName()); |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/startWorldCup") |
| | | @ApiOperation(value = "裁判开启游戏开始比赛【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil startWorldCup(StartWorldCup startWorldCup){ |
| | | return worldCupService.startWorldCup(startWorldCup); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getCompletedWorldCupTips") |
| | | @ApiOperation(value = "首页获取完成比赛的提示【2.0】", tags = {"APP-首页"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<Integer> getCompletedWorldCupTips(){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Integer tips = worldCupService.getCompletedWorldCupTips(uid); |
| | | return ResultUtil.success(tips); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getWorldCupList") |
| | | @ApiOperation(value = "获取世界杯列表【2.0】", tags = {"APP-社区世界杯"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WorldCupListVo>> getWorldCupList(WorldCupList worldCupList){ |
| | | List<WorldCupListVo> worldCupList1 = worldCupService.getWorldCupList(worldCupList); |
| | | return ResultUtil.success(worldCupList1); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getWorldCupInfo") |
| | | @ApiOperation(value = "获取世界杯详情【2.0】", tags = {"APP-社区世界杯"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "世界杯id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "lon", value = "经度", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "lat", value = "纬度", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<WorldCupInfo> getWorldCupInfo(Integer id,String lon, String lat){ |
| | | WorldCupInfo worldCupInfo = worldCupService.getWorldCupInfo(id, lon, lat); |
| | | return ResultUtil.success(worldCupInfo); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/checkPaymentMethod") |
| | | @ApiOperation(value = "世界杯报名前校验支付方式【2.0】", tags = {"APP-社区世界杯"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<CheckPaymentMethodVo> checkPaymentMethod(CheckPaymentMethod checkPaymentMethod){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.success(); |
| | | } |
| | | checkPaymentMethod.setUid(uid); |
| | | CheckPaymentMethodVo checkPaymentMethodVo = worldCupService.checkPaymentMethod(checkPaymentMethod); |
| | | return ResultUtil.success(checkPaymentMethodVo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/paymentWorldCup") |
| | | @ApiOperation(value = "世界杯报名【2.0】", tags = {"APP-社区世界杯"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil paymentWorldCup(PaymentWorldCup paymentWorldCup){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.success(); |
| | | } |
| | | paymentWorldCup.setUid(uid); |
| | | return worldCupService.paymentWorldCup(paymentWorldCup); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信支付回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/worldCup/wxPayWorldCupCallback") |
| | | public void wxPayWorldCupCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if(null != map){ |
| | | String code = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | String result = map.get("result"); |
| | | ResultUtil resultUtil = worldCupService.paymentWorldCupCallback(code, transaction_id); |
| | | if(resultUtil.getCode() == 200){ |
| | | PrintWriter out = response.getWriter(); |
| | | out.println(result); |
| | | out.flush(); |
| | | out.close(); |
| | | }else{ |
| | | log.error("社区世界杯报名微信支付回业务处理异常:" + resultUtil.getMsg()); |
| | | } |
| | | }else{ |
| | | log.error("社区世界杯报名微信支付回调解析异常"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝支付回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/worldCup/aliPayWorldCupCallback") |
| | | public void aliPayWorldCupCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if(null != map){ |
| | | String code = map.get("out_trade_no"); |
| | | String transaction_id = map.get("trade_no"); |
| | | String result = map.get("result"); |
| | | ResultUtil resultUtil = worldCupService.paymentWorldCupCallback(code, transaction_id); |
| | | if(resultUtil.getCode() == 200){ |
| | | PrintWriter out = response.getWriter(); |
| | | out.println(result); |
| | | out.flush(); |
| | | out.close(); |
| | | }else{ |
| | | log.error("社区世界杯报名支付宝支付回业务处理异常:" + resultUtil.getMsg()); |
| | | } |
| | | }else{ |
| | | log.error("社区世界杯报名付宝支支付回调解析异常"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据店铺id获取有效的世界杯 |
| | | * @param storeId |
| | | * @return |
| | | */ |
| | | @PostMapping("/worldCup/getWorldCupStoreList") |
| | | public List<WorldCupStore> getWorldCupStoreList(@RequestBody Integer storeId){ |
| | | List<WorldCup> worldCupList = worldCupService.list(new QueryWrapper<WorldCup>().in("status", Arrays.asList(1, 2))); |
| | | List<Integer> collect = worldCupList.stream().map(WorldCup::getId).collect(Collectors.toList()); |
| | | return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId).in("worldCupId", collect)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getEntrantRank") |
| | | @ApiOperation(value = "获取世界杯排名【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<EntrantRankVo> getEntrantRank(EntrantRank entrantRank){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.success(); |
| | | } |
| | | entrantRank.setAppUserId(uid); |
| | | EntrantRankVo entrantRank1 = worldCupCompetitorService.getEntrantRank(entrantRank); |
| | | return ResultUtil.success(entrantRank1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getMyWorldCupList") |
| | | @ApiOperation(value = "获取报名的世界杯列表【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WorldCupListVo>> getMyWorldCupList(MyWorldCupList myWorldCupList){ |
| | | List<WorldCupListVo> myWorldCupList1 = worldCupPaymentParticipantService.getMyWorldCupList(myWorldCupList); |
| | | return ResultUtil.success(myWorldCupList1); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getParticipant") |
| | | @ApiOperation(value = "获取已报名的参赛人员【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<ParticipantVo>> getParticipant(){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<ParticipantVo> participant = worldCupPaymentParticipantService.getParticipant(uid); |
| | | return ResultUtil.success(participant); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getMyWorldCupInfo") |
| | | @ApiOperation(value = "获取已报名世界杯详情【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "列表中的id", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "lon", value = "经度", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "lat", value = "纬度", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<MyWorldCupInfo> getMyWorldCupInfo(String id, String lon, String lat){ |
| | | MyWorldCupInfo myWorldCupInfo = worldCupPaymentParticipantService.getMyWorldCupInfo(id, lon, lat); |
| | | return ResultUtil.success(myWorldCupInfo); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getWorldCupMatchRecord") |
| | | @ApiOperation(value = "获取比赛记录【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<MatchRecordVo> getWorldCupMatchRecord(MatchRecord matchRecord){ |
| | | MatchRecordVo matchRecord1 = worldCupCompetitorService.getMatchRecord(matchRecord); |
| | | return ResultUtil.success(matchRecord1); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getWorldCupRank") |
| | | @ApiOperation(value = "获取比赛排名【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WorldCupRankVo>> getWorldCupRank(WorldCupRank worldCupRank){ |
| | | List<WorldCupRankVo> worldCupRank1 = worldCupCompetitorService.getWorldCupRank(worldCupRank); |
| | | return ResultUtil.success(worldCupRank1); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取学员参与数量 |
| | | * @param studentId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/count") |
| | | public Integer count(@RequestBody Integer studentId){ |
| | | return worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>() |
| | | .eq("participantId", studentId).eq("participantType", 1)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取学员世界杯胜利次数 |
| | | * @param studentId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/winCount") |
| | | public Integer winCount(@RequestBody Integer studentId){ |
| | | return worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>() |
| | | .eq("participantId", studentId).eq("participantType", 1).eq("matchResult", 1)); |
| | | } |
| | | |
| | | /** |
| | | * 获取比赛管理列表数据 |
| | | * @param worldCupListAll |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/getWorldCupListAll") |
| | | public Map<String, Object> getWorldCupListAll(@RequestBody WorldCupListAll worldCupListAll){ |
| | | return worldCupService.getWorldCupListAll(worldCupListAll); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加社区世界杯 |
| | | * @param worldCup |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/addWorldCup") |
| | | public Integer addWorldCup(@RequestBody WorldCup worldCup){ |
| | | String lon = worldCup.getLon(); |
| | | String lat = worldCup.getLat(); |
| | | Map<String, String> geocode = null; |
| | | try { |
| | | geocode = gdMapGeocodingUtil.geocode(lon, lat); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | worldCup.setProvince(province.replace("省", "")); |
| | | worldCup.setProvinceCode(provinceCode); |
| | | worldCup.setCity(city.replace("市", "")); |
| | | worldCup.setCityCode(cityCode); |
| | | worldCupService.save(worldCup); |
| | | return worldCup.getId(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加社区世界杯和门店关系数据 |
| | | * @param worldCupStore |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/addWorldCupStore") |
| | | public void addWorldCupStore(@RequestBody WorldCupStore worldCupStore){ |
| | | worldCupStoreService.save(worldCupStore); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 编辑社区世界杯 |
| | | * @param worldCup |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/editWorldCup") |
| | | public Integer editWorldCup(@RequestBody WorldCup worldCup){ |
| | | String lon = worldCup.getLon(); |
| | | String lat = worldCup.getLat(); |
| | | Map<String, String> geocode = null; |
| | | try { |
| | | geocode = gdMapGeocodingUtil.geocode(lon, lat); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | worldCup.setProvince(province.replace("省", "")); |
| | | worldCup.setProvinceCode(provinceCode); |
| | | worldCup.setCity(city.replace("市", "")); |
| | | worldCup.setCityCode(cityCode); |
| | | worldCupService.updateById(worldCup); |
| | | return worldCup.getId(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除世界杯门店关系数据 |
| | | * @param worldCupId |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/delWorldCupStore") |
| | | public void delWorldCupStore(@RequestBody Integer worldCupId){ |
| | | worldCupStoreService.remove(new QueryWrapper<WorldCupStore>().eq("worldCupId", worldCupId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取世界杯赛事数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/getWorldCupById") |
| | | public WorldCup getWorldCupById(@RequestBody Integer id){ |
| | | return worldCupService.getById(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据世界杯id获取门店关系数据 |
| | | * @param worldCupId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/getWorldCupStoreAllList") |
| | | public List<WorldCupStore> getWorldCupStoreAllList(@RequestBody Integer worldCupId){ |
| | | return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("worldCupId", worldCupId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消赛事退款操作 |
| | | * @param id |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/cancelWorldCupRefund") |
| | | public void cancelWorldCupRefund(@RequestBody Integer id){ |
| | | worldCupService.cancelWorldCupRefund(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 游戏结束后的通知回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/worldCup/endWorldCupCallback") |
| | | public void endWorldCupCallback(String custom, Integer red_score, Integer blue){ |
| | | worldCupCompetitorService.endWorldCupCallback(custom, red_score, blue); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消赛事后微信退款回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/worldCup/wxRefundWorldCupCallback") |
| | | public void wxRefundWorldCupCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | Map<String, String> map = payMoneyUtil.wxRefundCallback(request); |
| | | if(null != map){ |
| | | String refund_id = map.get("refund_id"); |
| | | String out_refund_no = map.get("out_refund_no"); |
| | | String result = map.get("result"); |
| | | WorldCupPayment worldCupPayment = worldCupPaymentService.getOne(new QueryWrapper<WorldCupPayment>().eq("code", out_refund_no)); |
| | | worldCupPayment.setRefundOrderNo(refund_id); |
| | | worldCupPayment.setRefundTime(new Date()); |
| | | worldCupPayment.setPayStatus(3); |
| | | worldCupPaymentService.updateById(worldCupPayment); |
| | | PrintWriter out = null; |
| | | try { |
| | | out = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | out.println(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取已报名人员列表 |
| | | * @param registeredPersonnel |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/getRegisteredPersonnel") |
| | | public Map<String, Object> getRegisteredPersonnel(@RequestBody RegisteredPersonnel registeredPersonnel){ |
| | | return worldCupPaymentParticipantService.getRegisteredPersonnel(registeredPersonnel); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 社区世界杯 |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 16:58 |
| | | */ |
| | | @Data |
| | | @TableName("t_world_cup") |
| | | public class WorldCup { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("startTime") |
| | | private Date startTime; |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("endTime") |
| | | private Date endTime; |
| | | /** |
| | | * 报名结束时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("registrationClosingTime") |
| | | private Date registrationClosingTime; |
| | | /** |
| | | * 开始年龄 |
| | | */ |
| | | @TableField("startAge") |
| | | private Integer startAge; |
| | | /** |
| | | * 结束年龄 |
| | | */ |
| | | @TableField("endAge") |
| | | private Integer endAge; |
| | | /** |
| | | * 报名性别(0=全部,1=男,2=女) |
| | | */ |
| | | @TableField("gender") |
| | | private Integer gender; |
| | | /** |
| | | * 支付方式(1=免费,2=现金支付,3=玩湃币支付,4=课时支付) |
| | | */ |
| | | @TableField("payType") |
| | | private String payType; |
| | | /** |
| | | * 现金 |
| | | */ |
| | | @TableField("cash") |
| | | private BigDecimal cash; |
| | | /** |
| | | * 玩湃币 |
| | | */ |
| | | @TableField("paiCoin") |
| | | private Integer paiCoin; |
| | | /** |
| | | * 课时 |
| | | */ |
| | | @TableField("classHour") |
| | | private Integer classHour; |
| | | /** |
| | | * 最多报名人数 |
| | | */ |
| | | @TableField("maxPeople") |
| | | private Integer maxPeople; |
| | | /** |
| | | * 基础报名人数 |
| | | */ |
| | | @TableField("basePeople") |
| | | private Integer basePeople; |
| | | /** |
| | | * 参赛获得积分 |
| | | */ |
| | | @TableField("participationIntegral") |
| | | private Integer participationIntegral; |
| | | /** |
| | | * 胜利获得积分 |
| | | */ |
| | | @TableField("winIntegral") |
| | | private Integer winIntegral; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 参赛地址 |
| | | */ |
| | | @TableField("address") |
| | | private String address; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @TableField("lon") |
| | | private String lon; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @TableField("lat") |
| | | private String lat; |
| | | /** |
| | | * 封面图 |
| | | */ |
| | | @TableField("coverImg") |
| | | private String coverImg; |
| | | /** |
| | | * 首页默认背景图 |
| | | */ |
| | | @TableField("homeBackdropImg") |
| | | private String homeBackdropImg; |
| | | /** |
| | | * 比赛图片 |
| | | */ |
| | | @TableField("infoImg") |
| | | private String infoImg; |
| | | /** |
| | | * 比赛简介 |
| | | */ |
| | | @TableField("intro") |
| | | private String intro; |
| | | /** |
| | | * 比赛详情 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 已比赛次数 |
| | | */ |
| | | @TableField("matchNumber") |
| | | private Integer matchNumber; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 15:35 |
| | | */ |
| | | @Data |
| | | @TableName("t_world_cup_competitor") |
| | | public class WorldCupCompetitor { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | /** |
| | | * 参赛编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 世界杯id |
| | | */ |
| | | @TableField("worldCupId") |
| | | private Integer worldCupId; |
| | | /** |
| | | * 参赛人员类型(1=学员,2=参赛人) |
| | | */ |
| | | @TableField("participantType") |
| | | private Integer participantType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 参赛人id |
| | | */ |
| | | @TableField("participantId") |
| | | private Integer participantId; |
| | | /** |
| | | * 参赛方(1=蓝方,2=红方) |
| | | */ |
| | | @TableField("participant") |
| | | private Integer participant; |
| | | /** |
| | | * 比赛结果(1=胜,-1=负) |
| | | */ |
| | | @TableField("matchResult") |
| | | private Integer matchResult; |
| | | /** |
| | | * 我方分数 |
| | | */ |
| | | @TableField("ourScore") |
| | | private Integer ourScore; |
| | | /** |
| | | * 对手分数 |
| | | */ |
| | | @TableField("opponentScore") |
| | | private Integer opponentScore; |
| | | /** |
| | | * 参赛奖励 |
| | | */ |
| | | @TableField("participationIntegral") |
| | | private Integer participationIntegral; |
| | | /** |
| | | * 胜利奖励 |
| | | */ |
| | | @TableField("winIntegral") |
| | | private Integer winIntegral; |
| | | /** |
| | | * 比赛开始时间 |
| | | */ |
| | | @TableField("startTime") |
| | | private Date startTime; |
| | | /** |
| | | * 比赛结束时间 |
| | | */ |
| | | @TableField("endTime") |
| | | private Date endTime; |
| | | /** |
| | | * 提示状态(0=否,1=是) |
| | | */ |
| | | @TableField("tips") |
| | | private Integer tips; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 14:15 |
| | | */ |
| | | @Data |
| | | @TableName("t_world_cup_payment") |
| | | public class WorldCupPayment { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | /** |
| | | * 支付流水号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 世界杯id |
| | | */ |
| | | @TableField("worldCupId") |
| | | private Integer worldCupId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 支付方式(0=免费,1=微信,2=支付宝,3=玩湃币,4=课时) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 支付单价 |
| | | */ |
| | | @TableField("unitPrice") |
| | | private BigDecimal unitPrice; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @TableField("amount") |
| | | private BigDecimal amount; |
| | | /** |
| | | * 支付状态(1=待支付,2=已支付,3=已退款) |
| | | */ |
| | | @TableField("payStatus") |
| | | private Integer payStatus; |
| | | /** |
| | | * 支付时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 第三方支付流水号 |
| | | */ |
| | | @TableField("payOrderNo") |
| | | private String payOrderNo; |
| | | /** |
| | | * 退款时间 |
| | | */ |
| | | @TableField("refundTime") |
| | | private Date refundTime; |
| | | /** |
| | | * 第三方退款流水号 |
| | | */ |
| | | @TableField("refundOrderNo") |
| | | private String refundOrderNo; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 参赛人数据 |
| | | */ |
| | | @TableField("entrant") |
| | | private String entrant; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 11:03 |
| | | */ |
| | | @Data |
| | | @TableName("t_world_cup_payment_participant") |
| | | public class WorldCupPaymentParticipant { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | /** |
| | | * 世界杯id |
| | | */ |
| | | @TableField("worldCupId") |
| | | private Integer worldCupId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 支付记录id |
| | | */ |
| | | @TableField("worldCupPaymentId") |
| | | private Long worldCupPaymentId; |
| | | /** |
| | | * 参赛人员类型(1=学员,2=参赛人) |
| | | */ |
| | | @TableField("participantType") |
| | | private Integer participantType; |
| | | /** |
| | | * 参赛人员id |
| | | */ |
| | | @TableField("participantId") |
| | | private Integer participantId; |
| | | /** |
| | | * 是否已参赛(0=否,1=是) |
| | | */ |
| | | @TableField("alreadyEntered") |
| | | private Integer alreadyEntered; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | /** |
| | | * 课时支付存储的数据 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 社区世界杯门店 |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 18:06 |
| | | */ |
| | | @Data |
| | | @TableName("t_world_cup_store") |
| | | public class WorldCupStore { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 世界杯id |
| | | */ |
| | | @TableField("worldCupId") |
| | | private Integer worldCupId; |
| | | /** |
| | | * 门店id |
| | | */ |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | /** |
| | | * 是否开启世界杯按钮(0=否,1=是) |
| | | */ |
| | | @TableField("isOpen") |
| | | private Integer isOpen; |
| | | /** |
| | | * 世界杯入口背景图 |
| | | */ |
| | | @TableField("backgroundImage") |
| | | private String backgroundImage; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient; |
| | | |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.model.GetStuSourseList; |
| | | import com.dsh.communityWorldCup.feignclient.model.PurchaseRecordVo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | @FeignClient(value = "mb-cloud-competition") |
| | | public interface DeductionCompetitionsClient { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.account; |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/29 14:09 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface AppUserClient { |
| | | |
| | | /** |
| | | * 根据用户id获取用户信息 |
| | | * |
| | | * @param appUserId |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/appUser/queryAppUser") |
| | | AppUser queryAppUser(Integer appUserId); |
| | | |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | | * |
| | | * @param appUser |
| | | */ |
| | | @PostMapping("/base/appUser/updateAppUser") |
| | | void updateAppUser(AppUser appUser); |
| | | |
| | | @PostMapping("/base/appUser/getAllUser") |
| | | List<AppUser> getAllUser(); |
| | | |
| | | |
| | | @PostMapping("/base/appUser/queryAppUser1") |
| | | AppUser getAppUser(Integer appUserId); |
| | | |
| | | |
| | | /** |
| | | * 根据城市code获取用户的id集合 |
| | | * @param cityCode 城市code |
| | | * @return |
| | | */ |
| | | @PostMapping("/appUser/getAppUserIds") |
| | | List<Integer> getAppUserIds(String cityCode); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.account; |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.account.model.Student; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/10 9:59 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface StudentClient { |
| | | |
| | | @PostMapping("/base/appUser/updateTStudent") |
| | | void updateAppUser(TStudent student); |
| | | |
| | | /** |
| | | * 根据电话号码获取学员 |
| | | * |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @PostMapping("/student/queryStudentByPhone") |
| | | Student queryStudentByPhone(String phone); |
| | | |
| | | |
| | | @PostMapping("/student/queryStudentList") |
| | | List<TStudent> queryStudentList(@RequestBody Integer appUserId); |
| | | |
| | | @PostMapping("/student/queryById") |
| | | TStudent queryById(Integer id); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.account.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/29 14:09 |
| | | */ |
| | | @Data |
| | | public class AppUser { |
| | | private Integer id; |
| | | /** |
| | | * 编号 |
| | | */ |
| | | private String code; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String password; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | private Integer gender; |
| | | /** |
| | | * 身高 |
| | | */ |
| | | private Double height; |
| | | /** |
| | | * 体重 |
| | | */ |
| | | private Double weight; |
| | | /** |
| | | * bmi健康值 |
| | | */ |
| | | private Double bmi; |
| | | /** |
| | | * 身份证号 |
| | | */ |
| | | private String idCard; |
| | | /** |
| | | * 微信openid |
| | | */ |
| | | private String openid; |
| | | /** |
| | | * 省 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 是否是年度会员(0=否,1=是) |
| | | */ |
| | | private Integer isVip; |
| | | /** |
| | | * 会员有效期 |
| | | */ |
| | | private Date vipEndTime; |
| | | /** |
| | | * 会员等级id |
| | | */ |
| | | private Integer viplevelId; |
| | | /** |
| | | * 推荐用户id |
| | | */ |
| | | private Integer referralUserId; |
| | | /** |
| | | * 销售员id |
| | | */ |
| | | private Integer salesmanUserId; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 剩余积分 |
| | | */ |
| | | private Integer integral; |
| | | /** |
| | | * 玩湃币 |
| | | */ |
| | | private Integer playPaiCoins; |
| | | /** |
| | | * 用户头像 |
| | | */ |
| | | private String headImg; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.account.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/4 23:39 |
| | | */ |
| | | @Data |
| | | public class Student { |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 学员姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 学员电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | private Integer sex; |
| | | /** |
| | | * 身高 |
| | | */ |
| | | private Double height; |
| | | /** |
| | | * 体重 |
| | | */ |
| | | private Double weight; |
| | | /** |
| | | * bmi健康值 |
| | | */ |
| | | private Double bmi; |
| | | /** |
| | | * 身份证号 |
| | | */ |
| | | private String idCard; |
| | | /** |
| | | * 体侧表 |
| | | */ |
| | | private String lateralSurface; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | /** |
| | | * 头像 |
| | | */ |
| | | private String headImg; |
| | | /** |
| | | * 是否默认 1默认 2不是默认 |
| | | */ |
| | | private Integer isDefault; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.account.model; |
| | | |
| | | import java.util.Date; |
| | | import java.io.Serializable; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 学员信息 |
| | | * </p> |
| | | * |
| | | * @author administrator |
| | | * @since 2023-06-14 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_student") |
| | | public class TStudent { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 学员姓名 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 学员电话 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | @TableField("birthday") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | @TableField("sex") |
| | | private Integer sex; |
| | | /** |
| | | * 身高 |
| | | */ |
| | | @TableField("height") |
| | | private Double height; |
| | | /** |
| | | * 体重 |
| | | */ |
| | | @TableField("weight") |
| | | private Double weight; |
| | | /** |
| | | * bmi健康值 |
| | | */ |
| | | @TableField("bmi") |
| | | private Double bmi; |
| | | /** |
| | | * 身份证号 |
| | | */ |
| | | @TableField("idCard") |
| | | private String idCard; |
| | | /** |
| | | * 体侧表 |
| | | */ |
| | | @TableField("lateralSurface") |
| | | private String lateralSurface; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | /** |
| | | * 头像 |
| | | */ |
| | | @TableField("headImg") |
| | | private String headImg; |
| | | /** |
| | | * 是否默认 1默认 2不是默认 |
| | | */ |
| | | @TableField("isDefault") |
| | | private Integer isDefault; |
| | | |
| | | |
| | | private String image1; |
| | | |
| | | private String image2; |
| | | private String image3; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.competition; |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 11:21 |
| | | */ |
| | | @FeignClient("mb-cloud-competition") |
| | | public interface ParticipantClient { |
| | | |
| | | |
| | | /** |
| | | * 获取参赛人员信息 |
| | | * @param id 参赛人员id |
| | | * @return |
| | | */ |
| | | @PostMapping("/participant/getParticipant") |
| | | Participant getParticipant(Integer id); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.competition.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/6 16:46 |
| | | */ |
| | | @Data |
| | | public class Participant { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | private Integer gender; |
| | | /** |
| | | * 身高(CM) |
| | | */ |
| | | private Integer height; |
| | | /** |
| | | * 体重(KG) |
| | | */ |
| | | private Double weight; |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 身份证号码 |
| | | */ |
| | | private String idcard; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.course; |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.course.model.CoursePackageOrderStudent; |
| | | import com.dsh.communityWorldCup.model.DeductionClassHour; |
| | | import com.dsh.communityWorldCup.model.DeductionClassHourList; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 15:26 |
| | | */ |
| | | @FeignClient("mb-cloud-course") |
| | | public interface CoursePackageOrderStudentClient { |
| | | |
| | | |
| | | /** |
| | | * 根据学院id获取剩余有效课时数据 |
| | | * @param studentId |
| | | * @return |
| | | */ |
| | | @PostMapping("/coursePackageOrderStudent/getCoursePackageOrderStudent") |
| | | List<CoursePackageOrderStudent> getCoursePackageOrderStudent(Integer studentId); |
| | | |
| | | |
| | | /** |
| | | * 扣减学员课时 |
| | | * @param deductionClassHourList |
| | | */ |
| | | @PostMapping("/coursePackageOrderStudent/deductionClassHour") |
| | | DeductionClassHourList deductionClassHour(DeductionClassHourList deductionClassHourList); |
| | | |
| | | |
| | | /** |
| | | * 回退课时后添加排课记录 |
| | | * @param deductionClassHourList |
| | | */ |
| | | @PostMapping("/coursePackageOrderStudent/backspaceClassHour") |
| | | void backspaceClassHour(DeductionClassHourList deductionClassHourList); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.course; |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.course.model.PaymentDeductionClassHour; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/10 9:54 |
| | | */ |
| | | @FeignClient("mb-cloud-course") |
| | | public interface CoursePackagePaymentClient { |
| | | |
| | | |
| | | /** |
| | | * 获取学员剩余课时 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/coursePackagePayment/queryResidueClassHour") |
| | | Integer queryResidueClassHour(Integer id); |
| | | |
| | | |
| | | @PostMapping("/coursePackagePayment/queryResidueClassHourById") |
| | | Integer queryResidueClassHourById(Long id); |
| | | |
| | | |
| | | /** |
| | | * 支付扣减学员课时 |
| | | */ |
| | | @PostMapping("/coursePackagePayment/paymentDeductionClassHour") |
| | | void paymentDeductionClassHour(PaymentDeductionClassHour paymentDeductionClassHour); |
| | | |
| | | |
| | | /** |
| | | * 取消报名赛事后回退学员课时 |
| | | * |
| | | * @param paymentDeductionClassHour |
| | | */ |
| | | @PostMapping("/coursePackagePayment/rollbackPaymentDeductionClassHour") |
| | | void rollbackPaymentDeductionClassHour(PaymentDeductionClassHour paymentDeductionClassHour); |
| | | |
| | | |
| | | @PostMapping("/coursePackagePayment/isHave") |
| | | Integer isHave(String ids); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.course.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/11/25 11:59 |
| | | */ |
| | | @Data |
| | | public class CoursePackageOrderStudent { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Long id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 学员id |
| | | */ |
| | | private Integer studentId; |
| | | /** |
| | | * 课包id |
| | | */ |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 总课时 |
| | | */ |
| | | private Integer totalClassHours; |
| | | /** |
| | | * 剩余课时 |
| | | */ |
| | | private Integer laveClassHours; |
| | | /** |
| | | * 缺课次数 |
| | | */ |
| | | private Integer absencesNumber; |
| | | /** |
| | | * 退课课时 |
| | | */ |
| | | private Integer dropoutsNumber; |
| | | /** |
| | | * 课程状态(1=正常,2=已退课) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 退课时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date withdrawalTime; |
| | | /** |
| | | * 退课凭证 |
| | | */ |
| | | private String certificate; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | /** |
| | | * 赠送课时 |
| | | */ |
| | | private Integer giftClassHours; |
| | | /** |
| | | * 课程有效期 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date useTime; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.course.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/10 15:05 |
| | | */ |
| | | @Data |
| | | public class PaymentDeductionClassHour { |
| | | /** |
| | | * 学员id |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 扣减课时 |
| | | */ |
| | | private Integer classHour; |
| | | /** |
| | | * 支付编号 |
| | | */ |
| | | private String code; |
| | | /** |
| | | * 用于支付的课程 |
| | | */ |
| | | private Long courseId; |
| | | private Integer uid; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.model; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class BillingDataRequestVo { |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | private String monthStart = null; |
| | | |
| | | @ApiModelProperty(value = "结束时间时间") |
| | | private String monthEnd = null; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Integer appUserId; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.model; |
| | | |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class BillingRequest { |
| | | /** |
| | | * MM-dd HH:mm |
| | | */ |
| | | private String time; |
| | | /** |
| | | * 金额 |
| | | */ |
| | | private double amount; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.model; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class BillingRequestVo { |
| | | |
| | | List<BillingRequest> requests; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CompetitionUser { |
| | | private String name; |
| | | |
| | | private Integer sex; |
| | | |
| | | private String phone; |
| | | private String idCard; |
| | | private Integer state; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.model; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class GetPeopleQuery { |
| | | private long limit; |
| | | private long offset; |
| | | private Integer id; |
| | | private Integer state; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/6 9:59 |
| | | */ |
| | | @Data |
| | | public class GetStuSourseList { |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | private Integer appUserId; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.model; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class ListQuery { |
| | | private long limit; |
| | | |
| | | private long offset; |
| | | |
| | | private String provinceCode; |
| | | private String cityCode; |
| | | private String eventName; |
| | | private String time; |
| | | private Integer state; |
| | | private Integer registerCondition; |
| | | private List<Integer> ids; |
| | | // 角色类型 如果是平台1的话 查询审核通过的 如果是运营商查询所有属于 |
| | | private Integer obj; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 类型实体类: |
| | | * 类型:购买课包、消课、报名赛事、介绍有礼 |
| | | */ |
| | | |
| | | @Data |
| | | public class PurchaseRecordVo { |
| | | |
| | | @ApiModelProperty(value = "类型名称") |
| | | private String purchaseType; |
| | | |
| | | @ApiModelProperty(value = "类型变动时间") |
| | | private String purchaseTime; |
| | | |
| | | @ApiModelProperty(value = "类型涉及金额") |
| | | private String purchaseAmount; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.other; |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.other.model.TGame; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/5 10:39 |
| | | */ |
| | | @FeignClient("mb-cloud-other") |
| | | public interface GameClient { |
| | | |
| | | /** |
| | | * 根据suduid获取游戏数据 |
| | | * @param sutuId |
| | | * @return |
| | | */ |
| | | @PostMapping("/api/game/getTGameBySutuId") |
| | | TGame getTGameBySutuId(String sutuId); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.other; |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.other.model.Site; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 15:13 |
| | | */ |
| | | @FeignClient("mb-cloud-other") |
| | | public interface SiteClient { |
| | | |
| | | |
| | | /** |
| | | * 根据id获取场地信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/site/listById") |
| | | Site getSite(Integer id); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.other; |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.other.model.Store; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/29 10:09 |
| | | */ |
| | | @FeignClient("mb-cloud-other") |
| | | public interface StoreClient { |
| | | /** |
| | | * 根据门店id获取门店信息 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/store/queryStoreById") |
| | | Store queryStoreById(Integer id); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.other.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/13 15:57 |
| | | */ |
| | | @Data |
| | | public class Site { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 门店id |
| | | */ |
| | | private Integer storeId; |
| | | /** |
| | | * 场地名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 场地类型id |
| | | */ |
| | | private Integer siteTypeId; |
| | | /** |
| | | * 城市管理员id |
| | | */ |
| | | private Integer cityManagerId; |
| | | /** |
| | | * 省 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 是否可预约(0=否,1=是) |
| | | */ |
| | | private Integer isCanBeBooked; |
| | | /** |
| | | * 预约开始时间 |
| | | */ |
| | | private String appointmentStartTime; |
| | | /** |
| | | * 预约结束时间 |
| | | */ |
| | | private String appointmentEndTime; |
| | | /** |
| | | * 现金价格(x/半小时) |
| | | */ |
| | | private Double cashPrice; |
| | | /** |
| | | * 玩湃币价格(x/半小时) |
| | | */ |
| | | private Integer playPaiCoin; |
| | | /** |
| | | * 场地责任险有效期 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date insuranceEndTime; |
| | | /** |
| | | * 场地责任险图片 |
| | | */ |
| | | private String insuranceImg; |
| | | /** |
| | | * 消防应急管理方案 |
| | | */ |
| | | private String managementPlan; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | private Integer operatorId; |
| | | private String typeName; |
| | | private String imgs; |
| | | private String introduce; |
| | | private Integer ishalf; |
| | | private String nextName; |
| | | private String halfName; |
| | | private Double cashPriceOne; |
| | | private Double playPaiCoinOne; |
| | | private String ids; |
| | | private Integer sign; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.other.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/29 10:09 |
| | | */ |
| | | @Data |
| | | public class Store { |
| | | private Integer id; |
| | | /** |
| | | * 门店名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 门店店长id |
| | | */ |
| | | private Integer storeStaffId; |
| | | /** |
| | | * 城市管理员id |
| | | */ |
| | | private Integer cityManagerId; |
| | | /** |
| | | * 省 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 详细地址 |
| | | */ |
| | | private String address; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private String lat; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private String lon; |
| | | /** |
| | | * 营业开始时间 |
| | | */ |
| | | private String startTime; |
| | | /** |
| | | * 营业结束时间 |
| | | */ |
| | | private String endTime; |
| | | /** |
| | | * 封面图 |
| | | */ |
| | | private String coverDrawing; |
| | | /** |
| | | * 实景图 |
| | | */ |
| | | private String realPicture; |
| | | /** |
| | | * 门店介绍 |
| | | */ |
| | | private String introduce; |
| | | /** |
| | | * 福利图片 |
| | | */ |
| | | private String welfarePicture; |
| | | /** |
| | | * 评分 |
| | | */ |
| | | private BigDecimal score; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.feignclient.other.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 智慧球场 |
| | | * </p> |
| | | * |
| | | * @author administrator |
| | | * @since 2023-09-18 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_game") |
| | | public class TGame extends Model<TGame> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 运营商id 0为平台 |
| | | */ |
| | | @TableField("operationId") |
| | | private Integer operationId; |
| | | |
| | | /** |
| | | * 省 |
| | | */ |
| | | private String province; |
| | | |
| | | /** |
| | | * 省code |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | |
| | | /** |
| | | * 市 |
| | | */ |
| | | private String city; |
| | | |
| | | /** |
| | | * 市code |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | |
| | | /** |
| | | * 门店id |
| | | */ |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | /** |
| | | * 场地id |
| | | */ |
| | | @TableField("siteId") |
| | | private Integer siteId; |
| | | |
| | | /** |
| | | * 蓝色方id |
| | | */ |
| | | private String blue; |
| | | |
| | | /** |
| | | * 红方id |
| | | */ |
| | | private String red; |
| | | |
| | | private Integer state; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.communityWorldCup.entity.WorldCupCompetitor; |
| | | import com.dsh.communityWorldCup.model.MatchRecord; |
| | | import com.dsh.communityWorldCup.model.MatchRecordList; |
| | | import com.dsh.communityWorldCup.model.WorldCupRank; |
| | | import com.dsh.communityWorldCup.model.WorldCupRankVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 15:45 |
| | | */ |
| | | public interface WorldCupCompetitorMapper extends BaseMapper<WorldCupCompetitor> { |
| | | |
| | | /** |
| | | * 获取参赛次数排名 |
| | | * @param appUserIds |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getNumberOfGamesRanked(@Param("appUserIds") List<Integer> appUserIds); |
| | | |
| | | |
| | | /** |
| | | * 获取比赛记录 |
| | | * @param matchRecord |
| | | * @return |
| | | */ |
| | | List<MatchRecordList> getMatchRecord(@Param("item") MatchRecord matchRecord); |
| | | |
| | | |
| | | /** |
| | | * 获取参赛排名 |
| | | * @param worldCupRank |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getWorldCupRank(@Param("item") WorldCupRank worldCupRank, @Param("appUserIds") List<Integer> appUserIds); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.communityWorldCup.entity.WorldCup; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 17:08 |
| | | */ |
| | | public interface WorldCupMapper extends BaseMapper<WorldCup> { |
| | | |
| | | |
| | | /** |
| | | * 裁判获取世界杯列表 |
| | | * @param worldCupListCoach |
| | | * @return |
| | | */ |
| | | List<WorldCupListCoachVo> getWorldCupListCoach(@Param("item") WorldCupListCoach worldCupListCoach); |
| | | |
| | | |
| | | /** |
| | | * 获取世界杯列表 |
| | | * @param worldCupList |
| | | * @return |
| | | */ |
| | | List<WorldCupListVo> getWorldCupList(@Param("item") WorldCupList worldCupList); |
| | | |
| | | |
| | | /** |
| | | * 获取世界杯详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | WorldCupInfo getWorldCupInfo(@Param("id") Integer id); |
| | | |
| | | |
| | | /** |
| | | * 获取比赛管理列表数据 |
| | | * @param worldCupListAll |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getWorldCupListAll(@Param("item") WorldCupListAll worldCupListAll); |
| | | |
| | | |
| | | |
| | | Integer getWorldCupListAllCount(@Param("item") WorldCupListAll worldCupListAll); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.communityWorldCup.entity.WorldCupPayment; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 14:22 |
| | | */ |
| | | public interface WorldCupPaymentMapper extends BaseMapper<WorldCupPayment> { |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant; |
| | | import com.dsh.communityWorldCup.model.MyWorldCupList; |
| | | import com.dsh.communityWorldCup.model.WorldCupListVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 11:06 |
| | | */ |
| | | public interface WorldCupPaymentParticipantMapper extends BaseMapper<WorldCupPaymentParticipant> { |
| | | |
| | | |
| | | /** |
| | | * 获取报名数据 |
| | | * @param worldCupId |
| | | * @param participantType |
| | | * @param participantId |
| | | * @return |
| | | */ |
| | | WorldCupPaymentParticipant getWorldCupPaymentParticipant(@Param("worldCupId") Integer worldCupId, @Param("participantType") Integer participantType, |
| | | @Param("participantId") Integer participantId); |
| | | |
| | | |
| | | /** |
| | | * 获取社区世界杯我的报名列表 |
| | | * @param myWorldCupList |
| | | * @return |
| | | */ |
| | | List<WorldCupListVo> getMyWorldCupList(@Param("item") MyWorldCupList myWorldCupList); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.communityWorldCup.entity.WorldCupStore; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 18:09 |
| | | */ |
| | | public interface WorldCupStoreMapper extends BaseMapper<WorldCupStore> { |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 15:20 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class CheckPaymentMethod { |
| | | @ApiModelProperty(value = "世界杯id", required = true, dataType = "int") |
| | | private Integer id; |
| | | @ApiModelProperty(value = "参赛人员id[{\"id\":123,\"isStudent\":1},{\"id\":222,\"isStudent\":0}]", required = true, dataType = "String") |
| | | private String ids; |
| | | private Integer uid; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 15:14 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class CheckPaymentMethodVo { |
| | | @ApiModelProperty("能否使用玩湃币支付(0=否,1=是)") |
| | | private Integer paiCoin; |
| | | @ApiModelProperty("能否使用课时支付(0=否,1=是)") |
| | | private Integer classHour; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 15:44 |
| | | */ |
| | | @Data |
| | | public class DeductionClassHour { |
| | | /** |
| | | * 课时记录id |
| | | */ |
| | | private Long id; |
| | | /** |
| | | * 学员id |
| | | */ |
| | | private Integer studentId; |
| | | /** |
| | | * 课时id |
| | | */ |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 扣减课时 |
| | | */ |
| | | private Integer classHour; |
| | | /** |
| | | * 删除的排课数量(用户回退时重新排课) |
| | | */ |
| | | private Integer scheduledCourses; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 15:46 |
| | | */ |
| | | @Data |
| | | public class DeductionClassHourList { |
| | | List<DeductionClassHour> deductionClassHourList; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/28 14:57 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class EntrantRank { |
| | | @ApiModelProperty(value = "参赛人id", required = true, dataType = "int") |
| | | private Integer id; |
| | | @ApiModelProperty(value = "是否是学员", required = true, dataType = "int") |
| | | private Integer isStudent; |
| | | private Integer appUserId; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/28 14:52 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class EntrantRankVo { |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | @ApiModelProperty("全国排名") |
| | | private Integer nationalRank; |
| | | @ApiModelProperty("城市名称") |
| | | private String cityName; |
| | | @ApiModelProperty("城市排名") |
| | | private Integer cityRank; |
| | | @ApiModelProperty("胜利场次") |
| | | private Integer win; |
| | | @ApiModelProperty("失败场次") |
| | | private Integer lose; |
| | | @ApiModelProperty("胜率") |
| | | private Double winRate; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 11:12 |
| | | */ |
| | | @ApiModel |
| | | @Data |
| | | public class EntryPointInfoVo { |
| | | @ApiModelProperty("参赛点id") |
| | | private Integer id; |
| | | @ApiModelProperty("参赛点图片") |
| | | private String cover; |
| | | @ApiModelProperty("参赛点名称") |
| | | private String name; |
| | | @ApiModelProperty("参赛点地址") |
| | | private String address; |
| | | @ApiModelProperty("距离") |
| | | private Double distance; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/29 10:19 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MatchRecord { |
| | | @ApiModelProperty(value = "参赛人id", required = true, dataType = "int") |
| | | private Integer id; |
| | | @ApiModelProperty(value = "是否是学员", required = true, dataType = "int") |
| | | private Integer isStudent; |
| | | @ApiModelProperty(value = "页码,首页1", required = true, dataType = "int") |
| | | private Integer pageNo; |
| | | @ApiModelProperty(value = "每页条数", required = true, dataType = "int") |
| | | private Integer pageSize; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/29 10:12 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MatchRecordList { |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("我方分数") |
| | | private Integer ourScore; |
| | | @ApiModelProperty("对手分数") |
| | | private Integer opponentScore; |
| | | @ApiModelProperty("比赛时间") |
| | | private String startTime; |
| | | @ApiModelProperty("比赛结果(1=胜,-1=负)") |
| | | private Integer matchResult; |
| | | @ApiModelProperty("获得积分") |
| | | private Integer award; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/29 10:08 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MatchRecordVo { |
| | | @ApiModelProperty("总场次") |
| | | private Integer totalSession; |
| | | @ApiModelProperty("记录列表") |
| | | private List<MatchRecordList> list; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/28 16:49 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MyWorldCupInfo { |
| | | @ApiModelProperty("世界杯id") |
| | | private Integer id; |
| | | @ApiModelProperty("图片") |
| | | private String infoImg; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("热度") |
| | | private Integer heat; |
| | | @ApiModelProperty("开始时间") |
| | | private String startTime; |
| | | @ApiModelProperty("结束时间") |
| | | private String endTime; |
| | | @ApiModelProperty("报名截止时间") |
| | | private String registrationClosingTime; |
| | | @ApiModelProperty("报名年龄") |
| | | private String age; |
| | | @ApiModelProperty("报名性别(0=全部,1=男,2=女)") |
| | | private Integer gender; |
| | | @ApiModelProperty("省") |
| | | private String province; |
| | | @ApiModelProperty("市") |
| | | private String city; |
| | | @ApiModelProperty("参赛地址") |
| | | private String address; |
| | | @ApiModelProperty("参与赛点") |
| | | private String stores; |
| | | @ApiModelProperty("参赛人员列表") |
| | | private List<ParticipantVo> participants; |
| | | @ApiModelProperty("支付方式(0=免费,1=微信,2=支付宝,3=玩湃币,4=课时)") |
| | | private Integer payType; |
| | | @ApiModelProperty("比赛费用单价") |
| | | private Double unitPrice; |
| | | @ApiModelProperty("支付费用") |
| | | private Double expense; |
| | | @ApiModelProperty("简介") |
| | | private String intro; |
| | | @ApiModelProperty("富文本") |
| | | private String content; |
| | | @ApiModelProperty("比赛状态(1=未开始,2=已开始,3=已结束,4=已取消)") |
| | | private Integer status; |
| | | @ApiModelProperty("是否可取消(0=否,1=是)") |
| | | private Integer revocable; |
| | | @ApiModelProperty("门店信息") |
| | | private List<Map<String, Object>> storeInfos; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/28 16:25 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MyWorldCupList { |
| | | @ApiModelProperty(value = "参赛人id", required = true, dataType = "int") |
| | | private Integer id; |
| | | @ApiModelProperty(value = "是否是学员", required = true, dataType = "int") |
| | | private Integer isStudent; |
| | | @ApiModelProperty(value = "页码,首页1", required = true, dataType = "int") |
| | | private Integer pageNo; |
| | | @ApiModelProperty(value = "每页条数", required = true, dataType = "int") |
| | | private Integer pageSize; |
| | | @ApiModelProperty(value = "状态(1=未开始,2=进行中)") |
| | | private Integer state; |
| | | private Integer appUserId; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/6 16:52 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class ParticipantVo { |
| | | @ApiModelProperty("人员id") |
| | | private Integer id; |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | @ApiModelProperty("年龄") |
| | | private Integer age; |
| | | @ApiModelProperty("身份证号码") |
| | | private String idcard; |
| | | @ApiModelProperty("电话号码") |
| | | private String phone; |
| | | @ApiModelProperty("身高") |
| | | private Integer height; |
| | | @ApiModelProperty("体重") |
| | | private Double weight; |
| | | @ApiModelProperty("生日") |
| | | private String birthday; |
| | | @ApiModelProperty("性别(1=男,2=女)") |
| | | private Integer gender; |
| | | @ApiModelProperty("剩余课时") |
| | | private Integer residueClassHour; |
| | | @ApiModelProperty("是否为学员") |
| | | private Integer isStudent; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 11:25 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class PaymentWorldCup { |
| | | @ApiModelProperty(value = "世界杯id", required = true, dataType = "int") |
| | | private Integer id; |
| | | @ApiModelProperty(value = "支付方式(1=微信,2=支付宝,3=玩湃币,4=课时)") |
| | | private Integer payType; |
| | | @ApiModelProperty(value = "参赛人员id[{\"id\":123,\"isStudent\":1},{\"id\":222,\"isStudent\":0}]", required = true, dataType = "String") |
| | | private String ids; |
| | | private Integer uid; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/6 11:02 |
| | | */ |
| | | @Data |
| | | public class RegisteredPersonnel { |
| | | /** |
| | | * 世界杯赛事id |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 电话号码 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 身份证号 |
| | | */ |
| | | private String idcode; |
| | | /** |
| | | * 状态(1=正常,2=取消) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | | /** |
| | | * 页条数 |
| | | */ |
| | | private Integer limit; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 15:24 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class StartWorldCup { |
| | | @ApiModelProperty(value = "扫码结果", required = true, dataType = "String") |
| | | private String code; |
| | | @ApiModelProperty(value = "参赛人员[{\"id\":1234,\"participantType\":1,\"type\":\"blue\"},{\"id\":1234,\"participantType\":2,\"type\":\"red\"}]", required = true, dataType = "String") |
| | | private String people; |
| | | @ApiModelProperty(value = "世界杯id", required = true, dataType = "int") |
| | | private Integer worldCupId; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 10:20 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupInfo { |
| | | @ApiModelProperty("世界杯id") |
| | | private Integer id; |
| | | @ApiModelProperty("图片") |
| | | private String infoImg; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("热度") |
| | | private Integer heat; |
| | | @ApiModelProperty("开始时间") |
| | | private String startTime; |
| | | @ApiModelProperty("结束时间") |
| | | private String endTime; |
| | | @ApiModelProperty("报名截止时间") |
| | | private String registrationClosingTime; |
| | | @ApiModelProperty("报名年龄") |
| | | private String age; |
| | | @ApiModelProperty("报名性别(0=全部,1=男,2=女)") |
| | | private Integer gender; |
| | | @ApiModelProperty("省") |
| | | private String province; |
| | | @ApiModelProperty("市") |
| | | private String city; |
| | | @ApiModelProperty("参赛地址") |
| | | private String address; |
| | | @ApiModelProperty("参与赛点") |
| | | private String stores; |
| | | @ApiModelProperty("比赛费用(现金)") |
| | | private Double cash; |
| | | @ApiModelProperty("比赛费用(玩湃币)") |
| | | private Double paiCoin; |
| | | @ApiModelProperty("比赛费用(课时)") |
| | | private Double classHour; |
| | | @ApiModelProperty("简介") |
| | | private String intro; |
| | | @ApiModelProperty("富文本") |
| | | private String content; |
| | | @ApiModelProperty("门店信息") |
| | | private List<Map<String, Object>> storeInfos; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 17:50 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupList { |
| | | @ApiModelProperty(value = "当前门店id", required = true, dataType = "int") |
| | | private Integer id; |
| | | @ApiModelProperty(value = "搜索内容", required = false, dataType = "Stirng") |
| | | private String content; |
| | | @ApiModelProperty(value = "所在赛点id", required = false, dataType = "int") |
| | | private Integer storeId; |
| | | @ApiModelProperty(value = "报名条件(0=全部,1=男,2=女)", required = false, dataType = "int") |
| | | private Integer gender; |
| | | @ApiModelProperty(value = "热度排序(1=正序,2=降序)", required = false, dataType = "int") |
| | | private Integer sort; |
| | | @ApiModelProperty(value = "经度", required = true, dataType = "String") |
| | | private String lon; |
| | | @ApiModelProperty(value = "纬度", required = true, dataType = "String") |
| | | private String lat; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2024/3/2 11:01 |
| | | */ |
| | | @Data |
| | | public class WorldCupListAll { |
| | | /** |
| | | * 比赛名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private String startTime; |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private String endTime; |
| | | /** |
| | | * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | | /** |
| | | * 页条数 |
| | | */ |
| | | private Integer limit; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 17:26 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupListCoach { |
| | | @ApiModelProperty(value = "搜索内容", required = false, dataType = "String") |
| | | private String content; |
| | | @ApiModelProperty(value = "经度", required = true, dataType = "String") |
| | | private String lon; |
| | | @ApiModelProperty(value = "纬度", required = true, dataType = "String") |
| | | private String lat; |
| | | @ApiModelProperty(value = "赛点id", required = false, dataType = "int") |
| | | private Integer storeId; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 17:15 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupListCoachVo { |
| | | @ApiModelProperty("id") |
| | | private Integer id; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("活动时间") |
| | | private String activeTime; |
| | | @ApiModelProperty("已比赛次数") |
| | | private Integer matchNumber; |
| | | @ApiModelProperty("比赛状态(1=未开始,2=已开始,3=已结束,4=已取消)") |
| | | private Integer status; |
| | | private String lon; |
| | | private String lat; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 16:45 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupListVo { |
| | | @ApiModelProperty("世界杯id") |
| | | private String id; |
| | | private Integer worldCupId; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("报名截止时间") |
| | | private String registrationClosingTime; |
| | | @ApiModelProperty("报名年龄") |
| | | private String age; |
| | | @ApiModelProperty("封面图片") |
| | | private String coverImg; |
| | | @ApiModelProperty("报名人数") |
| | | private Integer matchNumber; |
| | | @ApiModelProperty("说明") |
| | | private String content; |
| | | @ApiModelProperty("热度") |
| | | private Integer heat; |
| | | private Double distance; |
| | | private String lon; |
| | | private String lat; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 11:08 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupPeople { |
| | | @ApiModelProperty(value = "赛事id", required = true, dataType = "int") |
| | | private Integer worldCupId; |
| | | @ApiModelProperty(value = "二维码结果", required = true, dataType = "String") |
| | | private String code; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 10:17 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupPeopleVo { |
| | | @ApiModelProperty("参赛人id") |
| | | private Long id; |
| | | @ApiModelProperty("参赛人姓名") |
| | | private String name; |
| | | @ApiModelProperty("参赛人头像") |
| | | private String avatar; |
| | | @ApiModelProperty("参赛人年龄") |
| | | private Integer age; |
| | | @ApiModelProperty("参赛人员类型(1=学员,2=参赛人)") |
| | | private Integer participantType; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/29 10:47 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupRank { |
| | | @ApiModelProperty(value = "参赛人id", required = true, dataType = "int") |
| | | private Integer id; |
| | | @ApiModelProperty(value = "是否是学员", required = true, dataType = "int") |
| | | private Integer isStudent; |
| | | @ApiModelProperty(value = "年份,2024", required = false, dataType = "int") |
| | | private Integer year; |
| | | @ApiModelProperty(value = "范围,1=全国,2=成都", required = true, dataType = "int") |
| | | private Integer radius; |
| | | @ApiModelProperty(value = "排序,1=场次,2=胜率", required = true, dataType = "int") |
| | | private Integer sort; |
| | | private Integer appUserId; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/29 10:35 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupRankVo { |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | @ApiModelProperty("头像") |
| | | private String avatar; |
| | | @ApiModelProperty("总场次") |
| | | private Integer totalSession; |
| | | @ApiModelProperty("胜率") |
| | | private Double winRate; |
| | | @ApiModelProperty("是否是自己(0=否,1=是)") |
| | | private Integer oneself; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.communityWorldCup.entity.WorldCupCompetitor; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 15:47 |
| | | */ |
| | | public interface IWorldCupCompetitorService extends IService<WorldCupCompetitor> { |
| | | |
| | | |
| | | /** |
| | | * 获取参赛人员名次 |
| | | * @param entrantRank |
| | | * @return |
| | | */ |
| | | EntrantRankVo getEntrantRank(EntrantRank entrantRank); |
| | | |
| | | |
| | | /** |
| | | * 获取比赛记录 |
| | | * @param matchRecord |
| | | * @return |
| | | */ |
| | | MatchRecordVo getMatchRecord(MatchRecord matchRecord); |
| | | |
| | | |
| | | /** |
| | | * 获取参赛排名 |
| | | * @param worldCupRank |
| | | * @return |
| | | */ |
| | | List<WorldCupRankVo> getWorldCupRank(WorldCupRank worldCupRank); |
| | | |
| | | |
| | | /** |
| | | * 比赛结束后通知处理逻辑 |
| | | * @param custom |
| | | * @param red_score |
| | | * @param blue |
| | | */ |
| | | void endWorldCupCallback(String custom, Integer red_score, Integer blue); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 11:06 |
| | | */ |
| | | public interface IWorldCupPaymentParticipantService extends IService<WorldCupPaymentParticipant>{ |
| | | |
| | | |
| | | /** |
| | | * 获取报名数据 |
| | | * @param worldCupId |
| | | * @param participantType |
| | | * @param participantId |
| | | * @return |
| | | */ |
| | | WorldCupPaymentParticipant getWorldCupPaymentParticipant(Integer worldCupId, Integer participantType, Integer participantId); |
| | | |
| | | |
| | | /** |
| | | * 获取社区世界杯我的报名列表 |
| | | * @param myWorldCupList |
| | | * @return |
| | | */ |
| | | List<WorldCupListVo> getMyWorldCupList(MyWorldCupList myWorldCupList); |
| | | |
| | | |
| | | /** |
| | | * 获取已报名的世界杯详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | MyWorldCupInfo getMyWorldCupInfo(String id, String lon, String lat); |
| | | |
| | | |
| | | /** |
| | | * 获取已报过名的参赛人员 |
| | | * @param uid 当前用户 |
| | | * @return |
| | | */ |
| | | List<ParticipantVo> getParticipant(Integer uid); |
| | | |
| | | |
| | | /** |
| | | * 获取已报名人员列表 |
| | | * @param registeredPersonnel |
| | | * @return |
| | | */ |
| | | Map<String, Object> getRegisteredPersonnel(RegisteredPersonnel registeredPersonnel); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.communityWorldCup.entity.WorldCupPayment; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 14:22 |
| | | */ |
| | | public interface IWorldCupPaymentService extends IService<WorldCupPayment> { |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.communityWorldCup.entity.WorldCup; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import com.dsh.communityWorldCup.util.ResultUtil; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 17:11 |
| | | */ |
| | | public interface IWorldCupService extends IService<WorldCup> { |
| | | |
| | | |
| | | /** |
| | | * 裁判获取世界杯列表数据 |
| | | * @return |
| | | */ |
| | | List<WorldCupListCoachVo> getWorldCupListCoach(WorldCupListCoach worldCupListCoach); |
| | | |
| | | |
| | | /** |
| | | * 开启世界杯赛事 |
| | | * @param startWorldCup |
| | | * @return |
| | | */ |
| | | ResultUtil startWorldCup(StartWorldCup startWorldCup); |
| | | |
| | | |
| | | /** |
| | | * 获取用户完成赛事没有提示的数据 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Integer getCompletedWorldCupTips(Integer uid); |
| | | |
| | | |
| | | /** |
| | | * 获取社区世界杯列表 |
| | | * @param worldCupList |
| | | * @return |
| | | */ |
| | | List<WorldCupListVo> getWorldCupList(WorldCupList worldCupList); |
| | | |
| | | |
| | | /** |
| | | * 获取世界杯详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | WorldCupInfo getWorldCupInfo(Integer id, String lon, String lat); |
| | | |
| | | |
| | | /** |
| | | * 报名前校验支付方式 |
| | | * @param checkPaymentMethod |
| | | * @return |
| | | */ |
| | | CheckPaymentMethodVo checkPaymentMethod(CheckPaymentMethod checkPaymentMethod); |
| | | |
| | | |
| | | /** |
| | | * 报名世界杯 |
| | | * @param paymentWorldCup |
| | | * @return |
| | | */ |
| | | ResultUtil paymentWorldCup(PaymentWorldCup paymentWorldCup); |
| | | |
| | | |
| | | /** |
| | | * 第三方支付完成后回调逻辑处理 |
| | | * @param code |
| | | * @param outTradeNo |
| | | * @return |
| | | */ |
| | | ResultUtil paymentWorldCupCallback(String code, String outTradeNo); |
| | | |
| | | |
| | | /** |
| | | * 取消赛事后退还费用 |
| | | * @param id |
| | | */ |
| | | void cancelWorldCupRefund(Integer id); |
| | | |
| | | |
| | | /** |
| | | * 获取比赛管理列表数据 |
| | | * @param worldCupListAll |
| | | * @return |
| | | */ |
| | | Map<String, Object> getWorldCupListAll(WorldCupListAll worldCupListAll); |
| | | |
| | | |
| | | /** |
| | | * 定时任务修改状态 |
| | | */ |
| | | void taskUpdateStatus(); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.communityWorldCup.entity.WorldCupStore; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 18:08 |
| | | */ |
| | | public interface IWorldCupStoreService extends IService<WorldCupStore> { |
| | | |
| | | |
| | | /** |
| | | * 获取世界杯赛点列表 |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getWorldCupStore(); |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.communityWorldCup.entity.WorldCup; |
| | | import com.dsh.communityWorldCup.entity.WorldCupCompetitor; |
| | | import com.dsh.communityWorldCup.feignclient.account.AppUserClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | | import com.dsh.communityWorldCup.feignclient.other.StoreClient; |
| | | import com.dsh.communityWorldCup.mapper.WorldCupCompetitorMapper; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import com.dsh.communityWorldCup.service.IWorldCupCompetitorService; |
| | | import com.dsh.communityWorldCup.service.IWorldCupService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 15:47 |
| | | */ |
| | | @Service |
| | | public class WorldCupCompetitorServiceImpl extends ServiceImpl<WorldCupCompetitorMapper, WorldCupCompetitor> implements IWorldCupCompetitorService { |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | |
| | | @Resource |
| | | private ParticipantClient participantClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Autowired |
| | | private IWorldCupService worldCupService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取参赛人员名次信息 |
| | | * @param entrantRank |
| | | * @return |
| | | */ |
| | | @Override |
| | | public EntrantRankVo getEntrantRank(EntrantRank entrantRank) { |
| | | EntrantRankVo entrantRankVo = new EntrantRankVo(); |
| | | if(entrantRank.getIsStudent() == 0){ |
| | | //参赛人员 |
| | | Participant participant = participantClient.getParticipant(entrantRank.getId()); |
| | | entrantRankVo.setName(participant.getName()); |
| | | }else{ |
| | | //学员 |
| | | TStudent tStudent = studentClient.queryById(entrantRank.getId()); |
| | | entrantRankVo.setName(tStudent.getName()); |
| | | } |
| | | //全国排名---直接数据库分组查询后排序 |
| | | entrantRankVo.setNationalRank(0); |
| | | List<Map<String, Object>> mapList = this.baseMapper.getNumberOfGamesRanked(null); |
| | | for (int i = 0; i < mapList.size(); i++) { |
| | | Map<String, Object> map = mapList.get(i); |
| | | Integer participantType = Integer.valueOf(map.get("participantType").toString()); |
| | | Integer participantId = Integer.valueOf(map.get("participantId").toString()); |
| | | Integer num = Integer.valueOf(map.get("num").toString()); |
| | | if(null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())){ |
| | | entrantRankVo.setNationalRank(i + 1); |
| | | } |
| | | } |
| | | /** |
| | | * 城市排名 |
| | | * 1、先查询出当前用户对应的城市 |
| | | * 2、再根据城市查询对应的所有人员 |
| | | * 3、再根据查询出来的参赛人分组查询出参赛次数后排序 |
| | | */ |
| | | entrantRankVo.setCityRank(0); |
| | | AppUser appUser = appUserClient.getAppUser(entrantRank.getAppUserId()); |
| | | entrantRankVo.setCityName(appUser.getCity()); |
| | | List<Integer> appUserIds = appUserClient.getAppUserIds(appUser.getCityCode()); |
| | | List<Map<String, Object>> mapList1 = this.baseMapper.getNumberOfGamesRanked(appUserIds); |
| | | for (int i = 0; i < mapList1.size(); i++) { |
| | | Map<String, Object> map = mapList1.get(i); |
| | | Integer participantType = Integer.valueOf(map.get("participantType").toString()); |
| | | Integer participantId = Integer.valueOf(map.get("participantId").toString()); |
| | | Integer num = Integer.valueOf(map.get("num").toString()); |
| | | if(null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())){ |
| | | entrantRankVo.setCityRank(i + 1); |
| | | } |
| | | } |
| | | QueryWrapper<WorldCupCompetitor> wrapper = new QueryWrapper<>(); |
| | | if(entrantRank.getIsStudent() == 0){ |
| | | wrapper.eq("participantType", 2); |
| | | }else{ |
| | | wrapper.eq("participantType", 1); |
| | | } |
| | | int win = this.count(wrapper.eq("participantId", entrantRank.getId()).eq("matchResult", 1)); |
| | | entrantRankVo.setWin(win); |
| | | |
| | | wrapper = new QueryWrapper<>(); |
| | | if(entrantRank.getIsStudent() == 0){ |
| | | wrapper.eq("participantType", 2); |
| | | }else{ |
| | | wrapper.eq("participantType", 1); |
| | | } |
| | | int lose = this.count(wrapper.eq("participantId", entrantRank.getId()).eq("matchResult", -1)); |
| | | entrantRankVo.setLose(lose); |
| | | if((win + lose) == 0){ |
| | | entrantRankVo.setWinRate(0D); |
| | | }else{ |
| | | entrantRankVo.setWinRate(new BigDecimal(win).divide(new BigDecimal(win + lose), new MathContext(4, RoundingMode.HALF_EVEN)).multiply(new BigDecimal(100)).doubleValue()); |
| | | } |
| | | return entrantRankVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取比赛记录 |
| | | * @param matchRecord |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MatchRecordVo getMatchRecord(MatchRecord matchRecord) { |
| | | matchRecord.setIsStudent(matchRecord.getIsStudent() == 0 ? 2 : 1); |
| | | int pageNo = (matchRecord.getPageNo() - 1) * matchRecord.getPageSize(); |
| | | matchRecord.setPageNo(pageNo); |
| | | MatchRecordVo matchRecordVo = new MatchRecordVo(); |
| | | int count = this.count(new QueryWrapper<WorldCupCompetitor>().eq("participantId", matchRecord.getId()) |
| | | .eq("participantType", matchRecord.getIsStudent())); |
| | | matchRecordVo.setTotalSession(count); |
| | | List<MatchRecordList> matchRecord1 = this.baseMapper.getMatchRecord(matchRecord); |
| | | matchRecordVo.setList(matchRecord1); |
| | | return matchRecordVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取参赛排名 |
| | | * @param worldCupRank |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<WorldCupRankVo> getWorldCupRank(WorldCupRank worldCupRank) { |
| | | worldCupRank.setIsStudent(worldCupRank.getIsStudent() == 0 ? 2 : 1); |
| | | List<Integer> appUserIds = null; |
| | | if(worldCupRank.getRadius() == 2){ |
| | | AppUser appUser = appUserClient.getAppUser(worldCupRank.getAppUserId()); |
| | | appUserIds = appUserClient.getAppUserIds(appUser.getCityCode()); |
| | | } |
| | | List<Map<String, Object>> lists = this.baseMapper.getWorldCupRank(worldCupRank, appUserIds); |
| | | List<WorldCupRankVo> list = new ArrayList<>(); |
| | | for (int i = 0; i < lists.size(); i++) { |
| | | Map<String, Object> map = lists.get(i); |
| | | Integer participantType = Integer.valueOf(map.get("participantType").toString()); |
| | | Integer participantId = Integer.valueOf(map.get("participantId").toString()); |
| | | Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); |
| | | Integer totalSession = Integer.valueOf(map.get("totalSession").toString()); |
| | | Double winRate = Double.valueOf(map.get("winRate").toString()); |
| | | //自己排名在20内的标识 |
| | | boolean b = false; |
| | | if(i <= 19){ |
| | | WorldCupRankVo worldCupRankVo = new WorldCupRankVo(); |
| | | worldCupRankVo.setTotalSession(totalSession); |
| | | worldCupRankVo.setWinRate(winRate); |
| | | //学员 |
| | | if(participantType == 1){ |
| | | TStudent tStudent = studentClient.queryById(participantId); |
| | | worldCupRankVo.setAvatar(tStudent.getHeadImg()); |
| | | String name = tStudent.getName(); |
| | | if(name.length() > 2){ |
| | | name = name.charAt(0) + "*" + name.substring(2); |
| | | }else{ |
| | | name = name.charAt(0) + "*"; |
| | | } |
| | | worldCupRankVo.setName(name); |
| | | } |
| | | //参赛人员 |
| | | if(participantType == 2){ |
| | | AppUser appUser1 = appUserClient.getAppUser(appUserId); |
| | | Participant participant = participantClient.getParticipant(participantId); |
| | | worldCupRankVo.setAvatar(appUser1.getHeadImg()); |
| | | String name = participant.getName(); |
| | | if(name.length() > 2){ |
| | | name = name.charAt(0) + "*" + name.substring(2); |
| | | }else{ |
| | | name = name.charAt(0) + "*"; |
| | | } |
| | | worldCupRankVo.setName(name); |
| | | |
| | | } |
| | | if(worldCupRank.getIsStudent().equals(participantType) && worldCupRank.getId().equals(participantId)){ |
| | | worldCupRankVo.setOneself(1); |
| | | b = true; |
| | | }else{ |
| | | worldCupRankVo.setOneself(0); |
| | | } |
| | | |
| | | list.add(worldCupRankVo); |
| | | } |
| | | //排名20内,且包含自己直接返回 |
| | | if(i == 19 && b){ |
| | | break; |
| | | } |
| | | //排名前20的数据添加完成后且包含自己,需要将自己找出来后添加到21位 |
| | | if(i > 19 && !b){ |
| | | if(worldCupRank.getIsStudent().equals(participantType) && worldCupRank.getId().equals(participantId)){ |
| | | WorldCupRankVo worldCupRankVo = new WorldCupRankVo(); |
| | | worldCupRankVo.setTotalSession(totalSession); |
| | | worldCupRankVo.setWinRate(winRate); |
| | | //学员 |
| | | if(participantType == 1){ |
| | | TStudent tStudent = studentClient.queryById(participantId); |
| | | worldCupRankVo.setAvatar(tStudent.getHeadImg()); |
| | | String name = tStudent.getName(); |
| | | if(name.length() > 2){ |
| | | name = name.charAt(0) + "*" + name.substring(2); |
| | | }else{ |
| | | name = name.charAt(0) + "*"; |
| | | } |
| | | worldCupRankVo.setName(name); |
| | | } |
| | | //参赛人员 |
| | | if(participantType == 2){ |
| | | AppUser appUser1 = appUserClient.getAppUser(appUserId); |
| | | Participant participant = participantClient.getParticipant(participantId); |
| | | worldCupRankVo.setAvatar(appUser1.getHeadImg()); |
| | | String name = participant.getName(); |
| | | if(name.length() > 2){ |
| | | name = name.charAt(0) + "*" + name.substring(2); |
| | | }else{ |
| | | name = name.charAt(0) + "*"; |
| | | } |
| | | worldCupRankVo.setName(name); |
| | | |
| | | } |
| | | worldCupRankVo.setOneself(1); |
| | | list.add(worldCupRankVo); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 比赛结束后通知处理逻辑 |
| | | * @param custom 开始比赛接口上传的自定义参数 |
| | | * @param red_score 红方分数 |
| | | * @param blue 蓝方分数 |
| | | */ |
| | | @Override |
| | | public void endWorldCupCallback(String custom, Integer red_score, Integer blue) { |
| | | List<Long> ids = JSON.parseArray(custom, Long.class); |
| | | List<WorldCupCompetitor> worldCupCompetitors = this.listByIds(ids); |
| | | WorldCupCompetitor worldCupCompetitor1 = worldCupCompetitors.get(0); |
| | | WorldCup worldCup = worldCupService.getById(worldCupCompetitor1.getWorldCupId()); |
| | | for (WorldCupCompetitor worldCupCompetitor : worldCupCompetitors) { |
| | | //蓝方 |
| | | if(worldCupCompetitor.getParticipant() == 1){ |
| | | worldCupCompetitor.setMatchResult(blue.compareTo(red_score)); |
| | | worldCupCompetitor.setOurScore(blue); |
| | | worldCupCompetitor.setOpponentScore(red_score); |
| | | worldCupCompetitor.setEndTime(new Date()); |
| | | worldCupCompetitor.setWinIntegral(0); |
| | | if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && blue.compareTo(red_score) >= 0){ |
| | | worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId()); |
| | | appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral()); |
| | | appUserClient.updateAppUser(appUser); |
| | | } |
| | | } |
| | | //红方 |
| | | if(worldCupCompetitor.getParticipant() == 2){ |
| | | worldCupCompetitor.setMatchResult(red_score.compareTo(blue)); |
| | | worldCupCompetitor.setOurScore(red_score); |
| | | worldCupCompetitor.setOpponentScore(blue); |
| | | worldCupCompetitor.setEndTime(new Date()); |
| | | worldCupCompetitor.setWinIntegral(0); |
| | | if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && red_score.compareTo(blue) >= 0){ |
| | | worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId()); |
| | | appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral()); |
| | | appUserClient.updateAppUser(appUser); |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.updateBatchById(worldCupCompetitors); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.communityWorldCup.entity.WorldCup; |
| | | import com.dsh.communityWorldCup.entity.WorldCupPayment; |
| | | import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant; |
| | | import com.dsh.communityWorldCup.entity.WorldCupStore; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | | import com.dsh.communityWorldCup.feignclient.other.StoreClient; |
| | | import com.dsh.communityWorldCup.feignclient.other.model.Store; |
| | | import com.dsh.communityWorldCup.mapper.WorldCupPaymentParticipantMapper; |
| | | import com.dsh.communityWorldCup.model.MyWorldCupInfo; |
| | | import com.dsh.communityWorldCup.model.MyWorldCupList; |
| | | import com.dsh.communityWorldCup.model.WorldCupListVo; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import com.dsh.communityWorldCup.service.IWorldCupPaymentParticipantService; |
| | | import com.dsh.communityWorldCup.service.IWorldCupPaymentService; |
| | | import com.dsh.communityWorldCup.service.IWorldCupService; |
| | | import com.dsh.communityWorldCup.service.IWorldCupStoreService; |
| | | import com.dsh.communityWorldCup.util.GeodesyUtil; |
| | | import com.dsh.communityWorldCup.util.ToolUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 11:07 |
| | | */ |
| | | @Service |
| | | public class WorldCupPaymentParticipantServiceImpl extends ServiceImpl<WorldCupPaymentParticipantMapper, WorldCupPaymentParticipant> implements IWorldCupPaymentParticipantService { |
| | | |
| | | @Autowired |
| | | private IWorldCupPaymentService worldCupPaymentService; |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | |
| | | @Resource |
| | | private ParticipantClient participantClient; |
| | | |
| | | @Autowired |
| | | private IWorldCupService worldCupService; |
| | | |
| | | @Autowired |
| | | private IWorldCupPaymentParticipantService worldCupPaymentParticipantService; |
| | | |
| | | @Autowired |
| | | private IWorldCupStoreService worldCupStoreService; |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取报名数据 |
| | | * @param worldCupId |
| | | * @param participantType |
| | | * @param participantId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WorldCupPaymentParticipant getWorldCupPaymentParticipant(Integer worldCupId, Integer participantType, Integer participantId) { |
| | | return this.baseMapper.getWorldCupPaymentParticipant(worldCupId, participantType, participantId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取社区世界杯我的报名列表 |
| | | * @param myWorldCupList |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<WorldCupListVo> getMyWorldCupList(MyWorldCupList myWorldCupList) { |
| | | int pageNo = (myWorldCupList.getPageNo() - 1) * myWorldCupList.getPageSize(); |
| | | myWorldCupList.setPageNo(pageNo); |
| | | myWorldCupList.setIsStudent(myWorldCupList.getIsStudent() == 0 ? 2 : 1); |
| | | List<WorldCupListVo> myWorldCupList1 = this.baseMapper.getMyWorldCupList(myWorldCupList); |
| | | for (WorldCupListVo worldCupListVo : myWorldCupList1) { |
| | | Integer worldCupId = worldCupListVo.getWorldCupId(); |
| | | List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCupId).eq("payStatus", 2).eq("state", 1)); |
| | | List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); |
| | | Integer heat = worldCupListVo.getHeat(); |
| | | if(collect.size() > 0){ |
| | | int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); |
| | | heat += count; |
| | | } |
| | | worldCupListVo.setHeat(heat); |
| | | } |
| | | return myWorldCupList1; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取已报名的世界杯详情 |
| | | * @param id 社区世界杯支付对应的参与者记录id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MyWorldCupInfo getMyWorldCupInfo(String id, String lon, String lat) { |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = this.getById(id); |
| | | Integer worldCupId = worldCupPaymentParticipant.getWorldCupId(); |
| | | WorldCupPayment worldCupPayment = worldCupPaymentService.getById(worldCupPaymentParticipant.getWorldCupPaymentId()); |
| | | WorldCupInfo worldCupInfo = worldCupService.getWorldCupInfo(worldCupId, null, null); |
| | | WorldCup worldCup = worldCupService.getById(worldCupId); |
| | | MyWorldCupInfo myWorldCupInfo = new MyWorldCupInfo(); |
| | | BeanUtils.copyProperties(worldCupInfo, myWorldCupInfo); |
| | | myWorldCupInfo.setUnitPrice(worldCupPayment.getUnitPrice().doubleValue()); |
| | | myWorldCupInfo.setExpense(worldCupPayment.getAmount().doubleValue()); |
| | | myWorldCupInfo.setStatus(worldCup.getStatus()); |
| | | myWorldCupInfo.setRevocable(1); |
| | | myWorldCupInfo.setProvince(worldCup.getProvince()); |
| | | myWorldCupInfo.setCity(worldCup.getCity()); |
| | | myWorldCupInfo.setPayType(worldCupPayment.getPayType()); |
| | | //开始前一天不能取消 |
| | | if(worldCup.getStartTime().getTime() < System.currentTimeMillis() + 86400000L){ |
| | | myWorldCupInfo.setRevocable(0); |
| | | } |
| | | List<ParticipantVo> datas = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | List<WorldCupPaymentParticipant> list1 = this.list(new QueryWrapper<WorldCupPaymentParticipant>().eq("worldCupPaymentId", worldCupPaymentParticipant.getWorldCupPaymentId())); |
| | | for (WorldCupPaymentParticipant wcpp : list1) { |
| | | Integer participantType = wcpp.getParticipantType(); |
| | | Integer participantId = wcpp.getParticipantId(); |
| | | ParticipantVo participantVo = new ParticipantVo(); |
| | | //学员 |
| | | if(1 == participantType){ |
| | | TStudent tStudent = studentClient.queryById(participantId); |
| | | participantVo.setId(tStudent.getId()); |
| | | participantVo.setName(tStudent.getName()); |
| | | int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())); |
| | | participantVo.setAge(age); |
| | | participantVo.setIdcard(tStudent.getIdCard()); |
| | | participantVo.setPhone(tStudent.getPhone()); |
| | | participantVo.setIsStudent(1); |
| | | datas.add(participantVo); |
| | | } |
| | | //参赛人员 |
| | | if(2 == participantType){ |
| | | Participant participant = participantClient.getParticipant(participantId); |
| | | participantVo.setId(participant.getId()); |
| | | participantVo.setName(participant.getName()); |
| | | int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())); |
| | | participantVo.setAge(age); |
| | | participantVo.setIdcard(participant.getIdcard()); |
| | | participantVo.setPhone(participant.getPhone()); |
| | | participantVo.setIsStudent(0); |
| | | datas.add(participantVo); |
| | | } |
| | | } |
| | | |
| | | myWorldCupInfo.setParticipants(datas); |
| | | List<WorldCupStore> worldCupStores = worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("worldCupId", id)); |
| | | ArrayList<Map<String, Object>> objects = new ArrayList<>(); |
| | | for (WorldCupStore worldCupStore : worldCupStores) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | Store store = storeClient.queryStoreById(worldCupStore.getStoreId()); |
| | | map.put("name", store.getName()); |
| | | |
| | | |
| | | String str = store.getAddress(); |
| | | str = str.substring(str.indexOf("省") + 1); |
| | | |
| | | // 去掉第一个“市”及之前的字符串 |
| | | str = str.substring(str.indexOf("市") + 1); |
| | | |
| | | // 去掉第一个“区”及之前的字符串 |
| | | str = str.substring(str.indexOf("区") + 1); |
| | | |
| | | map.put("address", str); |
| | | map.put("storeLon", store.getLon()); |
| | | map.put("storeLat", store.getLat()); |
| | | map.put("storeCoverDrawing", store.getCoverDrawing()); |
| | | if (ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)) { |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | | double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | map.put("distance", wgs84); |
| | | } |
| | | objects.add(map); |
| | | } |
| | | worldCupInfo.setStoreInfos(objects); |
| | | return myWorldCupInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取已报过名的参赛人员 |
| | | * @param uid 当前用户 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ParticipantVo> getParticipant(Integer uid) { |
| | | List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("appUserId", uid) |
| | | .eq("payStatus", 2).eq("state", 1)); |
| | | List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); |
| | | List<ParticipantVo> datas = new ArrayList<>(); |
| | | Set<Integer> csry = new HashSet<>(); |
| | | Set<Integer> xy = new HashSet<>(); |
| | | if(collect.size() > 0){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | List<WorldCupPaymentParticipant> list1 = this.list(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); |
| | | for (WorldCupPaymentParticipant worldCupPaymentParticipant : list1) { |
| | | Integer participantType = worldCupPaymentParticipant.getParticipantType(); |
| | | Integer participantId = worldCupPaymentParticipant.getParticipantId(); |
| | | ParticipantVo participantVo = new ParticipantVo(); |
| | | //学员 |
| | | if(1 == participantType && !xy.contains(participantId)){ |
| | | TStudent tStudent = studentClient.queryById(participantId); |
| | | participantVo.setId(tStudent.getId()); |
| | | participantVo.setName(tStudent.getName()); |
| | | int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())); |
| | | participantVo.setAge(age); |
| | | participantVo.setIdcard(tStudent.getIdCard()); |
| | | participantVo.setPhone(tStudent.getPhone()); |
| | | participantVo.setIsStudent(1); |
| | | datas.add(participantVo); |
| | | } |
| | | //参赛人员 |
| | | if(2 == participantType && !csry.contains(participantId)){ |
| | | Participant participant = participantClient.getParticipant(participantId); |
| | | participantVo.setId(participant.getId()); |
| | | participantVo.setName(participant.getName()); |
| | | int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())); |
| | | participantVo.setAge(age); |
| | | participantVo.setIdcard(participant.getIdcard()); |
| | | participantVo.setPhone(participant.getPhone()); |
| | | participantVo.setIsStudent(0); |
| | | datas.add(participantVo); |
| | | } |
| | | } |
| | | } |
| | | return datas; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取 已报名人员列表 |
| | | * @param registeredPersonnel |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getRegisteredPersonnel(RegisteredPersonnel registeredPersonnel) { |
| | | Integer id = registeredPersonnel.getId(); |
| | | String idcode = registeredPersonnel.getIdcode(); |
| | | String name = registeredPersonnel.getName(); |
| | | String phone = registeredPersonnel.getPhone(); |
| | | Integer status = registeredPersonnel.getStatus(); |
| | | Integer offset = registeredPersonnel.getOffset(); |
| | | Integer limit = registeredPersonnel.getLimit(); |
| | | QueryWrapper<WorldCupPayment> queryWrapper = new QueryWrapper<WorldCupPayment>() |
| | | .eq("worldCupId", id).eq("state", 1); |
| | | if(status == 1){ |
| | | queryWrapper.eq("payStatus", 2); |
| | | }else{ |
| | | queryWrapper.eq("payStatus", 3); |
| | | } |
| | | List<WorldCupPayment> list = worldCupPaymentService.list(queryWrapper); |
| | | List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if(collect.size() == 0){ |
| | | map.put("rows", new ArrayList<>()); |
| | | map.put("total", 0); |
| | | return map; |
| | | } |
| | | List<WorldCupPaymentParticipant> list1 = this.list(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); |
| | | List<Map<String, Object>> list2 = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | for (WorldCupPaymentParticipant on : list1) { |
| | | WorldCupPayment worldCupPayment = worldCupPaymentService.getById(on.getWorldCupPaymentId()); |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | if(on.getParticipantType() == 1){ |
| | | TStudent tStudent = studentClient.queryById(on.getParticipantId()); |
| | | if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(phone) && tStudent.getPhone().indexOf(phone) == -1){ |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(idcode) && tStudent.getIdCard().indexOf(idcode) == -1){ |
| | | continue; |
| | | } |
| | | map1.put("id", tStudent.getId()); |
| | | map1.put("isStudent", 1); |
| | | map1.put("name", tStudent.getName()); |
| | | map1.put("gender", tStudent.getSex() == 1 ? "男" : "女"); |
| | | map1.put("age", Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday()))); |
| | | map1.put("phone", tStudent.getPhone()); |
| | | map1.put("idcard", tStudent.getIdCard()); |
| | | map1.put("state", worldCupPayment.getPayStatus() - 1); |
| | | }else{ |
| | | Participant participant = participantClient.getParticipant(on.getParticipantId()); |
| | | if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){ |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(phone) && participant.getPhone().indexOf(phone) == -1){ |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(idcode) && participant.getIdcard().indexOf(idcode) == -1){ |
| | | continue; |
| | | } |
| | | map1.put("id", participant.getId()); |
| | | map1.put("isStudent", 0); |
| | | map1.put("name", participant.getName()); |
| | | map1.put("gender", participant.getGender() == 1 ? "男" : "女"); |
| | | map1.put("age", Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday()))); |
| | | map1.put("phone", participant.getPhone()); |
| | | map1.put("idcard", participant.getIdcard()); |
| | | map1.put("state", worldCupPayment.getPayStatus() - 1); |
| | | } |
| | | list2.add(map1); |
| | | } |
| | | |
| | | limit += offset; |
| | | map.put("rows", list2.subList(offset, list2.size() >= limit ? limit : list.size())); |
| | | map.put("total", list2.size()); |
| | | return map; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.communityWorldCup.entity.WorldCupPayment; |
| | | import com.dsh.communityWorldCup.mapper.WorldCupPaymentMapper; |
| | | import com.dsh.communityWorldCup.service.IWorldCupPaymentService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 14:23 |
| | | */ |
| | | @Service |
| | | public class WorldCupPaymentServiceImpl extends ServiceImpl<WorldCupPaymentMapper, WorldCupPayment> implements IWorldCupPaymentService { |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.communityWorldCup.entity.*; |
| | | import com.dsh.communityWorldCup.feignclient.account.AppUserClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | | import com.dsh.communityWorldCup.feignclient.course.CoursePackageOrderStudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.course.model.CoursePackageOrderStudent; |
| | | import com.dsh.communityWorldCup.feignclient.other.GameClient; |
| | | import com.dsh.communityWorldCup.feignclient.other.StoreClient; |
| | | import com.dsh.communityWorldCup.feignclient.other.model.Store; |
| | | import com.dsh.communityWorldCup.feignclient.other.model.TGame; |
| | | import com.dsh.communityWorldCup.mapper.WorldCupMapper; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import com.dsh.communityWorldCup.service.*; |
| | | import com.dsh.communityWorldCup.util.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 17:11 |
| | | */ |
| | | @Service |
| | | public class WorldCupServiceImpl extends ServiceImpl<WorldCupMapper, WorldCup> implements IWorldCupService { |
| | | |
| | | @Autowired |
| | | private IWorldCupCompetitorService worldCupCompetitorService; |
| | | |
| | | @Autowired |
| | | private IWorldCupPaymentParticipantService worldCupPaymentParticipantService; |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | @Autowired |
| | | private IWorldCupStoreService worldCupStoreService; |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | |
| | | @Resource |
| | | private ParticipantClient participantClient; |
| | | |
| | | @Autowired |
| | | private IWorldCupPaymentService worldCupPaymentService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private CoursePackageOrderStudentClient coursePackageOrderStudentClient; |
| | | |
| | | @Resource |
| | | private GameClient gameClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 裁判获取世界杯列表数据 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<WorldCupListCoachVo> getWorldCupListCoach(WorldCupListCoach worldCupListCoach) { |
| | | List<WorldCupListCoachVo> worldCupListCoach1 = this.baseMapper.getWorldCupListCoach(worldCupListCoach); |
| | | //对查询结果进行距离排序(直线距离) |
| | | Collections.sort(worldCupListCoach1, new Comparator<WorldCupListCoachVo>() { |
| | | @Override |
| | | public int compare(WorldCupListCoachVo o1, WorldCupListCoachVo o2) { |
| | | Map<String, Double> distance1 = GeodesyUtil.getDistance(o1.getLon() + "," + o1.getLat(), worldCupListCoach.getLon() + "," + worldCupListCoach.getLat()); |
| | | Double wgs841 = distance1.get("WGS84"); |
| | | Map<String, Double> distance2 = GeodesyUtil.getDistance(o2.getLon() + "," + o2.getLat(), worldCupListCoach.getLon() + "," + worldCupListCoach.getLat()); |
| | | Double wgs842 = distance2.get("WGS84"); |
| | | return wgs841.compareTo(wgs842); |
| | | } |
| | | }); |
| | | return worldCupListCoach1; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 开启世界杯赛事 |
| | | * @param startWorldCup |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultUtil startWorldCup(StartWorldCup startWorldCup) { |
| | | WorldCup worldCup = this.getById(startWorldCup.getWorldCupId()); |
| | | if(worldCup.getStartTime().getTime() > System.currentTimeMillis()){ |
| | | return ResultUtil.error("赛事还未开始"); |
| | | } |
| | | if(worldCup.getEndTime().getTime() <= System.currentTimeMillis()){ |
| | | return ResultUtil.error("赛事已结束"); |
| | | } |
| | | if(worldCup.getStatus() == 4){ |
| | | return ResultUtil.error("赛事已取消"); |
| | | } |
| | | //1、通过扫码获取的sutuid查询t_game表中的红蓝方sutuid |
| | | String code = startWorldCup.getCode(); |
| | | JSONObject object = JSON.parseObject(code); |
| | | String sutu_id = object.getString("sutu_id"); |
| | | TGame tGame = gameClient.getTGameBySutuId(sutu_id); |
| | | if(null == tGame){ |
| | | return ResultUtil.error("无效的游戏二维码"); |
| | | } |
| | | |
| | | String people = startWorldCup.getPeople(); |
| | | JSONArray jsonArray = JSON.parseArray(people); |
| | | String timeStr = UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3); |
| | | List<Long> ids = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | Integer participantType = jsonObject.getInteger("participantType"); |
| | | String type = jsonObject.getString("type"); |
| | | WorldCupCompetitor worldCupCompetitor = new WorldCupCompetitor(); |
| | | worldCupCompetitor.setCode(timeStr); |
| | | worldCupCompetitor.setWorldCupId(startWorldCup.getWorldCupId()); |
| | | worldCupCompetitor.setParticipantType(participantType); |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = worldCupPaymentParticipantService.getWorldCupPaymentParticipant(startWorldCup.getWorldCupId(), participantType, id); |
| | | worldCupCompetitor.setAppUserId(worldCupPaymentParticipant.getAppUserId()); |
| | | worldCupCompetitor.setParticipantId(id); |
| | | worldCupCompetitor.setParticipant("blue".equals(type) ? 1 : 2); |
| | | worldCupCompetitor.setStartTime(new Date()); |
| | | //添加参赛奖励 |
| | | if(null != worldCup.getParticipationIntegral() && 0 < worldCup.getParticipationIntegral()){ |
| | | worldCupCompetitor.setParticipationIntegral(worldCup.getParticipationIntegral()); |
| | | AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId()); |
| | | appUser.setIntegral(appUser.getIntegral() + worldCup.getParticipationIntegral()); |
| | | appUserClient.updateAppUser(appUser); |
| | | } |
| | | |
| | | worldCupCompetitorService.save(worldCupCompetitor); |
| | | ids.add(worldCupCompetitor.getId()); |
| | | //已参赛 |
| | | worldCupPaymentParticipant.setAlreadyEntered(1); |
| | | worldCupPaymentParticipantService.updateById(worldCupPaymentParticipant); |
| | | } |
| | | //2、调起开启游戏的接口。 |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("space_id", tGame.getSiteId() + ""); |
| | | map.put("red_sutu_id", tGame.getRed()); |
| | | map.put("blue_sutu_id", tGame.getBlue()); |
| | | map.put("api_url", "http://221.182.45.100:56666/communityWorldCup/base/worldCup/endWorldCupCallback"); |
| | | map.put("custom", JSON.toJSONString(ids)); |
| | | |
| | | String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/batterGame", map); |
| | | JSONObject jsonObject = JSONObject.parseObject(s); |
| | | Integer code1 = jsonObject.getInteger("code"); |
| | | String message = jsonObject.getString("message"); |
| | | if (200 == code1) { |
| | | return ResultUtil.success(); |
| | | } else { |
| | | return ResultUtil.error(message); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户完成赛事没有提示的数据 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getCompletedWorldCupTips(Integer uid) { |
| | | int count = worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>() |
| | | .eq("appUserId", uid).eq("tips", 0).isNotNull("endTime")); |
| | | return count; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取社区世界杯列表 |
| | | * @param worldCupList |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<WorldCupListVo> getWorldCupList(WorldCupList worldCupList) { |
| | | //没有筛选门店,默认使用当前门店 |
| | | if(null == worldCupList.getStoreId()){ |
| | | worldCupList.setStoreId(worldCupList.getStoreId()); |
| | | } |
| | | List<WorldCupListVo> worldCupList1 = this.baseMapper.getWorldCupList(worldCupList); |
| | | for (WorldCupListVo worldCupListVo : worldCupList1) { |
| | | Integer id = Integer.valueOf(worldCupListVo.getId()); |
| | | List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", id).eq("payStatus", 2).eq("state", 1)); |
| | | List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); |
| | | Integer heat = worldCupListVo.getHeat(); |
| | | if(collect.size() > 0){ |
| | | int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); |
| | | heat += count; |
| | | } |
| | | worldCupListVo.setHeat(heat); |
| | | String lat = worldCupListVo.getLat(); |
| | | String lon = worldCupListVo.getLon(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, worldCupList.getLon() + "," + worldCupList.getLat()); |
| | | worldCupListVo.setDistance(distance.get("WGS84")); |
| | | } |
| | | |
| | | |
| | | if(null != worldCupList.getSort()){ |
| | | Collections.sort(worldCupList1, new Comparator<WorldCupListVo>() { |
| | | @Override |
| | | public int compare(WorldCupListVo o1, WorldCupListVo o2) { |
| | | if(worldCupList.getSort() == 1){ |
| | | return o1.getHeat().compareTo(o2.getHeat()); |
| | | } |
| | | if(worldCupList.getSort() == 2){ |
| | | return o1.getHeat().compareTo(o2.getHeat()) * -1; |
| | | } |
| | | return 0; |
| | | } |
| | | }); |
| | | }else{ |
| | | Collections.sort(worldCupList1, new Comparator<WorldCupListVo>() { |
| | | @Override |
| | | public int compare(WorldCupListVo o1, WorldCupListVo o2) { |
| | | return o1.getDistance().compareTo(o2.getDistance()) * -1; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return worldCupList1; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取世界杯详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WorldCupInfo getWorldCupInfo(Integer id, String lon, String lat) { |
| | | WorldCupInfo worldCupInfo = this.baseMapper.getWorldCupInfo(id); |
| | | List<WorldCupStore> worldCupStores = worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("worldCupId", id)); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | for (WorldCupStore worldCupStore : worldCupStores) { |
| | | Store store = storeClient.queryStoreById(worldCupStore.getStoreId()); |
| | | jsonArray.add(store.getName()); |
| | | } |
| | | worldCupInfo.setStores(jsonArray.toJSONString()); |
| | | |
| | | List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", id).eq("payStatus", 2).eq("state", 1)); |
| | | List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); |
| | | Integer heat = worldCupInfo.getHeat(); |
| | | if(collect.size() > 0){ |
| | | int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); |
| | | heat += count; |
| | | } |
| | | worldCupInfo.setHeat(heat); |
| | | ArrayList<Map<String, Object>> objects = new ArrayList<>(); |
| | | for (WorldCupStore worldCupStore : worldCupStores) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | Store store = storeClient.queryStoreById(worldCupStore.getStoreId()); |
| | | map.put("name", store.getName()); |
| | | |
| | | |
| | | String str = store.getAddress(); |
| | | str = str.substring(str.indexOf("省") + 1); |
| | | |
| | | // 去掉第一个“市”及之前的字符串 |
| | | str = str.substring(str.indexOf("市") + 1); |
| | | |
| | | // 去掉第一个“区”及之前的字符串 |
| | | str = str.substring(str.indexOf("区") + 1); |
| | | |
| | | map.put("address", str); |
| | | map.put("storeLon", store.getLon()); |
| | | map.put("storeLat", store.getLat()); |
| | | map.put("storeCoverDrawing", store.getCoverDrawing()); |
| | | if (ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)) { |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | | double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | map.put("distance", wgs84); |
| | | } |
| | | objects.add(map); |
| | | } |
| | | worldCupInfo.setStoreInfos(objects); |
| | | return worldCupInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 报名前校验支付方式 |
| | | * @param checkPaymentMethod |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CheckPaymentMethodVo checkPaymentMethod(CheckPaymentMethod checkPaymentMethod) { |
| | | WorldCup worldCup = this.getById(checkPaymentMethod.getId()); |
| | | JSONArray jsonArray = JSON.parseArray(checkPaymentMethod.getIds()); |
| | | CheckPaymentMethodVo checkPaymentMethodVo = new CheckPaymentMethodVo(); |
| | | AppUser appUser = appUserClient.getAppUser(checkPaymentMethod.getUid()); |
| | | BigDecimal multiply = new BigDecimal(jsonArray.size()).multiply(new BigDecimal(worldCup.getPaiCoin())); |
| | | if(appUser.getPlayPaiCoins() < multiply.intValue()){ |
| | | checkPaymentMethodVo.setPaiCoin(0); |
| | | }else{ |
| | | checkPaymentMethodVo.setPaiCoin(1); |
| | | } |
| | | |
| | | int classHour = 1; |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | //是否是学员(0=否,1=是) |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | if(0 == isStudent){ |
| | | classHour = 0; |
| | | break; |
| | | } |
| | | List<CoursePackageOrderStudent> coursePackageOrderStudent = coursePackageOrderStudentClient.getCoursePackageOrderStudent(id); |
| | | int sum = coursePackageOrderStudent.stream().mapToInt(CoursePackageOrderStudent::getLaveClassHours).sum(); |
| | | if(sum < worldCup.getClassHour()){ |
| | | classHour = 0; |
| | | break; |
| | | } |
| | | } |
| | | checkPaymentMethodVo.setClassHour(classHour); |
| | | return checkPaymentMethodVo; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 报名世界杯 |
| | | * @param paymentWorldCup |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultUtil paymentWorldCup(PaymentWorldCup paymentWorldCup) { |
| | | WorldCup worldCup = this.getById(paymentWorldCup.getId()); |
| | | if(null == worldCup){ |
| | | return ResultUtil.error("报名数据异常"); |
| | | } |
| | | if(null != worldCup.getRegistrationClosingTime() && System.currentTimeMillis() > worldCup.getRegistrationClosingTime().getTime()){ |
| | | return ResultUtil.error("报名时间已结束,无法完成报名"); |
| | | } |
| | | if(System.currentTimeMillis() > worldCup.getEndTime().getTime()){ |
| | | return ResultUtil.error("世界杯赛事已结束,无法完成报名"); |
| | | } |
| | | String ids = paymentWorldCup.getIds(); |
| | | JSONArray jsonArray = JSON.parseArray(ids); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | //是否是学员(0=否,1=是) |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | if(isStudent == 1){ |
| | | TStudent tStudent = studentClient.queryById(id); |
| | | if(worldCup.getStartAge() > (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())))){ |
| | | return ResultUtil.error("【" + tStudent.getName() + "】年龄不符合要求"); |
| | | } |
| | | if(worldCup.getEndAge() < (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())))){ |
| | | return ResultUtil.error("【" + tStudent.getName() + "】年龄不符合要求"); |
| | | } |
| | | }else{ |
| | | Participant participant = participantClient.getParticipant(id); |
| | | if(worldCup.getStartAge() > (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())))){ |
| | | return ResultUtil.error("【" + participant.getName() + "】年龄不符合要求"); |
| | | } |
| | | if(worldCup.getEndAge() < (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())))){ |
| | | return ResultUtil.error("【" + participant.getName() + "】年龄不符合要求"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //开始支付操作 |
| | | ResultUtil payment = null; |
| | | try { |
| | | payment = payment(worldCup, paymentWorldCup); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return payment; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付逻辑 |
| | | * @param worldCup |
| | | * @param paymentWorldCup |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private ResultUtil payment(WorldCup worldCup, PaymentWorldCup paymentWorldCup) throws Exception { |
| | | WorldCupPayment worldCupPayment = new WorldCupPayment(); |
| | | worldCupPayment.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(5)); |
| | | worldCupPayment.setWorldCupId(paymentWorldCup.getId()); |
| | | worldCupPayment.setAppUserId(paymentWorldCup.getUid()); |
| | | worldCupPayment.setPayType(paymentWorldCup.getPayType()); |
| | | worldCupPayment.setPayStatus(1); |
| | | worldCupPayment.setState(1); |
| | | worldCupPayment.setCreateTime(new Date()); |
| | | worldCupPayment.setEntrant(paymentWorldCup.getIds()); |
| | | int num = JSON.parseArray(paymentWorldCup.getIds()).size(); |
| | | //不免费 |
| | | String payType1 = worldCup.getPayType().split(",")[0]; |
| | | if(!"0".equals(payType1)){ |
| | | Integer payType = paymentWorldCup.getPayType(); |
| | | //微信 |
| | | if(payType == 1){ |
| | | worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); |
| | | worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); |
| | | worldCupPaymentService.save(worldCupPayment); |
| | | return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), |
| | | worldCup.getCash().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); |
| | | } |
| | | //支付宝 |
| | | if(payType == 2){ |
| | | worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); |
| | | worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); |
| | | worldCupPaymentService.save(worldCupPayment); |
| | | return payMoneyUtil.alipay("2088330203191220", "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), |
| | | worldCup.getCash().toString(), "/base/worldCup/aliPayWorldCupCallback"); |
| | | } |
| | | //玩湃币 |
| | | if(payType == 3){ |
| | | AppUser appUser = appUserClient.getAppUser(paymentWorldCup.getUid()); |
| | | BigDecimal multiply = new BigDecimal(num).multiply(new BigDecimal(worldCup.getPaiCoin())); |
| | | if(appUser.getPlayPaiCoins() < multiply.intValue()){ |
| | | return ResultUtil.error("报名失败,玩湃币不足,请充值!"); |
| | | } |
| | | worldCupPayment.setAmount(multiply); |
| | | worldCupPayment.setPayStatus(2); |
| | | worldCupPayment.setPayTime(new Date()); |
| | | worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); |
| | | worldCupPaymentService.save(worldCupPayment); |
| | | |
| | | appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() - multiply.intValue()); |
| | | appUserClient.updateAppUser(appUser); |
| | | |
| | | //添加报名明细 |
| | | String ids = paymentWorldCup.getIds(); |
| | | JSONArray jsonArray = JSON.parseArray(ids); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | //是否是学员(0=否,1=是) |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = new WorldCupPaymentParticipant(); |
| | | worldCupPaymentParticipant.setWorldCupId(paymentWorldCup.getId()); |
| | | worldCupPaymentParticipant.setWorldCupPaymentId(worldCupPayment.getId()); |
| | | worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid()); |
| | | worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | worldCupPaymentParticipant.setParticipantId(id); |
| | | worldCupPaymentParticipant.setAlreadyEntered(0); |
| | | worldCupPaymentParticipant.setCreateTime(new Date()); |
| | | worldCupPaymentParticipantService.save(worldCupPaymentParticipant); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | //课时 |
| | | if(payType == 4){ |
| | | BigDecimal multiply = new BigDecimal(num).multiply(new BigDecimal(worldCup.getClassHour())); |
| | | String ids = paymentWorldCup.getIds(); |
| | | JSONArray jsonArray = JSON.parseArray(ids); |
| | | List<DeductionClassHour> list = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | //是否是学员(0=否,1=是) |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | if(0 == isStudent){ |
| | | return ResultUtil.error("非学员无法使用课时报名"); |
| | | } |
| | | List<CoursePackageOrderStudent> coursePackageOrderStudent = coursePackageOrderStudentClient.getCoursePackageOrderStudent(id); |
| | | int sum = coursePackageOrderStudent.stream().mapToInt(CoursePackageOrderStudent::getLaveClassHours).sum(); |
| | | if(sum < worldCup.getClassHour()){ |
| | | return ResultUtil.error("报名失败,课时不足,请续课!"); |
| | | } |
| | | |
| | | //构建扣减课时数据 |
| | | Integer classHour = worldCup.getClassHour(); |
| | | for (CoursePackageOrderStudent packageOrderStudent : coursePackageOrderStudent) { |
| | | Integer laveClassHours = packageOrderStudent.getLaveClassHours(); |
| | | |
| | | DeductionClassHour deductionClassHour = new DeductionClassHour(); |
| | | if(classHour.compareTo(laveClassHours) > 0){ |
| | | //不够扣除,轮询直到扣除完 |
| | | classHour = classHour - laveClassHours; |
| | | deductionClassHour.setId(packageOrderStudent.getId()); |
| | | deductionClassHour.setClassHour(laveClassHours); |
| | | deductionClassHour.setStudentId(packageOrderStudent.getStudentId()); |
| | | deductionClassHour.setCoursePackageId(packageOrderStudent.getCoursePackageId()); |
| | | list.add(deductionClassHour); |
| | | }else{ |
| | | //够扣除直接跳出进行下个学员 |
| | | deductionClassHour.setId(packageOrderStudent.getId()); |
| | | deductionClassHour.setClassHour(classHour); |
| | | deductionClassHour.setStudentId(packageOrderStudent.getStudentId()); |
| | | deductionClassHour.setCoursePackageId(packageOrderStudent.getCoursePackageId()); |
| | | list.add(deductionClassHour); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //扣减课时操作 |
| | | DeductionClassHourList deductionClassHourList = new DeductionClassHourList(); |
| | | deductionClassHourList.setDeductionClassHourList(list); |
| | | DeductionClassHourList deductionClassHourList1 = coursePackageOrderStudentClient.deductionClassHour(deductionClassHourList); |
| | | |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = new WorldCupPaymentParticipant(); |
| | | worldCupPaymentParticipant.setWorldCupId(paymentWorldCup.getId()); |
| | | worldCupPaymentParticipant.setWorldCupPaymentId(worldCupPayment.getId()); |
| | | worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid()); |
| | | worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | worldCupPaymentParticipant.setParticipantId(id); |
| | | worldCupPaymentParticipant.setAlreadyEntered(0); |
| | | worldCupPaymentParticipant.setCreateTime(new Date()); |
| | | worldCupPaymentParticipant.setContent(JSON.toJSONString(deductionClassHourList1)); |
| | | worldCupPaymentParticipantService.save(worldCupPaymentParticipant); |
| | | } |
| | | |
| | | worldCupPayment.setAmount(multiply); |
| | | worldCupPayment.setPayStatus(2); |
| | | worldCupPayment.setPayTime(new Date()); |
| | | worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); |
| | | worldCupPaymentService.save(worldCupPayment); |
| | | |
| | | //添加报名明细 |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | //是否是学员(0=否,1=是) |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = new WorldCupPaymentParticipant(); |
| | | worldCupPaymentParticipant.setWorldCupId(paymentWorldCup.getId()); |
| | | worldCupPaymentParticipant.setWorldCupPaymentId(worldCupPayment.getId()); |
| | | worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid()); |
| | | worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | worldCupPaymentParticipant.setParticipantId(id); |
| | | worldCupPaymentParticipant.setAlreadyEntered(0); |
| | | worldCupPaymentParticipantService.save(worldCupPaymentParticipant); |
| | | } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | }else{ |
| | | worldCupPayment.setPayType(0); |
| | | worldCupPayment.setAmount(BigDecimal.ZERO); |
| | | worldCupPayment.setPayStatus(2); |
| | | worldCupPayment.setPayTime(new Date()); |
| | | worldCupPayment.setUnitPrice(BigDecimal.ZERO); |
| | | worldCupPaymentService.save(worldCupPayment); |
| | | |
| | | //添加报名明细 |
| | | String ids = paymentWorldCup.getIds(); |
| | | JSONArray jsonArray = JSON.parseArray(ids); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | //是否是学员(0=否,1=是) |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = new WorldCupPaymentParticipant(); |
| | | worldCupPaymentParticipant.setWorldCupId(paymentWorldCup.getId()); |
| | | worldCupPaymentParticipant.setWorldCupPaymentId(worldCupPayment.getId()); |
| | | worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid()); |
| | | worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | worldCupPaymentParticipant.setParticipantId(id); |
| | | worldCupPaymentParticipant.setAlreadyEntered(0); |
| | | worldCupPaymentParticipant.setCreateTime(new Date()); |
| | | worldCupPaymentParticipantService.save(worldCupPaymentParticipant); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 第三方支付完成后的处理逻辑 |
| | | * @param code |
| | | * @param outTradeNo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultUtil paymentWorldCupCallback(String code, String outTradeNo) { |
| | | WorldCupPayment worldCupPayment = worldCupPaymentService.getOne(new QueryWrapper<WorldCupPayment>().eq("code", code)); |
| | | worldCupPayment.setPayStatus(2); |
| | | worldCupPayment.setPayTime(new Date()); |
| | | worldCupPaymentService.updateById(worldCupPayment); |
| | | |
| | | //添加报名明细 |
| | | String ids = worldCupPayment.getEntrant(); |
| | | JSONArray jsonArray = JSON.parseArray(ids); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | //是否是学员(0=否,1=是) |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = new WorldCupPaymentParticipant(); |
| | | worldCupPaymentParticipant.setWorldCupId(worldCupPayment.getWorldCupId()); |
| | | worldCupPaymentParticipant.setWorldCupPaymentId(worldCupPayment.getId()); |
| | | worldCupPaymentParticipant.setAppUserId(worldCupPayment.getAppUserId()); |
| | | worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | worldCupPaymentParticipant.setParticipantId(id); |
| | | worldCupPaymentParticipant.setAlreadyEntered(0); |
| | | worldCupPaymentParticipant.setCreateTime(new Date()); |
| | | worldCupPaymentParticipantService.save(worldCupPaymentParticipant); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取比赛管理列表数据 |
| | | * @param worldCupListAll |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getWorldCupListAll(WorldCupListAll worldCupListAll) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> list = this.baseMapper.getWorldCupListAll(worldCupListAll); |
| | | for (Map<String, Object> map1 : list) { |
| | | String maxPeople = map1.get("maxPeople").toString(); |
| | | Integer id = Integer.valueOf(map1.get("id").toString()); |
| | | List<WorldCupPayment> lists = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", id).eq("payStatus", 2).eq("state", 1)); |
| | | List<Long> collect = lists.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); |
| | | Integer count = 0; |
| | | if(collect.size() > 0){ |
| | | count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); |
| | | } |
| | | map1.put("maxPeople", maxPeople + " - " + count); |
| | | } |
| | | Integer count = this.baseMapper.getWorldCupListAllCount(worldCupListAll); |
| | | map.put("rows", list); |
| | | map.put("total", count); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消赛事后退还费用 |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public void cancelWorldCupRefund(Integer id) { |
| | | List<WorldCupPaymentParticipant> list = worldCupPaymentParticipantService.list(new QueryWrapper<WorldCupPaymentParticipant>() |
| | | .eq("worldCupId", id).eq("alreadyEntered", 0)); |
| | | Set<Long> collect = list.stream().map(WorldCupPaymentParticipant::getWorldCupPaymentId).collect(Collectors.toSet()); |
| | | for (Long worldCupPaymentId : collect) { |
| | | List<WorldCupPaymentParticipant> list1 = worldCupPaymentParticipantService.list(new QueryWrapper<WorldCupPaymentParticipant>() |
| | | .eq("worldCupPaymentId", worldCupPaymentId).eq("alreadyEntered", 0)); |
| | | WorldCupPayment worldCupPayment = worldCupPaymentService.getById(worldCupPaymentId); |
| | | BigDecimal multiply = worldCupPayment.getUnitPrice().multiply(new BigDecimal(list1.size())); |
| | | //微信支付 |
| | | if(worldCupPayment.getPayType() == 1){ |
| | | Map<String, String> map = payMoneyUtil.wxRefund(worldCupPayment.getPayOrderNo(), worldCupPayment.getCode(), |
| | | worldCupPayment.getAmount().toString(), multiply.toString(), "/base/worldCup/wxRefundWorldCupCallback"); |
| | | if(!"SUCCESS".equals(map.get("return_code"))){ |
| | | System.err.println("-------------微信退款失败---------"); |
| | | System.err.println(map.get("return_msg")); |
| | | } |
| | | } |
| | | //支付宝支付 |
| | | if(worldCupPayment.getPayType() == 2){ |
| | | Map<String, String> map = null; |
| | | try { |
| | | map = payMoneyUtil.aliRefund(worldCupPayment.getPayOrderNo(), multiply.toString()); |
| | | } catch (AlipayApiException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if("10000".equals(map.get("code"))){ |
| | | String trade_no = map.get("trade_no"); |
| | | worldCupPayment.setRefundTime(new Date()); |
| | | worldCupPayment.setRefundOrderNo(trade_no); |
| | | worldCupPayment.setPayStatus(3); |
| | | worldCupPaymentService.updateById(worldCupPayment); |
| | | } |
| | | } |
| | | //玩湃币支付 |
| | | if(worldCupPayment.getPayType() == 3){ |
| | | Integer appUserId = worldCupPayment.getAppUserId(); |
| | | AppUser appUser = appUserClient.getAppUser(appUserId); |
| | | appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + multiply.intValue()); |
| | | appUserClient.updateAppUser(appUser); |
| | | worldCupPayment.setRefundTime(new Date()); |
| | | worldCupPayment.setRefundOrderNo(""); |
| | | worldCupPayment.setPayStatus(3); |
| | | worldCupPaymentService.updateById(worldCupPayment); |
| | | } |
| | | //课时支付 |
| | | if(worldCupPayment.getPayType() == 4){ |
| | | for (WorldCupPaymentParticipant worldCupPaymentParticipant : list1) { |
| | | String content = worldCupPaymentParticipant.getContent(); |
| | | DeductionClassHourList deductionClassHourList = JSON.parseObject(content, DeductionClassHourList.class); |
| | | coursePackageOrderStudentClient.backspaceClassHour(deductionClassHourList); |
| | | } |
| | | worldCupPayment.setRefundTime(new Date()); |
| | | worldCupPayment.setRefundOrderNo(""); |
| | | worldCupPayment.setPayStatus(3); |
| | | worldCupPaymentService.updateById(worldCupPayment); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务修改状态 |
| | | */ |
| | | @Override |
| | | public void taskUpdateStatus() { |
| | | List<WorldCup> worldCups = this.list(new QueryWrapper<WorldCup>().eq("status", 1).last(" and startTime <= now()")); |
| | | for (WorldCup worldCup : worldCups) { |
| | | worldCup.setStatus(2); |
| | | } |
| | | if(worldCups.size() > 0){ |
| | | this.updateBatchById(worldCups); |
| | | } |
| | | worldCups = this.list(new QueryWrapper<WorldCup>().eq("status", 2).last(" and endTime <= now()")); |
| | | for (WorldCup worldCup : worldCups) { |
| | | worldCup.setStatus(3); |
| | | } |
| | | if(worldCups.size() > 0){ |
| | | this.updateBatchById(worldCups); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.communityWorldCup.entity.WorldCupStore; |
| | | import com.dsh.communityWorldCup.feignclient.other.StoreClient; |
| | | import com.dsh.communityWorldCup.feignclient.other.model.Store; |
| | | import com.dsh.communityWorldCup.mapper.WorldCupStoreMapper; |
| | | import com.dsh.communityWorldCup.service.IWorldCupStoreService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 18:09 |
| | | */ |
| | | @Service |
| | | public class WorldCupStoreServiceImpl extends ServiceImpl<WorldCupStoreMapper, WorldCupStore> implements IWorldCupStoreService { |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取世界杯赛点列表 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getWorldCupStore() { |
| | | List<WorldCupStore> list = this.list(); |
| | | Set<Integer> collect = list.stream().map(WorldCupStore::getStoreId).collect(Collectors.toSet()); |
| | | List<Map<String, Object>> list1 = new ArrayList<>(); |
| | | for (Integer integer : collect) { |
| | | Store store = storeClient.queryStoreById(integer); |
| | | if(null != store){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", integer); |
| | | map.put("name", store.getName()); |
| | | list1.add(map); |
| | | } |
| | | } |
| | | return list1; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2021/7/28 10:26 |
| | | */ |
| | | public class CodeGenerateUtils { |
| | | |
| | | /** |
| | | * @return |
| | | * @Description 获取商品编码 |
| | | * 商品编码规则:nanoTime(后5位)*5位随机数(10000~99999) |
| | | * @Author xiaochen |
| | | */ |
| | | public static String generateProductCode() { |
| | | long nanoPart = System.nanoTime() % 100000L; |
| | | if (nanoPart < 10000L) { |
| | | nanoPart += 10000L; |
| | | } |
| | | long randomPart = (long) (Math.random() * (90000) + 10000); |
| | | String code = "0" + new BigDecimal(nanoPart).multiply(new BigDecimal(randomPart)); |
| | | return code.substring(code.length() - 10); |
| | | } |
| | | |
| | | /** |
| | | * @return |
| | | * @Description 生成订单编号 10位 |
| | | * 订单编号规则:(10位):(年末尾*月,取后2位)+(用户ID%3.33*日取整后2位)+(timestamp*10000以内随机数,取后6位) |
| | | * @Author xiaochen |
| | | */ |
| | | public static String generateOrderSn() { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int year = calendar.get(Calendar.YEAR); |
| | | year = year % 10; |
| | | if (year == 0) year = 10; |
| | | int month = calendar.get(Calendar.MONTH) + 1; |
| | | int yearMonth = year * month; |
| | | String yearMonthPart = "0" + yearMonth; |
| | | yearMonthPart = yearMonthPart.substring(yearMonthPart.length() - 2); |
| | | |
| | | int day = calendar.get(Calendar.DAY_OF_MONTH); |
| | | double v = Math.random() * 10000; |
| | | int dayNum = (int) ((v % 3.33) * day); |
| | | String dayPart = "0" + dayNum; |
| | | dayPart = dayPart.substring(dayPart.length() - 2); |
| | | |
| | | String timestampPart = "" + (Math.random() * 10000) * (System.currentTimeMillis() / 10000); |
| | | timestampPart = timestampPart.replace(".", "").replace("E", ""); |
| | | timestampPart = timestampPart.substring(0, 6); |
| | | return yearMonthPart + dayPart + timestampPart; |
| | | } |
| | | |
| | | /** |
| | | * @return |
| | | * @Description 生成统一支付单号 规则:年(2)月(2)日(2)时(2)分(2)+timestamp*5位随机整数取后5位 |
| | | * @Author xiaochen |
| | | */ |
| | | public static String generateVolumeSn() { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmss"); |
| | | String dateTime = dateFormat.format(calendar.getTime()); |
| | | dateTime = dateTime.substring(2); |
| | | String timestampPart = "" + (Math.random() * 10000) * (System.currentTimeMillis() / 10000); |
| | | timestampPart = timestampPart.replace(".", "").replace("E", ""); |
| | | timestampPart = timestampPart.substring(0, 5); |
| | | return dateTime + timestampPart; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | |
| | | |
| | | /** |
| | | * 日期时间类型的工具类,提供对日期和时间基于毫秒及以上精度的格式化方法、 |
| | | * 运算方法、比较方法等。注意:大部分对日期对象(java.util.Date)操作的方法, |
| | | * 不会修改原日期对象,而以一个新的日期对象返回。 |
| | | * <p> |
| | | * <p> |
| | | * <p><pre><b> |
| | | * 历史更新记录:</b> |
| | | * 2004-6-17 创建此类型 |
| | | * 2005-9-30 修改方法:parseToDate(),去掉了对年份从(1970-9999)这个范围的限制。抛出异常:IllegalArgumentException(),JThinkRuntimeException() |
| | | * 2005-10-2 修改方法: 其它方法,抛出异常:IllegalArgumentException(),JThinkRuntimeException() |
| | | * 2005-10-2 增加方法: addTime(Date d, double times, int type) |
| | | * 2005-10-2 增加方法: addSystemTime() |
| | | * 2005-10-2 修改方法, 对于所有以日期对象类型java.util.Date为参数的方法,如果日期为null,都抛出异常:IllegalArgumentException() |
| | | * <p> |
| | | * </pre></p> |
| | | */ |
| | | |
| | | public final class DateTimeHelper { |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 8:26:30.400 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmmssSa_12 = "yyyy-MM-dd KK:mm:ss.S a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 8:26:16 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmmssa_12 = "yyyy-MM-dd KK:mm:ss a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 8:26 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmma_12 = "yyyy-MM-dd KK:mm a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 8 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHa_12 = "yyyy-MM-dd KK a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-07-05 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMdda_12 = "yyyy-MM-dd a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 08:26:30.400 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmmssS = "yyyy-MM-dd HH:mm:ss.S"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 08:26:16 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 08:26 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmm = "yyyy-MM-dd HH:mm"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 08 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHH = "yyyy-MM-dd HH"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-07-05 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMdd = "yyyy-MM-dd"; |
| | | /** |
| | | * 把时间格式化成如:2002-07 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMM = "yyyy-MM"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:07.19 格式的字符串 |
| | | */ |
| | | public final static String FMT_MMdd = "MM.dd"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:12:08 PM(下午) 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmA_12 = "KK:mm a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:0:55 AM上午, CST 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmAz_12 = "KK:mm a,z"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:0:56 AM上午, 中国标准时间 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmAzzzz_12 = "KK:mm a,zzzz"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:12:08:23 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmssA_12 = "KK:mm:ss a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:0:55:33 AM上午, CST 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmssAz_12 = "KK:mm:ss a,z"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:0:56:23 AM上午, 中国标准时间 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmssAzzzz_12 = "KK:mm:ss a,zzzz"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04:45 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmss = "HH:mm:ss"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04:45.824 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmssS = "HH:mm:ss.S"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmm = "HH:mm"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04,CST 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmz = "HH:mm,z"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04,中国标准时间 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmzzzz = "HH:mm,zzzz"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:Sun,Nov 14,'2004 格式的字符串 |
| | | */ |
| | | public final static String FMT_WWMMDDYY_EN = "EEE,MMM d,''yyyy"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:星期日,2004年十一月14号 格式的字符串 |
| | | */ |
| | | public final static String FMT_WWMMDDYY_CN = "EEE,yyyy年MMMd号"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:Sun,Nov 14,'2004 格式的字符串 |
| | | */ |
| | | public final static String FMT_MMDDYY_EN = "MMM d,''yyyy"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:星期日,2004年十一月14号 格式的字符串 |
| | | */ |
| | | public final static String FMT_MMDDYY_CN = "yyyy年MMMd号"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:星期几 格式的字符串,即可获得该日这个时间是星期几 |
| | | */ |
| | | public final static String FMT_WW = "EEE"; |
| | | |
| | | public final static String FMT_ddMMyyyy = "dd-MM-yyyy"; |
| | | |
| | | /** |
| | | * 把时间格式成日期数字,如:20120606 |
| | | */ |
| | | public final static String FMT_yyyyMMdd_noseparator = "yyyyMMdd"; |
| | | |
| | | public final static String FMT_yyyyMMdd_Zh = "yyyy年MM月dd日"; |
| | | |
| | | public final static String FMT_yyyyMMddHH_noseparator = "yyyyMMddHH"; |
| | | |
| | | /** |
| | | * 把时间格式成日期数字,如:20120606121212 |
| | | */ |
| | | public final static String FMT_yyyyMMddhhmmss_noseparator = "yyyyMMddHHmmss"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002.07.05 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyxMMxdd = "yyyy.MM.dd"; |
| | | /** |
| | | * 常用的格式化时间的格式组,用于本类中格式化字符串成时间型 |
| | | */ |
| | | private final static String[] formatStr = { |
| | | FMT_ddMMyyyy, |
| | | FMT_yyyyMMddHHmmssS, |
| | | FMT_yyyyMMddHHmmss, |
| | | FMT_yyyyMMddHHmm, |
| | | FMT_yyyyMMddHH, |
| | | FMT_yyyyMMdd, |
| | | FMT_HHmmss, |
| | | FMT_HHmmssS, |
| | | FMT_HHmm, |
| | | FMT_HHmmz, |
| | | FMT_HHmmzzzz, |
| | | FMT_yyyyMMddHHmmssSa_12, |
| | | FMT_yyyyMMddHHmmssa_12, |
| | | FMT_yyyyMMddHHmma_12, |
| | | FMT_yyyyMMddHHa_12, |
| | | FMT_yyyyMMdda_12, |
| | | FMT_HHmmA_12, |
| | | FMT_HHmmAz_12, |
| | | FMT_HHmmAzzzz_12, |
| | | FMT_HHmmssA_12, |
| | | FMT_HHmmssAz_12, |
| | | FMT_HHmmssAzzzz_12 |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 私有化构造器,使得不能产生该类对象,类中所有的方法均为静态方法 |
| | | */ |
| | | private DateTimeHelper() { |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的Date值和格式串采用操作系统的默认所在的国家风格来格式化时间,并返回相应的字符串 |
| | | * |
| | | * @param date |
| | | * @param formatStr |
| | | * @return 如果为null,返回字符串"" |
| | | */ |
| | | public static String formatDateTimetoString(Date date, String formatStr) { |
| | | String reStr = ""; |
| | | if (date == null || formatStr == null || formatStr.trim().length() < 1) { |
| | | return reStr; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat(); |
| | | sdf.applyPattern(formatStr); |
| | | reStr = sdf.format(date); |
| | | return reStr; |
| | | } |
| | | |
| | | public static Date getSystemDate(String fmtstr) { |
| | | try { |
| | | return parseToDate(formatDateTimetoString(getSystemDate(), fmtstr)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return getSystemDate(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的Date值和格式串采用给定的国家所在的国家风格来格式化时间,并返回相应的字符串 |
| | | * |
| | | * @param date 日期对象 |
| | | * @param formatStr 日期格式 |
| | | * @return 如果为null,返回字符串"" |
| | | */ |
| | | public static String formatDateTimetoString(Date date, String formatStr, Locale locale) { |
| | | String reStr = ""; |
| | | if (date == null || formatStr == null || locale == null || formatStr.trim().length() < 1) { |
| | | return reStr; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr, locale); |
| | | reStr = sdf.format(date); |
| | | return reStr; |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的Date值字符串和格式串采用操作系统的默认所在的国家风格来格式化时间,并返回相应的字符串 |
| | | * |
| | | * @param dateStr 日期串 |
| | | * @param formatStr 日期格式 |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDateTimetoString(String dateStr, String formatStr) throws Exception { |
| | | String dStr = ""; |
| | | if (dateStr != null && dateStr.trim().length() > 0 && formatStr != null && formatStr.trim().length() > 0) { |
| | | dStr = formatDateTimetoString(parseToDate(dateStr), formatStr); |
| | | } |
| | | return dStr; |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的Date值字符串和格式串采用指定国家的风格来格式化时间,并返回相应的字符串 |
| | | * |
| | | * @param dateStr 日期串 |
| | | * @param formatStr 日期格式 |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDateTimetoString(String dateStr, String formatStr, Locale locale) throws Exception { |
| | | String dStr = ""; |
| | | if (dateStr != null && dateStr.trim().length() > 0 && formatStr != null && formatStr.trim().length() > 0 && locale != null) { |
| | | dStr = formatDateTimetoString(parseToDate(dateStr, locale), formatStr, locale); |
| | | } |
| | | return dStr; |
| | | } |
| | | |
| | | /** |
| | | * 按指定的格式和操作系统默认国家的风格把给定的日期字符串格式化为一个Date型日期 |
| | | * |
| | | * @param dateTimeStr |
| | | * @param formatStr |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(String dateTimeStr, String formatStr) throws Exception { |
| | | if (dateTimeStr == null || formatStr == null || dateTimeStr.trim().length() < 1 || formatStr.trim().length() < 1) { |
| | | throw new IllegalArgumentException("参数dateTimeStr、formatStr不能是null或空格串!"); |
| | | } |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr); |
| | | try { |
| | | return sdf.parse(dateTimeStr); |
| | | } catch (ParseException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按指定的格式和指定国家的风格把给定的日期字符串格式化为一个Date型日期 |
| | | * |
| | | * @param dateTimeStr |
| | | * @param formatStr |
| | | * @param locale |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(String dateTimeStr, String formatStr, Locale locale) throws Exception { |
| | | if (dateTimeStr != null && formatStr != null && locale != null && dateTimeStr.trim().length() > 0 && formatStr.trim().length() > 0) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr, locale); |
| | | try { |
| | | return sdf.parse(dateTimeStr); |
| | | } catch (ParseException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("参数dateTimeStr、formatStr、locale不能是null或空格串!"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按操作系统默认国家的风格把给定的日期字符串格式化为一个Date型日期 |
| | | * |
| | | * @param dateTimeStr |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(String dateTimeStr) throws Exception { |
| | | if (dateTimeStr == null || dateTimeStr.trim().length() < 1) { |
| | | throw new IllegalArgumentException("参数dateTimeSt不能是null或空格串!"); |
| | | } |
| | | int formatStrLength = formatStr.length; |
| | | int i = 0; |
| | | |
| | | for (i = 0; i < formatStrLength; i++) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr[i]); |
| | | try { |
| | | return sdf.parse(dateTimeStr); |
| | | } catch (ParseException e) { |
| | | } |
| | | } |
| | | throw new Exception("日期格式不正确!"); |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的年月和日返回一个日期型的对象 |
| | | * |
| | | * @param year 年 |
| | | * @param month 月 ,1到12 |
| | | * @param day 日 ,1到31 |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(int year, int month, int day) throws Exception { |
| | | if (month < 1 || month > 12 || day < 1 || day > 31) { |
| | | throw new IllegalArgumentException("参数不正确!"); |
| | | } |
| | | String yearStr = String.valueOf(year); |
| | | String monthStr = String.valueOf(month); |
| | | String dayStr = String.valueOf(day); |
| | | |
| | | return parseToDate(yearStr + "-" + monthStr + "-" + dayStr); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的年月日、时分秒、返回一个对应的Date型对象 |
| | | * |
| | | * @param year 年 |
| | | * @param month 月 ,1到12 |
| | | * @param day 日 ,1到31 |
| | | * @param h 小时,从0到23 |
| | | * @param m 分,从0到60 |
| | | * @param s 秒,从0到60 |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(int year, int month, int day, int h, int m, int s) throws Exception { |
| | | if (month < 1 || month > 12 || day < 1 || day > 31 || h < 0 || h > 23 || m < 0 || m > 60 || s < 0 || s > 60) { |
| | | throw new IllegalArgumentException("参数不正确!"); |
| | | } |
| | | String yearStr = String.valueOf(year); |
| | | String monthStr = String.valueOf(month); |
| | | String dayStr = String.valueOf(day); |
| | | String hStr = String.valueOf(h); |
| | | String mStr = String.valueOf(m); |
| | | String sStr = String.valueOf(s); |
| | | |
| | | return parseToDate(yearStr + "-" + monthStr + "-" + dayStr + " " + hStr + ":" + mStr + ":" + sStr); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按指定国家的风格把给定的日期字符串格式化为一个Date型日期 |
| | | * |
| | | * @param dateTimeStr |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(String dateTimeStr, Locale locale) throws Exception { |
| | | if (dateTimeStr == null || dateTimeStr.trim().length() < 1 || locale == null) { |
| | | throw new IllegalArgumentException("参数dateTimeSt、locale不能是null或空格串!"); |
| | | } |
| | | int formatStrLength = formatStr.length; |
| | | int i = 0; |
| | | for (i = 0; i < formatStrLength; i++) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr[i], locale); |
| | | try { |
| | | return sdf.parse(dateTimeStr); |
| | | } catch (ParseException e) { |
| | | } |
| | | } |
| | | throw new Exception("日期格式不正确!"); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间字符串按操作系统默认的国家风格格式化成"yyyy-MM-dd HH:mm:ss"格式的日期时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDateTimetoString(String dateTimeStr) throws Exception { |
| | | return formatDateTimetoString(dateTimeStr, FMT_yyyyMMddHHmmss); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间字符串按指定国家的风格格式化成"yyyy-MM-dd HH:mm:ss"格式的日期时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @param locale |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDateTimetoString(String dateTimeStr, Locale locale) throws Exception { |
| | | return formatDateTimetoString(dateTimeStr, FMT_yyyyMMddHHmmss, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间按操作系统默认的国家内格格式化成"yyyy-MM-dd HH:mm:ss"格式的日期时间串; |
| | | * |
| | | * @param dateTime |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatDateTimetoString(Date dateTime) { |
| | | return formatDateTimetoString(dateTime, FMT_yyyyMMddHHmmss); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间按指定国家的风格格式化成"yyyy-MM-dd HH:mm:ss"格式的日期时间串; |
| | | * |
| | | * @param dateTime |
| | | * @param locale |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatDateTimetoString(Date dateTime, Locale locale) { |
| | | return formatDateTimetoString(dateTime, FMT_yyyyMMddHHmmss, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期字符串按操作系统默认的国家风格格式化成"yyyy-MM-dd"格式的日期串; |
| | | * |
| | | * @param date |
| | | * @param dateStr 日期串 |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDatetoString(Date date, String dateStr) throws Exception { |
| | | return formatDateTimetoString(dateStr, FMT_yyyyMMdd); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期字符串按指定国家的风格格式化成"yyyy-MM-dd"格式的日期串; |
| | | * |
| | | * @param dateStr 日期串 |
| | | * @param locale Locale |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDatetoString(String dateStr, Locale locale) throws Exception { |
| | | return formatDateTimetoString(dateStr, FMT_yyyyMMdd, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期按指定操作系统默认国家的风格格式化成"yyyy-MM-dd"格式的日期串; |
| | | * |
| | | * @param d 日期对象 |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatDatetoString(Date d) { |
| | | return formatDateTimetoString(d, FMT_yyyyMMdd); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期按指定国家的风格格式化成"yyyy-MM-dd"格式的日期串; |
| | | * |
| | | * @param d 日期对象 |
| | | * @param locale Locale |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatDatetoString(Date d, Locale locale) { |
| | | return formatDateTimetoString(d, FMT_yyyyMMdd, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间字符串按操作系统默认的国家风格格式化成"HH:mm:ss"格式的时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatTimetoString(String dateTimeStr) throws Exception { |
| | | return formatDateTimetoString(dateTimeStr, FMT_HHmmss); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间字符串按指定国家的风格格式化成"HH:mm:ss"格式的时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @param locale |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatTimetoString(String dateTimeStr, Locale locale) throws Exception { |
| | | return formatDateTimetoString(dateTimeStr, FMT_HHmmss, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间按指定操作系统默认国家的风格格式化成"HH:mm:ss"格式的时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatTimetoString(Date dateTimeStr) { |
| | | return formatDateTimetoString(dateTimeStr, FMT_HHmmss); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间按指定国家的风格格式化成"HH:mm:ss"格式的时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @param locale |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatTimetoString(Date dateTimeStr, Locale locale) { |
| | | return formatDateTimetoString(dateTimeStr, FMT_HHmmss, locale); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的年份整数 |
| | | * |
| | | * @param d |
| | | * @return 年份 |
| | | */ |
| | | public static int getYearOfDate(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.YEAR); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的月份整数 |
| | | * |
| | | * @param d |
| | | * @return 月份 |
| | | */ |
| | | public static int getMonthOfYear(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.MONTH) + 1; |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的天份整数,是这个月的第几天 |
| | | * |
| | | * @param d |
| | | * @return 天份 |
| | | */ |
| | | public static int getDayOfMonth(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.DAY_OF_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的天份整数,是这个年份的第几天 |
| | | * |
| | | * @param d |
| | | * @return 天份 |
| | | */ |
| | | public static int getDayOfYear(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.DAY_OF_YEAR); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的天份整数,是这个周的第几天 |
| | | * |
| | | * @param d |
| | | * @return 天份 |
| | | */ |
| | | public static int getDayOfWeek(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.DAY_OF_WEEK) - 1; |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的周的整数,是这个月的第几周 |
| | | * |
| | | * @param d |
| | | * @return 周 |
| | | */ |
| | | public static int getWeekOfMonth(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.WEEK_OF_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的周的整数,是这个年份的第几周 |
| | | * |
| | | * @param d |
| | | * @return 周 |
| | | */ |
| | | public static int getWeekOfYear(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.WEEK_OF_YEAR); |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间所对应的在一天中的小时数的整数,如当前(Date now)是下午3点,返回为15 |
| | | * |
| | | * @param d |
| | | * @return 小时 |
| | | */ |
| | | public static int getHoursOfDay(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int hours = calendar.get(Calendar.HOUR_OF_DAY); |
| | | return hours; |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间所对应的在一天中的小时数的整数(采用12小时制),如当前(Date now)是下午3点,返回为3 |
| | | * |
| | | * @param d |
| | | * @return 小时 |
| | | */ |
| | | public static int getHoursOfDay12(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int hours = calendar.get(Calendar.HOUR); |
| | | return hours; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回该时间所对应的分钟数中的整数,如now是15点14分,则返回14 |
| | | * |
| | | * @param d |
| | | * @return 分钟 |
| | | */ |
| | | public static int getMinutesOfHour(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int minutes = calendar.get(Calendar.MINUTE); |
| | | |
| | | return minutes; |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间所对应的秒数中的整数,如now是15点14分34秒,则返回34 |
| | | * |
| | | * @param d |
| | | * @return 秒 |
| | | */ |
| | | public static int getSecondsOfMinute(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int seconds = calendar.get(Calendar.SECOND); |
| | | |
| | | return seconds; |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间所对应的毫秒数中的整数,如now是15点14分34秒470毫秒,则返回470 |
| | | * |
| | | * @param d |
| | | * @return 毫秒 |
| | | */ |
| | | public static int getMillisecondsOfSecond(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int millisecond = calendar.get(Calendar.MILLISECOND); |
| | | |
| | | return millisecond; |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间相对于1970年1月1日开始计算的对应的毫秒数 |
| | | * |
| | | * @param d |
| | | * @return 毫秒数 |
| | | */ |
| | | public static long getTime(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | return d.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 比较两个时间的先后顺序。 |
| | | * 如果时间d1在d2之前,返回1, |
| | | * 如果时间d1在d2之后,返回-1, |
| | | * 如果二者相等,返回0 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 如果时间d1在d2之前,返回1, |
| | | * 如果时间d1在d2之后,返回-1, |
| | | * 如果二者相等,返回0 |
| | | */ |
| | | public static int compareTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | |
| | | long dI1 = d1.getTime(); |
| | | long dI2 = d2.getTime(); |
| | | |
| | | if (dI1 > dI2) { |
| | | return -1; |
| | | } else if (dI1 < dI2) { |
| | | return 1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 返回两个日期之间的毫秒数的差距 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 二者至1970年1.1后的毫秒数的差值 |
| | | */ |
| | | public static long getMillisecondsOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long dI1 = d1.getTime(); |
| | | long dI2 = d2.getTime(); |
| | | return (dI1 - dI2); |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的秒数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的秒数 |
| | | */ |
| | | public static double getSecondsOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long i = getMillisecondsOfTwoDate(d1, d2); |
| | | |
| | | return (double) i / 1000; |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的分钟数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的分钟数 |
| | | */ |
| | | public static double getMinutesOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long millions = getMillisecondsOfTwoDate(d1, d2); |
| | | return (double) millions / 60 / 1000; |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的小时数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的小时数 |
| | | */ |
| | | public static double getHoursOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long millions = getMillisecondsOfTwoDate(d1, d2); |
| | | return (double) millions / 60 / 60 / 1000; |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的天数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的天数 |
| | | */ |
| | | public static double getDaysOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long millions = getMillisecondsOfTwoDate(d1, d2); |
| | | return (double) millions / 24 / 60 / 60 / 1000; |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的天数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的天数 |
| | | */ |
| | | public static Long daysOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long millions = getMillisecondsOfTwoDate(d1, d2); |
| | | return millions / 24 / 60 / 60 / 1000; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的时间值,可以为负。 |
| | | * |
| | | * @param d 日期对象 |
| | | * @param times 时间值 |
| | | * @param type 类型, |
| | | * Calendar.MILLISECOND,毫秒<BR> |
| | | * Calendar.SECOND,秒<BR> |
| | | * Calendar.MINUTE,分钟<BR> |
| | | * Calendar.HOUR,小时<BR> |
| | | * Calendar.DATE,日<BR> |
| | | * @return 如果d为null,返回null |
| | | */ |
| | | public static Date addTime(Date d, double times, int type) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | long qv = 1; |
| | | switch (type) { |
| | | case Calendar.MILLISECOND: |
| | | qv = 1; |
| | | break; |
| | | case Calendar.SECOND: |
| | | qv = 1000; |
| | | break; |
| | | case Calendar.MINUTE: |
| | | qv = 1000 * 60; |
| | | break; |
| | | case Calendar.HOUR: |
| | | qv = 1000 * 60 * 60; |
| | | break; |
| | | case Calendar.DATE: |
| | | qv = 1000 * 60 * 60 * 24; |
| | | break; |
| | | default: |
| | | throw new RuntimeException("时间类型不正确!type=" + type); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | long milliseconds = (long) Math.round(Math.abs(times) * qv); |
| | | if (times > 0) { |
| | | for (; milliseconds > 0; milliseconds -= 2147483647) { |
| | | if (milliseconds > 2147483647) { |
| | | calendar.add(Calendar.MILLISECOND, 2147483647); |
| | | } else { |
| | | calendar.add(Calendar.MILLISECOND, (int) milliseconds); |
| | | } |
| | | } |
| | | } else { |
| | | for (; milliseconds > 0; milliseconds -= 2147483647) { |
| | | if (milliseconds > 2147483647) { |
| | | calendar.add(Calendar.MILLISECOND, -2147483647); |
| | | } else { |
| | | calendar.add(Calendar.MILLISECOND, -(int) milliseconds); |
| | | } |
| | | } |
| | | } |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的年份,可以为负, 返回新的被加上了年份的日期对象,不影响参数日期对象值 |
| | | * Given a certain time and a specified year, which can be negative, returns a new date object with the added year, without affecting the value of the original date object. |
| | | * |
| | | * @param d |
| | | * @param years |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addYears(Date d, int years) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.YEAR, years); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的月份,可以为负 |
| | | * Adding the specified number of month to the given time is possible, including negative values. |
| | | * |
| | | * @param d |
| | | * @param months |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addMonths(Date d, int months) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.MONTH, months); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的天数,可以为负 |
| | | * Adding the specified number of day to the given time is possible, including negative values. |
| | | * |
| | | * @param d 日期对象 |
| | | * @param days |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addDays(Date d, int days) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.HOUR, days * 24); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的小时,可以为负 |
| | | * Adding the specified number of hour to the given time is possible, including negative values. |
| | | * |
| | | * @param d 日期对象 |
| | | * @param hours |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addHours(Date d, int hours) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.HOUR, hours); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的分钟,可以为负 |
| | | * Adding the specified number of minute to the given time is possible, including negative values. |
| | | * |
| | | * @param d |
| | | * @param minutes |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addMinutes(Date d, int minutes) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.MINUTE, minutes); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的秒数,可以为负 |
| | | * Adding the specified number of seconds to the given time is possible, including negative values. |
| | | * |
| | | * @param d |
| | | * @param seconds |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addSeconds(Date d, int seconds) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.SECOND, seconds); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的毫秒数,可以为负 |
| | | * Adding the specified number of milliseconds to the given time can result in a negative value. |
| | | * |
| | | * @param d |
| | | * @param milliseconds |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addMilliseconds(Date d, int milliseconds) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.MILLISECOND, milliseconds); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的年份是新的给定的年份 |
| | | * Setting the year of a date object to a new given year. |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param year 新的年份 |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date setYearOfDate(Date d, int year) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.YEAR, year); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的月份是新的给定的月份 |
| | | * Set the month of a date object to a new given month. |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param month 新的月份 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setMonthOfDate(Date d, int month) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.MONTH, month); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的天是新的给定的天 |
| | | * Set the day of a date object to a new given day. |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param day 新的天 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setDayOfDate(Date d, int day) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.DAY_OF_MONTH, day); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的小时是新的给定的小时 |
| | | * Setting the hour of a date object to a new given hour. |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param hour 新的小时数 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setHourOfDate(Date d, int hour) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.HOUR_OF_DAY, hour); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的分钟是新的给定的分钟数 |
| | | * Set the minutes of a date object to a new given minute value. |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param minute 新的分钟数 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setMinuteOfDate(Date d, int minute) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.MINUTE, minute); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的秒数是新的给定的分钟数 |
| | | * Setting the seconds of a date object to the new given minute value. |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param second 新的秒数 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setSecondOfDate(Date d, int second) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.SECOND, second); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的毫秒数是新的给定的分钟数 |
| | | * Setting the milliseconds of a date object to a new given minute value. |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param millisecond 新的毫秒数 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setMillisecondOfDate(Date d, int millisecond) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.MILLISECOND, millisecond); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回指定日期的月份的天数量 |
| | | * Retrieve the number of days in the month of the specified date. |
| | | * |
| | | * @param d 日期对象 |
| | | */ |
| | | public static int getDaysOfMonth(Date d) { |
| | | int year = getYearOfDate(d); |
| | | int month = getMonthOfYear(d); |
| | | return getDaysOfMonth(year, month); |
| | | } |
| | | |
| | | /** |
| | | * 返回指定日期的月份的天数量 |
| | | * Retrieve the number of days in the month of the specified date. |
| | | * |
| | | * @param year 年 |
| | | * @param month 月 |
| | | */ |
| | | public static int getDaysOfMonth(int year, int month) { |
| | | int days = 0; |
| | | if (month == 2) { |
| | | if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { |
| | | days = 29; |
| | | } else { |
| | | days = 28; |
| | | } |
| | | } |
| | | if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) { |
| | | days = 30; |
| | | } |
| | | if ((month == 1) || (month == 3) || (month == 5) || (month == 7) || (month == 8) || (month == 10) || (month == 12)) { |
| | | days = 31; |
| | | } |
| | | return days; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回系统时间,以日期对象形式返回 |
| | | * |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date getSystemDate() { |
| | | return new Date(System.currentTimeMillis()); |
| | | } |
| | | |
| | | /** |
| | | * 返回系统时间,以毫秒形式返回 |
| | | * |
| | | * @return 毫秒数 |
| | | */ |
| | | public static long getSystemTime() { |
| | | return System.currentTimeMillis(); |
| | | } |
| | | |
| | | /** |
| | | * 返回24小时前的时间 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getLastDay(Date date) { |
| | | long day = date.getTime(); |
| | | long lastDay = day - 24 * 60 * 60 * 1000; |
| | | return new Date(lastDay); |
| | | } |
| | | |
| | | /** |
| | | * 返回24小时后的时间 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getTomorrow(Date date) { |
| | | long day = date.getTime(); |
| | | long tomorrow = day + 24 * 60 * 60 * 1000; |
| | | return new Date(tomorrow); |
| | | } |
| | | |
| | | /** |
| | | * 取得30天前的这个时间 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Date getDayLastMonth() { |
| | | long day = new Date().getTime(); |
| | | long dayLastMonth = day - 24 * 60 * 60 * 1000 * 20; |
| | | return new Date(dayLastMonth); |
| | | } |
| | | |
| | | /** |
| | | * 取得30天后的这个时间 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Date getDayNextMonth() { |
| | | long day = new Date().getTime(); |
| | | long dayNextMonth = day + 20 * 24 * 60 * 60 * 1000; |
| | | return new Date(dayNextMonth); |
| | | } |
| | | |
| | | public static int getMonthCount(Date sDate, Date eDate) { |
| | | String sDateStr = DateTimeHelper.formatDateTimetoString(sDate, "MM"); |
| | | String eDateStr = DateTimeHelper.formatDateTimetoString(eDate, "MM"); |
| | | int monthCount = Integer.parseInt(eDateStr) - Integer.parseInt(sDateStr) + 1; |
| | | return monthCount; |
| | | } |
| | | |
| | | /** |
| | | * 取得下个月的这天,比如2月1日可取得3月1日,此方法有很大局限性,不能用于月末的天数 |
| | | * Obtain the same day of the following month, for example, February 1st can obtain March 1st. This method has significant limitations and cannot be used for the last days of the month. |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getDayNextMonth(Date date) { |
| | | String yearStr = DateTimeHelper.formatDateTimetoString(date, "yyyy"); |
| | | String monthStr = DateTimeHelper.formatDateTimetoString(date, "MM"); |
| | | String dayStr = DateTimeHelper.formatDateTimetoString(date, "dd"); |
| | | int year = Integer.parseInt(yearStr); |
| | | int month = Integer.parseInt(monthStr); |
| | | if (month == 12) { |
| | | month = 1; |
| | | year = year + 1; |
| | | yearStr = String.valueOf(year); |
| | | monthStr = String.valueOf(month); |
| | | } |
| | | |
| | | String dateStr = yearStr + "-" + monthStr + "-" + dayStr; |
| | | try { |
| | | date = DateTimeHelper.parseToDate(dateStr); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 获取当月开始时0点0分0秒 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Date getCurrentMouthStart() { |
| | | Date d = getSystemDate(); |
| | | d = setDayOfDate(d, 1); |
| | | d = setHourOfDate(d, 0); |
| | | d = setMinuteOfDate(d, 0); |
| | | d = setSecondOfDate(d, 0); |
| | | return d; |
| | | } |
| | | |
| | | /** |
| | | * 返回下月的这天 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getDateNextMonth(Date date) { |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | cal.add(Calendar.MONTH, +1); |
| | | return cal.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 根据时间获取和当前时间的差距. |
| | | * Obtain the difference between the current time and the time in question. |
| | | * |
| | | * @param date - 待比较实际 |
| | | * @return 时间差距字符串 |
| | | */ |
| | | public static String getPassdTime(Date date) { |
| | | if (null == date) { |
| | | return null; |
| | | } |
| | | String ret = null; |
| | | |
| | | // 计算和当前相差秒数 |
| | | // Calculate the difference in seconds from the current time. |
| | | long currentTimeMillis = System.currentTimeMillis(); |
| | | long timeDiff = (currentTimeMillis - date.getTime()); |
| | | |
| | | int seconds = (int) (timeDiff / 1000); |
| | | int minutes = seconds / 60; |
| | | int hours = minutes / 60; |
| | | int days = hours / 24; |
| | | int months = days / 30; |
| | | |
| | | if (days <= 7) { |
| | | if (days != 0) { |
| | | ret = days + "天前"; |
| | | } else if (hours != 0) { |
| | | ret = hours + "小时前"; |
| | | } else if (minutes != 0) { |
| | | ret = minutes + "分钟前"; |
| | | } else { |
| | | ret = "刚刚"; |
| | | } |
| | | } else { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");// HH:mm:ss"); |
| | | ret = sdf.format(date); |
| | | } |
| | | |
| | | return ret; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前日期后几天的日期 |
| | | * Obtaining the date of the day after several days from the current date. |
| | | * |
| | | * @param day 天数 |
| | | * @return |
| | | */ |
| | | public static Date getCurrentNextDays(int day) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, day); |
| | | Date date = calendar.getTime(); |
| | | return date; |
| | | } |
| | | |
| | | public static String getCurrentStringDate() { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String dateString = simpleDateFormat.format(new Date()); |
| | | return dateString; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前日期是星期几<br> |
| | | * Obtain the day of the week for the current date. |
| | | * |
| | | * @param dt |
| | | * @return 当前日期是星期几 |
| | | */ |
| | | public static String getWeekOfDate(Date dt) { |
| | | String[] weekDays = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"}; |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(dt); |
| | | int w = cal.get(Calendar.DAY_OF_WEEK) - 1; |
| | | if (w < 0) { |
| | | w = 0; |
| | | } |
| | | return weekDays[w]; |
| | | } |
| | | |
| | | /** |
| | | * 获取今天时间 2017-11-20 00:00:00 |
| | | */ |
| | | public static Date todayDate() { |
| | | try { |
| | | String date = formatDatetoString(new Date()); |
| | | String todayString = date + " 00:00:00"; |
| | | return parseToDate(todayString, FMT_yyyyMMdd); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new Date(); |
| | | } |
| | | |
| | | /** |
| | | * 获取指定日期的 时间 2017-11-20 00:00:00 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date createDate(Date date) { |
| | | try { |
| | | String dates = formatDatetoString(date); |
| | | String todayString = dates + " 00:00:00"; |
| | | return parseToDate(todayString, FMT_yyyyMMdd); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new Date(); |
| | | } |
| | | |
| | | |
| | | public static String createDateTime(Date date) { |
| | | try { |
| | | String dates = formatDatetoString(date); |
| | | String time = DateTimeHelper.formatDateTimetoString(new Date(), FMT_HHmmss); |
| | | String todayString = dates + " " + time; |
| | | return todayString; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public static String getTimeHint(Date time) { |
| | | String hint = ""; |
| | | double minutes = DateTimeHelper.getMinutesOfTwoDate(new Date(), time); |
| | | double hours = DateTimeHelper.getHoursOfTwoDate(new Date(), time); |
| | | double days = DateTimeHelper.getDaysOfTwoDate(new Date(), time); |
| | | if (minutes < 1) { |
| | | hint = "刚刚"; |
| | | } else if (hours < 1) { |
| | | hint = new Double(minutes).intValue() + "分钟前"; |
| | | } else if (days < 1) { |
| | | hint = new Double(hours).intValue() + "小时前"; |
| | | } else if (days < 7) { |
| | | hint = new Double(days).intValue() + "天前"; |
| | | } else { |
| | | hint = DateTimeHelper.formatDateTimetoString(time, DateTimeHelper.FMT_yyyyMMdd); |
| | | } |
| | | return hint; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据时间获取和当前时间的差距. |
| | | * Obtain the difference between the current time and the time in question. |
| | | * |
| | | * @param date - 待比较实际 |
| | | * @return 时间差距字符串 |
| | | */ |
| | | public static String getLoginTime(Date date) { |
| | | if (null == date) { |
| | | return null; |
| | | } |
| | | String ret = null; |
| | | |
| | | // 计算和当前相差秒数 |
| | | //Calculate the difference in seconds from the current time. |
| | | long currentTimeMillis = System.currentTimeMillis(); |
| | | long timeDiff = (currentTimeMillis - date.getTime()); |
| | | |
| | | int seconds = (int) (timeDiff / 1000); |
| | | int minutes = seconds / 60; |
| | | int hours = minutes / 60; |
| | | int days = hours / 24; |
| | | int months = days / 30; |
| | | |
| | | if (months != 0) { |
| | | ret = "1个月前"; |
| | | } else if (days != 0) { |
| | | ret = days + "天前"; |
| | | } else if (hours != 0) { |
| | | ret = hours + "小时前"; |
| | | } else if (minutes != 0) { |
| | | ret = minutes + "分钟前"; |
| | | } else { |
| | | ret = "刚刚"; |
| | | } |
| | | |
| | | return ret; |
| | | } |
| | | |
| | | |
| | | public static Date getWXTime() { |
| | | |
| | | Calendar calendar = Calendar.getInstance(Locale.CHINA); |
| | | Date date = calendar.getTime(); |
| | | |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 是否是同一天 |
| | | * it the same day |
| | | * |
| | | * @param first |
| | | * @param second |
| | | * @return |
| | | */ |
| | | public static Boolean isSameDay(Date first, Date second) { |
| | | |
| | | if (first == null || second == null) { |
| | | return false; |
| | | } |
| | | |
| | | int day1 = getDayOfYear(first); |
| | | int day2 = getDayOfYear(second); |
| | | if (day1 != day2) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 是否超过指定时刻 |
| | | * Has the specified time limit been exceeded |
| | | * |
| | | * @param day 时间 |
| | | * @param time 指定时刻 |
| | | * @return |
| | | */ |
| | | public static Boolean expireDayTime(Date day, Integer time) { |
| | | if (null == day) { |
| | | return false; |
| | | } |
| | | try { |
| | | String dates = formatDatetoString(day); |
| | | String timeHour = ""; |
| | | for (int i = 0; i <= 23; i++) { |
| | | if (i == time) { |
| | | if (i < 10) { |
| | | timeHour += " 0" + time + ":00:00"; |
| | | } else if (i < 23) { |
| | | timeHour += " " + time + ":00:00"; |
| | | } else { |
| | | timeHour += " 00" + time + ":00:00"; |
| | | } |
| | | } |
| | | } |
| | | String todayString = dates + timeHour; |
| | | Date esDayTime = parseToDate(todayString, FMT_yyyyMMddHHmmss); |
| | | if (DateTimeHelper.compareTwoDate(day, esDayTime) != 1) { |
| | | int i = compareTwoDate(day, esDayTime); |
| | | System.out.println(i); |
| | | return true; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 指定一天哪一个小时 |
| | | * Specify which hour of a particular day. |
| | | * |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public static Date createDayTime(Integer time) { |
| | | String dates = formatDatetoString(new Date()); |
| | | String timeHour = ""; |
| | | for (int i = 0; i <= 23; i++) { |
| | | if (i == time) { |
| | | if (i < 10) { |
| | | timeHour += " 0" + time + ":00:00"; |
| | | } else if (i < 23) { |
| | | timeHour += " " + time + ":00:00"; |
| | | } else { |
| | | timeHour += " 00" + time + ":00:00"; |
| | | } |
| | | } |
| | | } |
| | | String todayString = dates + timeHour; |
| | | Date esDayTime = new Date(); |
| | | try { |
| | | esDayTime = parseToDate(todayString, FMT_yyyyMMddHHmmss); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | return esDayTime; |
| | | } |
| | | |
| | | /** |
| | | * 数字换算成中文(周) |
| | | * Conversion of numbers to Chinese (weeks) |
| | | * |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public static String getWeekString(Integer time) { |
| | | if (time == 1) { |
| | | return "一"; |
| | | } else if (time == 2) { |
| | | return "二"; |
| | | } else if (time == 3) { |
| | | return "三"; |
| | | } else if (time == 4) { |
| | | return "四"; |
| | | } else if (time == 5) { |
| | | return "五"; |
| | | } else if (time == 6) { |
| | | return "六"; |
| | | } else if (time == 0 || time == 7) { |
| | | return "日"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * LocalDateTime -> Date |
| | | * |
| | | * @param localDateTime |
| | | * @return |
| | | */ |
| | | public static Date asDate(LocalDateTime localDateTime) { |
| | | return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | /** |
| | | * Date -> LocalDateTime |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static LocalDateTime asLocalDateTime(Date date) { |
| | | return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDateTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取两个时间的间隔(秒) |
| | | * Obtain the time difference between two instances (in seconds). |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return |
| | | */ |
| | | public static long getDateBetween(Date d1, Date d2) { |
| | | return Math.abs((d1.getTime() - d2.getTime()) / 1000);//取绝对值 |
| | | } |
| | | |
| | | /** |
| | | * @param date |
| | | * @return 获取今天最后的时间 |
| | | * Obtain the final time of today. |
| | | */ |
| | | public static Date getEndDate(Date date) { |
| | | if (date == null) { |
| | | return null; |
| | | } |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(date); |
| | | c.set(Calendar.HOUR_OF_DAY, 23); |
| | | c.set(Calendar.MINUTE, 59); |
| | | c.set(Calendar.SECOND, 59); |
| | | return c.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 日期天数差 |
| | | * Days Difference |
| | | */ |
| | | public static int daysBetween(Date today, Date endDate) throws ParseException { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | today = sdf.parse(sdf.format(today)); |
| | | endDate = sdf.parse(sdf.format(endDate)); |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(today); |
| | | long time1 = cal.getTimeInMillis(); |
| | | cal.setTime(endDate); |
| | | long time2 = cal.getTimeInMillis(); |
| | | long between_days = (time2 - time1) / (1000 * 3600 * 24); |
| | | return Integer.parseInt(String.valueOf(between_days)); |
| | | } |
| | | |
| | | /** |
| | | * 获取到当月所有日期 |
| | | * Obtain all dates of the current month |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static List<Date> getAllTheDateOftheMonth(Date date) { |
| | | List<Date> list = new ArrayList<Date>(); |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | cal.set(Calendar.DATE, 1); |
| | | |
| | | int month = cal.get(Calendar.MONTH); |
| | | while (cal.get(Calendar.MONTH) == month) { |
| | | list.add(cal.getTime()); |
| | | cal.add(Calendar.DATE, 1); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /*public static void main(String[] args) throws ParseException { |
| | | List<Date> allTheDateOftheMonth = getAllTheDateOftheMonth(new Date()); |
| | | Date date = allTheDateOftheMonth.get(11); |
| | | System.out.println(date.toLocaleString()); |
| | | int i = daysBetween(new Date(), date); |
| | | System.out.println(i); |
| | | }*/ |
| | | |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import java.util.TimeZone; |
| | | |
| | | public class DateUtil { |
| | | |
| | | private static TimeZone tz = TimeZone.getTimeZone("GMT+8"); |
| | | |
| | | /** |
| | | * 获取YYYY格式 |
| | | */ |
| | | public static String getYear() { |
| | | return formatDate(new Date(), "yyyy"); |
| | | } |
| | | |
| | | /** |
| | | * 获取YYYY格式 |
| | | */ |
| | | public static String getYear(Date date) { |
| | | return formatDate(date, "yyyy"); |
| | | } |
| | | |
| | | /** |
| | | * 获取YYYY-MM-DD格式 |
| | | */ |
| | | public static String getDay() { |
| | | return formatDate(new Date(), "yyyy-MM-dd"); |
| | | } |
| | | |
| | | /** |
| | | * 获取YYYY-MM-DD格式 |
| | | */ |
| | | public static String getDay(Date date) { |
| | | return formatDate(date, "yyyy-MM-dd"); |
| | | } |
| | | |
| | | /** |
| | | * 获取YYYYMMDD格式 |
| | | */ |
| | | public static String getDays() { |
| | | return formatDate(new Date(), "yyyyMMdd"); |
| | | } |
| | | |
| | | /** |
| | | * 获取YYYYMMDD格式 |
| | | */ |
| | | public static String getDays(Date date) { |
| | | return formatDate(date, "yyyyMMdd"); |
| | | } |
| | | |
| | | /** |
| | | * 获取YYYY-MM-DD HH:mm:ss格式 |
| | | */ |
| | | public static String getTime() { |
| | | return formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | |
| | | /** |
| | | * 获取YYYY-MM-DD HH:mm:ss.SSS格式 |
| | | */ |
| | | public static String getMsTime() { |
| | | return formatDate(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"); |
| | | } |
| | | |
| | | /** |
| | | * 获取YYYYMMDDHHmmss格式 |
| | | */ |
| | | public static String getAllTime() { |
| | | return formatDate(new Date(), "yyyyMMddHHmmss"); |
| | | } |
| | | |
| | | /** |
| | | * 获取YYYY-MM-DD HH:mm:ss格式 |
| | | */ |
| | | public static String getTime(Date date) { |
| | | return formatDate(date, "yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | |
| | | public static String formatDate(Date date, String pattern) { |
| | | String formatDate = null; |
| | | if (StringUtils.isNotBlank(pattern)) { |
| | | formatDate = DateFormatUtils.format(date, pattern); |
| | | } else { |
| | | formatDate = DateFormatUtils.format(date, "yyyy-MM-dd"); |
| | | } |
| | | return formatDate; |
| | | } |
| | | |
| | | /** |
| | | * 日期比较,如果s>=e 返回true 否则返回false) |
| | | * |
| | | * @author luguosui |
| | | */ |
| | | public static boolean compareDate(String s, String e) { |
| | | if (parseDate(s) == null || parseDate(e) == null) { |
| | | return false; |
| | | } |
| | | return parseDate(s).getTime() >= parseDate(e).getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 格式化日期 |
| | | */ |
| | | public static Date parseDate(String date) { |
| | | return parse(date, "yyyy-MM-dd"); |
| | | } |
| | | |
| | | /** |
| | | * 格式化日期 |
| | | */ |
| | | public static Date parseTimeMinutes(String date) { |
| | | return parse(date, "yyyy-MM-dd HH:mm"); |
| | | } |
| | | |
| | | /** |
| | | * 格式化日期 |
| | | */ |
| | | public static Date parseTime(String date) { |
| | | return parse(date, "yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | |
| | | /** |
| | | * 格式化日期 |
| | | */ |
| | | public static Date parse(String date, String pattern) { |
| | | try { |
| | | if (Objects.nonNull(date)) { |
| | | return DateUtils.parseDate(date, pattern); |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 格式化日期 |
| | | */ |
| | | public static String format(Date date, String pattern) { |
| | | return DateFormatUtils.format(date, pattern); |
| | | } |
| | | |
| | | /** |
| | | * 把日期转换为Timestamp |
| | | */ |
| | | public static Timestamp format(Date date) { |
| | | return new Timestamp(date.getTime()); |
| | | } |
| | | |
| | | /** |
| | | * 校验日期是否合法 |
| | | */ |
| | | public static boolean isValidDate(String s) { |
| | | return parse(s, "yyyy-MM-dd HH:mm:ss") != null; |
| | | } |
| | | |
| | | /** |
| | | * 校验日期是否合法 |
| | | */ |
| | | public static boolean isValidDate(String s, String pattern) { |
| | | return parse(s, pattern) != null; |
| | | } |
| | | |
| | | public static int getDiffYear(String startTime, String endTime) { |
| | | DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | int years = (int) (((fmt.parse(endTime).getTime() - fmt.parse( |
| | | startTime).getTime()) / (1000 * 60 * 60 * 24)) / 365); |
| | | return years; |
| | | } catch (Exception e) { |
| | | // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * <li>功能描述:时间相减得到天数 |
| | | */ |
| | | public static long getDaySub(String beginDateStr, String endDateStr) { |
| | | long day = 0; |
| | | SimpleDateFormat format = new SimpleDateFormat( |
| | | "yyyy-MM-dd"); |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | |
| | | try { |
| | | beginDate = format.parse(beginDateStr); |
| | | endDate = format.parse(endDateStr); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | day = (endDate.getTime() - beginDate.getTime()) / (24 * 60 * 60 * 1000); |
| | | // System.out.println("相隔的天数="+day); |
| | | |
| | | return day; |
| | | } |
| | | |
| | | /** |
| | | * 得到n天之后的日期 |
| | | */ |
| | | public static String getAfterDayDate(String days) { |
| | | int daysInt = Integer.parseInt(days); |
| | | |
| | | Calendar canlendar = Calendar.getInstance(); // java.util包 |
| | | canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 |
| | | Date date = canlendar.getTime(); |
| | | |
| | | SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String dateStr = sdfd.format(date); |
| | | |
| | | return dateStr; |
| | | } |
| | | |
| | | /** |
| | | * 得到n天之后是周几 |
| | | */ |
| | | public static String getAfterDayWeek(String days) { |
| | | int daysInt = Integer.parseInt(days); |
| | | |
| | | Calendar canlendar = Calendar.getInstance(); // java.util包 |
| | | canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 |
| | | Date date = canlendar.getTime(); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("E"); |
| | | String dateStr = sdf.format(date); |
| | | |
| | | return dateStr; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 得到系统日期 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Date getDate() { |
| | | TimeZone.setDefault(tz); |
| | | return new Date(); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前毫秒数 |
| | | * |
| | | * @return long |
| | | */ |
| | | public static long getCurMilli() { |
| | | long millisecond = 0; |
| | | Calendar cal = Calendar.getInstance(); |
| | | millisecond = cal.getTimeInMillis(); |
| | | return millisecond; |
| | | } |
| | | |
| | | /** |
| | | * 得到系统Calendar日期 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Calendar getCalendar() { |
| | | TimeZone.setDefault(tz); |
| | | Calendar cal = Calendar.getInstance(); |
| | | return cal; |
| | | } |
| | | |
| | | /** |
| | | * 毫秒转日期时间 |
| | | * |
| | | * @param millisecond |
| | | * @return |
| | | */ |
| | | public static String getDateTime(long millisecond) { |
| | | if (millisecond == 0) { |
| | | millisecond = getCurMilli(); |
| | | } |
| | | SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Calendar calendar = getCalendar(); |
| | | calendar.setTimeInMillis(millisecond); |
| | | return dateformat.format(calendar.getTime()); |
| | | } |
| | | |
| | | /** |
| | | * 日期转毫秒(加分钟) |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static long getMillisecond_fz(String date, Integer day) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String newDate = ""; |
| | | if ("".equals(date)) { |
| | | newDate = sdf.format(DateUtil.getDate()); |
| | | } else { |
| | | newDate = getDateTime(Long.parseLong(date)); |
| | | } |
| | | Date dt = null; |
| | | try { |
| | | dt = sdf.parse(newDate); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Calendar rightNow = Calendar.getInstance(); |
| | | rightNow.setTime(dt); |
| | | rightNow.add(Calendar.MINUTE, day); |
| | | Date dt1 = rightNow.getTime(); |
| | | return dt1.getTime(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * Double文档 |
| | | */ |
| | | public class DoubleUtil { |
| | | |
| | | public static Double format(Double num) { |
| | | BigDecimal b = new BigDecimal(num); |
| | | num = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | return num; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | public class EmojiUtil { |
| | | /** |
| | | * 编码 |
| | | * |
| | | * @param str 待转换字符串 |
| | | * @return 转换后字符串 |
| | | * @throws UnsupportedEncodingException exception |
| | | * @Description 将字符串中的emoji表情转换成可以在utf-8字符集数据库中保存的格式(表情占4个字节,需要utf8mb4字符集) |
| | | */ |
| | | public static String emojiEncode(String str) |
| | | throws UnsupportedEncodingException { |
| | | String patternString = "([\\x{10000}-\\x{10ffff}\ud800-\udfff])"; |
| | | |
| | | Pattern pattern = Pattern.compile(patternString); |
| | | Matcher matcher = pattern.matcher(str); |
| | | StringBuffer sb = new StringBuffer(); |
| | | while (matcher.find()) { |
| | | try { |
| | | matcher.appendReplacement( |
| | | sb, |
| | | "[[" |
| | | + URLEncoder.encode(matcher.group(1), |
| | | "UTF-8") + "]]"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | // LOG.error("emojiConvert error", e); |
| | | throw e; |
| | | } |
| | | } |
| | | matcher.appendTail(sb); |
| | | // LOG.debug("emojiConvert " + str + " to " + sb.toString() |
| | | // + ", len:" + sb.length()); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 解码 |
| | | * |
| | | * @param str 转换后的字符串 |
| | | * @return 转换前的字符串 |
| | | * @throws UnsupportedEncodingException exception |
| | | * @Description 还原utf8数据库中保存的含转换后emoji表情的字符串 |
| | | */ |
| | | public static String emojiDecode(String str) |
| | | throws UnsupportedEncodingException { |
| | | String patternString = "\\[\\[(.*?)\\]\\]"; |
| | | |
| | | Pattern pattern = Pattern.compile(patternString); |
| | | if (str == null) { |
| | | return str; |
| | | } |
| | | Matcher matcher = pattern.matcher(str); |
| | | |
| | | StringBuffer sb = new StringBuffer(); |
| | | while (matcher.find()) { |
| | | try { |
| | | matcher.appendReplacement(sb, |
| | | URLDecoder.decode(matcher.group(1), "UTF-8")); |
| | | } catch (UnsupportedEncodingException e) { |
| | | // LOG.error("emojiRecovery error", e); |
| | | throw e; |
| | | } |
| | | } |
| | | matcher.appendTail(sb); |
| | | // LOG.debug("emojiRecovery " + str + " to " + sb.toString()); |
| | | // System.out.println("emojiRecovery " + str + " to " + sb.toString()); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * @param str 待过滤字符串 |
| | | * @return 过滤后字符串 |
| | | * exception |
| | | * @Description 将字符串中的emoji表情过滤掉 |
| | | */ |
| | | public static String emojiSub(String str) { |
| | | String patternString = "([\\x{10000}-\\x{10ffff}\ud800-\udfff])"; |
| | | Pattern pattern = Pattern.compile(patternString); |
| | | Matcher matcher = pattern.matcher(str); |
| | | StringBuffer sb = new StringBuffer(); |
| | | while (matcher.find()) { |
| | | matcher.appendReplacement(sb, ""); |
| | | } |
| | | matcher.appendTail(sb); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.dsh.communityWorldCup.util.httpClinet.HttpClientUtil; |
| | | import com.dsh.communityWorldCup.util.httpClinet.HttpResult; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 高德地图的地理编码工具类 |
| | | */ |
| | | @Component |
| | | public class GDMapGeocodingUtil { |
| | | |
| | | private String key = "fb131ad2dbfb3f39d7d37d244b92aa2d"; |
| | | |
| | | |
| | | /** |
| | | * 将行政区域名称转化为坐标 |
| | | * |
| | | * @param province |
| | | * @param city |
| | | * @param county |
| | | * @param address |
| | | * @return |
| | | */ |
| | | public Map<String, Object> geocoding(String province, String city, String county, String address) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (ToolUtil.isEmpty(province)) { |
| | | map.put("status", -1); |
| | | map.put("data", "省不能为空"); |
| | | return map; |
| | | } |
| | | if ((ToolUtil.isEmpty(city) && ToolUtil.isNotEmpty(county)) || (ToolUtil.isEmpty(city) && ToolUtil.isNotEmpty(address))) { |
| | | map.put("status", -1); |
| | | map.put("data", "市不能为空"); |
| | | return map; |
| | | } |
| | | if ((ToolUtil.isEmpty(county) && ToolUtil.isNotEmpty(address))) { |
| | | map.put("status", -1); |
| | | map.put("data", "县/区不能为空"); |
| | | return map; |
| | | } |
| | | |
| | | String url = "https://restapi.amap.com/v3/geocode/geo?key=" + key + "&output=JSON"; |
| | | url += "&address=" + province + (ToolUtil.isNotEmpty(city) ? city : "") + (ToolUtil.isNotEmpty(county) ? county : "") + (ToolUtil.isNotEmpty(address) ? address : ""); |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | String status = jsonObject.getString("status"); |
| | | List<String> list = new ArrayList<>(); |
| | | |
| | | if (status.equals("1")) { |
| | | JSONArray geocodes = jsonObject.getJSONArray("geocodes"); |
| | | for (int i = 0; i < geocodes.size(); i++) { |
| | | String location = geocodes.getJSONObject(i).getString("location"); |
| | | list.add(location); |
| | | } |
| | | } |
| | | map.put("status", 0); |
| | | map.put("data", list); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | public Map<String, Object> geocoding(String address) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | String url = "https://restapi.amap.com/v3/geocode/geo?key=" + key + "&output=JSON&address=" + address; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | String status = jsonObject.getString("status"); |
| | | List<String> list = new ArrayList<>(); |
| | | |
| | | if (status.equals("1")) { |
| | | JSONArray geocodes = jsonObject.getJSONArray("geocodes"); |
| | | for (int i = 0; i < geocodes.size(); i++) { |
| | | String location = geocodes.getJSONObject(i).getString("location"); |
| | | list.add(location); |
| | | } |
| | | } |
| | | map.put("status", 0); |
| | | map.put("data", list); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据经纬度获取行政区域信息 |
| | | * |
| | | * @param lon |
| | | * @param lan |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public Map<String, String> geocode(String lon, String lan) throws Exception { |
| | | String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lon + "," + lan; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | |
| | | if (jsonObject.getString("status").equals("1")) { |
| | | JSONObject regeocode = jsonObject.getJSONObject("regeocode"); |
| | | JSONObject addressComponent = regeocode.getJSONObject("addressComponent"); |
| | | String address = regeocode.getString("formatted_address"); |
| | | map.put("address", address); |
| | | String code = addressComponent.getString("adcode"); |
| | | String province = addressComponent.getString("province"); |
| | | String city = addressComponent.getString("city"); |
| | | String district = addressComponent.getString("district"); |
| | | map.put("province", province); |
| | | map.put("provinceCode", code.substring(0, 2) + "0000"); |
| | | map.put("city", city); |
| | | map.put("cityCode", code.substring(0, 4) + "00"); |
| | | map.put("district", district); |
| | | map.put("districtCode", code); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 坐标转换 |
| | | * |
| | | * @param locations 经度和纬度用","分割,经度在前,纬度在后,经纬度小数点后不得超过6位。多个坐标对之间用”|”进行分隔最多支持40对坐标。 |
| | | * @param coordsys 可选值:gps;mapbar;baidu;autonavi(不进行转换) |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public Map<String, String> convert(String locations, String coordsys) throws Exception { |
| | | String url = "https://restapi.amap.com/v3/assistant/coordinate/convert?locations=" + locations + "&coordsys=" + coordsys + "&output=json&key=" + key; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if ("1".equals(jsonObject.getString("status"))) { |
| | | map.put("code", jsonObject.getString("infocode"));//"10000" |
| | | map.put("info", jsonObject.getString("info"));//status为0时,info返回错误原;否则返回“OK”。 |
| | | map.put("locations", jsonObject.getString("locations").split(";")[0]);//转换之后的坐标。若有多个坐标,则用 “;”进行区分和间隔 |
| | | } else { |
| | | map.put("code", jsonObject.getString("infocode")); |
| | | map.put("info", jsonObject.getString("info"));//status为0时,info返回错误原;否则返回“OK”。 |
| | | } |
| | | return map; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import org.gavaghan.geodesy.Ellipsoid; |
| | | import org.gavaghan.geodesy.GeodeticCalculator; |
| | | import org.gavaghan.geodesy.GeodeticCurve; |
| | | import org.gavaghan.geodesy.GlobalCoordinates; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 计算两个金纬度坐标之间的直线距离 |
| | | */ |
| | | public class GeodesyUtil { |
| | | |
| | | |
| | | /** |
| | | * 获取直线距离 |
| | | * |
| | | * @param fromLonLat |
| | | * @param toLonLat |
| | | * @return |
| | | */ |
| | | public static Map<String, Double> getDistance(String fromLonLat, String toLonLat) { |
| | | String[] from = fromLonLat.split(","); |
| | | String[] to = toLonLat.split(","); |
| | | GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0])); |
| | | GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0])); |
| | | double Sphere = getDistanceMeter(source, target, Ellipsoid.Sphere); |
| | | double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84); |
| | | double GRS80 = getDistanceMeter(source, target, Ellipsoid.GRS80); |
| | | double GRS67 = getDistanceMeter(source, target, Ellipsoid.GRS67); |
| | | double ANS = getDistanceMeter(source, target, Ellipsoid.ANS); |
| | | double WGS72 = getDistanceMeter(source, target, Ellipsoid.WGS72); |
| | | double Clarke1858 = getDistanceMeter(source, target, Ellipsoid.Clarke1858); |
| | | double Clarke1880 = getDistanceMeter(source, target, Ellipsoid.Clarke1880); |
| | | // System.out.println("Sphere坐标系计算结果:"+Sphere + "米"); |
| | | // System.out.println("WGS84坐标系计算结果:"+WGS84 + "米"); |
| | | // System.out.println("GRS80坐标系计算结果:"+GRS80 + "米"); |
| | | // System.out.println("GRS67坐标系计算结果:"+GRS67 + "米"); |
| | | // System.out.println("ANS坐标系计算结果:"+ANS + "米"); |
| | | // System.out.println("WGS72坐标系计算结果:"+WGS72 + "米"); |
| | | // System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米"); |
| | | // System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米"); |
| | | Map<String, Double> map = new HashMap<>(); |
| | | map.put("Sphere", Sphere); |
| | | map.put("WGS84", WGS84); |
| | | map.put("GRS80", GRS80); |
| | | map.put("GRS67", GRS67); |
| | | map.put("ANS", ANS); |
| | | map.put("WGS72", WGS72); |
| | | map.put("Clarke1858", Clarke1858); |
| | | map.put("Clarke1880", Clarke1880); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | private static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid) { |
| | | //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离 |
| | | GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo); |
| | | return geoCurve.getEllipsoidalDistance(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | public class HeaderAuthUtil { |
| | | |
| | | /** |
| | | * 用户UserId变量 |
| | | */ |
| | | protected final static String HEADER_USERID = "userId"; |
| | | |
| | | /** |
| | | * 获取Request请求头UserId |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getLoginAuthUserId(HttpServletRequest request) { |
| | | String userId = request.getHeader(HEADER_USERID); |
| | | return userId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpException; |
| | | import org.apache.commons.httpclient.SimpleHttpConnectionManager; |
| | | import org.apache.commons.httpclient.methods.GetMethod; |
| | | import org.apache.commons.httpclient.methods.PostMethod; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.security.MessageDigest; |
| | | import java.util.Map; |
| | | |
| | | public class HttpRequestUtil { |
| | | |
| | | public static String postRequest(String url, Map<String, String> params) { |
| | | // 构造HttpClient的实例 |
| | | HttpClient httpClient = new HttpClient(); |
| | | // 创建POST方法的实例 |
| | | PostMethod postMethod = new PostMethod(url); |
| | | // 设置请求头信息 |
| | | postMethod.setRequestHeader("Connection", "close"); |
| | | postMethod.addRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); |
| | | // 添加参数 |
| | | for (Map.Entry<String, String> entry : params.entrySet()) { |
| | | postMethod.addParameter(entry.getKey(), entry.getValue()); |
| | | } |
| | | // 使用系统提供的默认的恢复策略,设置请求重试处理,用的是默认的重试处理:请求三次 |
| | | httpClient.getParams().setBooleanParameter("http.protocol.expect-continue", false); |
| | | // 接收处理结果 |
| | | String result = null; |
| | | try { |
| | | // 执行Http Post请求 |
| | | httpClient.executeMethod(postMethod); |
| | | // 返回处理结果 |
| | | result = postMethod.getResponseBodyAsString(); |
| | | } catch (HttpException e) { |
| | | // 发生致命的异常,可能是协议不对或者返回的内容有问题 |
| | | System.out.println("请检查输入的URL!"); |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | // 发生网络异常 |
| | | System.out.println("发生网络异常!"); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | // 释放链接 |
| | | postMethod.releaseConnection(); |
| | | // 关闭HttpClient实例 |
| | | if (httpClient != null) { |
| | | ((SimpleHttpConnectionManager) httpClient.getHttpConnectionManager()).shutdown(); |
| | | httpClient = null; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static String postRequest1(String url, Map<String, String> params, String appKey, String appSecret) { |
| | | // 构造HttpClient的实例 |
| | | HttpClient httpClient = new HttpClient(); |
| | | // 创建POST方法的实例 |
| | | PostMethod postMethod = new PostMethod(url); |
| | | // 设置请求头信息 |
| | | String nonce = String.valueOf(Double.valueOf(Math.random() * 1000000.0D).intValue()); |
| | | String timeMillis = String.valueOf(System.currentTimeMillis()); |
| | | String signature = string2Sha1(appSecret + nonce + timeMillis); |
| | | postMethod.setRequestHeader("Host", "api-cn.ronghub.com"); |
| | | postMethod.setRequestHeader("App-Key", appKey); |
| | | postMethod.setRequestHeader("Signature", signature); |
| | | postMethod.setRequestHeader("Nonce", nonce); |
| | | postMethod.setRequestHeader("Timestamp", timeMillis); |
| | | postMethod.setRequestHeader("Host", "api-cn.ronghub.com"); |
| | | postMethod.addRequestHeader("Content-Type", "application/json"); |
| | | // 添加参数 |
| | | for (Map.Entry<String, String> entry : params.entrySet()) { |
| | | postMethod.addParameter(entry.getKey(), entry.getValue()); |
| | | } |
| | | // 使用系统提供的默认的恢复策略,设置请求重试处理,用的是默认的重试处理:请求三次 |
| | | httpClient.getParams().setBooleanParameter("http.protocol.expect-continue", false); |
| | | // 接收处理结果 |
| | | String result = null; |
| | | try { |
| | | // 执行Http Post请求 |
| | | httpClient.executeMethod(postMethod); |
| | | // 返回处理结果 |
| | | result = postMethod.getResponseBodyAsString(); |
| | | } catch (HttpException e) { |
| | | // 发生致命的异常,可能是协议不对或者返回的内容有问题 |
| | | System.out.println("请检查输入的URL!"); |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | // 发生网络异常 |
| | | System.out.println("发生网络异常!"); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | // 释放链接 |
| | | postMethod.releaseConnection(); |
| | | // 关闭HttpClient实例 |
| | | if (httpClient != null) { |
| | | ((SimpleHttpConnectionManager) httpClient.getHttpConnectionManager()).shutdown(); |
| | | httpClient = null; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private static String string2Sha1(String str) { |
| | | if (str == null || str.length() == 0) { |
| | | return null; |
| | | } |
| | | char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
| | | 'a', 'b', 'c', 'd', 'e', 'f'}; |
| | | try { |
| | | MessageDigest mdTemp = MessageDigest.getInstance("SHA1"); |
| | | mdTemp.update(str.getBytes("UTF-8")); |
| | | |
| | | byte[] md = mdTemp.digest(); |
| | | int j = md.length; |
| | | char buf[] = new char[j * 2]; |
| | | int k = 0; |
| | | for (int i = 0; i < j; i++) { |
| | | byte byte0 = md[i]; |
| | | buf[k++] = hexDigits[byte0 >>> 4 & 0xf]; |
| | | buf[k++] = hexDigits[byte0 & 0xf]; |
| | | } |
| | | return new String(buf); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public static String getRequest(String url, Map<String, String> params) { |
| | | // 构造HttpClient实例 |
| | | HttpClient client = new HttpClient(); |
| | | // 拼接参数 |
| | | String paramStr = ""; |
| | | for (String key : params.keySet()) { |
| | | paramStr = paramStr + "&" + key + "=" + params.get(key); |
| | | } |
| | | paramStr = paramStr.substring(1); |
| | | // 创建GET方法的实例 |
| | | GetMethod method = new GetMethod(url + "?" + paramStr); |
| | | // 接收返回结果 |
| | | String result = null; |
| | | try { |
| | | // 执行HTTP GET方法请求 |
| | | client.executeMethod(method); |
| | | // 返回处理结果 |
| | | result = method.getResponseBodyAsString(); |
| | | } catch (HttpException e) { |
| | | // 发生致命的异常,可能是协议不对或者返回的内容有问题 |
| | | System.out.println("请检查输入的URL!"); |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | // 发生网络异常 |
| | | System.out.println("发生网络异常!"); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | // 释放链接 |
| | | method.releaseConnection(); |
| | | // 关闭HttpClient实例 |
| | | if (client != null) { |
| | | ((SimpleHttpConnectionManager) client |
| | | .getHttpConnectionManager()).shutdown(); |
| | | client = null; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送网络请求 |
| | | * |
| | | * @param url |
| | | * @return |
| | | */ |
| | | public static String sendNetRequest(String url, Map<String, String> params) { |
| | | // 构造HttpClient实例 |
| | | HttpClient client = new HttpClient(); |
| | | String paramStr = ""; |
| | | for (String key : params.keySet()) { |
| | | paramStr = paramStr + "&" + key + "=" + params.get(key); |
| | | } |
| | | paramStr = paramStr.substring(1); |
| | | System.err.println(url + "?" + paramStr); |
| | | // 创建GET方法的实例 |
| | | GetMethod method = new GetMethod(url + "?" + paramStr); |
| | | // 接收返回结果 |
| | | String result = null; |
| | | try { |
| | | // 执行HTTP GET方法请求 |
| | | client.executeMethod(method); |
| | | // 返回处理结果 |
| | | result = method.getResponseBodyAsString(); |
| | | } catch (HttpException e) { |
| | | // 发生致命的异常,可能是协议不对或者返回的内容有问题 |
| | | System.out.println("请检查输入的URL!"); |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | // 发生网络异常 |
| | | System.out.println("发生网络异常!"); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | // 释放链接 |
| | | method.releaseConnection(); |
| | | // 关闭HttpClient实例 |
| | | if (client != null) { |
| | | ((SimpleHttpConnectionManager) client.getHttpConnectionManager()).shutdown(); |
| | | client = null; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * jsonp跨域请求数据响应<br/> |
| | | * 方法名:responsejsonpData<br/> |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @param map void<br/> |
| | | * @throws <br/> |
| | | * @author:Mryang<br/> |
| | | * @createTime:2016年7月31日-下午11:17:31 <br/> |
| | | * @tel: 15198268054<br /> |
| | | * @since 1.0.0 |
| | | */ |
| | | public void responsejsonpData(HttpServletRequest request, HttpServletResponse response, Map<String, Object> map) { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("Content-Type", "text/html;Charset=utf-8"); |
| | | try { |
| | | PrintWriter writer = response.getWriter(); |
| | | String params = request.getParameter("callback"); |
| | | String json = JSONObject.toJSONString(map); |
| | | writer.print(params + "(" + json + ")"); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.JavaType; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 返回json数据封装工具类 |
| | | * |
| | | * @ClassName: JsonUtil |
| | | * @author: yuds |
| | | * @date: 2019-09-20 09:19:27 |
| | | * @version: V1.0.0 |
| | | */ |
| | | public class JsonUtil { |
| | | |
| | | /** |
| | | * <li>将对象转化为json输出 |
| | | * <li>QuoteFieldNames ———-输出key时是否使用双引号,默认为true |
| | | * <li>WriteMapNullValue ——–是否输出值为null的字段,默认为false |
| | | * <li>WriteNullNumberAsZero —-数值字段如果为null,输出为0,而非null |
| | | * <li>WriteNullListAsEmpty —–List字段如果为null,输出为[],而非null |
| | | * <li>WriteNullStringAsEmpty —字符类型字段如果为null,输出为”“,而非null |
| | | * <li>WriteNullBooleanAsFalse –Boolean字段如果为null,输出为false,而非null |
| | | * <li>DisableCircularReferenceDetect 禁止循环引用检测 |
| | | */ |
| | | private static SerializerFeature[] serializerFeaturess = {SerializerFeature.WriteMapNullValue, |
| | | SerializerFeature.WriteNullNumberAsZero, SerializerFeature.WriteNullListAsEmpty, |
| | | SerializerFeature.WriteNullStringAsEmpty, SerializerFeature.WriteNullBooleanAsFalse, |
| | | SerializerFeature.DisableCircularReferenceDetect,}; |
| | | |
| | | private JsonUtil() { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * fastJson Object转json |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | public static String objToJson(Object obj) { |
| | | return JSON.toJSONString(obj, serializerFeaturess); |
| | | } |
| | | |
| | | /** |
| | | * fastJson Object转json |
| | | * |
| | | * @param obj |
| | | * @param dateFormat 时间格式化 |
| | | * @return |
| | | */ |
| | | public static String objToJson(Object obj, String dateFormat) { |
| | | return JSON.toJSONStringWithDateFormat(obj, dateFormat, serializerFeaturess); |
| | | } |
| | | |
| | | // 定义jackson对象 |
| | | private static final ObjectMapper MAPPER = new ObjectMapper(); |
| | | |
| | | /** |
| | | * 将对象转换成json字符串。 |
| | | * <p> |
| | | * Title: pojoToJson |
| | | * </p> |
| | | * <p> |
| | | * Description: |
| | | * </p> |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public static String objectToJson(Object data) { |
| | | try { |
| | | SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | MAPPER.setDateFormat(fmt); |
| | | String string = MAPPER.writeValueAsString(data); |
| | | return string; |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 将json结果集转化为对象 |
| | | * |
| | | * @param jsonData json数据 |
| | | * @param beanType 对象中的object类型 |
| | | * @return |
| | | */ |
| | | public static <T> T jsonToPojo(String jsonData, Class<T> beanType) { |
| | | try { |
| | | T t = MAPPER.readValue(jsonData, beanType); |
| | | return t; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 将json数据转换成pojo对象list |
| | | * <p> |
| | | * Title: jsonToList |
| | | * </p> |
| | | * <p> |
| | | * Description: |
| | | * </p> |
| | | * |
| | | * @param jsonData |
| | | * @param beanType |
| | | * @return |
| | | */ |
| | | public static <T> List<T> jsonToList(String jsonData, Class<T> beanType) { |
| | | JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType); |
| | | try { |
| | | List<T> list = MAPPER.readValue(jsonData, javaType); |
| | | return list; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public static JsonNode jsonToNode(String jsonData) { |
| | | try { |
| | | return MAPPER.readTree(jsonData); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static Map<String, String> jsonToMap(String json) { |
| | | JsonNode nodes = jsonToNode(json); |
| | | Iterator<Map.Entry<String, JsonNode>> fields = nodes.fields(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | while (fields.hasNext()) { |
| | | Map.Entry<String, JsonNode> next = fields.next(); |
| | | String value = next.getValue().asText(""); |
| | | map.put(next.getKey(), value); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.dsh.communityWorldCup.util.httpClinet.HttpClientUtil; |
| | | import com.dsh.communityWorldCup.util.httpClinet.HttpResult; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 12:05 |
| | | */ |
| | | public class JuHeUtil { |
| | | |
| | | |
| | | /** |
| | | * 校验实名认证 |
| | | * |
| | | * @param idcard |
| | | * @param name |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Boolean idcardAuthentication(String idcard, String name) throws Exception { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("idcard", idcard); |
| | | params.put("realname", name); |
| | | params.put("key", "29fec4bbe3108e4fbf52704e5a906fe0"); |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("POST", "http://op.juhe.cn/idcard/query", params, null, "form"); |
| | | if (httpResult.getCode() != 200) { |
| | | return false; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Integer error_code = jsonObject.getInteger("error_code"); |
| | | if (0 == error_code) { |
| | | JSONObject result = jsonObject.getJSONObject("result"); |
| | | Integer res = result.getInteger("res"); |
| | | return res == 1 ? true : false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import java.text.ParseException; |
| | | import java.time.Duration; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * LocalDateTimeUtils |
| | | * LocalDateTime 时间工具 |
| | | * |
| | | * @author yudeshan |
| | | * @version V1.0 |
| | | */ |
| | | public class LocalDateTimeUtils { |
| | | private final static int[] dayArr = new int[]{20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22}; |
| | | private final static String[] constellationArr = new String[]{"摩羯座", "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "摩羯座"}; |
| | | |
| | | |
| | | /** |
| | | * 取两个时间相差毫秒数 |
| | | * |
| | | * @param start 开始时间 |
| | | * @param end 结束时间 |
| | | * @return |
| | | */ |
| | | public static long betweenMillis(LocalDateTime start, LocalDateTime end) { |
| | | Duration duration = Duration.between(start, end); |
| | | return duration.toMillis(); |
| | | } |
| | | |
| | | /** |
| | | * 通过生日计算年龄 |
| | | * |
| | | * @param birthDay 生日 |
| | | * @return |
| | | * @throws ParseException |
| | | */ |
| | | public static int getAgeByBirth(LocalDate birthDay) throws ParseException { |
| | | int age = 0; |
| | | //出生日期晚于当前时间,无法计算 |
| | | LocalDate now = LocalDate.now(); |
| | | if (birthDay.isAfter(now)) { |
| | | throw new IllegalArgumentException("生日大于当前时间!"); |
| | | } |
| | | //当前年份 |
| | | int yearNow = now.getYear(); |
| | | //当前月份 |
| | | int monthNow = now.getMonthValue(); |
| | | //当前日期 |
| | | int dayOfMonthNow = now.getDayOfMonth(); |
| | | |
| | | int yearBirth = birthDay.getYear(); |
| | | int monthBirth = birthDay.getMonthValue(); |
| | | int dayOfMonthBirth = birthDay.getDayOfMonth(); |
| | | //计算整岁数 |
| | | age = yearNow - yearBirth; |
| | | if (monthNow <= monthBirth) { |
| | | if (monthNow == monthBirth) { |
| | | if (dayOfMonthNow < dayOfMonthBirth) { |
| | | //当前日期在生日之前,年龄减一 |
| | | age--; |
| | | } |
| | | } else { |
| | | //当前月份在生日之前,年龄减一 |
| | | age--; |
| | | } |
| | | } |
| | | return age; |
| | | } |
| | | |
| | | /** |
| | | * 根据月份计算星座 |
| | | */ |
| | | |
| | | public static String getConstellation(LocalDate date) { |
| | | Integer month = date.getMonthValue(); |
| | | Integer day = date.getDayOfMonth(); |
| | | return day < dayArr[month - 1] ? constellationArr[month - 1] : constellationArr[month]; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import java.security.MessageDigest; |
| | | |
| | | public class MD5AndKL { |
| | | |
| | | /** |
| | | * MD5加码。32位 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String MD5(String inStr) { |
| | | MessageDigest md5 = null; |
| | | try { |
| | | md5 = MessageDigest.getInstance("MD5"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e.toString()); |
| | | } |
| | | byte[] md5Bytes = md5.digest(inStr.getBytes()); |
| | | StringBuffer hexValue = new StringBuffer(); |
| | | for (int i = 0; i < md5Bytes.length; i++) { |
| | | int val = ((int) md5Bytes[i]) & 0xff; |
| | | if (val < 16) { |
| | | hexValue.append("0"); |
| | | } |
| | | hexValue.append(Integer.toHexString(val)); |
| | | } |
| | | return hexValue.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 可逆的加密算法 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String KL(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String s = new String(a); |
| | | return s; |
| | | } |
| | | |
| | | /** |
| | | * 加密后解密 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String JM(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String k = new String(a); |
| | | return k; |
| | | } |
| | | |
| | | |
| | | private static String byteArrayToHexString(byte b[]) { |
| | | StringBuffer resultSb = new StringBuffer(); |
| | | for (int i = 0; i < b.length; i++) |
| | | resultSb.append(byteToHexString(b[i])); |
| | | |
| | | return resultSb.toString(); |
| | | } |
| | | |
| | | private static String byteToHexString(byte b) { |
| | | int n = b; |
| | | if (n < 0) |
| | | n += 256; |
| | | int d1 = n / 16; |
| | | int d2 = n % 16; |
| | | return hexDigits[d1] + hexDigits[d2]; |
| | | } |
| | | |
| | | public static String MD5Encode(String origin, String charsetname) { |
| | | String resultString = null; |
| | | try { |
| | | resultString = new String(origin); |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | if (charsetname == null || "".equals(charsetname)) { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes())); |
| | | } else { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); |
| | | } |
| | | } catch (Exception exception) { |
| | | exception.printStackTrace(); |
| | | } |
| | | return resultString; |
| | | } |
| | | |
| | | private static final String hexDigits[] = {"0", "1", "2", "3", "4", "5", |
| | | "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; |
| | | |
| | | // public static void main(String args[]) { |
| | | // |
| | | // System.out.println("MD5后再加密:" + KL(MD5("123456"))); |
| | | // System.out.println(MD5("123456")); |
| | | // // System.out.println("加密:" + KL(MD5("123456"))); |
| | | // // s = KL(s); |
| | | // // System.out.println("解密:" + KL("81dc9bdb52d04dc20036dbd8313ed055")); |
| | | // // System.out.println("解密:" + JM(KL(s))); |
| | | // // System.out.println("解密为MD5后的:" + KL(KL(MD5(s)))); |
| | | // // System.out.println(JM("5d62957bb57d3e49dcf48a0df064be4c")); |
| | | // // System.out.println(MD5AndKL.KL(MD5AndKL.MD5("admin"+"87654321"))); |
| | | // } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.MessageSource; |
| | | import org.springframework.context.i18n.LocaleContextHolder; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | @Component |
| | | public class MessageUtils { |
| | | |
| | | @Autowired |
| | | private MessageSource messageSource; |
| | | |
| | | /** |
| | | * 根据消息键和参数 获取消息 委托给spring messageSource |
| | | * |
| | | * @param code 消息键 |
| | | * @param args 参数 |
| | | * @return 获取国际化翻译值 |
| | | */ |
| | | public String get(String code, Object... args) { |
| | | return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.CertAlipayRequest; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.domain.*; |
| | | import com.alipay.api.request.*; |
| | | import com.alipay.api.response.*; |
| | | import com.dsh.communityWorldCup.util.httpClinet.HttpClientUtil; |
| | | import org.apache.commons.collections.map.HashedMap; |
| | | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | import org.dom4j.Document; |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.Element; |
| | | import org.dom4j.io.SAXReader; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.IllegalBlockSizeException; |
| | | import javax.crypto.NoSuchPaddingException; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import java.security.InvalidKeyException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.NoSuchProviderException; |
| | | import java.security.Security; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 第三方支付工具类 |
| | | */ |
| | | @Component |
| | | public class PayMoneyUtil { |
| | | private String aliAppid = "2021004105665036";//支付宝appid |
| | | |
| | | private String appPrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==";//支付宝开发者应用私钥 |
| | | |
| | | private String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAouYvZ1v4RiydwNOnGcU0Hb4hQu0x6XUooaE2Bi6/atNOobtFdunnATGP6OMOW7yF9DpP8qH5mbFXAiaQD721y/7qlayI50UcV4mngRU4ZcaAVE3bp721Eg2H85RISa+Tb1CiOh+pc9p4l5UBseKsvB2ruHHForfZDPI8FL7AVUKBYCQPsa4zL6KAO2C6KULaTg/lCa+bYQKU0n9ca569VtdsqJUyxB9eSZjVd+9nKl62FLqp2NELGj7cXqiVBgDnBnVS5ZUO3mrBM5z/AxQbw3RwE3JqdkhzUA1BFjejAlT2zIGNOjUFagF8ao0wGElYfuk0bum6Hz5qWAt02QdNNwIDAQAB";//支付宝应用公钥 |
| | | |
| | | private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥 |
| | | |
| | | private String appid = "";//微信appid |
| | | |
| | | private String appletsAppid = "";//微信小程序appid |
| | | |
| | | private String mchId = "";//微信商户号 |
| | | |
| | | private String key = "";//微信商户号 |
| | | |
| | | private String callbackPath = "http://8.137.22.229:56666/competition";//支付回调网关地址 |
| | | |
| | | private String app_cert_path = "C:/cert/alipay/user/app_cert_path.crt";//应用公钥证书路径 |
| | | |
| | | private String alipay_cert_path = "C:/cert/alipay/user/alipay_cert_path.crt";//支付宝公钥证书文件路径 |
| | | |
| | | private String alipay_root_cert_path = "C:/cert/alipay/user/alipay_root_cert_path.crt";//支付宝CA根证书文件路径 |
| | | |
| | | private String certPath = "C:\\cert\\1523106371_20211206_cert\\apiclient_cert.p12";//微信证书 |
| | | |
| | | |
| | | /** |
| | | * 支付宝支付 |
| | | */ |
| | | public ResultUtil alipay(String smid,String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl) { |
| | | // //构造client |
| | | // CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); |
| | | // //设置网关地址 |
| | | // certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | // //设置应用Id |
| | | // certAlipayRequest.setAppId(aliAppid); |
| | | // //设置应用私钥 |
| | | // certAlipayRequest.setPrivateKey(appPrivateKey); |
| | | // //设置请求格式,固定值json |
| | | // certAlipayRequest.setFormat("json"); |
| | | // //设置字符集 |
| | | // certAlipayRequest.setCharset("UTF-8"); |
| | | // //设置签名类型 |
| | | // certAlipayRequest.setSignType("RSA2"); |
| | | // //设置应用公钥证书路径 |
| | | // certAlipayRequest.setCertPath(app_cert_path); |
| | | // //设置支付宝公钥证书路径 |
| | | // certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); |
| | | // //设置支付宝根证书路径 |
| | | // certAlipayRequest.setRootCertPath(alipay_root_cert_path); |
| | | // //构造client |
| | | // AlipayClient alipayClient = null; |
| | | // try { |
| | | // alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest (); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel (); |
| | | // model.setBody(body); |
| | | // model.setSubject (subject); |
| | | // model.setOutTradeNo (outTradeNo); |
| | | // model.setTimeoutExpress ("30m" ); |
| | | // model.setTotalAmount (amount); |
| | | // model.setProductCode ( "QUICK_MSECURITY_PAY" ); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | // request.setBizModel ( model ); |
| | | // request.setNotifyUrl (callbackPath + notifyUrl); |
| | | // try { |
| | | // //这里和普通的接口调用不同,使用的是sdkExecute |
| | | // AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("orderString", response.getBody()); |
| | | // System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | // return ResultUtil.success(map); |
| | | // } catch (AlipayApiException e ) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | model.setTimeoutExpress("30m"); |
| | | model.setTotalAmount(amount);//付款金额 |
| | | model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | SettleInfo settleInfo = new SettleInfo(); |
| | | settleInfo.setSettlePeriodTime("3d"); |
| | | SettleDetailInfo settleDetailInfo = new SettleDetailInfo(); |
| | | settleDetailInfo.setTransInType("defaultSettle"); |
| | | settleDetailInfo.setAmount(amount); |
| | | List<SettleDetailInfo> settleDetailInfos = new ArrayList<>(); |
| | | settleDetailInfos.add(settleDetailInfo); |
| | | settleInfo.setSettleDetailInfos(settleDetailInfos); |
| | | model.setSettleInfo(settleInfo); |
| | | SubMerchant subMerchant = new SubMerchant(); |
| | | subMerchant.setMerchantId(smid); |
| | | model.setSubMerchant(subMerchant); |
| | | ExtendParams extendParams = new ExtendParams(); |
| | | extendParams.setRoyaltyFreeze("true");// 冻结资金 用于后续分账处理 |
| | | model.setExtendParams(extendParams); |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(callbackPath + notifyUrl); |
| | | |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(map); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝扫码支付下单 |
| | | * |
| | | * @param body |
| | | * @param subject |
| | | * @param outTradeNo |
| | | * @param amount |
| | | * @param notifyUrl |
| | | * @return |
| | | */ |
| | | public ResultUtil aliScanCodePay(String body, String subject, String outTradeNo, String amount, String notifyUrl) { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); //获得初始化的AlipayClient |
| | | AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();//创建API对应的request类 |
| | | request.setBizContent("{" + |
| | | " \"out_trade_no\":\"" + outTradeNo + "\"," +//商户订单号 |
| | | " \"total_amount\":\"" + 1 + "\"," + |
| | | " \"subject\":\"" + subject + "\"," + |
| | | " \"notify_url\":\"" + callbackPath + notifyUrl + "\"," + |
| | | " \"body\":\"" + body + "\"," + |
| | | " \"store_id\":\"NJ_001\"," + |
| | | " \"timeout_express\":\"90m\"}");//订单允许的最晚付款时间 |
| | | AlipayTradePrecreateResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject alipay_trade_precreate_response = JSON.parseObject(response.getBody()).getJSONObject("alipay_trade_precreate_response"); |
| | | |
| | | System.err.print(alipay_trade_precreate_response.getString("qr_code")); |
| | | return ResultUtil.success(alipay_trade_precreate_response.getString("qr_code")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付成功后的回调处理逻辑 |
| | | * |
| | | * @param request |
| | | */ |
| | | public Map<String, String> alipayCallback(HttpServletRequest request) { |
| | | //获取支付宝POST过来反馈信息 |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | Map requestParams = request.getParameterMap(); |
| | | for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) { |
| | | String name = (String) iter.next(); |
| | | String[] values = (String[]) requestParams.get(name); |
| | | String valueStr = ""; |
| | | for (int i = 0; i < values.length; i++) { |
| | | valueStr = (i == values.length - 1) ? valueStr + values[i] |
| | | : valueStr + values[i] + "_"; |
| | | } |
| | | //乱码解决,这段代码在出现乱码时使用。 |
| | | //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8"); |
| | | params.put(name, valueStr); |
| | | } |
| | | //切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。 |
| | | //boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type) |
| | | // try { |
| | | // boolean flag = AlipaySignature.rsaCheckV1(params, alipay_public_key, "UTF-8","RSA2"); |
| | | // if(flag){ |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // String out_trade_no = params.get("out_trade_no"); |
| | | // String subject = params.get("subject"); |
| | | // String total_amount = params.get("total_amount"); |
| | | // String trade_no = params.get("trade_no"); |
| | | // String passback_params = params.get("passback_params"); |
| | | // map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | // map.put("subject", subject); |
| | | // map.put("total_amount", total_amount); |
| | | // map.put("trade_no", trade_no);//支付宝交易号 |
| | | // map.put("passback_params", passback_params);//回传参数 |
| | | // return map; |
| | | // }else{ |
| | | // System.err.println("验签失败"); |
| | | // } |
| | | // |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | |
| | | |
| | | Map<String, String> map = new HashMap<>(); |
| | | String out_trade_no = params.get("out_trade_no"); |
| | | String subject = params.get("subject"); |
| | | String total_amount = params.get("total_amount"); |
| | | String trade_no = params.get("trade_no"); |
| | | String passback_params = params.get("passback_params"); |
| | | map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | map.put("subject", subject); |
| | | map.put("total_amount", total_amount); |
| | | map.put("trade_no", trade_no);//支付宝交易号 |
| | | map.put("passback_params", passback_params);//回传参数 |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝查询订单支付状态 |
| | | * |
| | | * @param out_trade_no |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public AlipayTradeQueryResponse queryALIOrder(String out_trade_no) throws Exception { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); |
| | | request.setBizContent("{" + |
| | | " \"out_trade_no\":\"" + out_trade_no + "\"" + |
| | | "}"); |
| | | AlipayTradeQueryResponse response = alipayClient.execute(request); |
| | | if (response.isSuccess()) { |
| | | String tradeStatus = response.getTradeStatus();//交易状态:WAIT_BUYER_PAY(交易创建,等待买家付款)、TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、TRADE_SUCCESS(交易支付成功)、TRADE_FINISHED(交易结束,不可退款) |
| | | // return ResultUtil.success(tradeStatus); |
| | | return response; |
| | | } else { |
| | | return response; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 统一确认结算接口 |
| | | * @param smid |
| | | * @param code |
| | | * @param outTradeNo |
| | | * @param amount |
| | | * @return |
| | | */ |
| | | public ResultUtil confirm(String smid,String code, String outTradeNo, String amount) { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | aliAppid, |
| | | appPrivateKey, |
| | | "json", |
| | | "GBK", |
| | | alipay_public_key, |
| | | "RSA2"); |
| | | AlipayTradeSettleConfirmRequest request = new AlipayTradeSettleConfirmRequest(); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\""+code+"\"," + |
| | | " \"trade_no\":\""+outTradeNo+"\"," + |
| | | " \"settle_info\":{" + |
| | | " \"settle_detail_infos\":[" + |
| | | " {" + |
| | | " \"trans_in_type\":\"defaultSettle\"," + |
| | | " \"settle_entity_id\":\""+smid+"\"," + |
| | | " \"settle_entity_type\":\"SecondMerchant\"," + |
| | | " \"amount\":"+amount+"," + |
| | | " }" + |
| | | " ]" + |
| | | " }," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_freeze\":\"false\"" + |
| | | " }" + |
| | | "}"); |
| | | AlipayTradeSettleConfirmResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(response.isSuccess()){ |
| | | System.out.println("调用成功"); |
| | | return ResultUtil.success(); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | return ResultUtil.error("出现问题啦"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信统一下单 |
| | | * |
| | | * @param body 商品描述 |
| | | * @param attach 附加数据 |
| | | * @param out_trade_no 商户订单号 |
| | | * @param total_fee 标价金额 |
| | | * @param notify_url 通知地址 |
| | | * @param tradeType 交易类型 |
| | | * @return |
| | | */ |
| | | public ResultUtil weixinpay(String body, String attach, String out_trade_no, String total_fee, String notify_url, String tradeType, String openId) throws Exception { |
| | | int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String hostAddress = null; |
| | | try { |
| | | hostAddress = InetAddress.getLocalHost().getHostAddress(); |
| | | } catch (UnknownHostException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", "APP".equals(tradeType) ? appid : appletsAppid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("body", body); |
| | | map.put("attach", attach);//存储订单id |
| | | map.put("out_trade_no", out_trade_no);//存储的订单code |
| | | map.put("total_fee", i); |
| | | map.put("spbill_create_ip", hostAddress); |
| | | map.put("notify_url", callbackPath + notify_url); |
| | | map.put("trade_type", tradeType); |
| | | if ("JSAPI".equals(tradeType)) { |
| | | map.put("openid", openId); |
| | | } |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | String type = map1.get("trade_type"); |
| | | String prepay_id = map1.get("prepay_id"); |
| | | switch (type) { |
| | | case "JSAPI": |
| | | //重新进行签名后返回给前端 |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("appId", map1.get("appid")); |
| | | map2.put("nonceStr", map1.get("nonce_str")); |
| | | map2.put("package", "prepay_id=" + prepay_id); |
| | | map2.put("signType", "MD5"); |
| | | map2.put("timeStamp", new Date().getTime() + ""); |
| | | String s2 = this.weixinSignature(map2); |
| | | |
| | | map2.put("prepay_id", prepay_id); |
| | | map2.put("mch_id", map1.get("mch_id")); |
| | | map2.put("trade_type", map1.get("trade_type")); |
| | | |
| | | map2.put("sign", s2); |
| | | return ResultUtil.success(map2); |
| | | case "NATIVE": |
| | | String code_url = map1.get("code_url"); |
| | | return ResultUtil.success(code_url); |
| | | case "APP": |
| | | //重新进行签名后返回给前端 |
| | | Map<String, Object> map3 = new HashMap<>(); |
| | | map3.put("appid", appid); |
| | | map3.put("noncestr", nonce_str); |
| | | map3.put("package", "Sign=WXPay"); |
| | | map3.put("partnerid", mchId); |
| | | map3.put("prepayid", prepay_id); |
| | | map3.put("timestamp", new Date().getTime() / 1000); |
| | | String s1 = this.weixinSignature(map3); |
| | | map3.put("sign", s1); |
| | | System.err.println(map3); |
| | | return ResultUtil.success(map3); |
| | | } |
| | | return null; |
| | | } else { |
| | | System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信支付成功后的回调处理 |
| | | * |
| | | * @param request |
| | | */ |
| | | public Map<String, String> weixinpayCallback(HttpServletRequest request) { |
| | | try { |
| | | String param = this.getParam(request); |
| | | param = param.replaceAll("<!\\[CDATA\\[", ""); |
| | | param = param.replaceAll("]]>", ""); |
| | | Map<String, String> map = this.xmlToMap(param, "UTF-8"); |
| | | String return_code = map.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | Map<String, String> map1 = new HashedMap(); |
| | | map1.put("nonce_str", map.get("nonce_str")); |
| | | map1.put("out_trade_no", map.get("out_trade_no"));//存储的订单code |
| | | map1.put("attach", map.get("attach"));//存储订单id |
| | | map1.put("total_fee", map.get("total_fee")); |
| | | map1.put("transaction_id", map.get("transaction_id"));//微信支付订单号 |
| | | String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; |
| | | map1.put("result", result); |
| | | return map1; |
| | | } else { |
| | | System.err.println(map.get("err_code_des")); |
| | | } |
| | | } else { |
| | | System.err.println(map.get("return_msg")); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信扫码收款 |
| | | * |
| | | * @param body 商品描述 |
| | | * @param attach 附加数据 |
| | | * @param nonce_str 随机字符串 |
| | | * @param out_trade_no 商户订单号 |
| | | * @param total_fee 订单金额 |
| | | * @param auth_code 授权码 扫码支付授权码,设备读取用户微信中的条码或者二维码信息(注:用户付款码条形码规则:18位纯数字,以10、11、12、13、14、15开头) |
| | | * @return |
| | | */ |
| | | public ResultUtil wxScanQRCodePay(String body, String attach, String nonce_str, String out_trade_no, String total_fee, String auth_code) { |
| | | int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String hostAddress = null; |
| | | try { |
| | | InetAddress address = InetAddress.getLocalHost(); |
| | | hostAddress = address.getHostAddress(); |
| | | } catch (UnknownHostException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String randomCode = null; |
| | | try { |
| | | randomCode = UUIDUtil.getRandomCode(10); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str);//存储的支付人员id,员工扫描二维码支付的时候存储的是收款员工id |
| | | map.put("body", body); |
| | | map.put("attach", attach);//存储的费用月份数据,员工扫描二维码支付的时候存储的是收费项id |
| | | map.put("out_trade_no", randomCode + "_" + out_trade_no);//存储的房间id |
| | | map.put("total_fee", i); |
| | | map.put("spbill_create_ip", hostAddress); |
| | | map.put("auth_code", auth_code); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | String type = map1.get("trade_type"); |
| | | switch (type) { |
| | | case "JSAPI": |
| | | break; |
| | | case "NATIVE": |
| | | String code_url = map1.get("code_url"); |
| | | return ResultUtil.success(code_url); |
| | | case "APP": |
| | | String prepay_id = map1.get("prepay_id"); |
| | | //重新进行签名后返回给前端 |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("appid", appid); |
| | | map2.put("noncestr", nonce_str); |
| | | map2.put("package", "Sign=WXPay"); |
| | | map2.put("partnerid", mchId); |
| | | map2.put("prepayid", prepay_id); |
| | | map2.put("timestamp", new Date().getTime() + ""); |
| | | String s1 = this.weixinSignature(map2); |
| | | |
| | | map2.put("pac", "Sign=WXPay"); |
| | | map2.put("sign", s1); |
| | | // System.err.println(map2); |
| | | return ResultUtil.success(map2); |
| | | } |
| | | return null; |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝扫码收款 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public Object aliScanQRCodePay(String data) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信退款申请 |
| | | * |
| | | * @param transaction_id 微信订单号。微信生成的订单号,在支付通知中有返回 |
| | | * @param out_refund_no 商户退款单号。商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔。 |
| | | * @param total_fee 订单金额。订单总金额,单位为分,只能为整数 |
| | | * @param refund_fee 退款金额。退款总金额,订单总金额,单位为分,只能为整数 |
| | | * @param notify_url 退款结果通知url。异步接收微信支付退款结果通知的回调地址,通知URL必须为外网可访问的url,不允许带参数 如果参数中传了notify_url,则商户平台上配置的回调地址将不会生效。 |
| | | * @return |
| | | */ |
| | | public Map<String, String> wxRefund(String transaction_id, String out_refund_no, String total_fee, String refund_fee, String notify_url) { |
| | | int tf = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | int rf = new BigDecimal(refund_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String nonce_str = UUIDUtil.getRandomCode(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("transaction_id", transaction_id); |
| | | map.put("out_refund_no", out_refund_no); |
| | | map.put("total_fee", tf); |
| | | map.put("refund_fee", rf); |
| | | map.put("notify_url", callbackPath + notify_url); |
| | | String s = this.weixinSignature(map, key); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/refund"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println(body1); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | Map<String, String> map2 = new HashMap<>(); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | map2.put("return_code", result_code); |
| | | map2.put("refund_id", String.valueOf(map1.get("refund_id")));//微信退款订单号 |
| | | map2.put("refund_fee", String.valueOf(map1.get("refund_fee")));//退款金额 |
| | | return map2; |
| | | } else { |
| | | map2.put("return_code", result_code); |
| | | map2.put("return_msg", map1.get("err_code_des")); |
| | | return map2; |
| | | } |
| | | } else { |
| | | map2.put("return_code", return_code); |
| | | map2.put("return_msg", map1.get("return_msg")); |
| | | return map2; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信退款成功后的回调处理 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public Map<String, String> wxRefundCallback(HttpServletRequest request) { |
| | | try { |
| | | String param = this.getParam(request); |
| | | param = param.replaceAll("<!\\[CDATA\\[", ""); |
| | | param = param.replaceAll("]]>", ""); |
| | | Map<String, String> map = this.xmlToMap(param, "UTF-8"); |
| | | String return_code = map.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String req_info = map.get("req_info");//加密信息请用商户秘钥进行解密 |
| | | String s = this.wxDecrypt(req_info); |
| | | s = s.replaceAll("<!\\[CDATA\\[", ""); |
| | | s = s.replaceAll("]]>", ""); |
| | | map = this.xmlToMap(s, "UTF-8"); |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | map1.put("refund_id", map.get("refund_id")); |
| | | map1.put("out_refund_no", map.get("out_refund_no")); |
| | | String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; |
| | | map1.put("result", result); |
| | | return map1; |
| | | } else { |
| | | // System.err.println(map.get("return_msg")); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (BadPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchProviderException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalBlockSizeException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝退款 |
| | | * |
| | | * @param trade_no 支付宝交易号 |
| | | * @param refund_amount 退款金额 |
| | | * @return |
| | | * @throws AlipayApiException |
| | | */ |
| | | public Map<String, String> aliRefund(String trade_no, String refund_amount) throws AlipayApiException { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("trade_no", trade_no); |
| | | jsonObject.put("refund_amount", refund_amount); |
| | | request.setBizContent(jsonObject.toJSONString()); |
| | | AlipayTradeRefundResponse response = alipayClient.execute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | String outTradeNo = response.getOutTradeNo(); |
| | | map.put("code", response.getCode());//10000 |
| | | map.put("trade_no", response.getTradeNo());//支付宝交易号 |
| | | map.put("out_trade_no", outTradeNo);//商户订单号 |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | map.put("code", response.getCode()); |
| | | map.put("msg", response.getSubMsg()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询微信支付订单 |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil<Map<String, String>> queryWXOrder(String out_trade_no, String transaction_id) throws Exception { |
| | | String url = "https://api.mch.weixin.qq.com/pay/orderquery"; |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("out_trade_no", out_trade_no);//商户订单号 |
| | | map.put("transaction_id", transaction_id);//微信订单号 |
| | | map.put("nonce_str", nonce_str);//随机字符串 |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | Map<String, String> map2 = new HashMap<>(); |
| | | map2.put("trade_type", map1.get("trade_type")); |
| | | map2.put("trade_state", map1.get("trade_state"));//订单状态SUCCESS—支付成功,REFUND—转入退款,NOTPAY—未支付,CLOSED—已关闭,REVOKED—已撤销(刷卡支付),USERPAYING--用户支付中,PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | map2.put("transaction_id", map1.get("transaction_id")); |
| | | return ResultUtil.success(map2); |
| | | } else { |
| | | System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信转账功能(企业付款到零钱) |
| | | * |
| | | * @param openid 商户appid下,某用户的openid |
| | | * @param desc 企业付款备注,必填。 |
| | | * @param total_fee 企业付款金额 |
| | | * @param partner_trade_no 商户订单号,需保持唯一性 |
| | | * @return |
| | | */ |
| | | public Map<String, String> wxTransfers(String openid, String desc, String total_fee, String partner_trade_no) throws Exception { |
| | | int amount = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String nonce_str = UUIDUtil.getRandomCode(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_appid", appid);//申请商户号的appid或商户号绑定的appid |
| | | map.put("mchid", mchId);//微信支付分配的商户号 |
| | | map.put("nonce_str", nonce_str);//随机字符串,不长于32位 |
| | | map.put("partner_trade_no", partner_trade_no);//商户订单号,需保持唯一性 |
| | | map.put("openid", openid);//商户appid下,某用户的openid |
| | | map.put("check_name", "NO_CHECK");//NO_CHECK:不校验真实姓名 FORCE_CHECK:强校验真实姓名 |
| | | map.put("amount", amount);//企业付款金额,单位为分 |
| | | map.put("desc", desc);//企业付款备注,必填。 |
| | | String s = this.weixinSignature(map, key); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | Map<String, String> map2 = new HashMap<>(); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | map2.put("return_code", result_code); |
| | | map2.put("payment_no", String.valueOf(map1.get("payment_no")));//付款订单号 |
| | | map2.put("payment_time", String.valueOf(map1.get("payment_time")));//付款时间 |
| | | return map2; |
| | | } else { |
| | | map2.put("return_code", result_code); |
| | | map2.put("err_code", map1.get("err_code")); |
| | | map2.put("err_code_des", map1.get("err_code_des")); |
| | | return map2; |
| | | } |
| | | } else { |
| | | map2.put("return_code", return_code); |
| | | map2.put("return_msg", map1.get("return_msg")); |
| | | return map2; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信转账功能(企业付款到银行卡) |
| | | * |
| | | * @param desc 备注信息 |
| | | * @param total_fee 转账金额 |
| | | * @param partner_trade_no 订单号 |
| | | * @param enc_bank_no 银行卡号 |
| | | * @param enc_true_name 收款方用户名 |
| | | * @param bankName 银行名称 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public Map<String, String> wxPayBank(String desc, String total_fee, String partner_trade_no, String enc_bank_no, String enc_true_name, String bankName) throws Exception { |
| | | int amount = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String nonce_str = UUIDUtil.getRandomCode(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId);//微信支付分配的商户号 |
| | | map.put("nonce_str", nonce_str);//随机字符串,不长于32位 |
| | | map.put("partner_trade_no", partner_trade_no);//商户订单号,需保持唯一性 |
| | | map.put("enc_bank_no", enc_bank_no);//收款方银行卡号(采用标准RSA算法,公钥由微信侧提供) |
| | | map.put("enc_true_name", enc_true_name);//收款方用户名(采用标准RSA算法,公钥由微信侧提供) |
| | | map.put("bank_code", findBankCode(bankName));// |
| | | map.put("amount", amount);//企业付款金额,单位为分 |
| | | map.put("desc", desc);//企业付款备注,必填。 |
| | | String s = this.weixinSignature(map, key); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/mmpaysptrans/pay_bank"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | Map<String, String> map2 = new HashMap<>(); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | map2.put("return_code", result_code); |
| | | map2.put("payment_no", String.valueOf(map1.get("payment_no")));//付款订单号 |
| | | map2.put("cmms_amt", String.valueOf(map1.get("cmms_amt")));//手续费金额 RMB:分 |
| | | return map2; |
| | | } else { |
| | | map2.put("return_code", result_code); |
| | | map2.put("err_code", map1.get("err_code")); |
| | | map2.put("err_code_des", map1.get("err_code_des")); |
| | | return map2; |
| | | } |
| | | } else { |
| | | map2.put("return_code", return_code); |
| | | map2.put("return_msg", map1.get("return_msg")); |
| | | return map2; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信转账到银行卡不编号 |
| | | * |
| | | * @param bankName |
| | | * @return |
| | | */ |
| | | public String findBankCode(String bankName) { |
| | | String json = "{\"工商银行 \":1002,\"农业银行\":1005,\"建设银行\":1003,\"中国银行\":1026,\"交通银行 \":1020,\"招商银行 \":1001,\"邮储银行\":1066,\"民生银行 \":1006,\"平安银行 \":1010,\"中信银行\":1021,\"浦发银行 \":1004,\"兴业银行 \":1009,\"光大银行 \":1022,\"广发银行\":1027,\"华夏银行\":1025,\"宁波银行\":1056,\"北京银行\":4836,\"上海银行\":1024,\"南京银行\":1054,\"长子县融汇村镇银行\":4755,\"长沙银行\":4216,\"浙江泰隆商业银行\":4051,\"中原银行 \":4753,\"企业银行(中国)\":4761,\"顺德农商银行 \":4036,\"衡水银行\":4752,\"长治银行\":4756,\"大同银行\":4767,\"河南省农村信用社\":4115,\"宁夏黄河农村商业银行\":4150,\"山西省农村信用社\":4156,\"安徽省农村信用社\":4166,\"甘肃省农村信用社\":4157,\"天津农村商业银行\":4153,\"广西壮族自治区农村信用社\":4113,\"陕西省农村信用社\":4108,\"深圳农村商业银行\":4076,\"宁波鄞州农村商业银行\":4052,\"浙江省农村信用社联合社\":4764,\"江苏省农村信用社联合社\":4217,\"江苏紫金农村商业银行股份有限公司 \":4072,\"北京中关村银行股份有限公司 \":4769,\"星展银行( 中国) 有限公司 \":4778,\"枣庄银行股份有限公司 \":4766,\"海口联合农村商业银行股份有限公司 \":4758,\"南洋商业银行( 中国) 有限公司 \":4763}"; |
| | | JSONObject jsonObject = JSON.parseObject(json); |
| | | Set<String> strings = jsonObject.keySet(); |
| | | for (String key : strings) { |
| | | if (key.indexOf(bankName) >= 0) { |
| | | return jsonObject.getString(key); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝转账 |
| | | * |
| | | * @param out_biz_no 商家侧唯一订单号,由商家自定义。对于不同转账请求,商家需保证该订单号在自身系统唯一。 |
| | | * @param trans_amount 订单总金额,单位为元,精确到小数点后两位 |
| | | * @param order_title 转账业务的标题,用于在支付宝用户的账单里显示 |
| | | * @param identity 参与方的唯一标识(收款方支付宝账号) |
| | | * @param name 参与方真实姓名,如果非空,将校验收款支付宝账号姓名一致性。 |
| | | * @param remark 业务备注 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public Map<String, Object> aliTransfer(String out_biz_no, Double trans_amount, String order_title, String identity, String name, String remark) throws Exception { |
| | | CertAlipayRequest certAlipayRequest = new CertAlipayRequest(); |
| | | certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); //gateway:支付宝网关(固定)https://openapi.alipay.com/gateway.do |
| | | certAlipayRequest.setAppId(aliAppid); //APPID 即创建应用后生成,详情见创建应用并获取 APPID |
| | | certAlipayRequest.setPrivateKey(appPrivateKey); //开发者应用私钥,由开发者自己生成 |
| | | certAlipayRequest.setFormat("json"); //参数返回格式,只支持 json 格式 |
| | | certAlipayRequest.setCharset("UTF-8"); //请求和签名使用的字符编码格式,支持 GBK和 UTF-8 |
| | | certAlipayRequest.setSignType("RSA2"); //商户生成签名字符串所使用的签名算法类型,目前支持 RSA2 和 RSA,推荐商家使用 RSA2。 |
| | | certAlipayRequest.setCertPath(app_cert_path); //应用公钥证书路径(app_cert_path 文件绝对路径) |
| | | certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); //支付宝公钥证书文件路径(alipay_cert_path 文件绝对路径) |
| | | certAlipayRequest.setRootCertPath(alipay_root_cert_path); //支付宝CA根证书文件路径(alipay_root_cert_path 文件绝对路径) |
| | | AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | AlipayFundTransUniTransferRequest request = new AlipayFundTransUniTransferRequest(); |
| | | request.setBizContent("{" + |
| | | "\"out_biz_no\":\"" + out_biz_no + "\"," + |
| | | "\"trans_amount\":" + trans_amount + "," + |
| | | "\"product_code\":\"TRANS_ACCOUNT_NO_PWD\"," + |
| | | "\"biz_scene\":\"DIRECT_TRANSFER\"," + |
| | | "\"order_title\":\"" + order_title + "\"," + |
| | | "\"payee_info\":{" + |
| | | "\"identity\":\"" + identity + "\"," + |
| | | "\"identity_type\":\"ALIPAY_USER_ID\"," + |
| | | "\"name\":\"" + name + "\"," + |
| | | "}," + |
| | | "\"remark\":\"" + remark + "\"" + |
| | | "}"); |
| | | AlipayFundTransUniTransferResponse response = alipayClient.certificateExecute(request); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (response.isSuccess()) { |
| | | String status = response.getStatus(); |
| | | if (status.equals("SUCCESS")) {//成功 |
| | | map.put("code", response.getCode()); |
| | | map.put("order_id", response.getOrderId());//支付宝订单号 |
| | | map.put("pay_fund_order_id", response.getPayFundOrderId());//支付宝流水号 |
| | | } else { |
| | | map.put("code", response.getCode()); |
| | | map.put("sub_msg", response.getSubMsg()); |
| | | } |
| | | } else { |
| | | map.put("code", response.getSubCode()); |
| | | map.put("sub_msg", response.getSubMsg()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取请求内容 |
| | | * |
| | | * @param request |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | private String getParam(HttpServletRequest request) throws IOException { |
| | | // 读取参数 |
| | | InputStream inputStream; |
| | | StringBuilder sb = new StringBuilder(); |
| | | inputStream = request.getInputStream(); |
| | | String s; |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); |
| | | while ((s = in.readLine()) != null) { |
| | | sb.append(s); |
| | | } |
| | | in.close(); |
| | | inputStream.close(); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信下单的签名算法 |
| | | * |
| | | * @param map |
| | | * @return |
| | | */ |
| | | private String weixinSignature(Map<String, Object> map) { |
| | | try { |
| | | Set<Map.Entry<String, Object>> entries = map.entrySet(); |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | return (o1.getKey()).toString().compareTo(o2.getKey()); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, Object> item : infoIds) { |
| | | if (item.getKey() != null || item.getKey() != "") { |
| | | String key = item.getKey(); |
| | | Object val = item.getValue(); |
| | | if (!(val == "" || val == null)) { |
| | | sb.append(key + "=" + val + "&"); |
| | | } |
| | | } |
| | | } |
| | | sb.append("key=" + key); |
| | | String sign = MD5AndKL.MD5Encode(sb.toString(), "UTF-8").toUpperCase(); //注:MD5签名方式 |
| | | return sign; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信下单的签名算法 |
| | | * |
| | | * @param map |
| | | * @return |
| | | */ |
| | | private String weixinSignature(Map<String, Object> map, String key_) { |
| | | try { |
| | | Set<Map.Entry<String, Object>> entries = map.entrySet(); |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | return (o1.getKey()).toString().compareTo(o2.getKey()); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, Object> item : infoIds) { |
| | | if (item.getKey() != null || item.getKey() != "") { |
| | | String key = item.getKey(); |
| | | Object val = item.getValue(); |
| | | if (!(val == "" || val == null)) { |
| | | sb.append(key + "=" + val + "&"); |
| | | } |
| | | } |
| | | } |
| | | sb.append("key=" + key_); |
| | | String sign = MD5AndKL.MD5Encode(sb.toString(), "UTF-8").toUpperCase(); //注:MD5签名方式 |
| | | return sign; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信退款成功后的解密 |
| | | * |
| | | * @param req_info |
| | | * @return |
| | | */ |
| | | private String wxDecrypt(String req_info) throws NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException, |
| | | InvalidKeyException, BadPaddingException, IllegalBlockSizeException { |
| | | byte[] decode = Base64.getDecoder().decode(req_info); |
| | | String sign = MD5AndKL.MD5Encode(key, "UTF-8").toLowerCase(); |
| | | if (Security.getProvider("BC") == null) { |
| | | Security.addProvider(new BouncyCastleProvider()); |
| | | } |
| | | Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); |
| | | SecretKeySpec secretKeySpec = new SecretKeySpec(sign.getBytes(), "AES"); |
| | | cipher.init(Cipher.DECRYPT_MODE, secretKeySpec); |
| | | return new String(cipher.doFinal(decode)); |
| | | } |
| | | |
| | | |
| | | // public static void main(String[] ages){ |
| | | // PayMoneyUtil payMoneyUtil = new PayMoneyUtil(); |
| | | // ResultUtil ce = payMoneyUtil.alipay("测试", "测试", "", "121456457", "10", "http://123.com"); |
| | | // System.err.println(ce); |
| | | // ResultUtil resultUtil = null; |
| | | // try { |
| | | // resultUtil = payMoneyUtil.queryALIOrder("121456457"); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // System.err.println(resultUtil); |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * xml转map |
| | | * |
| | | * @param xml |
| | | * @param charset |
| | | * @return |
| | | * @throws UnsupportedEncodingException |
| | | * @throws DocumentException |
| | | */ |
| | | public static Map<String, String> xmlToMap(String xml, String charset) throws UnsupportedEncodingException, DocumentException { |
| | | |
| | | Map<String, String> respMap = new HashMap<String, String>(); |
| | | |
| | | SAXReader reader = new SAXReader(); |
| | | Document doc = reader.read(new ByteArrayInputStream(xml.getBytes(charset))); |
| | | Element root = doc.getRootElement(); |
| | | xmlToMap(root, respMap); |
| | | return respMap; |
| | | } |
| | | |
| | | public static Map<String, String> xmlToMap(Element tmpElement, Map<String, String> respMap) { |
| | | if (tmpElement.isTextOnly()) { |
| | | respMap.put(tmpElement.getName(), tmpElement.getText()); |
| | | return respMap; |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | Iterator<Element> eItor = tmpElement.elementIterator(); |
| | | while (eItor.hasNext()) { |
| | | Element element = eItor.next(); |
| | | xmlToMap(element, respMap); |
| | | } |
| | | return respMap; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import com.alibaba.csp.sentinel.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import redis.clients.jedis.Jedis; |
| | | import redis.clients.jedis.JedisPool; |
| | | import redis.clients.jedis.Pipeline; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * Redis工具类 |
| | | */ |
| | | @Component |
| | | public class RedisUtil { |
| | | |
| | | @Autowired |
| | | private JedisPool jedisPool; |
| | | |
| | | |
| | | /** |
| | | * 向redis中存储字符串没有过期时间 |
| | | * Storing strings in Redis without an expiration time. |
| | | * |
| | | * @param key |
| | | * @param value |
| | | */ |
| | | public void setStrValue(String key, String value) { |
| | | if (StringUtil.isNotEmpty(key)) { |
| | | Jedis resource = jedisPool.getResource(); |
| | | String set = resource.set(key, value); |
| | | closeJedis(resource); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 以分钟为单位设置存储值(设置过期时间) |
| | | * Set storage value in minutes (set expiration time) as units. |
| | | * |
| | | * @param key |
| | | * @param value |
| | | * @param time 秒 |
| | | */ |
| | | public void setStrValue(String key, String value, int time) { |
| | | if (StringUtil.isNotEmpty(key)) { |
| | | Jedis resource = jedisPool.getResource(); |
| | | String setex = resource.setex(key, time, value); |
| | | closeJedis(resource); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 从redis中获取值 |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public String getValue(String key) { |
| | | if (StringUtil.isNotEmpty(key)) { |
| | | Jedis resource = jedisPool.getResource(); |
| | | String data = resource.get(key); |
| | | closeJedis(resource); |
| | | return data; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量获取 |
| | | * |
| | | * @param kes |
| | | * @return |
| | | */ |
| | | public List<Object> getValues(List<String> kes) { |
| | | if (null != kes) { |
| | | Jedis resource = jedisPool.getResource(); |
| | | Pipeline pipelined = resource.pipelined(); |
| | | for (String key : kes) { |
| | | pipelined.get(key); |
| | | } |
| | | List<Object> list = pipelined.syncAndReturnAll(); |
| | | |
| | | closeJedis(resource); |
| | | pipelined.clear(); |
| | | try { |
| | | pipelined.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | List<Object> data = new ArrayList<>(); |
| | | for (Object o : list) { |
| | | if (null != o) { |
| | | data.add(o); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除key |
| | | * |
| | | * @param key |
| | | */ |
| | | public void remove(String key) { |
| | | if (StringUtil.isNotEmpty(key)) { |
| | | Jedis resource = jedisPool.getResource(); |
| | | Long del = resource.del(key); |
| | | closeJedis(resource); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除资源 |
| | | * |
| | | * @param jedis |
| | | */ |
| | | public void closeJedis(Jedis jedis) { |
| | | if (null != jedis) { |
| | | jedis.close(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | /** |
| | | * 定义统一返回对象 |
| | | */ |
| | | @ApiModel(value = "统一返回结果集") |
| | | public class ResultUtil<T> { |
| | | |
| | | public static final Integer SUCCESS = 200; |
| | | |
| | | public static final Integer PARAM_ERROR = 300; |
| | | |
| | | public static final Integer RUNTIME_ERROR = 400; |
| | | |
| | | public static final Integer ERROR = 500; |
| | | |
| | | public static final Integer TOKEN_ERROR = 600; |
| | | |
| | | public static final Integer SIGN_ERROR = 700; |
| | | |
| | | public static final String Token = "TOKEN_INVALID"; |
| | | |
| | | public static final String SIGN = "SIGN_INVALID"; |
| | | |
| | | @ApiModelProperty(name = "code", value = "业务状态码 200:成功,300:参数错误,400:运行异常,500:其他异常, 600:token无效,需重新登录,700:签名无效") |
| | | private Integer code;//备用状态码 |
| | | |
| | | @ApiModelProperty(name = "msg", value = "返回结果说明") |
| | | private String msg;//返回说明 |
| | | |
| | | @ApiModelProperty(name = "data", value = "返回结果值") |
| | | private T data;//返回数据 |
| | | |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public T getData() { |
| | | return data; |
| | | } |
| | | |
| | | |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public ResultUtil(Integer code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | private ResultUtil(Integer code, String msg, T data) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | this.data = data; |
| | | } |
| | | |
| | | |
| | | public static <T> ResultUtil<T> getResult(Integer code, String msg) { |
| | | return new ResultUtil<>(code, msg); |
| | | } |
| | | |
| | | public static <T> ResultUtil<T> getResult(Integer code, String msg, T data) { |
| | | return new ResultUtil<>(code, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * 错误信息 |
| | | * |
| | | * @return |
| | | */ |
| | | public static ResultUtil error(String mag) { |
| | | return ResultUtil.getResult(ResultUtil.ERROR, mag, new JSONObject()); |
| | | } |
| | | |
| | | /** |
| | | * 错误信息 |
| | | * |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> error(String mag, T obj) { |
| | | return ResultUtil.getResult(ResultUtil.ERROR, mag, obj); |
| | | } |
| | | |
| | | /** |
| | | * token失效 |
| | | * |
| | | * @return |
| | | */ |
| | | public static ResultUtil tokenErr() { |
| | | return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, ResultUtil.Token, new JSONObject()); |
| | | } |
| | | |
| | | /** |
| | | * token失效 |
| | | * |
| | | * @return |
| | | */ |
| | | public static ResultUtil tokenErr(String msg) { |
| | | return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, msg, new JSONObject()); |
| | | } |
| | | |
| | | /** |
| | | * 参数异常 |
| | | * |
| | | * @return |
| | | */ |
| | | public static ResultUtil paranErr(String ages) { |
| | | return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "【" + ages + "】参数异常", new JSONObject()); |
| | | } |
| | | |
| | | /** |
| | | * 参数异常 |
| | | * |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> paranErr(T data) { |
| | | return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "PARAM_ERROR", data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 运行异常 |
| | | * |
| | | * @return |
| | | */ |
| | | public static ResultUtil runErr() { |
| | | return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "SYSTEM_RUN_ERROR", new JSONObject()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 运行异常 |
| | | * |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> runErr(T data) { |
| | | return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "SYSTEM_RUN_ERROR", data); |
| | | } |
| | | |
| | | /** |
| | | * 运行异常 |
| | | * |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> runErr(T data, String msg) { |
| | | return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, msg, data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回成功 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | public static ResultUtil success() { |
| | | return ResultUtil.getResult(ResultUtil.SUCCESS, "SUCCESS", new JSONObject()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回成功 |
| | | * |
| | | * @param data |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> success(T data) { |
| | | return ResultUtil.getResult(ResultUtil.SUCCESS, "SUCCESS", data); |
| | | } |
| | | |
| | | /** |
| | | * 返回成功 |
| | | * |
| | | * @param msg |
| | | * @param data |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> success(String msg, T data) { |
| | | return ResultUtil.getResult(ResultUtil.SUCCESS, msg, data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 签名无效 |
| | | * |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> sign() { |
| | | return ResultUtil.getResult(ResultUtil.SIGN_ERROR, SIGN); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | |
| | | public class StrUtils { |
| | | /** |
| | | * 把逗号分隔的字符串转换字符串数组 |
| | | * Convert comma-separated string to string array. |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String[] splitStr2StrArr(String str, String split) { |
| | | if (str != null && !str.equals("")) { |
| | | return str.split(split); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 把逗号分隔字符串转换List的Long |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static List<Long> splitStr2LongArr(String str) { |
| | | String[] strings = splitStr2StrArr(str, ","); |
| | | if (strings == null) return null; |
| | | |
| | | List<Long> result = new ArrayList<>(); |
| | | for (String string : strings) { |
| | | result.add(Long.parseLong(string)); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 把逗号分隔字符串转换List的Long |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static List<Long> splitStr2LongArr(String str, String split) { |
| | | String[] strings = splitStr2StrArr(str, split); |
| | | if (strings == null) return null; |
| | | |
| | | List<Long> result = new ArrayList<>(); |
| | | for (String string : strings) { |
| | | result.add(Long.parseLong(string)); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static String getRandomString(int length) { |
| | | String str = "0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number = random.nextInt(10); |
| | | sb.append(str.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | |
| | | } |
| | | |
| | | public static String getComplexRandomString(int length) { |
| | | String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number = random.nextInt(62); |
| | | sb.append(str.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static String getClassCodeString(int length) { |
| | | String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number = random.nextInt(36); |
| | | sb.append(str.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static String convertPropertiesToHtml(String properties) { |
| | | //1:容量:6:32GB_4:样式:12:塑料壳 |
| | | StringBuilder sBuilder = new StringBuilder(); |
| | | String[] propArr = properties.split("_"); |
| | | for (String props : propArr) { |
| | | String[] valueArr = props.split(":"); |
| | | sBuilder.append(valueArr[1]).append(":").append(valueArr[3]).append("<br>"); |
| | | } |
| | | return sBuilder.toString(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import cn.mb.cloud.common.core.exception.BusinessException; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | /** |
| | | * 判断字符串不能为空和null,以及号码格式效验, |
| | | * 否则则抛出异常信息 |
| | | */ |
| | | public class StringUtil { |
| | | private StringUtil() { |
| | | } |
| | | |
| | | public static void checkNull(String str, String message) throws BusinessException { |
| | | if (!StringUtils.hasLength(str)) { |
| | | throw new BusinessException(message); |
| | | } |
| | | } |
| | | |
| | | public static void checkFormat(String str, String message) throws BusinessException { |
| | | if (!str.matches("^1[2|3|4|5|6|7|8|9][0-9]{9}$")) { |
| | | throw new BusinessException(message); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | |
| | | |
| | | //根据当前传入的时间,返回距离当前时间多少天 |
| | | |
| | | public class StudyTimeUtil { |
| | | private StudyTimeUtil() { |
| | | } |
| | | |
| | | /** |
| | | * 获取两个时间的间隔(秒)Obtain the time difference between two instances (in seconds). |
| | | * |
| | | * @param startDate 开始的时间 |
| | | * @return 返回当前时间与开始时间的相差天数 |
| | | */ |
| | | public static int getDateBetween(Date startDate) throws ParseException { |
| | | Date endDate = new Date(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | long startDateTime = dateFormat.parse(dateFormat.format(startDate)).getTime(); |
| | | long endDateTime = dateFormat.parse(dateFormat.format(endDate)).getTime(); |
| | | int days = (int) ((endDateTime - startDateTime) / (1000 * 3600 * 24)); |
| | | return days; |
| | | } |
| | | |
| | | public static Date getStartDate(LocalDateTime localDate) { |
| | | Date date = Date.from(localDate.atZone(ZoneId.systemDefault()).toInstant()); |
| | | return date; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import com.dsh.communityWorldCup.service.IWorldCupService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 8:39 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | |
| | | @Autowired |
| | | private IWorldCupService worldCupService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 每隔一分钟去处理的定时任务 |
| | | */ |
| | | @Scheduled(fixedRate = 60000) |
| | | public void taskMinute() { |
| | | try { |
| | | worldCupService.taskUpdateStatus(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * @author shaqian |
| | | * 定时任务修改赛事状态 |
| | | */ |
| | | @Component |
| | | public class TaskUtilCompetition { |
| | | |
| | | |
| | | /** |
| | | * 每秒去处理的定时任务 |
| | | */ |
| | | @Scheduled(fixedRate = 30000) |
| | | public void taskMinute() { |
| | | try { |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @Component |
| | | public class TokenUtil { |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | public Integer getUserIdFormRedis() throws Exception { |
| | | ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
| | | HttpServletRequest request = servletRequestAttributes.getRequest(); |
| | | String requestHeader = request.getHeader("Authorization"); |
| | | if (requestHeader != null && requestHeader.startsWith("Bearer ")) { |
| | | requestHeader = requestHeader.substring(requestHeader.indexOf(" ") + 1); |
| | | String key = null; |
| | | int length = requestHeader.length(); |
| | | if (length > 32) { |
| | | key = requestHeader.substring(length - 32); |
| | | } else { |
| | | key = requestHeader; |
| | | } |
| | | String value = redisUtil.getValue(key); |
| | | return null != value ? Integer.valueOf(value) : null; |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.io.StringWriter; |
| | | import java.lang.reflect.Array; |
| | | import java.math.BigDecimal; |
| | | import java.net.URISyntaxException; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | |
| | | /** |
| | | * 高频方法集合类 |
| | | */ |
| | | public class ToolUtil { |
| | | |
| | | /** |
| | | * 获取随机位数的字符串 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/8/24 14:09 |
| | | */ |
| | | public static String getRandomString(int length) { |
| | | String base = "abcdefghijklmnopqrstuvwxyz0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number = random.nextInt(base.length()); |
| | | sb.append(base.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 判断一个对象是否是时间类型 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/4/18 12:55 |
| | | */ |
| | | public static String dateType(Object o) { |
| | | if (o instanceof Date) { |
| | | return DateUtil.getDay((Date) o); |
| | | } else { |
| | | return o.toString(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取异常的具体信息 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/3/30 9:21 |
| | | * @version 2.0 |
| | | */ |
| | | public static String getExceptionMsg(Exception e) { |
| | | StringWriter sw = new StringWriter(); |
| | | try { |
| | | e.printStackTrace(new PrintWriter(sw)); |
| | | } finally { |
| | | try { |
| | | sw.close(); |
| | | } catch (IOException e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | return sw.getBuffer().toString().replaceAll("\\$", "T"); |
| | | } |
| | | |
| | | /** |
| | | * 比较两个对象是否相等。<br> |
| | | * 相同的条件有两个,满足其一即可:<br> |
| | | * 1. obj1 == null && obj2 == null; 2. obj1.equals(obj2) |
| | | * |
| | | * @param obj1 对象1 |
| | | * @param obj2 对象2 |
| | | * @return 是否相等 |
| | | */ |
| | | public static boolean equals(Object obj1, Object obj2) { |
| | | return (obj1 != null) ? (obj1.equals(obj2)) : (obj2 == null); |
| | | } |
| | | |
| | | /** |
| | | * 计算对象长度,如果是字符串调用其length函数,集合类调用其size函数,数组调用其length属性,其他可遍历对象遍历计算长度 |
| | | * |
| | | * @param obj 被计算长度的对象 |
| | | * @return 长度 |
| | | */ |
| | | public static int length(Object obj) { |
| | | if (obj == null) { |
| | | return 0; |
| | | } |
| | | if (obj instanceof CharSequence) { |
| | | return ((CharSequence) obj).length(); |
| | | } |
| | | if (obj instanceof Collection) { |
| | | return ((Collection<?>) obj).size(); |
| | | } |
| | | if (obj instanceof Map) { |
| | | return ((Map<?, ?>) obj).size(); |
| | | } |
| | | |
| | | int count; |
| | | if (obj instanceof Iterator) { |
| | | Iterator<?> iter = (Iterator<?>) obj; |
| | | count = 0; |
| | | while (iter.hasNext()) { |
| | | count++; |
| | | iter.next(); |
| | | } |
| | | return count; |
| | | } |
| | | if (obj instanceof Enumeration) { |
| | | Enumeration<?> enumeration = (Enumeration<?>) obj; |
| | | count = 0; |
| | | while (enumeration.hasMoreElements()) { |
| | | count++; |
| | | enumeration.nextElement(); |
| | | } |
| | | return count; |
| | | } |
| | | if (obj.getClass().isArray() == true) { |
| | | return Array.getLength(obj); |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * 对象中是否包含元素 |
| | | * |
| | | * @param obj 对象 |
| | | * @param element 元素 |
| | | * @return 是否包含 |
| | | */ |
| | | public static boolean contains(Object obj, Object element) { |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (obj instanceof String) { |
| | | if (element == null) { |
| | | return false; |
| | | } |
| | | return ((String) obj).contains(element.toString()); |
| | | } |
| | | if (obj instanceof Collection) { |
| | | return ((Collection<?>) obj).contains(element); |
| | | } |
| | | if (obj instanceof Map) { |
| | | return ((Map<?, ?>) obj).values().contains(element); |
| | | } |
| | | |
| | | if (obj instanceof Iterator) { |
| | | Iterator<?> iter = (Iterator<?>) obj; |
| | | while (iter.hasNext()) { |
| | | Object o = iter.next(); |
| | | if (equals(o, element)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | if (obj instanceof Enumeration) { |
| | | Enumeration<?> enumeration = (Enumeration<?>) obj; |
| | | while (enumeration.hasMoreElements()) { |
| | | Object o = enumeration.nextElement(); |
| | | if (equals(o, element)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | if (obj.getClass().isArray() == true) { |
| | | int len = Array.getLength(obj); |
| | | for (int i = 0; i < len; i++) { |
| | | Object o = Array.get(obj, i); |
| | | if (equals(o, element)) { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 对象是否不为空(新增) |
| | | * |
| | | * @param o String,List,Map,Object[],int[],long[] |
| | | * @return |
| | | */ |
| | | public static boolean isNotEmpty(Object o) { |
| | | return !isEmpty(o); |
| | | } |
| | | |
| | | /** |
| | | * 对象是否为空 |
| | | * |
| | | * @param o String,List,Map,Object[],int[],long[] |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("rawtypes") |
| | | public static boolean isEmpty(Object o) { |
| | | if (o == null) { |
| | | return true; |
| | | } |
| | | if (o instanceof String) { |
| | | if (o.toString().trim().equals("")) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof List) { |
| | | if (((List) o).size() == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof Map) { |
| | | if (((Map) o).size() == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof Set) { |
| | | if (((Set) o).size() == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof Object[]) { |
| | | if (((Object[]) o).length == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof int[]) { |
| | | if (((int[]) o).length == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof long[]) { |
| | | if (((long[]) o).length == 0) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 对象组中是否存在 Empty Object |
| | | * |
| | | * @param os 对象组 |
| | | * @return |
| | | */ |
| | | public static boolean isOneEmpty(Object... os) { |
| | | for (Object o : os) { |
| | | if (isEmpty(o)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 对象组中是否全是 Empty Object |
| | | * |
| | | * @param os |
| | | * @return |
| | | */ |
| | | public static boolean isAllEmpty(Object... os) { |
| | | for (Object o : os) { |
| | | if (!isEmpty(o)) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 是否为数字 |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | public static boolean isNum(Object obj) { |
| | | try { |
| | | Integer.parseInt(obj.toString()); |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 如果为空, 则调用默认值 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static Object getValue(Object str, Object defaultValue) { |
| | | if (isEmpty(str)) { |
| | | return defaultValue; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 强转->string,并去掉多余空格 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String toStr(Object str) { |
| | | return toStr(str, ""); |
| | | } |
| | | |
| | | /** |
| | | * 强转->string,并去掉多余空格 |
| | | * |
| | | * @param str |
| | | * @param defaultValue |
| | | * @return |
| | | */ |
| | | public static String toStr(Object str, String defaultValue) { |
| | | if (null == str) { |
| | | return defaultValue; |
| | | } |
| | | return str.toString().trim(); |
| | | } |
| | | |
| | | /** |
| | | * 强转->int |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | // public static int toInt(Object value) { |
| | | // return toInt(value, -1); |
| | | // } |
| | | |
| | | /** |
| | | * 强转->int |
| | | * |
| | | * @param obj |
| | | * @param defaultValue |
| | | * @return |
| | | */ |
| | | // public static int toInt(Object value, int defaultValue) { |
| | | // return Convert.toInt(value, defaultValue); |
| | | // } |
| | | |
| | | /** |
| | | * 强转->long |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | // public static long toLong(Object value) { |
| | | // return toLong(value, -1); |
| | | // } |
| | | |
| | | /** |
| | | * 强转->long |
| | | * |
| | | * @param obj |
| | | * @param defaultValue |
| | | * @return |
| | | */ |
| | | // public static long toLong(Object value, long defaultValue) { |
| | | // return Convert.toLong(value, defaultValue); |
| | | // } |
| | | // |
| | | // public static String encodeUrl(String url) { |
| | | // return URLKit.encode(url, CharsetKit.UTF_8); |
| | | // } |
| | | // |
| | | // public static String decodeUrl(String url) { |
| | | // return URLKit.decode(url, CharsetKit.UTF_8); |
| | | // } |
| | | |
| | | /** |
| | | * map的key转为小写 |
| | | * |
| | | * @param map |
| | | * @return Map<String , Object> |
| | | */ |
| | | public static Map<String, Object> caseInsensitiveMap(Map<String, Object> map) { |
| | | Map<String, Object> tempMap = new HashMap<>(); |
| | | for (String key : map.keySet()) { |
| | | tempMap.put(key.toLowerCase(), map.get(key)); |
| | | } |
| | | return tempMap; |
| | | } |
| | | |
| | | /** |
| | | * 获取map中第一个数据值 |
| | | * |
| | | * @param <K> Key的类型 |
| | | * @param <V> Value的类型 |
| | | * @param map 数据源 |
| | | * @return 返回的值 |
| | | */ |
| | | public static <K, V> V getFirstOrNull(Map<K, V> map) { |
| | | V obj = null; |
| | | for (Entry<K, V> entry : map.entrySet()) { |
| | | obj = entry.getValue(); |
| | | if (obj != null) { |
| | | break; |
| | | } |
| | | } |
| | | return obj; |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static StringBuilder builder(String... strs) { |
| | | final StringBuilder sb = new StringBuilder(); |
| | | for (String str : strs) { |
| | | sb.append(str); |
| | | } |
| | | return sb; |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static void builder(StringBuilder sb, String... strs) { |
| | | for (String str : strs) { |
| | | sb.append(str); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 去掉指定后缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param suffix 后缀 |
| | | * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 |
| | | */ |
| | | public static String removeSuffix(String str, String suffix) { |
| | | if (isEmpty(str) || isEmpty(suffix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.endsWith(suffix)) { |
| | | return str.substring(0, str.length() - suffix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 当前时间 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/7 21:56 |
| | | */ |
| | | public static String currentTime() { |
| | | return DateUtil.getTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断是否是windows操作系统 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/24 22:34 |
| | | */ |
| | | public static Boolean isWinOs() { |
| | | String os = System.getProperty("os.name"); |
| | | if (os.toLowerCase().startsWith("win")) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取临时目录 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/24 22:35 |
| | | */ |
| | | public static String getTempPath() { |
| | | return System.getProperty("java.io.tmpdir"); |
| | | } |
| | | |
| | | /** |
| | | * 把一个数转化为int |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/11/15 下午11:10 |
| | | */ |
| | | public static Integer toInt(Object val) { |
| | | if (val instanceof Double) { |
| | | BigDecimal bigDecimal = new BigDecimal((Double) val); |
| | | return bigDecimal.intValue(); |
| | | } else { |
| | | return Integer.valueOf(val.toString()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取项目路径 |
| | | */ |
| | | public static String getWebRootPath(String filePath) { |
| | | try { |
| | | String path = ToolUtil.class.getClassLoader().getResource("").toURI().getPath(); |
| | | path = path.replace("/WEB-INF/classes/", ""); |
| | | path = path.replace("/target/classes/", ""); |
| | | path = path.replace("file:/", ""); |
| | | if (ToolUtil.isEmpty(filePath)) { |
| | | return path; |
| | | } else { |
| | | return path + "/" + filePath; |
| | | } |
| | | } catch (URISyntaxException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取文件后缀名 不包含点 |
| | | */ |
| | | public static String getFileSuffix(String fileWholeName) { |
| | | if (ToolUtil.isEmpty(fileWholeName)) { |
| | | return "none"; |
| | | } |
| | | int lastIndexOf = fileWholeName.lastIndexOf("."); |
| | | return fileWholeName.substring(lastIndexOf + 1); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util; |
| | | |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 定义生成随机码的工具类 |
| | | */ |
| | | public class UUIDUtil { |
| | | |
| | | private int i = 1; |
| | | |
| | | |
| | | /** |
| | | * 定义生成原生的UUID随机码 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getNativeUUID() { |
| | | return UUID.randomUUID().toString(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 生成32位随机码 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getRandomCode() { |
| | | return UUIDUtil.getNativeUUID().replaceAll("-", ""); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取给定长度的随机码 |
| | | * |
| | | * @param num |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String getRandomCode(Integer num) throws Exception { |
| | | String str = null; |
| | | if (0 < num) { |
| | | if (num % 32 > 0) { |
| | | Integer s = num / 32; |
| | | Integer l = num % 32; |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < s; i++) { |
| | | sb.append(UUIDUtil.getRandomCode()); |
| | | } |
| | | sb.append(UUIDUtil.getRandomCode().substring(0, l)); |
| | | str = sb.toString(); |
| | | } else if (num % 32 == 0) { |
| | | Integer s = num / 32; |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < s; i++) { |
| | | sb.append(UUIDUtil.getRandomCode()); |
| | | } |
| | | str = sb.toString(); |
| | | } else { |
| | | str = UUIDUtil.getRandomCode().substring(0, num); |
| | | } |
| | | } else { |
| | | throw new Exception("参数只能大于0"); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取根据当前时间的字符串数据 |
| | | * |
| | | * @return |
| | | */ |
| | | public synchronized static String getTimeStr() { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmssSSS"); |
| | | return simpleDateFormat.format(new Date()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 获取数字随机码 |
| | | * @Author pzb |
| | | * @Date 2021/8/11 16:52 |
| | | * @Param |
| | | * @Return |
| | | * @Exception |
| | | */ |
| | | public static String getNumberRandom(Integer num) { |
| | | if (null == num) { |
| | | num = 32; |
| | | } |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < num; i++) { |
| | | sb.append(Double.valueOf(Math.random() * 10).intValue()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | /* |
| | | package com.dsh.app.util.akeylogin; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.springframework.util.Base64Utils; |
| | | |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | public class Auth { |
| | | private static String appkey = "xxx"; |
| | | private static String appSecret = "xxx"; |
| | | |
| | | |
| | | public static String postRequestNoSecurity(String url, Map<String, String> headers, Object data) throws Exception { |
| | | String securityReq = JSON.toJSONString(data); |
| | | OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(30, TimeUnit.SECONDS).build(); |
| | | RequestBody body = RequestBody.create(MediaType.parse("application/json"), securityReq); |
| | | HttpSender.Request.Builder builder = new HttpSender.Request.Builder(); |
| | | if (!BaseUtils.isEmpty(headers)) { |
| | | for (Map.Entry<String, String> entry : headers.entrySet()) { |
| | | builder.addHeader(entry.getKey(), entry.getValue()); |
| | | } |
| | | } |
| | | final Request request = builder.addHeader("Content-Length", String.valueOf(securityReq.length())) |
| | | .url(url) |
| | | .post(body) |
| | | .build(); |
| | | Call call = okHttpClient.newCall(request); |
| | | Response response = call.execute(); |
| | | |
| | | String securityRes = response.body().string(); |
| | | return securityRes; |
| | | } |
| | | } |
| | | */ |
New file |
| | |
| | | package com.dsh.communityWorldCup.util.akeylogin; |
| | | |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.Base64; |
| | | |
| | | public class Base64Utils { |
| | | private static final Charset DEFAULT_CHARSET; |
| | | |
| | | public Base64Utils() { |
| | | } |
| | | |
| | | public static byte[] encode(byte[] src) { |
| | | return src.length == 0 ? src : Base64.getEncoder().encode(src); |
| | | } |
| | | |
| | | public static byte[] decode(byte[] src) { |
| | | return src.length == 0 ? src : Base64.getDecoder().decode(src); |
| | | } |
| | | |
| | | public static byte[] encodeUrlSafe(byte[] src) { |
| | | return src.length == 0 ? src : Base64.getUrlEncoder().encode(src); |
| | | } |
| | | |
| | | public static byte[] decodeUrlSafe(byte[] src) { |
| | | return src.length == 0 ? src : Base64.getUrlDecoder().decode(src); |
| | | } |
| | | |
| | | public static String encodeToString(byte[] src) { |
| | | return src.length == 0 ? "" : new String(encode(src), DEFAULT_CHARSET); |
| | | } |
| | | |
| | | public static byte[] decodeFromString(String src) { |
| | | return src.isEmpty() ? new byte[0] : decode(src.getBytes(DEFAULT_CHARSET)); |
| | | } |
| | | |
| | | public static String encodeToUrlSafeString(byte[] src) { |
| | | return new String(encodeUrlSafe(src), DEFAULT_CHARSET); |
| | | } |
| | | |
| | | public static byte[] decodeFromUrlSafeString(String src) { |
| | | return decodeUrlSafe(src.getBytes(DEFAULT_CHARSET)); |
| | | } |
| | | |
| | | static { |
| | | DEFAULT_CHARSET = StandardCharsets.UTF_8; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util.akeylogin; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.util.Collection; |
| | | import java.util.Map; |
| | | |
| | | public class BaseUtils { |
| | | public static boolean isEmpty(Object target) { |
| | | if (target == null) { |
| | | return true; |
| | | } |
| | | if (target instanceof String && "".equals(target)) { |
| | | return true; |
| | | } else if (target instanceof Collection) { |
| | | return ((Collection<?>) target).isEmpty(); |
| | | } else if (target instanceof Map) { |
| | | return ((Map<?, ?>) target).isEmpty(); |
| | | } else if (target.getClass().isArray()) { |
| | | return Array.getLength(target) == 0; |
| | | } |
| | | return false; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util.akeylogin; |
| | | |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.SecretKey; |
| | | import javax.crypto.SecretKeyFactory; |
| | | import javax.crypto.spec.DESKeySpec; |
| | | import javax.crypto.spec.IvParameterSpec; |
| | | import java.security.Key; |
| | | import java.security.spec.AlgorithmParameterSpec; |
| | | |
| | | public class DES { |
| | | public static final String ALGORITHM = "DES"; |
| | | public static final String PADDING = "DES/CBC/PKCS5Padding"; |
| | | private static final byte[] DEFAULT_INITIALIZATION_VECTOR = ("00000000".getBytes()); |
| | | |
| | | private String padding = PADDING; |
| | | private byte[] initializationVectorBytes = DEFAULT_INITIALIZATION_VECTOR; |
| | | private AlgorithmParameterSpec paramSpec; |
| | | |
| | | public DES() { |
| | | this.paramSpec = new IvParameterSpec(initializationVectorBytes); |
| | | } |
| | | |
| | | public DES(String padding) { |
| | | this.padding = padding; |
| | | this.paramSpec = new IvParameterSpec(initializationVectorBytes); |
| | | } |
| | | |
| | | public DES(String padding, byte[] initializationVectorBytes) { |
| | | this.padding = padding; |
| | | this.initializationVectorBytes = initializationVectorBytes; |
| | | this.paramSpec = new IvParameterSpec(initializationVectorBytes); |
| | | } |
| | | |
| | | public DES(byte[] initializationVectorBytes) { |
| | | this.initializationVectorBytes = initializationVectorBytes; |
| | | this.paramSpec = new IvParameterSpec(initializationVectorBytes); |
| | | } |
| | | |
| | | |
| | | public byte[] encodeBytes(byte[] data, byte[] key) throws Exception { |
| | | Key secretKey = getKey(key); |
| | | Cipher cipher = Cipher.getInstance(padding); |
| | | cipher.init(Cipher.ENCRYPT_MODE, secretKey, paramSpec); |
| | | byte[] bytes = cipher.doFinal(data); |
| | | return bytes; |
| | | } |
| | | |
| | | public byte[] decodeBytes(byte[] data, byte[] key) throws Exception { |
| | | Key secretKey = getKey(key); |
| | | Cipher cipher = Cipher.getInstance(padding); |
| | | cipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec); |
| | | return cipher.doFinal(data); |
| | | |
| | | } |
| | | |
| | | public String getPadding() { |
| | | return padding; |
| | | } |
| | | |
| | | public byte[] getInitializationVectorBytes() { |
| | | return initializationVectorBytes; |
| | | } |
| | | |
| | | private static Key getKey(byte[] key) throws Exception { |
| | | DESKeySpec dks = new DESKeySpec(key); |
| | | SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM); |
| | | SecretKey secretKey = keyFactory.generateSecret(dks); |
| | | return secretKey; |
| | | } |
| | | |
| | | public static byte[] decode(byte[] data, byte[] key) throws Exception { |
| | | return decode(data, key, DEFAULT_INITIALIZATION_VECTOR); |
| | | } |
| | | |
| | | |
| | | public static byte[] encode(byte[] data, byte[] key) throws Exception { |
| | | return encode(data, key, DEFAULT_INITIALIZATION_VECTOR); |
| | | } |
| | | |
| | | public static byte[] decode(byte[] data, byte[] key, byte[] ivBytes) throws Exception { |
| | | DES des = new DES(PADDING, ivBytes); |
| | | return des.decodeBytes(data, key); |
| | | } |
| | | |
| | | public static byte[] encode(byte[] data, byte[] key, byte[] ivBytes) throws Exception { |
| | | DES des = new DES(PADDING, ivBytes); |
| | | return des.encodeBytes(data, key); |
| | | } |
| | | } |
New file |
| | |
| | | /* |
| | | package com.dsh.app.util.akeylogin; |
| | | |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | public class LoginUtil { |
| | | private static String appkey = "*******"; |
| | | private static String appSecret = "*****"; |
| | | private static String authHost = "http://identify.verify.mob.com/"; |
| | | private static String url = authHost + "auth/auth/sdkClientFreeLogin"; |
| | | |
| | | public static String getPhoneNumber(String mbToken,String opToken, String operator) throws Exception { |
| | | HashMap<String, Object> request = new HashMap<>(); |
| | | request.put("appkey", appkey); |
| | | request.put("token", mbToken); |
| | | request.put("opToken",opToken); |
| | | request.put("operator", operator); |
| | | request.put("timestamp", System.currentTimeMillis()); |
| | | request.put("sign", SignUtil.getSign(request, appSecret)); |
| | | String response = Auth.postRequestNoSecurity(url, null, request); |
| | | JSONObject jsonObject = JSONObject.parseObject(response); |
| | | if (200 == jsonObject.getInteger("status")) { |
| | | String res = jsonObject.getString("res"); |
| | | byte[] decode = DES.decode(Base64Utils.decode(res.getBytes()), appSecret.getBytes()); |
| | | jsonObject.put("res", JSONObject.parseObject(new String(decode))); |
| | | } |
| | | |
| | | JSONObject jsonObject1 = JSON.parseObject(jsonObject.toString()); |
| | | String data = jsonObject1.getString("res"); |
| | | JSONObject jsondata = JSON.parseObject(data); |
| | | return jsondata.getString("phone"); |
| | | } |
| | | } |
| | | */ |
New file |
| | |
| | | package com.dsh.communityWorldCup.util.akeylogin; |
| | | |
| | | import java.security.MessageDigest; |
| | | |
| | | public class Md5Util { |
| | | private static final String hexDigIts[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; |
| | | |
| | | /** |
| | | * MD5加密 |
| | | * |
| | | * @param origin 字符 |
| | | * @param charsetname 编码 |
| | | * @return |
| | | */ |
| | | public static String MD5Encode(String origin, String charsetname) { |
| | | String resultString = null; |
| | | try { |
| | | resultString = new String(origin); |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | if (null == charsetname || "".equals(charsetname)) { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes())); |
| | | } else { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | return resultString; |
| | | } |
| | | |
| | | |
| | | public static String byteArrayToHexString(byte b[]) { |
| | | StringBuffer resultSb = new StringBuffer(); |
| | | for (int i = 0; i < b.length; i++) { |
| | | resultSb.append(byteToHexString(b[i])); |
| | | } |
| | | return resultSb.toString(); |
| | | } |
| | | |
| | | public static String byteToHexString(byte b) { |
| | | int n = b; |
| | | if (n < 0) { |
| | | n += 256; |
| | | } |
| | | int d1 = n / 16; |
| | | int d2 = n % 16; |
| | | return hexDigIts[d1] + hexDigIts[d2]; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util.akeylogin; |
| | | |
| | | import java.util.Map; |
| | | import java.util.TreeMap; |
| | | |
| | | public class SignUtil { |
| | | private static String charset = "utf8"; |
| | | |
| | | public static String getSign(Map<String, Object> data, String secret) { |
| | | if (data == null) { |
| | | return null; |
| | | } |
| | | //排序参数 |
| | | Map<String, Object> mappingList = new TreeMap<>(data); |
| | | StringBuilder plainText = new StringBuilder(); |
| | | mappingList.forEach((k, v) -> { |
| | | if (!"sign".equals(k) && !BaseUtils.isEmpty(v)) { |
| | | plainText.append(String.format("%s=%s&", k, v)); |
| | | } |
| | | }); |
| | | String substring = plainText.substring(0, plainText.length() - 1); |
| | | return Md5Util.MD5Encode(substring + secret, charset); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util.httpClinet; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.ssl.SSLContexts; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.Charset; |
| | | import java.security.KeyStore; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * http工具类 |
| | | */ |
| | | public class HttpClientUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); |
| | | |
| | | private static PoolingHttpClientConnectionManager connectionManager; |
| | | |
| | | |
| | | { |
| | | //1.创建连接池管理器 |
| | | connectionManager = new PoolingHttpClientConnectionManager(60000, |
| | | TimeUnit.MILLISECONDS); |
| | | connectionManager.setMaxTotal(1000); |
| | | connectionManager.setDefaultMaxPerRoute(50); |
| | | } |
| | | |
| | | /** |
| | | * 创建一个httpClient对象 |
| | | */ |
| | | private static CloseableHttpClient getHttpCline() { |
| | | return HttpClients.custom() |
| | | .setConnectionManager(connectionManager) |
| | | .disableAutomaticRetries() |
| | | .build(); |
| | | } |
| | | |
| | | private static RequestConfig getRequestConfig() { |
| | | RequestConfig.Builder builder = RequestConfig.custom(); |
| | | builder.setSocketTimeout(60000)//3.1设置客户端等待服务端返回数据的超时时间 |
| | | .setConnectTimeout(30000)//3.2设置客户端发起TCP连接请求的超时时间 |
| | | .setExpectContinueEnabled(true) |
| | | .setConnectionRequestTimeout(30000);//3.3设置客户端从连接池获取链接的超时时间 |
| | | return builder.build(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建一个POST请求实例 |
| | | * |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private static CloseableHttpResponse setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception { |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | if (null != header) { |
| | | for (String key : header.keySet()) { |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | List<NameValuePair> list = new ArrayList<>(); |
| | | if (null != params) { |
| | | Set<String> keys = params.keySet(); |
| | | for (String key : keys) { |
| | | list.add(new BasicNameValuePair(key, null == params.get(key) ? null : params.get(key).toString())); |
| | | } |
| | | } |
| | | switch (contentType) { |
| | | case "form": |
| | | httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); |
| | | break; |
| | | case "json": |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String s = objectMapper.writeValueAsString(params); |
| | | httpPost.setEntity(new StringEntity(s, ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), Charset.forName("UTF-8")))); |
| | | break; |
| | | } |
| | | return getHttpCline().execute(httpPost); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取get请求实例 |
| | | * |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private static CloseableHttpResponse setGetHttpRequset(String url, Map<String, Object> params, Map<String, String> header) throws Exception { |
| | | StringBuffer sb = new StringBuffer(); |
| | | String p = ""; |
| | | if (null != params) { |
| | | Set<String> keys = params.keySet(); |
| | | for (String key : keys) { |
| | | sb.append(key + "=" + params.get(key) + "&"); |
| | | } |
| | | p = "?" + sb.substring(0, sb.length() - 1); |
| | | } |
| | | HttpGet httpGet = new HttpGet(url + p); |
| | | httpGet.setConfig(getRequestConfig()); |
| | | if (null != header) { |
| | | for (String key : header.keySet()) { |
| | | httpGet.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | return getHttpCline().execute(httpGet); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送http请求 |
| | | * |
| | | * @param mothed "GET、POST、PUT、HEAD、DELETE、HEAD、OPTIONS" |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | * @param header 请求头 |
| | | * @param contentType 参数请求方式form/json |
| | | * @return |
| | | */ |
| | | public static HttpResult pushHttpRequset(String mothed, String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception { |
| | | String randome = UUID.randomUUID().toString(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")请求参数:" + JSON.toJSONString(params)); |
| | | CloseableHttpResponse httpResponse = null; |
| | | switch (mothed) { |
| | | case "GET": |
| | | httpResponse = setGetHttpRequset(url, params, header); |
| | | break; |
| | | case "POST": |
| | | httpResponse = setPostHttpRequset(url, params, header, contentType); |
| | | break; |
| | | } |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")返回结果:" + content); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送XML请求 |
| | | * |
| | | * @param url 请求地址 |
| | | * @param xml XML数据 |
| | | * @param header 自定义请求头 |
| | | * @return |
| | | */ |
| | | public static HttpResult pushHttpRequsetXml(String url, String xml, Map<String, String> header) throws Exception { |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | for (String key : header.keySet()) { |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpResponse httpResponse = getHttpCline().execute(httpPost); |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 请求https发送XML请求 |
| | | * |
| | | * @param url 接口路径 |
| | | * @param xml 内容 |
| | | * @param header 请求头 |
| | | * @param certPassword 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String pushHttpsRequsetXml(String url, String xml, Map<String, String> header, String certPassword, String certPath, String certType) throws Exception { |
| | | HttpPost httpPost = new HttpPost(url); |
| | | for (String key : header.keySet()) { |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpClient httpCline = initCert(certPassword, certPath, certType); |
| | | CloseableHttpResponse httpResponse = httpCline.execute(httpPost); |
| | | String content = null; |
| | | if (httpResponse.getStatusLine().getStatusCode() == 200) { |
| | | content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | } else { |
| | | content = "返回状态码:" + httpResponse.getStatusLine() + "。" + EntityUtils.toString(httpResponse.getEntity()); |
| | | } |
| | | close(httpResponse); |
| | | httpCline.close(); |
| | | return content; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化https对象(带证书) |
| | | * |
| | | * @param key 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @throws Exception |
| | | */ |
| | | private static CloseableHttpClient initCert(String key, String certPath, String certType) throws Exception { |
| | | KeyStore keyStore = KeyStore.getInstance(certType); |
| | | InputStream inputStream = new FileInputStream(new File(certPath)); |
| | | try { |
| | | keyStore.load(inputStream, key.toCharArray()); |
| | | } finally { |
| | | inputStream.close(); |
| | | } |
| | | SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, key.toCharArray()).build(); |
| | | SSLConnectionSocketFactory sslsf = |
| | | new SSLConnectionSocketFactory(sslcontext, null, null, |
| | | SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); |
| | | return HttpClients.custom().setSSLSocketFactory(sslsf).build(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 关闭资源 |
| | | */ |
| | | private static void close(CloseableHttpResponse httpResponse) { |
| | | try { |
| | | if (null != httpResponse) { |
| | | EntityUtils.consume(httpResponse.getEntity());//此处高能,通过源码分析,由EntityUtils是否回收HttpEntity |
| | | httpResponse.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (null != httpResponse) { |
| | | httpResponse.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.util.httpClinet; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * http请求返回封装 |
| | | */ |
| | | @Data |
| | | public class HttpResult { |
| | | /** |
| | | * 返回状态码 |
| | | */ |
| | | private Integer code; |
| | | /** |
| | | * 返回结果 |
| | | */ |
| | | private String data; |
| | | |
| | | /** |
| | | * 返回封装结果 |
| | | * |
| | | * @param code |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public static HttpResult getHttpResult(Integer code, String data) { |
| | | HttpResult httpResult = new HttpResult(); |
| | | httpResult.setCode(code); |
| | | httpResult.setData(data); |
| | | return httpResult; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.config; |
| | | |
| | | import com.fasterxml.jackson.core.JsonGenerator; |
| | | import com.fasterxml.jackson.databind.JsonSerializer; |
| | | import com.fasterxml.jackson.databind.SerializerProvider; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author 张鹏 |
| | | * @date 2020/9/2 11:12 |
| | | * <p> |
| | | * 重新封装实体时,ID 丢失精度,在重写的 ID 上添加注解 @JsonSerialize(using = JsonLongSerializer.class) |
| | | */ |
| | | public class JsonLongSerializer extends JsonSerializer<Long> { |
| | | @Override |
| | | public void serialize(Long aLong, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { |
| | | jsonGenerator.writeString(Long.toString(aLong)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.config; |
| | | |
| | | import org.springframework.boot.autoconfigure.context.MessageSourceProperties; |
| | | import org.springframework.context.MessageSource; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.support.ResourceBundleMessageSource; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.servlet.LocaleResolver; |
| | | |
| | | import java.time.Duration; |
| | | |
| | | |
| | | /** |
| | | * 国际化配置 |
| | | */ |
| | | @Configuration |
| | | public class MessageLocalConfig { |
| | | |
| | | @Bean |
| | | public MessageSource messageSource(MessageSourceProperties properties) { |
| | | ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); |
| | | if (StringUtils.hasText(properties.getBasename())) { |
| | | messageSource.setBasenames(StringUtils |
| | | .commaDelimitedListToStringArray(StringUtils.trimAllWhitespace(properties.getBasename()))); |
| | | } |
| | | if (properties.getEncoding() != null) { |
| | | messageSource.setDefaultEncoding(properties.getEncoding().name()); |
| | | } |
| | | messageSource.setFallbackToSystemLocale(properties.isFallbackToSystemLocale()); |
| | | Duration cacheDuration = properties.getCacheDuration(); |
| | | if (cacheDuration != null) { |
| | | messageSource.setCacheMillis(cacheDuration.toMillis()); |
| | | } |
| | | messageSource.setAlwaysUseMessageFormat(properties.isAlwaysUseMessageFormat()); |
| | | messageSource.setUseCodeAsDefaultMessage(properties.isUseCodeAsDefaultMessage()); |
| | | return messageSource; |
| | | } |
| | | |
| | | |
| | | @Bean//注册国际化组件 |
| | | public LocaleResolver localeResolver() { |
| | | return new MyLocaleResolver(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.config; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.servlet.LocaleResolver; |
| | | |
| | | import javax.servlet.ServletInputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.util.Locale; |
| | | |
| | | public class MyLocaleResolver implements LocaleResolver { |
| | | |
| | | @Override |
| | | public Locale resolveLocale(HttpServletRequest request) { |
| | | //1=中文,2=英文,3=印尼文 |
| | | String language = getQueryParams(request, "language"); |
| | | |
| | | Locale locale = null; |
| | | if (StringUtils.isEmpty(language)) { |
| | | locale = Locale.getDefault(); |
| | | } |
| | | //如果请求不为空 |
| | | if (language.equals("1")) { |
| | | locale = new Locale("zh", "CN"); |
| | | } else if (language.equals("2")) { |
| | | locale = new Locale("en", "US"); |
| | | } else { |
| | | locale = new Locale("in", "ID"); |
| | | } |
| | | return locale; |
| | | } |
| | | |
| | | @Override |
| | | public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) { |
| | | } |
| | | |
| | | |
| | | public String getQueryParams(HttpServletRequest request, String key) { |
| | | try { |
| | | String method = request.getMethod(); |
| | | if ("POST".equals(method)) { |
| | | String parameter = request.getParameter(key); |
| | | if (!StringUtils.isEmpty(parameter)) { |
| | | return parameter; |
| | | } |
| | | Object attribute = request.getAttribute(key); |
| | | if (null != attribute) { |
| | | return attribute.toString(); |
| | | } |
| | | StringBuffer sb = new StringBuffer(); |
| | | ServletInputStream inputStream = request.getInputStream(); |
| | | BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); |
| | | String s; |
| | | while ((s = bufferedReader.readLine()) != null) { |
| | | sb.append(s); |
| | | } |
| | | bufferedReader.close(); |
| | | inputStream.close(); |
| | | JSONObject jsonObject = JSON.parseObject(sb.toString()); |
| | | return jsonObject.getString(key); |
| | | } else { |
| | | String parameter = request.getParameter(key); |
| | | if (!StringUtils.isEmpty(parameter)) { |
| | | return parameter; |
| | | } |
| | | Object attribute = request.getAttribute(key); |
| | | if (null != attribute) { |
| | | return attribute.toString(); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.config; |
| | | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.PropertySource; |
| | | import redis.clients.jedis.JedisPool; |
| | | import redis.clients.jedis.JedisPoolConfig; |
| | | |
| | | @Configuration |
| | | @PropertySource("classpath:redis.properties") |
| | | public class RedisConfig { |
| | | @Value("${spring.redis.host}") |
| | | private String host; |
| | | |
| | | @Value("${spring.redis.port}") |
| | | private int port; |
| | | |
| | | @Value("${spring.redis.timeout}") |
| | | private int timeout; |
| | | |
| | | @Value("${spring.redis.jedis.pool.max-idle}") |
| | | private int maxIdle; |
| | | |
| | | @Value("${spring.redis.jedis.pool.min-idle}") |
| | | private int minIdle; |
| | | |
| | | @Value("${spring.redis.jedis.pool.max-wait}") |
| | | private long maxWaitMillis; |
| | | |
| | | @Value("${spring.redis.jedis.pool.max-active}") |
| | | private int maxTotal; |
| | | |
| | | @Value("${spring.redis.password}") |
| | | private String password; |
| | | |
| | | @Value("${spring.redis.block-when-exhausted}") |
| | | private boolean blockWhenExhausted; |
| | | |
| | | @Bean |
| | | public JedisPool redisPoolFactory() throws Exception { |
| | | JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); |
| | | jedisPoolConfig.setMaxIdle(maxIdle); |
| | | jedisPoolConfig.setMinIdle(minIdle); |
| | | jedisPoolConfig.setMaxTotal(maxTotal); |
| | | jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); |
| | | // 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true |
| | | //When the connection is exhausted, if it is set to false, it will throw an exception. If set to true, it will block until timeout. By default, it is set to true. |
| | | jedisPoolConfig.setBlockWhenExhausted(blockWhenExhausted); |
| | | // 是否启用pool的jmx管理功能, 默认true |
| | | //Enable JMX management for pool, default is set to true. |
| | | jedisPoolConfig.setJmxEnabled(true); |
| | | JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password); |
| | | return jedisPool; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.config.Sharding_jdbc; |
| | | |
| | | |
| | | /** |
| | | * 数据源 |
| | | * |
| | | * @author pzb |
| | | * @Date 2022/11/21 21:13 |
| | | */ |
| | | public class DatasourceModel { |
| | | private String url; |
| | | private String username; |
| | | private String password; |
| | | private String driverClassName; |
| | | private Integer maxActive; |
| | | private Long maxWait; |
| | | private Integer minIdle; |
| | | private Integer initialSize; |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | 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 String getDriverClassName() { |
| | | return driverClassName; |
| | | } |
| | | |
| | | public void setDriverClassName(String driverClassName) { |
| | | this.driverClassName = driverClassName; |
| | | } |
| | | |
| | | public DatasourceModel getDatasourceModel() { |
| | | return this; |
| | | } |
| | | |
| | | public Integer getMaxActive() { |
| | | return maxActive; |
| | | } |
| | | |
| | | public void setMaxActive(Integer maxActive) { |
| | | this.maxActive = maxActive; |
| | | } |
| | | |
| | | public Long getMaxWait() { |
| | | return maxWait; |
| | | } |
| | | |
| | | public void setMaxWait(Long maxWait) { |
| | | this.maxWait = maxWait; |
| | | } |
| | | |
| | | public Integer getMinIdle() { |
| | | return minIdle; |
| | | } |
| | | |
| | | public void setMinIdle(Integer minIdle) { |
| | | this.minIdle = minIdle; |
| | | } |
| | | |
| | | public Integer getInitialSize() { |
| | | return initialSize; |
| | | } |
| | | |
| | | public void setInitialSize(Integer initialSize) { |
| | | this.initialSize = initialSize; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.config.Sharding_jdbc; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.PropertySource; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * 数据源配置 |
| | | * |
| | | * @author pzb |
| | | * @Date 2022/11/21 20:32 |
| | | */ |
| | | @Component |
| | | @PropertySource(value = "classpath:sharding-jdbc.properties") |
| | | @ConfigurationProperties(prefix = "datasource.master0") |
| | | public class Master0DataSource extends DatasourceModel { |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.config.Sharding_jdbc; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory; |
| | | import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; |
| | | import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; |
| | | import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; |
| | | import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration; |
| | | import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration; |
| | | import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.sql.DataSource; |
| | | import java.sql.SQLException; |
| | | import java.util.*; |
| | | |
| | | @Configuration |
| | | public class ShardingConfig { |
| | | |
| | | @Autowired |
| | | private Master0DataSource master0DataSource; |
| | | |
| | | |
| | | @Bean |
| | | public DataSource getDataSource() { |
| | | DataSource dataSource = null; |
| | | try { |
| | | Properties properties = new Properties(); |
| | | properties.setProperty("sql-show", "true"); |
| | | String databaseName = "m_0";//真实数据源名称,多个数据源用逗号区分 |
| | | dataSource = ShardingSphereDataSourceFactory.createDataSource(databaseName, createDataSourceMap(), createShardingRuleConfiguration(), properties); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return dataSource; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 配置多数据源 |
| | | * |
| | | * @return |
| | | */ |
| | | private Map<String, DataSource> createDataSourceMap() { |
| | | Map<String, DataSource> dataSourceMap = new HashMap<>(); |
| | | // 配置第 1 个数据源 |
| | | DruidDataSource dataSource1 = new DruidDataSource(); |
| | | dataSource1.setDriverClassName(master0DataSource.getDriverClassName()); |
| | | dataSource1.setUrl(master0DataSource.getUrl()); |
| | | dataSource1.setUsername(master0DataSource.getUsername()); |
| | | dataSource1.setPassword(master0DataSource.getPassword()); |
| | | dataSource1.setMaxActive(master0DataSource.getMaxActive()); |
| | | dataSource1.setMaxWait(master0DataSource.getMaxWait()); |
| | | dataSource1.setMinIdle(master0DataSource.getMinIdle()); |
| | | dataSource1.setInitialSize(master0DataSource.getInitialSize()); |
| | | dataSourceMap.put("m_0", dataSource1); |
| | | return dataSourceMap; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分片配置 |
| | | * |
| | | * @return |
| | | */ |
| | | private Collection<RuleConfiguration> createShardingRuleConfiguration() { |
| | | LinkedList<RuleConfiguration> linkedList = new LinkedList(); |
| | | |
| | | //分片规则配置 |
| | | ShardingRuleConfiguration result1 = new ShardingRuleConfiguration(); |
| | | result1.getTables().add(getWorldCupCompetitorTableRuleConfiguration()); |
| | | Properties props1 = new Properties(); |
| | | props1.setProperty("algorithm-expression", "t_world_cup_competitor$->{worldCupId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_world_cup_competitor-inline", new AlgorithmConfiguration("INLINE", props1)); |
| | | result1.getKeyGenerators().put("t_world_cup_competitor-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | |
| | | //分片规则配置 |
| | | result1.getTables().add(getWorldCupPaymentTableRuleConfiguration()); |
| | | Properties props2 = new Properties(); |
| | | props2.setProperty("algorithm-expression", "t_world_cup_payment$->{worldCupId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_world_cup_payment-inline", new AlgorithmConfiguration("INLINE", props2)); |
| | | result1.getKeyGenerators().put("t_world_cup_payment-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | |
| | | //分片规则配置 |
| | | result1.getTables().add(getWorldCupPaymentParticipantTableRuleConfiguration()); |
| | | Properties props3 = new Properties(); |
| | | props3.setProperty("algorithm-expression", "t_world_cup_payment_participant$->{worldCupId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_world_cup_payment_participant-inline", new AlgorithmConfiguration("INLINE", props3)); |
| | | result1.getKeyGenerators().put("t_world_cup_payment_participant-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | |
| | | linkedList.add(result1); |
| | | return linkedList; |
| | | } |
| | | |
| | | /** |
| | | * 分片算法配置 |
| | | * |
| | | * @return |
| | | */ |
| | | private ShardingTableRuleConfiguration getWorldCupCompetitorTableRuleConfiguration() { |
| | | ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_world_cup_competitor", "m_$->{0}.t_world_cup_competitor$->{1..5}");//50 |
| | | result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("worldCupId", "t_world_cup_competitor-inline")); |
| | | result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_world_cup_competitor-snowflake")); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分片算法配置 |
| | | * |
| | | * @return |
| | | */ |
| | | private ShardingTableRuleConfiguration getWorldCupPaymentTableRuleConfiguration() { |
| | | ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_world_cup_payment", "m_$->{0}.t_world_cup_payment$->{1..5}");//50 |
| | | result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("worldCupId", "t_world_cup_payment-inline")); |
| | | result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_world_cup_payment-snowflake")); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分片算法配置 |
| | | * |
| | | * @return |
| | | */ |
| | | private ShardingTableRuleConfiguration getWorldCupPaymentParticipantTableRuleConfiguration() { |
| | | ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_world_cup_payment_participant", "m_$->{0}.t_world_cup_payment_participant$->{1..5}");//50 |
| | | result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("worldCupId", "t_world_cup_payment_participant-inline")); |
| | | result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_world_cup_payment_participant-snowflake")); |
| | | return result; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.config; |
| | | |
| | | |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.ParameterBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.schema.ModelRef; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Parameter; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * swagger配置类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年6月1日19:42:59 |
| | | */ |
| | | @Configuration |
| | | @ConditionalOnProperty(prefix = "guns", name = "swagger-open", havingValue = "true") |
| | | public class SwaggerConfig { |
| | | |
| | | @Bean |
| | | public Docket systemApi() { |
| | | List<Parameter> parameters = new ArrayList<>(); |
| | | // 添加header头 |
| | | ParameterBuilder type = new ParameterBuilder(); |
| | | type.name("Authorization").description("登录token").modelRef(new ModelRef("string")) |
| | | .parameterType("header").required(true).build(); |
| | | parameters.add(type.build()); |
| | | return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.stylefeng.guns.rest.controller.api")) |
| | | .paths(PathSelectors.any()).build().groupName("登录后API调用").globalOperationParameters(parameters).apiInfo(apiInfo("登录后API调用", "文档中可以查询及测试接口调用参数和结果", "1.0.0版本")); |
| | | } |
| | | |
| | | @Bean |
| | | public Docket commonApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.stylefeng.guns.rest.controller.common")) |
| | | .paths(PathSelectors.any()).build().groupName("公共Aip接口") |
| | | .apiInfo(apiInfo("公共Aip接口", "文档中可以查询及测试接口调用参数和结果", "1.0.0版本")); |
| | | } |
| | | |
| | | |
| | | private ApiInfo apiInfo(String name, String description, String version) { |
| | | ApiInfo apiInfo = new ApiInfoBuilder().title(name).description(description).version(version).build(); |
| | | return apiInfo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.dsh.page; |
| | | |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.io.PrintWriter; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.net.URLEncoder; |
| | | import java.util.Enumeration; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class HttpKit { |
| | | |
| | | public static String getIp() { |
| | | return HttpKit.getRequest().getRemoteHost(); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有请求的值 |
| | | */ |
| | | public static Map<String, String> getRequestParameters() { |
| | | HashMap<String, String> values = new HashMap<>(); |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | Enumeration enums = request.getParameterNames(); |
| | | while (enums.hasMoreElements()) { |
| | | String paramName = (String) enums.nextElement(); |
| | | String paramValue = request.getParameter(paramName); |
| | | values.put(paramName, paramValue); |
| | | } |
| | | return values; |
| | | } |
| | | |
| | | /** |
| | | * 获取 HttpServletRequest |
| | | */ |
| | | public static HttpServletResponse getResponse() { |
| | | HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse(); |
| | | return response; |
| | | } |
| | | |
| | | /** |
| | | * 获取 包装防Xss Sql注入的 HttpServletRequest |
| | | * |
| | | * @return request |
| | | */ |
| | | public static HttpServletRequest getRequest() { |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | return new WafRequestWrapper(request); |
| | | } |
| | | |
| | | /** |
| | | * 向指定URL发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的URL |
| | | * @param param 请求参数 |
| | | * @return URL 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url, Map<String, String> param) { |
| | | String result = ""; |
| | | BufferedReader in = null; |
| | | try { |
| | | StringBuffer query = new StringBuffer(); |
| | | |
| | | for (Map.Entry<String, String> kv : param.entrySet()) { |
| | | query.append(URLEncoder.encode(kv.getKey(), "UTF-8") + "="); |
| | | query.append(URLEncoder.encode(kv.getValue(), "UTF-8") + "&"); |
| | | } |
| | | if (query.lastIndexOf("&") > 0) { |
| | | query.deleteCharAt(query.length() - 1); |
| | | } |
| | | |
| | | String urlNameString = url + "?" + query.toString(); |
| | | URL realUrl = new URL(urlNameString); |
| | | // 打开和URL之间的连接 |
| | | //Establish the connection between the open URL and other relevant components. |
| | | URLConnection connection = realUrl.openConnection(); |
| | | // 设置通用的请求属性 |
| | | //Set universal request properties. |
| | | connection.setRequestProperty("accept", "*/*"); |
| | | connection.setRequestProperty("connection", "Keep-Alive"); |
| | | connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | // 建立实际的连接 |
| | | //Establishing a tangible connection |
| | | connection.connect(); |
| | | // 获取所有响应头字段 |
| | | //Retrieve all response header fields. |
| | | Map<String, List<String>> map = connection.getHeaderFields(); |
| | | // 遍历所有的响应头字段 |
| | | //Traverse all response header fields. |
| | | for (String key : map.keySet()) { |
| | | System.out.println(key + "--->" + map.get(key)); |
| | | } |
| | | // 定义 BufferedReader输入流来读取URL的响应 |
| | | //Define a BufferedReader input stream to read the response of the URL. |
| | | in = new BufferedReader(new InputStreamReader(connection.getInputStream())); |
| | | String line; |
| | | while ((line = in.readLine()) != null) { |
| | | result += line; |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("发送GET请求出现异常!" + e); |
| | | e.printStackTrace(); |
| | | } |
| | | // 使用finally块来关闭输入流 |
| | | //Use a 'finally' block to close the input stream. |
| | | finally { |
| | | try { |
| | | if (in != null) { |
| | | in.close(); |
| | | } |
| | | } catch (Exception e2) { |
| | | e2.printStackTrace(); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送POST方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendPost(String url, Map<String, String> param) { |
| | | PrintWriter out = null; |
| | | BufferedReader in = null; |
| | | String result = ""; |
| | | try { |
| | | String para = ""; |
| | | for (String key : param.keySet()) { |
| | | para += (key + "=" + param.get(key) + "&"); |
| | | } |
| | | if (para.lastIndexOf("&") > 0) { |
| | | para = para.substring(0, para.length() - 1); |
| | | } |
| | | String urlNameString = url + "?" + para; |
| | | URL realUrl = new URL(urlNameString); |
| | | // 打开和URL之间的连接 |
| | | URLConnection conn = realUrl.openConnection(); |
| | | // 设置通用的请求属性 |
| | | conn.setRequestProperty("accept", "*/*"); |
| | | conn.setRequestProperty("connection", "Keep-Alive"); |
| | | conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | // 发送POST请求必须设置如下两行 |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | // 获取URLConnection对象对应的输出流 |
| | | out = new PrintWriter(conn.getOutputStream()); |
| | | // 发送请求参数 |
| | | out.print(param); |
| | | // flush输出流的缓冲 |
| | | out.flush(); |
| | | // 定义BufferedReader输入流来读取URL的响应 |
| | | in = new BufferedReader(new InputStreamReader(conn.getInputStream())); |
| | | String line; |
| | | while ((line = in.readLine()) != null) { |
| | | result += line; |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("发送 POST 请求出现异常!" + e); |
| | | e.printStackTrace(); |
| | | } |
| | | // 使用finally块来关闭输出流、输入流 |
| | | finally { |
| | | try { |
| | | if (out != null) { |
| | | out.close(); |
| | | } |
| | | if (in != null) { |
| | | in.close(); |
| | | } |
| | | } catch (IOException ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.page; |
| | | |
| | | /** |
| | | * 数据库排序 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年5月31日20:48:41 |
| | | */ |
| | | public enum Order { |
| | | |
| | | ASC("asc"), DESC("desc"); |
| | | |
| | | private String des; |
| | | |
| | | Order(String des) { |
| | | this.des = des; |
| | | } |
| | | |
| | | public String getDes() { |
| | | return des; |
| | | } |
| | | |
| | | public void setDes(String des) { |
| | | this.des = des; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.page; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * BootStrap Table默认的分页参数创建 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-05 22:25 |
| | | */ |
| | | public class PageFactory<T> { |
| | | |
| | | public Page<T> defaultPage(Integer limit, Integer offset) { |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | String sort = request.getParameter("sort"); //排序字段名称 |
| | | String order = request.getParameter("order"); //asc或desc(升序或降序) |
| | | if (StringUtils.isEmpty(sort)) { |
| | | Page<T> page = new Page<>((offset / limit + 1), limit); |
| | | return page; |
| | | } else { |
| | | Page<T> page = new Page<T>((offset / limit + 1), limit); |
| | | if (Order.ASC.getDes().equals(order)) { |
| | | } else { |
| | | } |
| | | return page; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2011-2014, hubin (jobob@qq.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.dsh.page; |
| | | |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * Web防火墙工具类 |
| | | Web firewall tool category |
| | | * <p> |
| | | * @author hubin |
| | | * @Date 2014-5-8 |
| | | */ |
| | | public class WafKit { |
| | | |
| | | /** |
| | | * @Description 过滤XSS脚本内容 |
| | | Filtering XSS scripts content. |
| | | * @param value |
| | | * 待处理内容 |
| | | * @return |
| | | */ |
| | | public static String stripXSS(String value) { |
| | | String rlt = null; |
| | | |
| | | if (null != value) { |
| | | // NOTE: It's highly recommended to use the ESAPI library and uncomment the following line to |
| | | // avoid encoded attacks. |
| | | // value = ESAPI.encoder().canonicalize(value); |
| | | |
| | | // Avoid null characters |
| | | rlt = value.replaceAll("", ""); |
| | | |
| | | // Avoid anything between script tags |
| | | Pattern scriptPattern = Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid anything in a src='...' type of expression |
| | | /*scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\'(.*?)\\\'", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\"(.*?)\\\"", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll("");*/ |
| | | |
| | | // Remove any lonesome </script> tag |
| | | scriptPattern = Pattern.compile("</script>", Pattern.CASE_INSENSITIVE); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Remove any lonesome <script ...> tag |
| | | scriptPattern = Pattern.compile("<script(.*?)>", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid eval(...) expressions |
| | | scriptPattern = Pattern.compile("eval\\((.*?)\\)", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid expression(...) expressions |
| | | scriptPattern = Pattern.compile("expression\\((.*?)\\)", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid javascript:... expressions |
| | | scriptPattern = Pattern.compile("javascript:", Pattern.CASE_INSENSITIVE); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid vbscript:... expressions |
| | | scriptPattern = Pattern.compile("vbscript:", Pattern.CASE_INSENSITIVE); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid onload= expressions |
| | | scriptPattern = Pattern.compile("onload(.*?)=", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | } |
| | | |
| | | return rlt; |
| | | } |
| | | |
| | | /** |
| | | * @Description 过滤SQL注入内容 |
| | | Filter SQL injection content. |
| | | * @param value |
| | | * 待处理内容 |
| | | * @return |
| | | */ |
| | | public static String stripSqlInjection(String value) { |
| | | return (null == value) ? null : value.replaceAll("('.+--)|(--)|(%7C)", ""); //value.replaceAll("('.+--)|(--)|(\\|)|(%7C)", ""); |
| | | } |
| | | |
| | | /** |
| | | * @Description 过滤SQL/XSS注入内容 |
| | | Filter SQL/XSS injection content. |
| | | * @param value |
| | | * 待处理内容 |
| | | * @return |
| | | */ |
| | | public static String stripSqlXSS(String value) { |
| | | return stripXSS(stripSqlInjection(value)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2011-2014, hubin (jobob@qq.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| | | * use this file except in compliance with the License. You may obtain a copy of |
| | | * the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| | | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| | | * License for the specific language governing permissions and limitations under |
| | | * the License. |
| | | */ |
| | | package com.dsh.page; |
| | | |
| | | import javax.servlet.http.Cookie; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletRequestWrapper; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Request请求过滤包装 |
| | | Request for packaging filtration. |
| | | * <p> |
| | | * @author hubin |
| | | * @Date 2014-5-8 |
| | | */ |
| | | public class WafRequestWrapper extends HttpServletRequestWrapper { |
| | | |
| | | private boolean filterXSS = true; |
| | | |
| | | private boolean filterSQL = true; |
| | | |
| | | |
| | | public WafRequestWrapper(HttpServletRequest request, boolean filterXSS, boolean filterSQL) { |
| | | super(request); |
| | | this.filterXSS = filterXSS; |
| | | this.filterSQL = filterSQL; |
| | | } |
| | | |
| | | |
| | | public WafRequestWrapper(HttpServletRequest request) { |
| | | this(request, true, true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 数组参数过滤 |
| | | * @param parameter |
| | | * 过滤参数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String[] getParameterValues(String parameter) { |
| | | String[] values = super.getParameterValues(parameter); |
| | | if (values == null) { |
| | | return null; |
| | | } |
| | | |
| | | int count = values.length; |
| | | String[] encodedValues = new String[count]; |
| | | for (int i = 0; i < count; i++) { |
| | | encodedValues[i] = filterParamString(values[i]); |
| | | } |
| | | |
| | | return encodedValues; |
| | | } |
| | | |
| | | @Override |
| | | @SuppressWarnings({"rawtypes", "unchecked"}) |
| | | public Map getParameterMap() { |
| | | Map<String, String[]> primary = super.getParameterMap(); |
| | | Map<String, String[]> result = new HashMap<String, String[]>(primary.size()); |
| | | for (Map.Entry<String, String[]> entry : primary.entrySet()) { |
| | | result.put(entry.getKey(), filterEntryString(entry.getValue())); |
| | | } |
| | | return result; |
| | | |
| | | } |
| | | |
| | | protected String[] filterEntryString(String[] rawValue) { |
| | | for (int i = 0; i < rawValue.length; i++) { |
| | | rawValue[i] = filterParamString(rawValue[i]); |
| | | } |
| | | return rawValue; |
| | | } |
| | | |
| | | /** |
| | | * @Description 参数过滤 |
| | | * @param parameter |
| | | * 过滤参数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getParameter(String parameter) { |
| | | return filterParamString(super.getParameter(parameter)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 请求头过滤 |
| | | * @param name |
| | | * 过滤内容 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getHeader(String name) { |
| | | return filterParamString(super.getHeader(name)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description Cookie内容过滤 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Cookie[] getCookies() { |
| | | Cookie[] existingCookies = super.getCookies(); |
| | | if (existingCookies != null) { |
| | | for (int i = 0; i < existingCookies.length; ++i) { |
| | | Cookie cookie = existingCookies[i]; |
| | | cookie.setValue(filterParamString(cookie.getValue())); |
| | | } |
| | | } |
| | | return existingCookies; |
| | | } |
| | | |
| | | /** |
| | | * @Description 过滤字符串内容 |
| | | * @param rawValue |
| | | * 待处理内容 |
| | | * @return |
| | | */ |
| | | protected String filterParamString(String rawValue) { |
| | | if (null == rawValue) { |
| | | return null; |
| | | } |
| | | String tmpStr = rawValue; |
| | | if (this.filterXSS) { |
| | | tmpStr = WafKit.stripXSS(rawValue); |
| | | } |
| | | if (this.filterSQL) { |
| | | tmpStr = WafKit.stripSqlInjection(tmpStr); |
| | | } |
| | | return tmpStr; |
| | | } |
| | | } |
New file |
| | |
| | | spring.profiles.active=@profiles.active@ |
| | | spring.application.name=@artifactId@ |
| | | spring.cloud.nacos.username=@profiles.nacos-username@ |
| | | spring.cloud.nacos.password=@profiles.nacos-password@ |
| | | spring.cloud.nacos.config.server-addr=@profiles.nacos-addr@ |
| | | spring.cloud.nacos.config.namespace=@profiles.nacos-namespace@ |
| | | spring.cloud.nacos.config.group=@profiles.group@ |
| | | spring.cloud.nacos.config.file-extension=properties |
| | | spring.cloud.nacos.config.extension-configs[0].data-id=${spring.application.name}.${spring.cloud.nacos.config.file-extension} |
| | | spring.cloud.nacos.config.extension-configs[0].group=@profiles.group@ |
| | | spring.cloud.nacos.config.extension-configs[0].refresh=true |
| | | spring.cloud.nacos.config.extension-configs[1].data-id=@profiles.global.config@.${spring.cloud.nacos.config.file-extension} |
| | | spring.cloud.nacos.config.extension-configs[1].group=@profiles.group@ |
| | | spring.cloud.nacos.config.extension-configs[1].refresh=true |
| | | spring.cloud.nacos.discovery.server-addr=@profiles.nacos-addr@ |
| | | spring.cloud.nacos.discovery.namespace=@profiles.nacos-namespace@ |
| | | spring.cloud.nacos.discovery.register-enabled=true |
| | | spring.cloud.nacos.discovery.group=@profiles.group@ |
| | | spring.main.allow-bean-definition-overriding=true |
| | | spring.flyway.enabled=false |
| | | # \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0479\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD |
| | | feign.compression.request.mime-types=text/xml,application/xml,application/json |
| | | feign.compression.request.min-request-size=4096 |
| | | feign.compression.request.enabled=true |
| | | feign.compression.response.enabled=true |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,比如: 如果设置为WARN,则低于WARN的信息都不会输出 --> |
| | | <!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true --> |
| | | <!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> |
| | | <!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> |
| | | <configuration scan="true" scanPeriod="10 seconds"> |
| | | <contextName>logback</contextName> |
| | | |
| | | <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> |
| | | <property name="log.path" value="/usr/playpai/server/logs"/> |
| | | |
| | | <!--0. 日志格式和颜色渲染 --> |
| | | <!-- 彩色日志依赖的渲染类 --> |
| | | <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> |
| | | <conversionRule conversionWord="wex" |
| | | converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> |
| | | <conversionRule conversionWord="wEx" |
| | | converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> |
| | | <!-- 彩色日志格式 --> |
| | | <property name="CONSOLE_LOG_PATTERN" |
| | | value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
| | | |
| | | <!--1. 输出到控制台--> |
| | | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
| | | <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
| | | <level>debug</level> |
| | | </filter> |
| | | <encoder> |
| | | <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
| | | <!-- 设置字符集 --> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!--2. 输出到文档--> |
| | | <!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
| | | <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/debug.log</file> |
| | | <!--日志文档输出格式 Output format of the log document.--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 Rolling strategy of the logger, recording by date or by size.--> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志归档 --> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录debug级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>debug</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
| | | <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/info.log</file> |
| | | <!--日志文档输出格式 Output format of the log document.--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 Rolling strategy of the logger, recording by date or by size.--> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 每天日志归档路径以及格式 --> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录info级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>info</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
| | | <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/warn.log</file> |
| | | <!--日志文档输出格式 Output format of the log document.--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 Rolling strategy of the logger, recording by date or by size.--> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录warn级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>warn</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
| | | <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/error.log</file> |
| | | <!--日志文档输出格式 Output format of the log document.--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 Rolling strategy of the logger, recording by date or by size.--> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录ERROR级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.5 所有 除了DEBUG级别的其它高于DEBUG的 日志,记录到一个文件 --> |
| | | <appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/all.log</file> |
| | | <!--日志文档输出格式 Output format of the log document.--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 Rolling strategy of the logger, recording by date or by size.--> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>DEBUG</level> |
| | | <onMatch>DENY</onMatch> |
| | | <onMismatch>ACCEPT</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- |
| | | <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 |
| | | 以及指定<appender>。<logger>仅有一个name属性, |
| | | 一个可选的level和一个可选的addtivity属性。 |
| | | name:用来指定受此logger约束的某一个包或者具体的某一个类。 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 还有一个特殊值INHERITED或者同义词NULL,代表强制执行上级的级别。 |
| | | 如果未设置此属性,那么当前logger将会继承上级的级别。 |
| | | addtivity:是否向上级logger传递打印信息。默认是true。 |
| | | <logger name="org.springframework.web" level="info"/> |
| | | <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/> |
| | | --> |
| | | |
| | | <!-- |
| | | root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 不能设置为INHERITED或者同义词NULL。默认是DEBUG |
| | | 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 |
| | | --> |
| | | |
| | | <!-- 4 最终的策略: |
| | | 基本策略(root级) + 根据profile在启动时, logger标签中定制化package日志级别(优先级高于上面的root级)--> |
| | | <springProfile name="dev"> |
| | | <root level="info"> |
| | | <appender-ref ref="CONSOLE"/> |
| | | <appender-ref ref="DEBUG_FILE"/> |
| | | <appender-ref ref="INFO_FILE"/> |
| | | <appender-ref ref="WARN_FILE"/> |
| | | <appender-ref ref="ERROR_FILE"/> |
| | | <appender-ref ref="ALL_FILE"/> |
| | | </root> |
| | | <logger name="com.dsh" level="debug"/> |
| | | <logger name="business-log" level="warn"/> |
| | | </springProfile> |
| | | |
| | | <springProfile name="fat"> |
| | | <root level="info"> |
| | | <appender-ref ref="CONSOLE"/> |
| | | <appender-ref ref="DEBUG_FILE"/> |
| | | <appender-ref ref="INFO_FILE"/> |
| | | <appender-ref ref="WARN_FILE"/> |
| | | <appender-ref ref="ERROR_FILE"/> |
| | | <appender-ref ref="ALL_FILE"/> |
| | | </root> |
| | | <logger name="com.dsh.course.mapper" level="error"/> |
| | | <logger name="business-log" level="warn"/> |
| | | </springProfile> |
| | | |
| | | <springProfile name="prod"> |
| | | <root level="warn"> |
| | | <!-- 生产环境最好不配置console写文件 --> |
| | | <appender-ref ref="DEBUG_FILE"/> |
| | | <appender-ref ref="INFO_FILE"/> |
| | | <appender-ref ref="WARN_FILE"/> |
| | | <appender-ref ref="ERROR_FILE"/> |
| | | <appender-ref ref="ALL_FILE"/> |
| | | </root> |
| | | <logger name="com.dsh.course.mapper" level="error"/> |
| | | <logger name="business-log" level="warn"/> |
| | | </springProfile> |
| | | |
| | | </configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.communityWorldCup.mapper.WorldCupCompetitorMapper"> |
| | | |
| | | <select id="getNumberOfGamesRanked" resultType="map"> |
| | | select * from ( |
| | | select |
| | | CASE WHEN participantType = 2 THEN 0 ELSE 1 END as participantType, |
| | | participantId, |
| | | count(*) as num |
| | | from t_world_cup_competitor |
| | | where DATE_FORMAT(NOW(), '%Y-%m-%d') = DATE_FORMAT(startTime, '%Y-%m-%d') |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | | <foreach collection="appUserIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | group by participantType, participantId |
| | | ) as aa order by aa.num desc |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getMatchRecord" resultType="com.dsh.communityWorldCup.model.MatchRecordList"> |
| | | select |
| | | b.`name`, |
| | | a.ourScore, |
| | | a.opponentScore, |
| | | DATE_FORMAT(a.startTime, '%Y-%m-%d %H:%i') as startTime, |
| | | a.matchResult, |
| | | (a.participationIntegral + a.winIntegral) as award |
| | | from t_world_cup_competitor a |
| | | left join t_world_cup b on (a.worldCupId = b.id) |
| | | where a.participantId = #{item.id} and a.participantType = #{item.isStudent} |
| | | order by a.startTime desc limit #{item.pageNo}, #{item.pageSize} |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getWorldCupRank" resultType="java.util.Map"> |
| | | select * from ( |
| | | select |
| | | a.participantType, |
| | | a.participantId, |
| | | a.appUserId, |
| | | a.num as totalSession, |
| | | (ifnull(b.num, 0) / a.num * 100) as winRate |
| | | from ( |
| | | select |
| | | participantType, |
| | | participantId, |
| | | appUserId, |
| | | count(*) as num |
| | | from t_world_cup_competitor |
| | | where 1 = 1 |
| | | <if test="null != item.year"> |
| | | and DATE_FORMAT(a.startTime, '%Y') = #{item.year} |
| | | </if> |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | | <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")"> |
| | | #{iten} |
| | | </foreach> |
| | | </if> |
| | | group by participantType, participantId, appUserId |
| | | ) as a |
| | | left join ( |
| | | select |
| | | participantType, |
| | | participantId, |
| | | appUserId, |
| | | count(*) as num |
| | | from t_world_cup_competitor |
| | | where matchResult = 1 |
| | | <if test="null != item.year"> |
| | | and DATE_FORMAT(a.startTime, '%Y') = #{item.year} |
| | | </if> |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | | <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")"> |
| | | #{iten} |
| | | </foreach> |
| | | </if> |
| | | group by participantType, participantId, appUserId |
| | | ) as b on (a.participantId = b.participantId and a.participantType = b.participantType) |
| | | ) as aa |
| | | <if test="null != item.sort and item.sort == 1"> |
| | | order by aa.totalSession desc |
| | | </if> |
| | | <if test="null != item.sort and item.sort == 2"> |
| | | order by aa.winRate desc |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.communityWorldCup.mapper.WorldCupMapper"> |
| | | |
| | | |
| | | <select id="getWorldCupListCoach" resultType="com.dsh.communityWorldCup.model.WorldCupListCoachVo"> |
| | | select |
| | | id, |
| | | name, |
| | | CONCAT(DATE_FORMAT(startTime, '%Y.%m.%d %H:%i'), '-', DATE_FORMAT(endTime, '%Y.%m.%d %H:%i'))as activeTime, |
| | | matchNumber, |
| | | status, |
| | | lon, |
| | | lat, |
| | | CASE status WHEN 1 THEN 2 WHEN 2 THEN 1 ELSE status END as sort |
| | | from t_world_cup where 1 = 1 |
| | | <if test="null != item.content and '' != item.content"> |
| | | and `name` like CONCAT('%', #{item.content}, '%') |
| | | </if> |
| | | <if test="null != item.storeId"> |
| | | and id in (select worldCupId from t_world_cup_store where storeId = #{item.storeId}) |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getWorldCupList" resultType="com.dsh.communityWorldCup.model.WorldCupListVo"> |
| | | select |
| | | a.id, |
| | | a.name, |
| | | DATE_FORMAT(a.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime, |
| | | CONCAT(a.startAge, '-', a.endAge) as age, |
| | | a.coverImg, |
| | | a.intro as content, |
| | | a.lon, |
| | | a.lat, |
| | | a.basePeople as heat |
| | | from t_world_cup a |
| | | where a.status in (1, 2) |
| | | <if test="null != item.content and '' != item.content"> |
| | | and a.name like CONCAT('%', #{item.content}, '%') |
| | | </if> |
| | | <if test="null != item.storeId"> |
| | | and a.worldCupId in (select worldCupId from t_world_cup_store where storeId = #{item.storeId}) |
| | | </if> |
| | | <if test="null != item.gender"> |
| | | and #{item.gender} = a.gender |
| | | </if> |
| | | order by a.createTime desc |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getWorldCupInfo" resultType="com.dsh.communityWorldCup.model.WorldCupInfo"> |
| | | select |
| | | a.id, |
| | | a.infoImg, |
| | | a.name, |
| | | a.basePeople as heat, |
| | | DATE_FORMAT(a.startTime, '%Y-%m-%d %H:%i') as startTime, |
| | | DATE_FORMAT(a.endTime, '%Y-%m-%d %H:%i') as endTime, |
| | | DATE_FORMAT(a.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime, |
| | | CONCAT(a.startAge, '-', a.endAge) as age, |
| | | a.gender, |
| | | a.province, |
| | | a.city, |
| | | a.address, |
| | | a.cash, |
| | | a.paiCoin, |
| | | a.classHour, |
| | | a.intro, |
| | | a.content |
| | | from t_world_cup a |
| | | where a.id = #{id} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getWorldCupListAll" resultType="map"> |
| | | select |
| | | id, |
| | | `name`, |
| | | DATE_FORMAT(startTime, '%Y.%m.%d %H:%i') as startTime, |
| | | DATE_FORMAT(endTime, '%Y.%m.%d %H:%i') as endTime, |
| | | CONCAT(startAge, '至', endAge) as age, |
| | | gender, |
| | | maxPeople, |
| | | status |
| | | from t_world_cup |
| | | where 1 = 1 |
| | | <if test="null != item.name and '' != item.name"> |
| | | and `name` like CONCAT('%', #{item.name}, '%') |
| | | </if> |
| | | <if test="null != item.startTime and '' != item.startTime"> |
| | | and DATE_FORMAT(startTime, '%Y-%m-%d') >= #{item.startTime} |
| | | </if> |
| | | <if test="null != item.endTime and '' != item.endTime"> |
| | | and DATE_FORMAT(endTime, '%Y-%m-%d') <= #{item.endTime} |
| | | </if> |
| | | <if test="null != item.status"> |
| | | and status= #{item.status} |
| | | </if> |
| | | order by createTime desc limit #{item.offset}, #{item.limit} |
| | | </select> |
| | | |
| | | |
| | | <select id="getWorldCupListAllCount" resultType="int"> |
| | | select |
| | | count(*) |
| | | from t_world_cup |
| | | where 1 = 1 |
| | | <if test="null != item.name and '' != item.name"> |
| | | and `name` like CONCAT('%', #{item.name}, '%') |
| | | </if> |
| | | <if test="null != item.startTime and '' != item.startTime"> |
| | | and DATE_FORMAT(startTime, '%Y-%m-%d') >= #{item.startTime} |
| | | </if> |
| | | <if test="null != item.endTime and '' != item.endTime"> |
| | | and DATE_FORMAT(endTime, '%Y-%m-%d') <= #{item.endTime} |
| | | </if> |
| | | <if test="null != item.status"> |
| | | and status= #{item.status} |
| | | </if> |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.communityWorldCup.mapper.WorldCupPaymentMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.communityWorldCup.mapper.WorldCupPaymentParticipantMapper"> |
| | | |
| | | |
| | | |
| | | <select id="getWorldCupPaymentParticipant" resultType="com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant"> |
| | | select * |
| | | from t_world_cup_payment_participant |
| | | where alreadyEntered = 0 and worldCupId = #{worldCupId} and participantType = #{participantType} and participantId = #{participantId} and worldCupPaymentId in ( |
| | | select id from t_world_cup_payment where worldCupId = #{worldCupId} and payStatus = 2 and state = 1 |
| | | ) order by createTime desc limit 0, 1 |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getMyWorldCupList" resultType="com.dsh.communityWorldCup.model.WorldCupListVo"> |
| | | select |
| | | a.id, |
| | | b.worldCupId, |
| | | c.name, |
| | | DATE_FORMAT(c.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime, |
| | | CONCAT(c.startAge, '-', c.endAge) as age, |
| | | c.coverImg, |
| | | c.intro as content, |
| | | c.lon, |
| | | c.lat, |
| | | c.basePeople as heat |
| | | from t_world_cup_payment_participant a |
| | | left join t_world_cup_payment b on (a.worldCupPaymentId = b.id) |
| | | left join t_world_cup c on (b.worldCupId = c.id) |
| | | where a.participantType = #{item.isStudent} and a.participantId = #{item.id} and b.payStatus = 2 and b.refundTime is null and b.state = 1 |
| | | <if test="null != item.state"> |
| | | and c.status = #{item.state} |
| | | </if> |
| | | order by b.createTime desc limit #{item.pageNo}, #{item.pageSize} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.communityWorldCup.mapper.WorldCupStoreMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | spring.redis.database=0 |
| | | spring.redis.host=@redis.addr@ |
| | | spring.redis.port=@redis.port@ |
| | | spring.redis.password=@redis.password@ |
| | | spring.redis.jedis.pool.max-active=1024 |
| | | spring.redis.jedis.pool.max-wait=10000 |
| | | spring.redis.jedis.pool.max-idle=200 |
| | | spring.redis.jedis.pool.min-idle=50 |
| | | spring.redis.timeout=10000 |
| | | spring.redis.block-when-exhausted=true |
New file |
| | |
| | | datasource.names=master0 |
| | | datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_community_world_cup?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.username=root |
| | | datasource.master0.password=123456 |
| | | datasource.master0.maxActive=20 |
| | | datasource.master0.maxWait=60000 |
| | | datasource.master0.minIdle=5 |
| | | datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | | #datasource.names=master0 |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://127.0.0.1:3306/playpai_community_world_cup?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=playpai2023! |
| | | #datasource.master0.maxActive=20 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=5 |
| | | #datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | |
| | | import com.dsh.competition.entity.UserCompetition; |
| | | import com.dsh.competition.feignclient.account.AppUserClient; |
| | | import com.dsh.competition.feignclient.account.StudentClient; |
| | | import com.dsh.competition.feignclient.account.StudentHonorClient; |
| | | import com.dsh.competition.feignclient.account.model.AppUser; |
| | | import com.dsh.competition.feignclient.account.model.StudentHonor; |
| | | import com.dsh.competition.feignclient.account.model.TStudent; |
| | | import com.dsh.competition.feignclient.course.CoursePackagePaymentClient; |
| | | import com.dsh.competition.feignclient.course.model.PaymentDeductionClassHour; |
| | |
| | | |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据门店ids 获取对应的赛事 根据赛事支付记录获取用户ids |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | |
| | | }) |
| | | |
| | | public synchronized ResultUtil paymentCompetition(PaymentCompetitionVo paymentCompetitionVo) { |
| | | try { |
| | | Competition byId = competitionService.getById(paymentCompetitionVo.getId()); |
| | | Date date = byId.getEndTime(); |
| | | // Assuming you have a Date object |
| | | // Check if the date is past the current time |
| | | boolean isPast = date.after(new Date()); |
| | | if (!isPast) { |
| | | return new ResultUtil(0, "已超过截至报名时间"); |
| | |
| | | } else { |
| | | competition.setStatus(3); |
| | | } |
| | | |
| | | if(competition.getStatus() == 2){ |
| | | //添加勋章数据 |
| | | List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>() |
| | | .eq("competitionId", competition.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | Set<Integer> collect = list.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toSet()); |
| | | for (Integer integer : collect) { |
| | | int count = paymentCompetitionService.count(new QueryWrapper<PaymentCompetition>() |
| | | .eq("appUserId", integer).eq("payStatus", 2).eq("state", 1)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(integer); |
| | | studentHonor.setHonorType(2); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | } |
| | | } |
| | | competition.setInsertTime(new Date()); |
| | | cttService.save(competition); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } else { |
| | | competition.setStatus(3); |
| | | } |
| | | |
| | | if(competition.getStatus() == 2){ |
| | | //添加勋章数据 |
| | | List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>() |
| | | .eq("competitionId", competition.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | Set<Integer> collect = list.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toSet()); |
| | | for (Integer integer : collect) { |
| | | int count = paymentCompetitionService.count(new QueryWrapper<PaymentCompetition>() |
| | | .eq("appUserId", integer).eq("payStatus", 2).eq("state", 1)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(integer); |
| | | studentHonor.setHonorType(2); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | } |
| | | } |
| | | cttService.updateById(competition); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | |
| | | @Autowired |
| | | private UserCompetitionService userCompetitionService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/addParticipant") |
| | | @ApiOperation(value = "添加参赛人员", tags = {"APP-赛事活动列表", ""}) |
| | | @ApiOperation(value = "添加参赛人员【2.0】", tags = {"APP-赛事活动列表", "人员管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/queryParticipantList") |
| | | @ApiOperation(value = "获取参赛人员列表", tags = {"APP-赛事活动列表", ""}) |
| | | @ApiOperation(value = "获取参赛人员列表", tags = {"APP-赛事活动列表", "我的二维码", "人员管理", "APP-社区世界杯"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "isPre(1过滤)", name = "是否过滤未实名", required = true, dataType = "int") |
| | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/editParticipant") |
| | | @ApiOperation(value = "编辑参赛人员", tags = {"APP-赛事活动列表", ""}) |
| | | @ApiOperation(value = "编辑参赛人员", tags = {"APP-赛事活动列表", "人员管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/delParticipant") |
| | | @ApiOperation(value = "删除参赛人员", tags = {"APP-赛事活动列表", ""}) |
| | | @ApiOperation(value = "删除参赛人员", tags = {"APP-赛事活动列表", "人员管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private UserCompetitionService userCompetitionService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | public Integer counts(@RequestBody Integer stuId) { |
| | | return userCompetitionService.count(new QueryWrapper<UserCompetition>().eq("participantId", stuId)); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/participant/getParticipant") |
| | | public Participant getParticipant(@RequestBody Integer id){ |
| | | return participantService.getById(id); |
| | | } |
| | | } |
| | |
| | | @TableField("participantId") |
| | | private Integer participantId; |
| | | /** |
| | | * 参与人员类型(1=学员,2=参赛者) |
| | | */ |
| | | @TableField("participantType") |
| | | private Integer participantType; |
| | | /** |
| | | * 支付记录id |
| | | */ |
| | | @TableField("paymentCompetitionId") |
New file |
| | |
| | | package com.dsh.competition.feignclient.account; |
| | | |
| | | import com.dsh.competition.feignclient.account.model.StudentHonor; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * 勋章 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface StudentHonorClient { |
| | | |
| | | |
| | | /** |
| | | * 保存用户勋章 |
| | | * @param studentHonor |
| | | */ |
| | | @PostMapping("/studentHonor/saveStudentHonor") |
| | | void saveStudentHonor(StudentHonor studentHonor); |
| | | } |
New file |
| | |
| | | package com.dsh.competition.feignclient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StudentHonor { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 荣耀类型 |
| | | */ |
| | | private Integer honorType; |
| | | /** |
| | | * 当前次数 |
| | | */ |
| | | private Integer number; |
| | | } |
| | |
| | | public class PaymentCompetitionVo { |
| | | @ApiModelProperty(value = "赛事id", dataType = "int", required = true) |
| | | private Integer id; |
| | | @ApiModelProperty(value = "参赛人员id,多个分号分隔", dataType = "String", required = true) |
| | | @ApiModelProperty(value = "参赛人员id[{\"id\":123,\"isStudent\":1},{\"id\":222,\"isStudent\":0}]", dataType = "String", required = true) |
| | | private String ids; |
| | | @ApiModelProperty(value = "支付方式(1=微信,2=支付宝,3=余额,4=课时)", dataType = "int", required = true) |
| | | private Integer payType; |
| | |
| | | package com.dsh.competition.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.UuidUtils; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | |
| | | @Override |
| | | public ResultUtil paymentCompetition(Integer uid, PaymentCompetitionVo paymentCompetitionVo) throws Exception { |
| | | AppUser appUser = appUserClient.queryAppUser(uid); |
| | | String[] split = paymentCompetitionVo.getIds().split(";"); |
| | | JSONArray jsonArray = JSON.parseArray(paymentCompetitionVo.getIds()); |
| | | Competition competition = this.getById(paymentCompetitionVo.getId()); |
| | | |
| | | List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>().eq("competitionId", paymentCompetitionVo.getId()).ne("payStatus", 3)); |
| | |
| | | } |
| | | |
| | | |
| | | // int competitionId = userCompetitionService.count(new QueryWrapper<UserCompetition>().eq("competitionId", paymentCompetitionVo.getId())); |
| | | if ((competitionId + split.length) > competition.getApplicantsNumber()) { |
| | | if ((competitionId + jsonArray.size()) > competition.getApplicantsNumber()) { |
| | | return ResultUtil.error("报名人数超过最大限制"); |
| | | } |
| | | BigDecimal money = null; |
| | | if (paymentCompetitionVo.getPayType() == 1 || paymentCompetitionVo.getPayType() == 2) { |
| | | money = new BigDecimal(competition.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN); |
| | | money = new BigDecimal(competition.getCashPrice()).multiply(new BigDecimal(jsonArray.size())).setScale(2, RoundingMode.HALF_EVEN); |
| | | } |
| | | if (paymentCompetitionVo.getPayType() == 3) {//玩湃币 |
| | | money = new BigDecimal(competition.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN); |
| | | money = new BigDecimal(competition.getPlayPaiCoin()).multiply(new BigDecimal(jsonArray.size())).setScale(2, RoundingMode.HALF_EVEN); |
| | | if (money.compareTo(new BigDecimal(appUser.getPlayPaiCoins())) > 0) { |
| | | return new ResultUtil(2, "报名失败,玩湃币不足,请充值"); |
| | | } |
| | | } |
| | | if (paymentCompetitionVo.getPayType() == 4) {//课程 |
| | | money = new BigDecimal(competition.getClassPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN); |
| | | for (String s : split) { |
| | | // Participant participant = participantService.getById(s); |
| | | // Student student = studentClient.queryStudentByPhone(participant.getPhone()); |
| | | // if(null == student){ |
| | | // return ResultUtil.error(participant.getName() + "不是学员,无法使用课时支付。"); |
| | | // } |
| | | // 2.0 |
| | | money = new BigDecimal(competition.getClassPrice()).multiply(new BigDecimal(jsonArray.size())).setScale(2, RoundingMode.HALF_EVEN); |
| | | Integer integer = coursePackagePaymentClient.queryResidueClassHourById(paymentCompetitionVo.getCoursePaymentId()); |
| | | if (new BigDecimal(integer).compareTo(new BigDecimal(competition.getClassPrice())) < 0) { |
| | | if (new BigDecimal(integer).compareTo(money) < 0) { |
| | | return new ResultUtil(3, "剩余课时不足,无法完成支付。"); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | paymentCompetition.setInsertTime(new Date()); |
| | | paymentCompetitionService.save(paymentCompetition); |
| | | |
| | | for (String s : split) { |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | UserCompetition userCompetition = new UserCompetition(); |
| | | userCompetition.setAppUserId(uid); |
| | | userCompetition.setCompetitionId(paymentCompetitionVo.getId()); |
| | | userCompetition.setParticipantId(Integer.valueOf(s)); |
| | | userCompetition.setParticipantId(id); |
| | | userCompetition.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | userCompetition.setPaymentCompetitionId(paymentCompetition.getId()); |
| | | userCompetition.setInsertTime(new Date()); |
| | | userCompetitionService.save(userCompetition); |
| | |
| | | paymentCompetition.setPayOrderNo(""); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | |
| | | // competition.setApplicantsNumber(competition.getApplicantsNumber() + 1); |
| | | this.updateById(competition); |
| | | } |
| | | if (paymentCompetitionVo.getPayType() == 4) {//课程 |
| | | for (String s : split) { |
| | | // Participant participant = participantService.getById(s); |
| | | // Student student = studentClient.queryStudentByPhone(participant.getPhone()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | if(isStudent == 0){ |
| | | continue; |
| | | } |
| | | //扣减课时 |
| | | PaymentDeductionClassHour paymentDeductionClassHour = new PaymentDeductionClassHour(); |
| | | paymentDeductionClassHour.setId(Integer.valueOf(s)); |
| | | paymentDeductionClassHour.setId(id); |
| | | paymentDeductionClassHour.setClassHour(competition.getClassPrice()); |
| | | paymentDeductionClassHour.setCode(code); |
| | | paymentDeductionClassHour.setCourseId(paymentCompetitionVo.getCoursePaymentId()); |
| | | paymentDeductionClassHour.setUid(uid); |
| | | coursePackagePaymentClient.paymentDeductionClassHour(paymentDeductionClassHour); |
| | | } |
| | | |
| | | paymentCompetition = paymentCompetitionService.getById(paymentCompetition.getId()); |
| | | paymentCompetition.setAppUserId(null); |
| | | paymentCompetition.setPayStatus(2); |
| | |
| | | if (null != student) { |
| | | Integer integer = coursePackagePaymentClient.queryResidueClassHour(student.getId()); |
| | | participantVo.setResidueClassHour(integer); |
| | | participantVo.setIsStudent(1); |
| | | |
| | | } else { |
| | | participantVo.setResidueClassHour(0); |
| | |
| | | continue; |
| | | } |
| | | linkedHashMap.put(participant.getIdcard(), participantVo); |
| | | // listVo.add(participantVo); |
| | | |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.competition.entity.Competition; |
| | | import com.dsh.competition.entity.PaymentCompetition; |
| | | import com.dsh.competition.feignclient.account.StudentHonorClient; |
| | | import com.dsh.competition.feignclient.account.model.StudentHonor; |
| | | import com.dsh.competition.model.TCompetition; |
| | | import com.dsh.competition.service.CompetitionService; |
| | | import com.dsh.competition.service.IPaymentCompetitionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author shaqian |
| | |
| | | @Resource |
| | | private CompetitionService competitionService; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | @Autowired |
| | | private IPaymentCompetitionService paymentCompetitionService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 每秒去处理的定时任务 |
| | | */ |
| | |
| | | .ne("status", 4).ne("state", 3)); |
| | | for (Competition competition : list) { |
| | | // 当前时间小于开始时间 |
| | | if (competition.getStartTime().after(new Date())) { |
| | | if (competition.getStatus() != 1 && competition.getStartTime().after(new Date())) { |
| | | competition.setStatus(1); |
| | | } |
| | | if (competition.getStartTime().before(new Date())) { |
| | | if (competition.getStatus() == 1 && competition.getStartTime().before(new Date())) { |
| | | if (competition.getEndTime().after(new Date())) { |
| | | competition.setStatus(2); |
| | | } else { |
| | | competition.setStatus(3); |
| | | } |
| | | |
| | | if(competition.getStatus() == 2){ |
| | | //添加勋章数据 |
| | | List<PaymentCompetition> list1 = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>() |
| | | .eq("competitionId", competition.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | Set<Integer> collect = list1.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toSet()); |
| | | for (Integer integer : collect) { |
| | | int count = paymentCompetitionService.count(new QueryWrapper<PaymentCompetition>() |
| | | .eq("appUserId", integer).eq("payStatus", 2).eq("state", 1)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(integer); |
| | | studentHonor.setHonorType(2); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | } |
| | | } |
| | | competitionService.updateById(competition); |
| | | } |
| | |
| | | #datasource.names=master0 |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_competition?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=123456 |
| | | #datasource.master0.maxActive=20 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=5 |
| | | #datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | | datasource.names=master0 |
| | | datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | datasource.master0.url=jdbc:mysql://127.0.0.1:3306/playpai_competition?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_competition?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.username=root |
| | | datasource.master0.password=playpai2023! |
| | | datasource.master0.password=123456 |
| | | datasource.master0.maxActive=20 |
| | | datasource.master0.maxWait=60000 |
| | | datasource.master0.minIdle=5 |
| | |
| | | |
| | | |
| | | |
| | | #datasource.names=master0 |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://127.0.0.1:3306/playpai_competition?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=playpai2023! |
| | | #datasource.master0.maxActive=20 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=5 |
| | | #datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.CoachClient; |
| | |
| | | @PostMapping("/cancelledClasses/addCancelledClasses") |
| | | public void addCancelledClasses(@RequestBody CancelledClasses cancelledClasses) { |
| | | cancelledClassesService.save(cancelledClasses); |
| | | |
| | | // TCoursePackagePayment byId = coursePackagePaymentService.getById(cancelledClasses.getCoursePackagePaymentId()); |
| | | orderStudentService.getById(cancelledClasses.getCoursePackagePaymentId()); |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(cancelledClasses.getCoursePackagePaymentId()); |
| | |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // 2.0 |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/course/paymentCourseCouponList") |
| | | @ApiOperation(value = "支付课程--完成后优惠券列表", tags = {"APP-课程列表"}) |
New file |
| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.CoursePackageOrderStudent; |
| | | import com.dsh.course.model.DeductionClassHourList; |
| | | import com.dsh.course.service.ICoursePackageOrderStudentService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 15:27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/coursePackageOrderStudent") |
| | | public class CoursePackageOrderStudentController { |
| | | |
| | | @Autowired |
| | | private ICoursePackageOrderStudentService coursePackageOrderStudentService; |
| | | |
| | | |
| | | /** |
| | | * 根据学院id获取剩余有效课时数据 |
| | | * @param studentId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getCoursePackageOrderStudent") |
| | | public List<CoursePackageOrderStudent> getCoursePackageOrderStudent(@RequestBody Integer studentId){ |
| | | return coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>() |
| | | .eq("studentId", studentId).eq("status", 1).eq("state", 1) |
| | | .gt("laveClassHours", 0).last(" and useTime > now()")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 扣减学员课时 |
| | | * @param deductionClassHourList |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/deductionClassHour") |
| | | public DeductionClassHourList deductionClassHour(@RequestBody DeductionClassHourList deductionClassHourList){ |
| | | return coursePackageOrderStudentService.deductionClassHour(deductionClassHourList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 回退课时和回退排课数据 |
| | | * @param deductionClassHourList |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/backspaceClassHour") |
| | | public void backspaceClassHour(DeductionClassHourList deductionClassHourList){ |
| | | coursePackageOrderStudentService.backspaceClassHour(deductionClassHourList); |
| | | } |
| | | } |
| | |
| | | storeVo.setLon(store.getLon()); |
| | | storeVo.setCoursePrice(ToolUtil.isEmpty(paymentConfig.getCashPayment()) ? (double) paymentConfig.getPlayPaiCoin() : paymentConfig.getCashPayment()); |
| | | storeVo.setStatus(1); |
| | | // 2.0 |
| | | storeVo.setAllNum(tCoursePackagePayment.getTotalClassHours()); |
| | | storeVo.setLastNum(tCoursePackagePayment.getLaveClassHours()); |
| | | storeVo.setUseNum(tCoursePackagePayment.getTotalClassHours() - tCoursePackagePayment.getLaveClassHours()); |
| | |
| | | } |
| | | } |
| | | |
| | | // 2.0 |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/payCourse") |
| | | @ApiOperation(value = "课后练习-确认购课", tags = {"APP-开始上课"}) |
| | |
| | | @PostMapping("/coursePackagePayment/paymentDeductionClassHour") |
| | | public void paymentDeductionClassHour(@RequestBody PaymentDeductionClassHour paymentDeductionClassHour) { |
| | | try { |
| | | // 2.0 用id进行查询 |
| | | // TCoursePackagePayment coursePackagePayment = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("id", paymentDeductionClassHour.getCourseId()).eq("payStatus", 2) |
| | | // .eq("status", 1).eq("state", 1).gt("laveClassHours", 0)); |
| | | // Integer classHour = paymentDeductionClassHour.getClassHour(); |
| | | // for (TCoursePackagePayment coursePackagePayment : list) { |
| | | |
| | | |
| | | |
| | | CoursePackageOrderStudent coursePackageOrderStudent = coursePackageOrderStudentService.getById(paymentDeductionClassHour.getCourseId()); |
| | | // if (paymentDeductionClassHour.getClassHour() > coursePackageOrderStudent.getLaveClassHours()) { |
| | | // return ResultUtil.error("当前课包课时数不足"); |
| | | // } |
| | | TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrderStudent.getCoursePackageId()); |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() - paymentDeductionClassHour.getClassHour()); |
| | | coursePackageOrderStudentService.updateById(coursePackageOrderStudent); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // if (coursePackagePayment.getLaveClassHours().compareTo(classHour) >= 0) { |
| | | // coursePackagePayment.setLaveClassHours(coursePackagePayment.getLaveClassHours() - classHour); |
| | | // coursePackagePayment.setAppUserId(null); |
| | | // packagePaymentService.updateById(coursePackagePayment); |
| | | // |
| | | // CourseCounsum courseCounsum = new CourseCounsum(); |
| | | // courseCounsum.setPaymentId(coursePackagePayment.getId()); |
| | | // courseCounsum.setChangeType(0); |
| | | // courseCounsum.setNum(classHour); |
| | | // courseCounsum.setInsertTime(new Date()); |
| | | // courseCounsum.setReason("报名赛事"); |
| | | // courseCounsumService.save(courseCounsum); |
| | | // |
| | | // |
| | | // List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackagePayment.getStudentId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); |
| | | // List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | // coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id", collect)); |
| | | // coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", paymentDeductionClassHour.getId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); |
| | | // |
| | | // |
| | | // TCoursePackage tCoursePackage = packageService.getById(coursePackagePayment.getCoursePackageId()); |
| | | // String classWeeks = tCoursePackage.getClassWeeks(); |
| | | // List<Integer> week = week(classWeeks); |
| | | // |
| | | // TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", coursePackagePayment.getCoursePackageId()).eq("studentId", coursePackagePayment.getStudentId())); |
| | | // |
| | | // Date today = new Date(); |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // calendar.add(Calendar.DATE, -1); |
| | | // today = calendar.getTime(); |
| | | // |
| | | // |
| | | // Integer laveClassHours = pay.getLaveClassHours(); |
| | | // Integer codeTime = tCoursePackage.getCodeTime(); |
| | | // Integer can = laveClassHours / codeTime; |
| | | // |
| | | // int count = 0; |
| | | // String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | // String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // |
| | | // Date[] dates = generateDateArray(14, today); |
| | | // for (Date date : dates) { |
| | | // if (count == can) { |
| | | // break; |
| | | // } |
| | | // int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date); |
| | | // if (week.contains(wei)) { |
| | | // for (int i1 = 0; i1 < split.length; i1++) { |
| | | // if (count == can) { |
| | | // break; |
| | | // } |
| | | // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | // Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | // Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | // coursePackageScheduling.setClassDate(parse); |
| | | // coursePackageScheduling.setEndDate(parse1); |
| | | // coursePackageScheduling.setStatus(1); |
| | | // coursePackageSchedulingService.save(coursePackageScheduling); |
| | | // CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | // student1.setAppUserId(pay.getAppUserId()); |
| | | // student1.setStudentId(pay.getStudentId()); |
| | | // student1.setCoursePackageId(pay.getCoursePackageId()); |
| | | // student1.setCoursePackagePaymentId(pay.getId()); |
| | | // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | // student1.setSignInOrNot(1); |
| | | // student1.setReservationStatus(1); |
| | | // student1.setInsertTime(new Date()); |
| | | // studentService.save(student1); |
| | | // count++; |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // // 2.0 少于3课时 推送 |
| | | // if (coursePackagePayment.getLaveClassHours() <= 3) { |
| | | // Integer appUserId = coursePackagePayment.getAppUserId(); |
| | | // |
| | | // //调用推送 |
| | | // HttpHeaders headers = new HttpHeaders(); |
| | | // // 以表单的方式提交 |
| | | // headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | // String s1 = appUserId + "_" + "Three"; |
| | | // //定时修改排课状态 |
| | | // String s = internalRestTemplate.getForObject("http://mb-cloud-gateway/netty/sendMsgToClient?id=" + s1, String.class); |
| | | // JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | // if (jsonObject1.getIntValue("code") != 200) { |
| | | // System.err.println(jsonObject1.getString("msg")); |
| | | // } |
| | | // } |
| | | // |
| | | // CancelledClasses cancelledClasses = new CancelledClasses(); |
| | | // cancelledClasses.setType(2); |
| | | // cancelledClasses.setVoucher(paymentDeductionClassHour.getCode()); |
| | | // cancelledClasses.setCoursePackageId(coursePackagePayment.getCoursePackageId()); |
| | | // cancelledClasses.setCoursePackagePaymentId(coursePackagePayment.getId()); |
| | | // cancelledClasses.setCancelledClassesNumber(classHour); |
| | | // cancelledClasses.setInsertTime(new Date()); |
| | | // cancelledClassesService.save(cancelledClasses); |
| | | // |
| | | // } else { |
| | | // CancelledClasses cancelledClasses = new CancelledClasses(); |
| | | // cancelledClasses.setType(2); |
| | | // cancelledClasses.setVoucher(paymentDeductionClassHour.getCode()); |
| | | // cancelledClasses.setCoursePackageId(coursePackagePayment.getCoursePackageId()); |
| | | // cancelledClasses.setCoursePackagePaymentId(coursePackagePayment.getId()); |
| | | // cancelledClasses.setCancelledClassesNumber(coursePackagePayment.getLaveClassHours()); |
| | | // cancelledClasses.setInsertTime(new Date()); |
| | | // cancelledClassesService.save(cancelledClasses); |
| | | // |
| | | // coursePackagePayment.setLaveClassHours(0); |
| | | // packagePaymentService.updateById(coursePackagePayment); |
| | | // |
| | | // classHour -= cancelledClasses.getCancelledClassesNumber(); |
| | | // } |
| | | // } |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(paymentDeductionClassHour.getClassHour()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("赛事报名"); |
| | | courseCounsum.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() - paymentConfig.getPlayPaiCoin()); |
| | | auClitn.updateAppUser(appUser); |
| | | |
| | | // 2.0 |
| | | TCourseInfoRecord tCourseInfoRecord = new TCourseInfoRecord(); |
| | | tCourseInfoRecord.setUserId(userIdFormRedis); |
| | | tCourseInfoRecord.setCourseId(coursePackage.getCoursePackageId()); |
| | |
| | | boolean id = packagePaymentService.update(packagePayment, new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("id", packagePayment.getId())); |
| | | if (id) { |
| | | // 2.0 |
| | | TCourseInfoRecord tCourseInfoRecord = new TCourseInfoRecord(); |
| | | tCourseInfoRecord.setNum(packagePayment.getTotalClassHours()); |
| | | tCourseInfoRecord.setName("续课"); |
| | |
| | | } |
| | | } |
| | | } |
| | | // 2.0 |
| | | TCourseInfoRecord tCourseInfoRecord = new TCourseInfoRecord(); |
| | | tCourseInfoRecord.setUserId(userId); |
| | | tCourseInfoRecord.setCourseId(courseId); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody WeeksOfCourseRest stuId) { |
| | | // try { |
| | | return coursePackageOrderStudentService.obtainStuClassDetails(stuId.getStuId(), stuId.getAppUserId(), stuId.getPageNum()); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // throw new RuntimeException(); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | // 2.0 送课时 |
| | | @PostMapping("/base/coursePack/sendHours") |
| | | public Integer sendHours(@RequestBody String s) throws ParseException { |
| | | String[] split2 = s.split("_"); |
| | | TCoursePackagePayment byId = packagePaymentService.getById(Long.valueOf(split2[0])); |
| | | byId.setTotalClassHours(byId.getTotalClassHours() + Integer.valueOf(split2[2])); |
| | | boolean b = packagePaymentService.updateHoursById(byId, Integer.valueOf(split2[2])); |
| | | CoursePackageOrderStudent coursePackageOrderStudent = coursePackageOrderStudentService.getById(Long.valueOf(split2[0])); |
| | | coursePackageOrderStudent.setTotalClassHours(coursePackageOrderStudent.getTotalClassHours() + Integer.valueOf(split2[2])); |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() + Integer.valueOf(split2[2])); |
| | | coursePackageOrderStudentService.updateById(coursePackageOrderStudent); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(byId.getId()); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(Integer.valueOf(split2[2])); |
| | | courseCounsum.setInsertTime(new Date()); |
| | |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", byId.getStudentId()).eq("coursePackageId", byId.getCoursePackageId())); |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackageOrderStudent.getStudentId()).eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId())); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id", collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", byId.getStudentId()).eq("coursePackageId", byId.getCoursePackageId())); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackageOrderStudent.getStudentId()).eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId())); |
| | | |
| | | |
| | | TCoursePackage tCoursePackage = packageService.getById(byId.getCoursePackageId()); |
| | | TCoursePackage tCoursePackage = packageService.getById(coursePackageOrderStudent.getCoursePackageId()); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", byId.getCoursePackageId()).eq("studentId", byId.getStudentId())); |
| | | TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId()).eq("studentId", coursePackageOrderStudent.getStudentId())); |
| | | |
| | | Date today = new Date(); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (b) { |
| | | return 1; |
| | | } else { |
| | | |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/reverse") |
| | | @ApiOperation(value = "上课主页-预约操作--2.0改请假操作", tags = {"APP-开始上课"}) |
| | | @ApiOperation(value = "上课主页-预约操作--改请假操作", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "课包id", name = "courseID", required = true, dataType = "String"), |
| | |
| | | courseCounsum.setReason("退费"); |
| | | courseCounsum.setPaymentId(o.getId()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setAppUserId(o.getAppUserId()); |
| | | counsumService.save(courseCounsum); |
| | | |
| | | o.setTotalClassHours(0); |
| | | o.setLaveClassHours(0); |
| | | o.setStatus(2); |
| | | o.setAppUserId(null); |
| | |
| | | courseCounsum.setNum(laveClassHours); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setPaymentId(orinPay.getId()); |
| | | courseCounsum.setAppUserId(orinPay.getAppUserId()); |
| | | counsumService.save(courseCounsum); |
| | | |
| | | CourseCounsum courseCounsum1 = new CourseCounsum(); |
| | |
| | | courseCounsum1.setNum(laveClassHours); |
| | | courseCounsum1.setChangeType(1); |
| | | courseCounsum1.setPaymentId(studentPay.getId()); |
| | | courseCounsum1.setAppUserId(studentPay.getAppUserId()); |
| | | counsumService.save(courseCounsum1); |
| | | |
| | | schedulingService.addNewCoursePackageScheduling(studentPay.getId(), laveClassHours); |
| | |
| | | courseCounsum.setNum(laveClassHours1); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setPaymentId(orinPay.getId()); |
| | | courseCounsum.setAppUserId(orinPay.getAppUserId()); |
| | | counsumService.save(courseCounsum); |
| | | |
| | | |
| | |
| | | courseCounsum1.setNum(laveClassHours1); |
| | | courseCounsum1.setChangeType(1); |
| | | courseCounsum1.setPaymentId(to.getId()); |
| | | courseCounsum1.setAppUserId(to.getAppUserId()); |
| | | counsumService.save(courseCounsum1); |
| | | |
| | | //开始排课 |
| | |
| | | // 添加购买课时 paytyoe为7 |
| | | // 排课可期 判断课程时间段 添加排课表 添加上课记录表 |
| | | // 找到原来的课包 扣课时 |
| | | // CoursePackageOrderStudent coursePackageOrderStudent = orderStudentService.getById(toHoliDto.getId()); |
| | | CoursePackageOrderStudent coursePackageOrderStudent = orderStudentService.getOne(new QueryWrapper<CoursePackageOrderStudent>().eq("coursePackageId",toHoliDto.getId()).eq("studentId",stuId)); |
| | | |
| | | TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrderStudent.getCoursePackageId()); |
| | |
| | | coursePackageOrderStudent.setAppUserId(null); |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours()-toHoliDto.getClassNum()); |
| | | orderStudentService.updateById(coursePackageOrderStudent); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(toHoliDto.getClassNum()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("报名假期班"); |
| | | courseCounsum.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); |
| | | if(3 >= laveClassHours){ |
| | | AppUser appUser = appUserClient.queryAppUser(coursePackageOrderStudent.getAppUserId()); |
| | |
| | | //增加日期,用于判断 |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(toHoliDto.getClassNum()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("报名假期班"); |
| | | // courseCounsum.setAppUserId(userId); |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | |
| | | return "报名成功"; |
| | |
| | | @ResponseBody |
| | | public String toTrans(@RequestBody ToHoliDto toHoliDto) throws ParseException { |
| | | String[] stuIds = toHoliDto.getIds(); |
| | | // //查询出学员ids对应的棵树,判断剩余课时数是否够 |
| | | // List<CoursePackageOrderStudent> list = orderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>().eq("coursePackageId", toHoliDto.getClassId()).in("studentId", stuIds)); |
| | | // List<String> notStudent = new ArrayList<>(); |
| | | // for (CoursePackageOrderStudent coursePackageOrderStudent : list) { |
| | | // if (coursePackageOrderStudent.getLaveClassHours() < toHoliDto.getClassNum()) { |
| | | // notStudent.add(studentClient.queryStudentById(coursePackageOrderStudent.getStudentId()).getName()); |
| | | // } |
| | | // } |
| | | // if (!notStudent.isEmpty()) { |
| | | // String notStudentStr = String.join(",", notStudent); |
| | | // return notStudentStr+":课时数不足"; |
| | | // } |
| | | |
| | | |
| | | //转移课程 |
| | | for (String stuId : stuIds) { |
| | | // CoursePackageOrderStudent orinPay = orderStudentService.getById(toHoliDto.getId()); |
| | | CoursePackageOrderStudent orinPay = orderStudentService.getOne(new QueryWrapper<CoursePackageOrderStudent>() |
| | | .eq("studentId", stuId) |
| | | .eq("coursePackageId", toHoliDto.getId())); |
| | |
| | | courseCounsum.setInsertTime(new Date()); |
| | | Integer appUserId = orinPay.getAppUserId(); |
| | | Integer appUserId1 = studentPay.getAppUserId(); |
| | | |
| | | courseCounsum.setReason("换课"); |
| | | |
| | | |
| | | orinPay.setLaveClassHours(0); |
| | | orinPay.setStatus(3); |
| | | orinPay.setAppUserId(null); |
| | |
| | | courseCounsum.setNum(laveClassHours); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setPaymentId(orinPay.getId()); |
| | | courseCounsum.setAppUserId(orinPay.getAppUserId()); |
| | | counsumService.save(courseCounsum); |
| | | |
| | | CourseCounsum courseCounsum1 = new CourseCounsum(); |
| | | courseCounsum1.setInsertTime(new Date()); |
| | | // if (appUserId.compareTo(appUserId1) != 0) { |
| | | // courseCounsum1.setReason("赠课"); |
| | | // } else { |
| | | courseCounsum1.setReason("换课"); |
| | | // } |
| | | courseCounsum1.setNum(laveClassHours); |
| | | courseCounsum1.setChangeType(1); |
| | | courseCounsum1.setPaymentId(studentPay.getId()); |
| | | courseCounsum1.setAppUserId(studentPay.getAppUserId()); |
| | | counsumService.save(courseCounsum1); |
| | | |
| | | schedulingService.addNewCoursePackageScheduling(studentPay.getId(), laveClassHours); |
New file |
| | |
| | | package com.dsh.course.feignclient.account; |
| | | |
| | | import com.dsh.course.feignclient.account.model.StudentHonor; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * 勋章 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface StudentHonorClient { |
| | | |
| | | |
| | | /** |
| | | * 保存用户勋章 |
| | | * @param studentHonor |
| | | */ |
| | | @PostMapping("/studentHonor/saveStudentHonor") |
| | | void saveStudentHonor(StudentHonor studentHonor); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignclient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StudentHonor { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 荣耀类型 |
| | | */ |
| | | private Integer honorType; |
| | | /** |
| | | * 当前次数 |
| | | */ |
| | | private Integer number; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 15:44 |
| | | */ |
| | | @Data |
| | | public class DeductionClassHour { |
| | | /** |
| | | * 课时记录id |
| | | */ |
| | | private Long id; |
| | | /** |
| | | * 学员id |
| | | */ |
| | | private Integer studentId; |
| | | /** |
| | | * 课时id |
| | | */ |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 扣减课时 |
| | | */ |
| | | private Integer classHour; |
| | | /** |
| | | * 删除的排课数量(用户回退时重新排课) |
| | | */ |
| | | private Integer scheduledCourses; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/22 15:46 |
| | | */ |
| | | @Data |
| | | public class DeductionClassHourList { |
| | | List<DeductionClassHour> deductionClassHourList; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.CoursePackageOrderStudent; |
| | | import com.dsh.course.feignclient.model.RecordAppoint; |
| | | import com.dsh.course.model.DeductionClassHourList; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<RecordAppoint> obtainStuClassDetails(Integer stuId, Integer appUserId, Integer pageNum); |
| | | |
| | | |
| | | /** |
| | | * 扣除学员课时 |
| | | * @param deductionClassHourList |
| | | * @return |
| | | */ |
| | | DeductionClassHourList deductionClassHour(DeductionClassHourList deductionClassHourList); |
| | | |
| | | |
| | | /** |
| | | * 回退课时和回退排课数据 |
| | | * @param deductionClassHourList |
| | | */ |
| | | void backspaceClassHour(DeductionClassHourList deductionClassHourList); |
| | | } |
| | |
| | | TCoursePackage coursePackage = coursePackageService.getById(order.getCoursePackageId()); |
| | | Store store = storeClient.queryStoreById(coursePackage.getStoreId()); |
| | | RegisterCourseVo registerCourseVo = new RegisterCourseVo(); |
| | | // 2.0 |
| | | registerCourseVo.setType(coursePackage.getType()); |
| | | |
| | | registerCourseVo.setOrderId(order.getId()); |
| | |
| | | registerCourseVo.setPackageImg(coursePackage.getCoverDrawing()); |
| | | String storeAndCourse = coursePackage.getName() + "(" + store.getName() + ")"; |
| | | registerCourseVo.setCourseNameStore(storeAndCourse); |
| | | // 2.0 |
| | | registerCourseVo.setCourseTime(new SimpleDateFormat("yyyy-MM-dd").format(order.getInsertTime())); |
| | | Coach coach = coachClient.queryCoachById(coursePackage.getCoachId()); |
| | | registerCourseVo.setCourseTeacher(ToolUtil.isEmpty(coach) ? "" : coach.getName()); |
| | |
| | | import com.dsh.course.feignclient.other.StoreClient; |
| | | import com.dsh.course.feignclient.other.model.Store; |
| | | import com.dsh.course.mapper.*; |
| | | import com.dsh.course.model.DeductionClassHour; |
| | | import com.dsh.course.model.DeductionClassHourList; |
| | | import com.dsh.course.service.CourseCounsumService; |
| | | import com.dsh.course.service.ICoursePackageOrderStudentService; |
| | | import com.dsh.course.service.ICoursePackageSchedulingService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | | import com.dsh.course.util.DateTimeHelper; |
| | | import com.dsh.course.util.DateUtil; |
| | | import com.dsh.course.util.ToolUtil; |
| | |
| | | @Autowired |
| | | private ICoursePackageSchedulingService coursePackageSchedulingService; |
| | | |
| | | @Autowired |
| | | private CourseCounsumService courseCounsumService; |
| | | |
| | | @Resource |
| | | private TCoursePackageMapper tcpmapper; |
| | | |
| | | @Resource |
| | | private StoreClient stoClient; |
| | | |
| | | @Autowired |
| | | private TCoursePackageService coursePackageService; |
| | | |
| | | |
| | | |
| | |
| | | List<CoursePackageScheduling> list = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>() |
| | | .eq("appUserId", appUserId) |
| | | .eq("studentId", stuId) |
| | | // .lt("classDate", sdf.format(calendar.getTime())) |
| | | .orderByAsc("classDate") |
| | | ); |
| | | List<Long> ids = list.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()); |
| | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd"); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | if (list.size() > 0) { |
| | | |
| | | // int pageNum = 1; // 页码 |
| | | int pageSize = 10; // 每页记录数 |
| | | Page<CoursePackageStudent> page = new Page<>(pageNum, pageSize); |
| | | IPage<CoursePackageStudent> coursePackageStudentPage = cpsMapper.selectPage(page, new QueryWrapper<CoursePackageStudent>() |
| | |
| | | } |
| | | |
| | | |
| | | CoursePackageScheduling byId = coursePackageSchedulingService.getById(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | if (byId == null) { |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingService.getById(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | if (coursePackageScheduling == null) { |
| | | continue; |
| | | } |
| | | String dateString1 = sdf.format(byId.getClassDate()); |
| | | String dateString2 = sdf.format(byId.getEndDate()); |
| | | String dateString1 = sdf.format(coursePackageScheduling.getClassDate()); |
| | | String dateString2 = sdf.format(coursePackageScheduling.getEndDate()); |
| | | |
| | | |
| | | recordVo.setTimeFrame(dateString1 + "-" + dateString2.substring(11)); |
| | |
| | | String[] split = classWeeks.split(";"); |
| | | List<String> integerList = Arrays.asList(split); |
| | | String weekOfDate = DateTimeHelper.getWeekOfDate(new Date()); |
| | | // if (integerList.contains(weekOfDate)) { |
| | | String dat = simpleDateFormat.format(byId.getClassDate()) + " " + dateString1.substring(11); |
| | | String ed = simpleDateFormat.format(byId.getEndDate()) + " " + dateString2.substring(11); |
| | | String dat = simpleDateFormat.format(coursePackageScheduling.getClassDate()) + " " + dateString1.substring(11); |
| | | String ed = simpleDateFormat.format(coursePackageScheduling.getEndDate()) + " " + dateString2.substring(11); |
| | | |
| | | Date start = null; |
| | | Date end = null; |
| | |
| | | } |
| | | |
| | | CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | .eq("coursePackageSchedulingId", byId.getId()).last("limit 1")); |
| | | // else { |
| | | // Date now = new Date(); |
| | | // if (now.after(byId.getClassDate()) && now.before(byId.getEndDate())) { |
| | | // recordVo.setStatus(2); |
| | | // } else { |
| | | // recordVo.setStatus(3); |
| | | // |
| | | // } |
| | | // } |
| | | .eq("coursePackageSchedulingId", coursePackageScheduling.getId()).last("limit 1")); |
| | | |
| | | |
| | | if (new Date().after(start)&&new Date().before(end)){ |
| | | recordVo.setStatus(2); |
| | | } |
| | | //待上课 |
| | | if (start.after(new Date())) { |
| | | recordVo.setStatus(1); |
| | | } |
| | | //已取消 |
| | | if (byId.getStatus() == 4) { |
| | | if (coursePackageScheduling.getStatus() == 4) { |
| | | recordVo.setStatus(4); |
| | | } else if (coursePackageStudent.getSignInOrNot() == 2) { |
| | | } |
| | | //已请假 |
| | | if (coursePackageStudent.getSignInOrNot() == 2) { |
| | | recordVo.setStatus(5); |
| | | }else if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | } |
| | | //已完成 |
| | | if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | recordVo.setStatus(3); |
| | | // 消课 到课状态0 旷课 |
| | | if (coursePackageStudent.getSignInOrNot() == 0) { |
| | | recordVo.setStatus(6); |
| | | } |
| | | |
| | | }else if (new Date().after(start)&&new Date().before(end)){ |
| | | recordVo.setStatus(2); |
| | | }else if (start.after(new Date())) { |
| | | //待上课 |
| | | recordVo.setStatus(1); |
| | | } |
| | | else { |
| | | // CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | // .eq("coursePackageSchedulingId", byId.getId()).last("limit 1")); |
| | | // if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | // recordVo.setStatus(3); |
| | | // // 消课 到课状态0 旷课 |
| | | // if (coursePackageStudent.getSignInOrNot() == 0) { |
| | | // recordVo.setStatus(6); |
| | | // } |
| | | // |
| | | // } else { |
| | | // Date now = new Date(); |
| | | // if (now.after(byId.getClassDate()) && now.before(byId.getEndDate())) { |
| | | // recordVo.setStatus(2); |
| | | // } else { |
| | | // recordVo.setStatus(3); |
| | | // |
| | | // } |
| | | // } |
| | | } |
| | | // } else { |
| | | // recordVo.setStatus(1); |
| | | // } |
| | | recordVoList.add(recordVo); |
| | | } |
| | | |
| | |
| | | return ids; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 扣除学员课时 |
| | | * @param deductionClassHourList |
| | | * @return |
| | | */ |
| | | @Override |
| | | public DeductionClassHourList deductionClassHour(DeductionClassHourList deductionClassHourList) { |
| | | try { |
| | | List<DeductionClassHour> list = deductionClassHourList.getDeductionClassHourList(); |
| | | for (DeductionClassHour deductionClassHour : list) { |
| | | CoursePackageOrderStudent coursePackageOrderStudent = this.getById(deductionClassHour.getId()); |
| | | Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() - deductionClassHour.getClassHour()); |
| | | |
| | | //计算需要删除几个排课记录 |
| | | TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrderStudent.getCoursePackageId()); |
| | | Integer codeTime = coursePackage.getCodeTime(); |
| | | //未上的排课数据 |
| | | List<CoursePackageScheduling> packageSchedulings = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>().eq("studentId", coursePackageOrderStudent.getStudentId()) |
| | | .eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId()).eq("status", 1).orderByDesc("classDate")); |
| | | //排课使用的总课时 |
| | | int classHour = packageSchedulings.size() * codeTime; |
| | | //未排课的课时 |
| | | int notClass = laveClassHours - classHour; |
| | | |
| | | //判断是否需要删除排课数据 |
| | | if(notClass < deductionClassHour.getClassHour()){ |
| | | int clss = deductionClassHour.getClassHour() - notClass; |
| | | int n = clss % codeTime; |
| | | int l = 0; |
| | | //不整除的情况,需要多删除一节排课,回加差额课时。 |
| | | if(n != 0){ |
| | | n += 1; |
| | | l = (codeTime * n) - clss; |
| | | } |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() + l); |
| | | |
| | | //删除已排的课程 |
| | | List<CoursePackageScheduling> coursePackageSchedulings = packageSchedulings.subList(0, n); |
| | | List<Long> collect = coursePackageSchedulings.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()); |
| | | coursePackageSchedulingService.removeByIds(collect); |
| | | |
| | | deductionClassHour.setScheduledCourses(n); |
| | | } |
| | | |
| | | this.updateById(coursePackageOrderStudent); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(deductionClassHour.getClassHour()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("社区世界杯报名"); |
| | | courseCounsum.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | return deductionClassHourList; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 回退课时和回退排课数据 |
| | | * @param deductionClassHourList |
| | | */ |
| | | @Override |
| | | public void backspaceClassHour(DeductionClassHourList deductionClassHourList) { |
| | | List<DeductionClassHour> list = deductionClassHourList.getDeductionClassHourList(); |
| | | for (DeductionClassHour deductionClassHour : list) { |
| | | CoursePackageOrderStudent coursePackageOrderStudent = this.getById(deductionClassHour.getId()); |
| | | Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() + deductionClassHour.getClassHour()); |
| | | //需要排课的节数 |
| | | Integer scheduledCourses = deductionClassHour.getScheduledCourses(); |
| | | // coursePackageService |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.entity.TAppUser; |
| | | import com.dsh.course.entity.dto.StudentQeryDto; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.CoachClient; |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | import com.dsh.course.feignclient.account.UserIntegralChangesClient; |
| | | import com.dsh.course.feignclient.account.*; |
| | | import com.dsh.course.feignclient.account.model.*; |
| | | import com.dsh.course.feignclient.activity.BenefitVideoClient; |
| | | import com.dsh.course.feignclient.activity.CouponClient; |
| | |
| | | |
| | | @Resource |
| | | private UserIntegralChangesClient userIntegralChangesClient; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | .eq("coursePackageId", detailsRequest.getCoursePackageId()) |
| | | .eq("courseId", detailsRequest.getVideoId()) |
| | | ); |
| | | //完成学习 |
| | | if (null != userVideoDetails && userVideoDetails.getState() == 1 && detailsRequest.getIsOver() == 1) { |
| | | userVideoDetails.setState(2); |
| | | userVideoDetails.setUpdateTime(new Date()); |
| | |
| | | AppUser appUser = appuClient.queryAppUser(coursePackageScheduling.getAppUserId()); |
| | | appUser.setIntegral((null == appUser.getIntegral() ? 0 : appUser.getIntegral()) + (null == coursePackageScheduling.getIntegral() ? 0 : coursePackageScheduling.getIntegral())); |
| | | appuClient.updateAppUser(appUser); |
| | | //保存用户积分变动记录 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(coursePackageScheduling.getAppUserId()); |
| | | vo.setIntegral(coursePackageScheduling.getIntegral()); |
| | | vo.setType(4); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | //添加勋章数据 |
| | | Integer number = uvdmapper.selectCount(new QueryWrapper<UserVideoDetails>().eq("appUserId", appUserId).eq("state", 2)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(appUserId); |
| | | studentHonor.setHonorType(4); |
| | | studentHonor.setNumber(number); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | return "SUCCESS"; |
| | | } |
| | | return "ERROR"; |
| | |
| | | TCoursePackage coursePackage = tcpmapper.selectById(tCoursePackagePayment.getCoursePackageId()); |
| | | Store store = stoClient.queryStoreById(coursePackage.getStoreId()); |
| | | RegisterCourseVo registerCourseVo = new RegisterCourseVo(); |
| | | // 2.0 |
| | | registerCourseVo.setType(coursePackage.getType()); |
| | | |
| | | registerCourseVo.setOrderId(tCoursePackagePayment.getOrderId().longValue()); |
| | |
| | | registerCourseVo.setPackageImg(coursePackage.getCoverDrawing()); |
| | | String storeAndCourse = coursePackage.getName() + "(" + store.getName() + ")"; |
| | | registerCourseVo.setCourseNameStore(storeAndCourse); |
| | | // registerCourseVo.setCourseTime(coursePackage.getClassStartTime()+"-"+coursePackage.getClassEndTime()); |
| | | // 2.0 |
| | | registerCourseVo.setCourseTime(new SimpleDateFormat("yyyy-MM-dd").format(tCoursePackagePayment.getInsertTime())); |
| | | Coach coach = coachClient.queryCoachById(coursePackage.getCoachId()); |
| | | registerCourseVo.setCourseTeacher(ToolUtil.isEmpty(coach) ? "" : coach.getName()); |
| | |
| | | coursePackageListVo.setStoreName(null != store ? store.getName() : ""); |
| | | coursePackageListVo.setCoverDrawing(coursePackage.getCoverDrawing()); |
| | | |
| | | // 2.0修改 |
| | | String classStartTime = coursePackage.getClassStartTime(); |
| | | String classEndTime = coursePackage.getClassEndTime(); |
| | | ArrayList<String> classTime = new ArrayList<>(); |
| | |
| | | coursePackageListVo.setPayType(2); |
| | | } |
| | | |
| | | // 2.0修改 |
| | | String classStartTime = coursePackage.getClassStartTime(); |
| | | String classEndTime = coursePackage.getClassEndTime(); |
| | | ArrayList<String> classTime = new ArrayList<>(); |
| | |
| | | #datasource.names=master0 |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_course?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=123456 |
| | | #datasource.master0.maxActive=20 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=5 |
| | | #datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | | datasource.names=master0 |
| | | datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | datasource.master0.url=jdbc:mysql://127.0.0.1:3306/playpai_course?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_course?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.username=root |
| | | datasource.master0.password=playpai2023! |
| | | datasource.master0.password=123456 |
| | | datasource.master0.maxActive=20 |
| | | datasource.master0.maxWait=60000 |
| | | datasource.master0.minIdle=5 |
| | |
| | | |
| | | |
| | | |
| | | #datasource.names=master0 |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://127.0.0.1:3306/playpai_course?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=playpai2023! |
| | | #datasource.master0.maxActive=20 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=5 |
| | | #datasource.master0.initialSize=2 |
| | | |
| | | |
| | | |
| | |
| | | |
| | | <artifactId>mb-cloud-gateway</artifactId> |
| | | <packaging>jar</packaging> |
| | | <name>网关</name>444 |
| | | <name>网关</name> |
| | | <description>网关</description> |
| | | |
| | | |
| | | <dependencies> |
| | | |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>io.netty</groupId> |
| | | <artifactId>netty-all</artifactId> |
| | |
| | | @Value(("${ignore.other.uris}")) |
| | | private String IGNORE_OTHER_URIS; |
| | | /** |
| | | * 世界杯 |
| | | */ |
| | | @Value(("${ignore.communityWorldCup.prefix}")) |
| | | private String IGNORE_COMMUNITY_WORLD_CUP_PREFIX; |
| | | /** |
| | | * 世界杯 |
| | | */ |
| | | @Value(("${ignore.communityWorldCup.uris}")) |
| | | private String IGNORE_COMMUNITY_WORLD_CUP_URIS; |
| | | /** |
| | | * 管理后台 |
| | | */ |
| | | @Value(("${ignore.management.prefix}")) |
| | |
| | | } |
| | | |
| | | } |
| | | //世界杯 |
| | | if (uri.startsWith(IGNORE_COMMUNITY_WORLD_CUP_PREFIX)) { |
| | | if(!StringUtils.isEmpty(IGNORE_COMMUNITY_WORLD_CUP_URIS)){ |
| | | String[] split = IGNORE_COMMUNITY_WORLD_CUP_URIS.split(","); |
| | | for (String s : split) { |
| | | if (uri.contains(s)) { |
| | | return PermissionResult.PASS; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | // ----------------------------------------------------------------- 放行综合后台授权登录-UPMS |
New file |
| | |
| | | package com.dsh.course.feignClient.account; |
| | | |
| | | import com.dsh.course.feignClient.account.model.Referee; |
| | | import com.dsh.course.feignClient.account.model.RefereeList; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/1 14:24 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface RefereeClient { |
| | | |
| | | |
| | | /** |
| | | * 获取裁判管理列表 |
| | | * @param refereeList |
| | | * @return |
| | | */ |
| | | @PostMapping("/referee/getRefereeList") |
| | | Map<String, Object> getRefereeList(RefereeList refereeList); |
| | | |
| | | |
| | | /** |
| | | * 添加裁判 |
| | | * @param referee |
| | | */ |
| | | @PostMapping("/referee/addReferee") |
| | | void addReferee(Referee referee); |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/referee/getRefereeById") |
| | | Referee getRefereeById(Integer id); |
| | | |
| | | |
| | | /** |
| | | * 修改裁判 |
| | | * @param referee |
| | | */ |
| | | @PostMapping("/referee/editReferee") |
| | | void editReferee(Referee referee); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.account; |
| | | |
| | | import com.dsh.course.feignClient.account.model.StudentHonor; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * 勋章 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface StudentHonorClient { |
| | | |
| | | |
| | | /** |
| | | * 保存用户勋章 |
| | | * @param studentHonor |
| | | */ |
| | | @PostMapping("/studentHonor/saveStudentHonor") |
| | | void saveStudentHonor(StudentHonor studentHonor); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.account.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 裁判 |
| | | * @author 39373 |
| | | * @Date 2024/2/8 14:57 |
| | | */ |
| | | @Data |
| | | public class Referee { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 手机号 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/1 14:26 |
| | | */ |
| | | @Data |
| | | public class RefereeList { |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | | /** |
| | | * 页条数 |
| | | */ |
| | | private Integer limit; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StudentHonor { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 荣耀类型 |
| | | */ |
| | | private Integer honorType; |
| | | /** |
| | | * 当前次数 |
| | | */ |
| | | private Integer number; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup.Model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 社区世界杯 |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 16:58 |
| | | */ |
| | | @Data |
| | | public class WorldCup { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | /** |
| | | * 报名结束时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date registrationClosingTime; |
| | | /** |
| | | * 开始年龄 |
| | | */ |
| | | private Integer startAge; |
| | | /** |
| | | * 结束年龄 |
| | | */ |
| | | private Integer endAge; |
| | | /** |
| | | * 报名性别(0=全部,1=男,2=女) |
| | | */ |
| | | private Integer gender; |
| | | /** |
| | | * 支付方式(1=免费,2=现金支付,3=玩湃币支付,4=课时支付) |
| | | */ |
| | | private String payType; |
| | | /** |
| | | * 现金 |
| | | */ |
| | | private BigDecimal cash; |
| | | /** |
| | | * 玩湃币 |
| | | */ |
| | | private Integer paiCoin; |
| | | /** |
| | | * 课时 |
| | | */ |
| | | private Integer classHour; |
| | | /** |
| | | * 最多报名人数 |
| | | */ |
| | | private Integer maxPeople; |
| | | /** |
| | | * 基础报名人数 |
| | | */ |
| | | private Integer basePeople; |
| | | /** |
| | | * 参赛获得积分 |
| | | */ |
| | | private Integer participationIntegral; |
| | | /** |
| | | * 胜利获得积分 |
| | | */ |
| | | private Integer winIntegral; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 参赛地址 |
| | | */ |
| | | private String address; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private String lon; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private String lat; |
| | | /** |
| | | * 封面图 |
| | | */ |
| | | private String coverImg; |
| | | /** |
| | | * 首页默认背景图 |
| | | */ |
| | | private String homeBackdropImg; |
| | | /** |
| | | * 比赛图片 |
| | | */ |
| | | private String infoImg; |
| | | /** |
| | | * 比赛简介 |
| | | */ |
| | | private String intro; |
| | | /** |
| | | * 比赛详情 |
| | | */ |
| | | private String content; |
| | | /** |
| | | * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | /** |
| | | * 已比赛次数 |
| | | */ |
| | | private Integer matchNumber; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup.Model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/2 10:56 |
| | | */ |
| | | @Data |
| | | public class WorldCupListAll { |
| | | /** |
| | | * 比赛名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private String startTime; |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private String endTime; |
| | | /** |
| | | * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | | /** |
| | | * 页条数 |
| | | */ |
| | | private Integer limit; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup.Model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 社区世界杯门店 |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/18 18:06 |
| | | */ |
| | | @Data |
| | | public class WorldCupStore { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 世界杯id |
| | | */ |
| | | private Integer worldCupId; |
| | | /** |
| | | * 门店id |
| | | */ |
| | | private Integer storeId; |
| | | /** |
| | | * 是否开启世界杯按钮(0=否,1=是) |
| | | */ |
| | | private Integer isOpen; |
| | | /** |
| | | * 世界杯入口背景图 |
| | | */ |
| | | private String backgroundImage; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | private Integer sort; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup; |
| | | |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCup; |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupListAll; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/2 10:58 |
| | | */ |
| | | @FeignClient("mb-cloud-communityWorldCup") |
| | | public interface WorldCupClient { |
| | | |
| | | /** |
| | | * 获取比赛管理列表页数据 |
| | | * @param worldCupListAll |
| | | * @return |
| | | */ |
| | | @PostMapping("/worldCup/getWorldCupListAll") |
| | | Map<String, Object> getWorldCupListAll(WorldCupListAll worldCupListAll); |
| | | |
| | | |
| | | /** |
| | | * 添加社区世界杯 |
| | | * @param worldCup |
| | | * @return 数据id |
| | | */ |
| | | @PostMapping("/worldCup/addWorldCup") |
| | | Integer addWorldCup(WorldCup worldCup); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加社区世界杯 |
| | | * @param worldCup |
| | | * @return 数据id |
| | | */ |
| | | @PostMapping("/worldCup/editWorldCup") |
| | | void editWorldCup(WorldCup worldCup); |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/worldCup/getWorldCupById") |
| | | WorldCup getWorldCupById(Integer id); |
| | | |
| | | |
| | | /** |
| | | * 取消赛事退款操作 |
| | | * @param id |
| | | */ |
| | | @PostMapping("/worldCup/cancelWorldCupRefund") |
| | | void cancelWorldCupRefund(Integer id); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup; |
| | | |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupStore; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/4 9:58 |
| | | */ |
| | | @FeignClient("mb-cloud-communityWorldCup") |
| | | public interface WorldCupStoreClient { |
| | | |
| | | |
| | | /** |
| | | * 添加社区世界杯和门店关系数据 |
| | | * @param worldCupStore |
| | | */ |
| | | @PostMapping("/worldCup/addWorldCupStore") |
| | | void addWorldCupStore(WorldCupStore worldCupStore); |
| | | |
| | | |
| | | /** |
| | | * 删除世界杯门店关系数据 |
| | | * @param worldCupId |
| | | */ |
| | | @PostMapping("/worldCup/addWorldCupStore") |
| | | void delWorldCupStore(@RequestBody Integer worldCupId); |
| | | |
| | | |
| | | /** |
| | | * 根据世界杯id获取门店关系数据 |
| | | * @param worldCupId |
| | | * @return |
| | | */ |
| | | @PostMapping("/worldCup/getWorldCupStoreAllList") |
| | | List<WorldCupStore> getWorldCupStoreAllList(Integer worldCupId); |
| | | |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/cancelledClasses/addCancelledClasses") |
| | | void addCancelledClasses(CancelledClasses cancelledClasses); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.dsh.course.feignClient.course; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.course.model.CancelledClasses; |
| | | import com.dsh.course.feignClient.course.model.CoursePackageScheduling; |
| | | import com.dsh.course.feignClient.course.model.QueryCoursePackageSchedulingList; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | private data type2; |
| | | private data type3; |
| | | private data type4; |
| | | private data type5; |
| | | private data type6; |
| | | |
| | | |
| | | public static class data { |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家) |
| | | * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家,5=赢家,6=次数) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | |
| | | |
| | | List<TStoreListVo> listAllStore(@Param("page") Page<TStoreListVo> page, @Param("provinceCode") String provinceCode, @Param("cityCode") String cityCode, @Param("name") String name, @Param("phone") String phone, @Param("shopName") String shopName, @Param("id") Integer id); |
| | | |
| | | |
| | | |
| | | List<Map<String, Object>> listStoreAll(Page page, @Param("name") String name, |
| | | @Param("operator") Integer operator, @Param("provinceCode") String provinceCode, |
| | | @Param("cityCode") String cityCode); |
| | | |
| | | |
| | | |
| | | List<Map<String, Object>> listStoreAllByIds(@Param("ids") List<Integer> ids); |
| | | List<Map<String, Object>> querySiteListOfpage(@Param("provinceCode") String provinceCode, |
| | | @Param("cityCode") String cityCode, |
| | | @Param("operatorId") Integer operatorId, |
| | |
| | | } |
| | | return ResultUtil.success("添加成功"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取所有运营商 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getOperatorListAll") |
| | | public Object getOperatorListAll(){ |
| | | return operatorService.list(new QueryWrapper<TOperator>().eq("state", 1)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.feignClient.account.RefereeClient; |
| | | import com.dsh.course.feignClient.account.model.Referee; |
| | | import com.dsh.course.feignClient.account.model.RefereeList; |
| | | import com.dsh.guns.modular.system.model.Region; |
| | | import com.dsh.guns.modular.system.service.IRegionService; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 裁判管理 |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/1 14:08 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/referee") |
| | | public class RefereeController { |
| | | |
| | | private String PREFIX = "/system/referee/"; |
| | | |
| | | @Resource |
| | | private RefereeClient refereeClient; |
| | | |
| | | @Autowired |
| | | private IRegionService regionService; |
| | | |
| | | |
| | | |
| | | |
| | | @RequestMapping("") |
| | | public String showList(){ |
| | | return PREFIX + "referee.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param refereeList |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/listAll") |
| | | public Object listAll(RefereeList refereeList){ |
| | | return refereeClient.getRefereeList(refereeList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * @param referee |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/addReferee") |
| | | public ResultUtil addReferee(Referee referee){ |
| | | Region region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getProvinceCode())); |
| | | referee.setProvince(region.getName()); |
| | | region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getCityCode())); |
| | | referee.setCity(region.getName()); |
| | | refereeClient.addReferee(referee); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getReferee") |
| | | public Object getReferee(Integer id){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Referee referee = refereeClient.getRefereeById(id); |
| | | map.put("referee", referee); |
| | | List<Region> parent = regionService.list(new QueryWrapper<Region>().eq("parent_id", 0)); |
| | | map.put("province", parent); |
| | | Region region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getProvinceCode())); |
| | | List<Region> citys = regionService.list(new QueryWrapper<Region>().eq("parent_id", region.getId())); |
| | | map.put("city", citys); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改裁判数据 |
| | | * @param referee |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/editReferee") |
| | | public ResultUtil editReferee(Referee referee){ |
| | | Region region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getProvinceCode())); |
| | | referee.setProvince(region.getName()); |
| | | region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getCityCode())); |
| | | referee.setCity(region.getName()); |
| | | refereeClient.editReferee(referee); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * @param id |
| | | * @param state |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/updateState") |
| | | public ResultUtil updateState(Integer id, Integer state){ |
| | | Referee referee = new Referee(); |
| | | referee.setState(state); |
| | | referee.setId(id); |
| | | refereeClient.editReferee(referee); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | Protocol two = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 2)); |
| | | Protocol three = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 3)); |
| | | Protocol four = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 4)); |
| | | Protocol five = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 5)); |
| | | model.addAttribute("one",one); |
| | | model.addAttribute("two",two); |
| | | model.addAttribute("three",three); |
| | | model.addAttribute("four",four); |
| | | model.addAttribute("five",five); |
| | | return PREFIX + "tAgreementDriver.html"; |
| | | } |
| | | |
| | | @RequestMapping("/QrCodeDescription") |
| | | public String QrCodeDescription(Model model){ |
| | | Protocol six = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 6)); |
| | | model.addAttribute("six",six); |
| | | return PREFIX + "QrCodeDescription.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到添加车辆管理 |
| | | */ |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/store") |
| | | public class TStoreController { |
| | | public class TStoreController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/listAll") |
| | | public Object listAll(String name, Integer operator, String provinceCode, String cityCode){ |
| | | Page page = new PageFactory<List<Map<String, Object>>>().defaultPage(); |
| | | List<Map<String, Object>> mapList = storeService.listStoreAll(page, name, operator, provinceCode, cityCode); |
| | | page.setRecords(mapList); |
| | | return super.packForBT(page); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupStore; |
| | | import com.dsh.course.feignClient.communityWorldCup.WorldCupClient; |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCup; |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupListAll; |
| | | import com.dsh.course.feignClient.communityWorldCup.WorldCupStoreClient; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.util.DateUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.sql.ResultSet; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/2 10:40 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/worldCup") |
| | | public class WorldCupController { |
| | | |
| | | private String PREFIX = "/system/worldCup/"; |
| | | |
| | | @Resource |
| | | private WorldCupClient worldCupClient; |
| | | |
| | | @Resource |
| | | private WorldCupStoreClient worldCupStoreClient; |
| | | |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | |
| | | |
| | | /** |
| | | * 跳转列表页 |
| | | * @return |
| | | */ |
| | | @RequestMapping("") |
| | | public String showWorldCupList(){ |
| | | return PREFIX + "worldCup.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加页 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/openAddWorldCup") |
| | | public String openAddWorldCup(){ |
| | | return PREFIX + "worldCup_add.html"; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/openEditWorldCup") |
| | | public String openEditWorldCup(Model model, Integer id){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | WorldCup worldCup = worldCupClient.getWorldCupById(id); |
| | | model.addAttribute("item", worldCup); |
| | | model.addAttribute("startTime", sdf.format(worldCup.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(worldCup.getEndTime())); |
| | | model.addAttribute("registrationClosingTime", null != worldCup.getRegistrationClosingTime() ? sdf.format(worldCup.getRegistrationClosingTime()) : ""); |
| | | List<WorldCupStore> worldCupStoreAllList = worldCupStoreClient.getWorldCupStoreAllList(id); |
| | | List<Integer> collect = worldCupStoreAllList.stream().map(WorldCupStore::getStoreId).collect(Collectors.toList()); |
| | | List<Map<String, Object>> mapList = storeService.listStoreAllByIds(collect); |
| | | model.addAttribute("stores", JSON.toJSONString(mapList)); |
| | | return PREFIX + "worldCup_edit.html"; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/openInfoWorldCup") |
| | | public String openInfoWorldCup(Model model, Integer id){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | WorldCup worldCup = worldCupClient.getWorldCupById(id); |
| | | model.addAttribute("item", worldCup); |
| | | model.addAttribute("startTime", sdf.format(worldCup.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(worldCup.getEndTime())); |
| | | model.addAttribute("registrationClosingTime", null != worldCup.getRegistrationClosingTime() ? sdf.format(worldCup.getRegistrationClosingTime()) : ""); |
| | | List<WorldCupStore> worldCupStoreAllList = worldCupStoreClient.getWorldCupStoreAllList(id); |
| | | List<Integer> collect = worldCupStoreAllList.stream().map(WorldCupStore::getStoreId).collect(Collectors.toList()); |
| | | List<Map<String, Object>> mapList = storeService.listStoreAllByIds(collect); |
| | | model.addAttribute("stores", JSON.toJSONString(mapList)); |
| | | return PREFIX + "worldCup_info.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到门店选择页面 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/openStore") |
| | | public String openStore(){ |
| | | return PREFIX + "store.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param worldCupList |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/listAll") |
| | | public Object listAll(WorldCupListAll worldCupList){ |
| | | return worldCupClient.getWorldCupListAll(worldCupList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加社区世界杯 |
| | | * @param worldCup |
| | | * @param stores |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/addWorldCup") |
| | | public ResultUtil addWorldCup(WorldCup worldCup, String stores){ |
| | | worldCup.setStatus(1); |
| | | worldCup.setCreateTime(new Date()); |
| | | worldCup.setMatchNumber(0); |
| | | Integer integer = worldCupClient.addWorldCup(worldCup); |
| | | if(null != integer){ |
| | | JSONArray jsonArray = JSON.parseArray(stores); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | WorldCupStore worldCupStore = new WorldCupStore(); |
| | | worldCupStore.setStoreId(id); |
| | | worldCupStore.setWorldCupId(integer); |
| | | worldCupStore.setIsOpen(0); |
| | | worldCupStoreClient.addWorldCupStore(worldCupStore); |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 编辑社区世界杯 |
| | | * @param worldCup |
| | | * @param stores |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/editWorldCup") |
| | | public ResultUtil editWorldCup(WorldCup worldCup, String stores){ |
| | | WorldCup worldCup1 = worldCupClient.getWorldCupById(worldCup.getId()); |
| | | if(worldCup1.getStartTime().before(DateUtil.getDate())){ |
| | | return ResultUtil.error("赛事已开始,不能编辑"); |
| | | } |
| | | worldCupClient.editWorldCup(worldCup); |
| | | worldCupStoreClient.delWorldCupStore(worldCup.getId()); |
| | | JSONArray jsonArray = JSON.parseArray(stores); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | WorldCupStore worldCupStore = new WorldCupStore(); |
| | | worldCupStore.setStoreId(id); |
| | | worldCupStore.setWorldCupId(worldCup.getId()); |
| | | worldCupStore.setIsOpen(0); |
| | | worldCupStoreClient.addWorldCupStore(worldCupStore); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改赛事状态 |
| | | * @param id |
| | | * @param state |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/updateState") |
| | | public ResultUtil updateState(Integer id, Integer state){ |
| | | WorldCup worldCup = new WorldCup(); |
| | | worldCup.setId(id); |
| | | worldCup.setStatus(state); |
| | | worldCupClient.editWorldCup(worldCup); |
| | | //开始处理已支付的退费 |
| | | worldCupClient.cancelWorldCupRefund(id); |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | |
| | | String[] dates = times.split(";"); |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | Date minDate = null; |
| | | Date maxDate = null; |
| | | |
| | | for (String dateStr : dates) { |
| | | String[] dateRange = dateStr.split("-"); |
| | | String startDateStr = dateRange[0].trim(); |
| | | String endDateStr = dateRange[1].trim(); |
| | | |
| | | try { |
| | | String start = dates[0]; |
| | | String startDateStr = start.substring(0, start.lastIndexOf("-")); |
| | | Date startDate = format.parse(startDateStr); |
| | | Date endDate = format.parse(endDateStr); |
| | | |
| | | if (minDate == null || startDate.before(minDate)) { |
| | | minDate = startDate; |
| | | } |
| | | if (maxDate == null || endDate.after(maxDate)) { |
| | | maxDate = endDate; |
| | | } |
| | | String end = dates[dates.length - 1]; |
| | | String[] str = end.split(" "); |
| | | String endDateStr = str[0] + " " + str[1].substring(str[1].indexOf("-") + 1); |
| | | Date endDate = format.parse(endDateStr); |
| | | siteBooking.setStartTime(startDate); |
| | | siteBooking.setEndTime(endDate); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | System.out.println("最小日期:" + minDate); |
| | | System.out.println("最大日期:" + maxDate); |
| | | siteBooking.setStartTime(minDate); |
| | | siteBooking.setEndTime(maxDate); |
| | | siteBooking.setPayType(2); |
| | | |
| | | //存多少钱 |
| | | String money = siteBooking.getMoney(); |
| | | String[] moneys = money.split(","); |
| | | siteBooking.setPayMoney(Double.valueOf(moneys[0])); |
| | | |
| | | |
| | | // 查询当前预约人是否是会员 |
| | | String phone = siteBooking.getPhone(); |
| | | String booker = siteBooking.getBooker(); |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.system; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.model.Region; |
| | | import com.dsh.guns.modular.system.service.IRegionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/1 15:26 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/region") |
| | | public class RegionController { |
| | | |
| | | @Autowired |
| | | private IRegionService regionService; |
| | | |
| | | |
| | | /** |
| | | * 获取行政区联动 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getRegion") |
| | | public List<Region> getRegion(String pcode){ |
| | | Integer pid = 0; |
| | | if(ToolUtil.isNotEmpty(pcode)){ |
| | | Region code = regionService.getOne(new QueryWrapper<Region>().eq("code", pcode)); |
| | | pid = code.getId(); |
| | | } |
| | | return regionService.list(new QueryWrapper<Region>().eq("parent_id", pid)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | model.addAttribute("item", tStudentDto); |
| | | if (tStudentDto.getLateralSurface()!=null&&!tStudentDto.equals("")) { |
| | | // String[] pics = tStudentDto.getLateralSurface().split(";"); |
| | | // model.addAttribute("pic1", pics[0]); |
| | | // System.out.println("=====pic1==" + pics[0]); |
| | | // if (pics.length > 1) { |
| | | // model.addAttribute("pic2", pics[1]); |
| | | // System.out.println("=====pic2==" + pics[1]); |
| | | // } |
| | | // if (pics.length > 2) { |
| | | // model.addAttribute("pic3", pics[2]); |
| | | // System.out.println("=====pic3==" + pics[2]); |
| | | // } |
| | | model.addAttribute("images",tStudentDto.getLateralSurface()); |
| | | } |
| | | |
| | |
| | | @RequestMapping("/changeStatus/{id}") |
| | | @ResponseBody |
| | | public ResultUtil changeStatus(@PathVariable Integer id) { |
| | | // InsertBackDto insertBackDto= new InsertBackDto(); |
| | | // insertBackDto.setId(id); |
| | | //// insertBackDto.setIds(ids); |
| | | // System.out.println("=====insertBackDto========"+insertBackDto); |
| | | |
| | | courseStuddentClient.changeStatus(id); |
| | | courseStuddentClient.zeroClass(id); |
| | | |
| | |
| | | @RequestMapping("/noStatus/{id}") |
| | | @ResponseBody |
| | | public ResultUtil noStatus(@PathVariable Integer id) { |
| | | // InsertBackDto insertBackDto= new InsertBackDto(); |
| | | // insertBackDto.setId(id); |
| | | //// insertBackDto.setIds(ids); |
| | | // System.out.println("=====insertBackDto========"+insertBackDto); |
| | | |
| | | courseStuddentClient.noStatus(id); |
| | | courseStuddentClient.backStausClass(id); |
| | | // courseStuddentClient.zeroClass(id); |
| | | |
| | | System.out.println("============学员查询接口========="); |
| | | return new ResultUtil<>(0,0,"已拒绝",null,null); |
| | |
| | | System.out.println("========ToHoliDto========="+resultUtil); |
| | | |
| | | if (resultUtil.equals("换课成功")) { |
| | | // return ResultUtil.success(resultUtil); |
| | | return new ResultUtil<>(0,0,resultUtil); |
| | | |
| | | }else { |
| | | return new ResultUtil<>(0,1,resultUtil);} |
| | | return new ResultUtil<>(0,1,resultUtil); |
| | | } |
| | | // if (resultUtil==""){ |
| | | // }else{ |
| | | } |
| | | |
| | | |
| | | //赠课 |
| | |
| | | */ |
| | | @TableField("startTime") |
| | | @ApiModelProperty("预约开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | /** |
| | | * 预约结束 |
| | | */ |
| | | @TableField("endTime") |
| | | @ApiModelProperty("预约结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | /** |
| | | * 预约人 |
| | |
| | | */ |
| | | @TableField("payTime") |
| | | @ApiModelProperty("支付时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date payTime; |
| | | /** |
| | | * 支付金额 |
| | |
| | | * 取消时间 |
| | | */ |
| | | @TableField("cancelTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date cancelTime; |
| | | /** |
| | | * 第三方取消退款流水号 |
| | |
| | | List<TStoreListVo> listAllStore(Page<TStoreListVo> page, String provinceCode, String cityCode, String name, String phone, String shopName, Integer objectId); |
| | | |
| | | |
| | | List<Map<String, Object>> listStoreAll(Page page, String name, Integer operator, String provinceCode, String cityCode); |
| | | |
| | | |
| | | List<Map<String, Object>> listStoreAllByIds(List<Integer> ids); |
| | | List<Map<String, Object>> querySiteListOfpage(String provinceCode, String cityCode, Integer operatorId, String storeName, Page<Map<String, Object>> page); |
| | | |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.CoursePackageOrderStudent; |
| | | import com.dsh.course.feignClient.account.StudentHonorClient; |
| | | import com.dsh.course.feignClient.account.model.StudentHonor; |
| | | import com.dsh.course.feignClient.course.*; |
| | | import com.dsh.course.feignClient.course.model.*; |
| | | import com.dsh.guns.config.UserExt; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | |
| | | @Resource |
| | | private CancelledClassesClient cancelledClassesClient; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil cancellationRecord(Long id, String cancelClasses, Integer deductClassHour) { |
| | | // CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingClient.queryCoursePackageSchedulingById(id); |
| | | |
| | | List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingClient.queryCoursePackageSchedulingsById(id); |
| | | CoursePackageScheduling coursePackageScheduling1 = coursePackageSchedulings.get(0); |
| | | Date classDate = coursePackageScheduling1.getEndDate(); |
| | |
| | | coursePackageScheduling.setDeductClassHour(deductClassHour); |
| | | coursePackageScheduling.setStatus(3); |
| | | } |
| | | |
| | | |
| | | // for (CoursePackageScheduling coursePackageScheduling : coursePackageSchedulings) { |
| | | |
| | | // if(coursePackageScheduling.getStatus() == 1 || coursePackageScheduling.getStatus() == 4){ |
| | | // return ResultUtil.error("不能添加消课凭证"); |
| | | // } |
| | | // coursePackageScheduling.setCancelClasses(cancelClasses); |
| | | // coursePackageScheduling.setDeductClassHour(deductClassHour); |
| | | coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageSchedulings); |
| | | |
| | | List<CoursePackageStudent> coursePackageStudents = coursePackageStudentClient.queryByCoursePackageSchedulingId(integers); |
| | |
| | | if(coursePackageStudent.getSignInOrNot() == 2){ |
| | | continue; |
| | | } |
| | | // TCoursePackagePayment tCoursePackagePayment = coursePackagePaymentClient.queryCoursePackagePaymentById(coursePackageStudent.getCoursePackagePaymentId()); |
| | | |
| | | CoursePackageOrderStudent coursePackageOrderStudent = coursePackagePaymentClient.queryCoursePackagePaymentById1(coursePackageStudent.getCoursePackagePaymentId()); |
| | | |
| | | if (deductClassHour!=null) { |
| | |
| | | cancelledClasses.setCoursePackageSchedulingId(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | cancelledClasses.setVoucher(cancelClasses); |
| | | if (deductClassHour!=null) { |
| | | cancelledClasses.setCancelledClassesNumber(deductClassHour);} |
| | | cancelledClasses.setCancelledClassesNumber(deductClassHour); |
| | | } |
| | | cancelledClasses.setInsertTime(new Date()); |
| | | cancelledClassesClient.addCancelledClasses(cancelledClasses); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //添加勋章数据 |
| | | QueryCoursePackageStudent queryCoursePackageStudent = new QueryCoursePackageStudent(); |
| | | queryCoursePackageStudent.setAppUserId(coursePackageStudent.getAppUserId()); |
| | | queryCoursePackageStudent.setSignInOrNot(1); |
| | | queryCoursePackageStudent.setReservationStatus(1); |
| | | List<CoursePackageStudent> coursePackageStudents1 = coursePackageStudentClient.queryCoursePackageStudent(queryCoursePackageStudent); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(coursePackageStudent.getAppUserId()); |
| | | studentHonor.setHonorType(1); |
| | | studentHonor.setNumber(coursePackageStudents1.size()); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | // } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | public void updateBenefits(Integer id, String p1) { |
| | | this.baseMapper.updateBasicBenefits(id,p1); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> listStoreAll(Page page, String name, Integer operator, String provinceCode, String cityCode) { |
| | | return this.baseMapper.listStoreAll(page, name, operator, provinceCode, cityCode); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> listStoreAllByIds(List<Integer> ids) { |
| | | return this.baseMapper.listStoreAllByIds(ids); |
| | | } |
| | | } |
| | |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listStoreAll" resultType="map"> |
| | | select |
| | | a.id, |
| | | CONCAT(a.province, a.city) as province, |
| | | b.name as operator, |
| | | a.name, |
| | | c.gate |
| | | from t_store a |
| | | left join t_operator b on (a.operatorId = b.id) |
| | | left join (select GROUP_CONCAT(id) as gate, storeId from t_gate group by storeId) c on (a.id = c.storeId) |
| | | where a.state = 1 |
| | | <if test="null != name and '' != name"> |
| | | and a.name like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != operator"> |
| | | and a.operatorId = #{operator} |
| | | </if> |
| | | <if test="null != provinceCode and '' != provinceCode"> |
| | | and a.provinceCode = #{provinceCode} |
| | | </if> |
| | | <if test="null != cityCode and '' != cityCode"> |
| | | and a.cityCode = #{cityCode} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listStoreAllByIds" resultType="map"> |
| | | select |
| | | a.id, |
| | | CONCAT(a.province, a.city) as province, |
| | | b.name as operator, |
| | | a.name, |
| | | c.gate |
| | | from t_store a |
| | | left join t_operator b on (a.operatorId = b.id) |
| | | left join (select GROUP_CONCAT(id) as gate, storeId from t_gate group by storeId) c on (a.id = c.storeId) |
| | | where a.id in |
| | | <foreach collection="ids" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
| | |
| | | <#button name="重置" icon="fa-trash" clickFun="TSite.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="TCompetitionTableToolbar" role="group"> |
| | | <div class="hidden-xs" id="TSiteTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/advertisement/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="TSite.openAddTSite()"/> |
| | | @} |
| | | |
| | | |
| | | @if(shiro.hasPermission("/advertisement/update")){ |
| | | <#button name="编辑" icon="fa-edit" clickFun="TSite.openEditTSite()" space="true"/> |
| | | @} |
| | | |
| | | @if(shiro.hasPermission("/advertisement/info")){ |
| | | <#button name="查看详情" icon="fa-search" clickFun="TSite.openInfo()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/advertisement/changeState")){ |
| | | <#button name="上架" icon="fa-check" clickFun="TSite.onShelf()" space="true"/> |
| | | |
| | | <#button name="下架" icon="fa-remove" clickFun="TSite.offShelf()" space="true"/> |
| | | @} |
| | | </div> |
| | |
| | | <select style="width: 300px" class="form-control" id="position" onchange="updatePosition(this)" name = "position"> |
| | | <option value="">选择类型</option> |
| | | <option value="1">首页banner</option> |
| | | <option value="2">线上课得积分</option> |
| | | <option value="3">看视频得奖励</option> |
| | | <option value="4">常见问题</option> |
| | | <option value="3">线上课得积分</option> |
| | | <option value="4">看视频得奖励</option> |
| | | <option value="5">常见问题</option> |
| | | <option value="6">社区世界杯顶部banner</option> |
| | | <option value="7">社区世界杯底部banner</option> |
| | | </select> |
| | | </div> |
| | | </div> |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>裁判管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="name" name="裁判姓名:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="phone" name="手机号:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <div class="input-group"> |
| | | <div class="input-group-btn open"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> |
| | | 所在省 |
| | | </button> |
| | | </div> |
| | | <select class="form-control" id="provinceCode" onchange="Referee.region('cityCode', this)"> |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <div class="input-group"> |
| | | <div class="input-group-btn open"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> |
| | | 所在市 |
| | | </button> |
| | | </div> |
| | | <select class="form-control" id="cityCode" > |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="Referee.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="Referee.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="RefereeTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/referee/openAddReferee")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="Referee.openAddReferee()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/referee/openEditReferee")){ |
| | | <#button name="编辑" icon="fa-edit" clickFun="Referee.openEditReferee()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/referee/delReferee")){ |
| | | <#button name="删除" icon="fa-edit" clickFun="Referee.delReferee()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/referee/offShelf")){ |
| | | <#button name="冻结" icon="fa-edit" clickFun="Referee.offShelf()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/referee/onShelf")){ |
| | | <#button name="解冻" icon="fa-edit" clickFun="Referee.onShelf()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="RefereeTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/referee/referee.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#createTime' |
| | | ,range: true |
| | | ,lang:"en" |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-6"> |
| | | <div class="layui-form-item layui-form-text"> <label class="layui-form-label">注意事项:</label> |
| | | <div class="layui-input-block"> |
| | | <textarea placeholder="请输入内容" class="layui-textarea" id="six">${six.content}</textarea> |
| | | </div> |
| | | </div> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="update(${six.id});"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script type="text/javascript"> |
| | | |
| | | function update(id){ |
| | | let six = $('#six').val(); |
| | | if (six == ""){ |
| | | Feng.error("内容不能为空!"); |
| | | return; |
| | | } |
| | | submitData(six,id); |
| | | } |
| | | |
| | | function submitData(content,id) { |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tAgree/updateAppParam", function(data){ |
| | | Feng.success("编辑成功!"); |
| | | },function(data){ |
| | | Feng.error("编辑失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("context", content); |
| | | ajax.set("id", id); |
| | | ajax.start(); |
| | | } |
| | | </script> |
| | | @} |
| | |
| | | <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">隐私协议</a></li> |
| | | <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">运动安全告知书</a></li> |
| | | <li class=""><a data-toggle="tab" href="#tab-4" aria-expanded="false">注销账号说明</a></li> |
| | | <li class=""><a data-toggle="tab" href="#tab-5" aria-expanded="false">社区世界杯报名协议</a></li> |
| | | </ul> |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div id="tab-5" class="tab-pane"> |
| | | <div class="panel-body"> |
| | | <textarea type="text/plain" id="editor_5" style="width:1200px;height:400px;">${five.content}</textarea> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5"> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="update_5(${five.id});"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | var editor_2 = null; |
| | | var editor_3 = null; |
| | | var editor_4 = null; |
| | | var editor_5 = null; |
| | | $(function () { |
| | | //初始化编辑器 |
| | | editor_1 = UE.getEditor('editor_1'); |
| | | editor_2 = UE.getEditor('editor_2'); |
| | | editor_3 = UE.getEditor('editor_3'); |
| | | editor_4 = UE.getEditor('editor_4'); |
| | | editor_5 = UE.getEditor('editor_5'); |
| | | }); |
| | | |
| | | function update_1(id){ |
| | |
| | | } |
| | | submitData(editor_4.getContent(),id); |
| | | } |
| | | function update_5(id){ |
| | | if (editor_5.getContentTxt() == ""){ |
| | | Feng.error("内容不能为空!"); |
| | | return; |
| | | } |
| | | submitData(editor_5.getContent(),id); |
| | | } |
| | | |
| | | function submitData(content,id) { |
| | | //提交信息 |
| | |
| | | }); |
| | | |
| | | |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | ,type:"date", |
| | | format: "yyyy-MM-dd HH:mm" |
| | | }); |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | ,type:"date", |
| | | format: "yyyy-MM-dd HH:mm" |
| | | }); |
| | | // laydate.render({ |
| | | // elem: '#endTime' |
| | | // ,type:"date", |
| | | // format: "yyyy-MM-dd HH:mm" |
| | | // }); |
| | | // laydate.render({ |
| | | // elem: '#startTime' |
| | | // ,type:"date", |
| | | // format: "yyyy-MM-dd HH:mm" |
| | | // }); |
| | | |
| | | laydate.render({ |
| | | elem: '#registerEndTime' |
| | |
| | | <h3 class = "title">运动达人:</h3> |
| | | <div id="table2"></div> |
| | | </div> |
| | | </div> |
| | | <div class="row" id = "table-container-2"> |
| | | <div class="table-container"> |
| | | <h3 class = "title">社区之王:</h3> |
| | | <div id="table3"></div> |
| | | </div> |
| | | </div> |
| | | <div class="row" id = "table-container-2"> |
| | | <div class="table-container"> |
| | | <h3 class = "title">深度玩家:</h3> |
| | | <div id="table4"></div> |
| | | </div> |
| | | <div class="table-container"> |
| | | <h3 class = "title">赢家:</h3> |
| | | <div id="table5"></div> |
| | | </div> |
| | | <div class="table-container"> |
| | | <h3 class = "title">次数:</h3> |
| | | <div id="table6"></div> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" id = "buttonEdit"> |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>参与赛点</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <div class="input-group"> |
| | | <div class="input-group-btn open"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> |
| | | 所在省 |
| | | </button> |
| | | </div> |
| | | <select class="form-control" id="provinceCode" onchange="Store.region('cityCode', this)"> |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <div class="input-group"> |
| | | <div class="input-group-btn open"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> |
| | | 所在市 |
| | | </button> |
| | | </div> |
| | | <select class="form-control" id="cityCode" > |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <div class="input-group"> |
| | | <div class="input-group-btn open"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> |
| | | 所属运营商 |
| | | </button> |
| | | </div> |
| | | <select class="form-control" id="operator" > |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="name" name="门店名称:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="Store.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="Store.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <#table id="StoreTable"/> |
| | | <div style="text-align: center;"> |
| | | <#button btnCss="danger" name="关闭" id="cancel" icon="fa-eraser" clickFun="Store.close()"/> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="Store.addSubmit()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/worldCup/store.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>社区世界杯比赛管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="name" name="比赛名称:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="startTime" name="开始时间:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="endTime" name="结束时间:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <div class="input-group"> |
| | | <div class="input-group-btn open"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> |
| | | 状态 |
| | | </button> |
| | | </div> |
| | | <select class="form-control" id="status"> |
| | | <option value="">全部</option> |
| | | <option value="1">未开始</option> |
| | | <option value="2">已开始</option> |
| | | <option value="3">已结束</option> |
| | | <option value="4">已取消</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="WorldCup.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="WorldCup.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="WorldCupTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/worldCup/openAddWorldCup")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="WorldCup.openAddWorldCup()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/worldCup/openEditWorldCup")){ |
| | | <#button name="编辑" icon="fa-edit" clickFun="WorldCup.openEditWorldCup()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/worldCup/cancelWorldCup")){ |
| | | <#button name="取消" icon="fa-edit" clickFun="WorldCup.cancelWorldCup()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/worldCup/openWorldCupInfo")){ |
| | | <#button name="查看详情" icon="fa-edit" clickFun="WorldCup.openWorldCupInfo()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/worldCup/registeredPersonnel")){ |
| | | <#button name="已报名人员" icon="fa-edit" clickFun="WorldCup.registeredPersonnel()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="WorldCupTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/worldCup/worldCup.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style type="text/css"> |
| | | #stores{ |
| | | width: 100%; |
| | | } |
| | | #stores td, #stores th{ |
| | | border: 1px solid #eee; |
| | | text-align: center; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | } |
| | | #stores td select, #stores td div, #stores td div input, #stores td input{ |
| | | height: 100%; |
| | | width: 95%; |
| | | border: none; |
| | | text-indent: 10px; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="userInfoForm"> |
| | | <input type="hidden" id="id" value=""> |
| | | <div class="row"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛名称:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="name"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*开始时间:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="startTime"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*结束时间:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="endTime"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">报名截止时间:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="registrationClosingTime"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*报名年龄:</label> |
| | | <div class="col-sm-1"> |
| | | <input class="form-control" id="startAge" type="number" min="0"> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">岁至:</label> |
| | | <div class="col-sm-1"> |
| | | <input class="form-control" id="endAge" type="number" min="0"> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">岁</label> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*报名性别</label> |
| | | <div class="col-sm-3"> |
| | | <select class="form-control" id="gender"> |
| | | <option value="0">全部</option> |
| | | <option value="1">男</option> |
| | | <option value="2">女</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*支付方式:</label> |
| | | <div class="col-sm-9" id="payType"> |
| | | <input type="checkbox" item="free" value="0" checked>免费 |
| | | <input type="checkbox" item="cash" value="1">现金支付 |
| | | <input type="checkbox" item="paiCoin" value="2">玩湃币支付 |
| | | <input type="checkbox" item="classHour" value="3">课时支付 |
| | | </div> |
| | | </div> |
| | | <div class="form-group cash" hidden> |
| | | <label class="col-sm-3 control-label">*现金支付:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="cash" type="number" min="0"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group paiCoin" hidden> |
| | | <label class="col-sm-3 control-label">*玩湃币支付:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="paiCoin" type="number" min="0"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group classHour" hidden> |
| | | <label class="col-sm-3 control-label">*课时支付:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="classHour" type="number" min="0"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*报名人数:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="maxPeople" type="number" min="0"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*基础报名人数:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="basePeople" type="number" min="0"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*参赛可获积分:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="participationIntegral" type="number" min="0"> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">胜场可获积分</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="winIntegral" type="number" min="0"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛地点:</label> |
| | | <div class="col-sm-7"> |
| | | <input class="form-control" id="address" onchange="WorldCupInfo.searchByStationName(this,1)"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*坐标选择:</label> |
| | | <div class="col-sm-7"> |
| | | <div id="container" style="height: 500px;" ></div> |
| | | </div> |
| | | <input type="hidden" id="longitude"/> |
| | | <input type="hidden" id="latitude"/> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">参与赛点:</label> |
| | | <div class="col-sm-7"> |
| | | <button onclick="WorldCupInfo.openStore()">选择门店</button> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label"></label> |
| | | <div class="col-sm-7"> |
| | | <table id="stores"> |
| | | <thead> |
| | | <tr> |
| | | <th>所在省市</th><th>所属运营商</th><th>门店名称</th><th>操作</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">赛事简介</label> |
| | | <div class="col-sm-7"> |
| | | <textarea class="form-control" id="intro" style="height:200px"></textarea> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label head-scu-label">比赛封面图</label> |
| | | <div class="col-sm-2"> |
| | | <div id="coverImgPreId"> |
| | | <div><img width="100px" height="100px" src="${ctxPath}/img/NoPIC.png"></div> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-1"> |
| | | <div class="head-scu-btn upload-btn" id="coverImgBtnId"> |
| | | <i class="fa fa-upload"></i> 文件上传 |
| | | </div> |
| | | </div> |
| | | <input type="hidden" id="coverImg" /> |
| | | <label class="col-sm-1 control-label">首页默认背景图</label> |
| | | <div class="col-sm-2"> |
| | | <div id="homeBackdropImgPreId"> |
| | | <div><img width="100px" height="100px" src="${ctxPath}/img/NoPIC.png"></div> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-1"> |
| | | <div class="head-scu-btn upload-btn" id="homeBackdropImgBtnId"> |
| | | <i class="fa fa-upload"></i> 文件上传 |
| | | </div> |
| | | </div> |
| | | <input type="hidden" id="homeBackdropImg" /> |
| | | </div> |
| | | <div class="row" id="app1"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label head-scu-label">*比赛图片(请上传不超过五张图片): </label> |
| | | <div class="col-sm-7"> |
| | | <el-upload |
| | | :limit="5" |
| | | class="avatar-uploader" |
| | | action="/tCouponManage/uploadPic" |
| | | list-type="picture-card" |
| | | accept="." |
| | | :on-success="handleAvatarSuccess" |
| | | :on-remove="handleRemove"> |
| | | <i class="el-icon-plus"></i> |
| | | </el-upload> |
| | | <el-dialog :visible.sync="dialogVisible"> |
| | | <img width="100%" :src="imageUrl1" alt=""> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">比赛详情</label> |
| | | <div class="col-sm-7" style="padding: 0px;"> |
| | | <textarea id="content" style="height: 800px;width: 100%;"></textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="WorldCupInfo.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="WorldCupInfo.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <script src="${ctxPath}/js/vue/vue.js"></script> |
| | | <script src="${ctxPath}/js/elementui/index.js"></script> |
| | | <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#registrationClosingTime' |
| | | }); |
| | | |
| | | |
| | | |
| | | var vue2 = new Vue({ |
| | | el: '#app1', |
| | | props: { |
| | | // 数量限制 |
| | | limit: { |
| | | type: Number, |
| | | default: 2 |
| | | }, |
| | | }, |
| | | data: { |
| | | autoUpload: true,//自动上传 |
| | | imageUrl1: '',//模型数据,用于上传图片完成后图片预览 |
| | | dialogVisible: false |
| | | }, |
| | | methods: { |
| | | handleAvatarSuccess(res, file) { |
| | | WorldCupInfo.goodsPicArray1.push({ |
| | | 'name': file.name, |
| | | 'uuid': file.uuid, |
| | | 'url': file.response |
| | | }); |
| | | }, |
| | | beforeAvatarUpload(file) { |
| | | const isLt2M = file.size / 1024 / 1024 < 10; |
| | | if (!isLt2M) { |
| | | this.$message.error('上传图片大小不能超过 10MB!'); |
| | | } |
| | | return isLt2M; |
| | | }, |
| | | handleRemove(file, fileList) { |
| | | WorldCupInfo.goodsPicArray1 = WorldCupInfo.goodsPicArray1.filter(item => { |
| | | return item.uid != file.uid; |
| | | }); |
| | | }, |
| | | }, |
| | | created() { |
| | | }, |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style type="text/css"> |
| | | #stores{ |
| | | width: 100%; |
| | | } |
| | | #stores td, #stores th{ |
| | | border: 1px solid #eee; |
| | | text-align: center; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | } |
| | | #stores td select, #stores td div, #stores td div input, #stores td input{ |
| | | height: 100%; |
| | | width: 95%; |
| | | border: none; |
| | | text-indent: 10px; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="userInfoForm"> |
| | | <input type="hidden" id="id" value="${item.id}"> |
| | | <input type="hidden" id="storeInfo", value='${stores}'> |
| | | <div class="row"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛名称:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="name" value="${item.name}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*开始时间:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="startTime" value="${startTime}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*结束时间:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="endTime" value="${endTime}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">报名截止时间:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="registrationClosingTime" value="${registrationClosingTime}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*报名年龄:</label> |
| | | <div class="col-sm-1"> |
| | | <input class="form-control" id="startAge" type="number" min="0" value="${item.startAge}"> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">岁至:</label> |
| | | <div class="col-sm-1"> |
| | | <input class="form-control" id="endAge" type="number" min="0" value="${item.endAge}"> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">岁</label> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*报名性别</label> |
| | | <div class="col-sm-3"> |
| | | <select class="form-control" id="gender"> |
| | | <option value="0" ${0 == item.gender ? 'selected' : ''}>全部</option> |
| | | <option value="1" ${1 == item.gender ? 'selected' : ''}>男</option> |
| | | <option value="2" ${2 == item.gender ? 'selected' : ''}>女</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*支付方式:</label> |
| | | <div class="col-sm-9" id="payType"> |
| | | <input type="checkbox" item="free" value="0" ${null != item.cash || null != item.paiCoin || null != item.classHour ? '' : 'checked'}>免费 |
| | | <input type="checkbox" item="cash" value="1" ${null == item.cash ? '' : 'checked'}>现金支付 |
| | | <input type="checkbox" item="paiCoin" value="2" ${null == item.paiCoin ? '' : 'checked'}>玩湃币支付 |
| | | <input type="checkbox" item="classHour" value="3" ${null == item.classHour ? '' : 'checked'}>课时支付 |
| | | </div> |
| | | </div> |
| | | <div class="form-group cash" ${null == item.cash ? 'hidden' : ''}> |
| | | <label class="col-sm-3 control-label">*现金支付:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="cash" type="number" min="0" value="${item.cash}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group paiCoin" ${null == item.paiCoin ? 'hidden' : ''}> |
| | | <label class="col-sm-3 control-label">*玩湃币支付:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="paiCoin" type="number" min="0" value="${item.paiCoin}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group classHour" ${null == item.classHour ? 'hidden' : ''}> |
| | | <label class="col-sm-3 control-label">*课时支付:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="classHour" type="number" min="0" value="${item.classHour}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*报名人数:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="maxPeople" type="number" min="0" value="${item.maxPeople}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*基础报名人数:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="basePeople" type="number" min="0" value="${item.basePeople}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*参赛可获积分:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="participationIntegral" type="number" min="0" value="${item.participationIntegral}"> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">胜场可获积分</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="winIntegral" type="number" min="0" value="${item.winIntegral}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛地点:</label> |
| | | <div class="col-sm-7"> |
| | | <input class="form-control" id="address" onchange="WorldCupInfo.searchByStationName(this,1)" value="${item.address}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*坐标选择:</label> |
| | | <div class="col-sm-7"> |
| | | <div id="container" style="height: 500px;" ></div> |
| | | </div> |
| | | <input type="hidden" id="longitude" value="${item.lon}"/> |
| | | <input type="hidden" id="latitude" value="${item.lat}"/> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">参与赛点:</label> |
| | | <div class="col-sm-7"> |
| | | <button onclick="WorldCupInfo.openStore()">选择门店</button> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label"></label> |
| | | <div class="col-sm-7"> |
| | | <table id="stores"> |
| | | <thead> |
| | | <tr> |
| | | <th>所在省市</th><th>所属运营商</th><th>门店名称</th><th>操作</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">赛事简介</label> |
| | | <div class="col-sm-7"> |
| | | <textarea class="form-control" id="intro" style="height:200px">${item.intro}</textarea> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label head-scu-label">比赛封面图</label> |
| | | <div class="col-sm-2"> |
| | | <div id="coverImgPreId"> |
| | | <div><img width="100px" height="100px" src="${item.coverImg}"></div> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-1"> |
| | | <div class="head-scu-btn upload-btn" id="coverImgBtnId"> |
| | | <i class="fa fa-upload"></i> 文件上传 |
| | | </div> |
| | | </div> |
| | | <input type="hidden" id="coverImg" value="${item.coverImg}"/> |
| | | <label class="col-sm-1 control-label">首页默认背景图</label> |
| | | <div class="col-sm-2"> |
| | | <div id="homeBackdropImgPreId"> |
| | | <div><img width="100px" height="100px" src="${item.homeBackdropImg}"></div> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-1"> |
| | | <div class="head-scu-btn upload-btn" id="homeBackdropImgBtnId"> |
| | | <i class="fa fa-upload"></i> 文件上传 |
| | | </div> |
| | | </div> |
| | | <input type="hidden" id="homeBackdropImg" value="${item.homeBackdropImg}"/> |
| | | </div> |
| | | <div class="row" id="app1"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label head-scu-label">*比赛图片(请上传不超过五张图片): </label> |
| | | <div class="col-sm-7"> |
| | | <el-upload |
| | | :limit="5" |
| | | class="avatar-uploader" |
| | | action="/tCouponManage/uploadPic" |
| | | list-type="picture-card" |
| | | accept="." |
| | | :file-list="imageUrl2" |
| | | :on-success="handleAvatarSuccess" |
| | | :on-remove="handleRemove"> |
| | | <i class="el-icon-plus"></i> |
| | | </el-upload> |
| | | <el-dialog :visible.sync="dialogVisible"> |
| | | <img width="100%" :src="imageUrl1" alt=""> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">比赛详情</label> |
| | | <div class="col-sm-7" style="padding: 0px;"> |
| | | <textarea id="content" style="height: 800px;width: 100%;">${item.content}</textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="WorldCupInfo.editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="WorldCupInfo.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <script src="${ctxPath}/js/vue/vue.js"></script> |
| | | <script src="${ctxPath}/js/elementui/index.js"></script> |
| | | <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#registrationClosingTime' |
| | | }); |
| | | |
| | | |
| | | |
| | | let id = '${item.infoImg}' |
| | | let obj = [] |
| | | |
| | | var vue2 = new Vue({ |
| | | el: '#app1', |
| | | props: { |
| | | // 数量限制 |
| | | limit: { |
| | | type: Number, |
| | | default: 2 |
| | | }, |
| | | }, |
| | | data: { |
| | | autoUpload: true,//自动上传 |
| | | imageUrl1: '',//模型数据,用于上传图片完成后图片预览 |
| | | imageUrl2: JSON.parse(id), |
| | | dialogVisible: false |
| | | }, |
| | | methods: { |
| | | handleAvatarSuccess(res, file) { |
| | | WorldCupInfo.goodsPicArray1.push({ |
| | | 'name': file.name, |
| | | 'uuid': file.uuid, |
| | | 'url': file.response |
| | | }); |
| | | }, |
| | | changeImg(){ |
| | | var i = id.split(",") |
| | | for (let j = 0; j <i.length; j++) { |
| | | let obj={ |
| | | name:i[j], |
| | | uuid:i[j], |
| | | url:i[j], |
| | | } |
| | | this.imageUrl2.push(obj) |
| | | |
| | | } |
| | | }, |
| | | beforeAvatarUpload(file) { |
| | | const isLt2M = file.size / 1024 / 1024 < 10; |
| | | if (!isLt2M) { |
| | | this.$message.error('上传图片大小不能超过 10MB!'); |
| | | } |
| | | return isLt2M; |
| | | }, |
| | | handleRemove(file, fileList) { |
| | | WorldCupInfo.goodsPicArray1 = WorldCupInfo.goodsPicArray1.filter(item => { |
| | | return item.uid != file.uid; |
| | | }); |
| | | }, |
| | | }, |
| | | created() { |
| | | // this.changeImg() |
| | | WorldCupInfo.goodsPicArray1 = this.imageUrl2 |
| | | }, |
| | | }); |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style type="text/css"> |
| | | #stores{ |
| | | width: 100%; |
| | | } |
| | | #stores td, #stores th{ |
| | | border: 1px solid #eee; |
| | | text-align: center; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | } |
| | | #stores td select, #stores td div, #stores td div input, #stores td input{ |
| | | height: 100%; |
| | | width: 95%; |
| | | border: none; |
| | | text-indent: 10px; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="userInfoForm"> |
| | | <input type="hidden" id="id" value="${item.id}"> |
| | | <input type="hidden" id="storeInfo", value='${stores}'> |
| | | <div class="row"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛名称:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="name" value="${item.name}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*开始时间:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="startTime" value="${startTime}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*结束时间:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="endTime" value="${endTime}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">报名截止时间:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="registrationClosingTime" value="${registrationClosingTime}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*报名年龄:</label> |
| | | <div class="col-sm-1"> |
| | | <input class="form-control" id="startAge" type="number" min="0" value="${item.startAge}" disabled> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">岁至:</label> |
| | | <div class="col-sm-1"> |
| | | <input class="form-control" id="endAge" type="number" min="0" value="${item.endAge}" disabled> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">岁</label> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*报名性别</label> |
| | | <div class="col-sm-3"> |
| | | <select class="form-control" id="gender" disabled> |
| | | <option value="0" ${0 == item.gender ? 'selected' : ''}>全部</option> |
| | | <option value="1" ${1 == item.gender ? 'selected' : ''}>男</option> |
| | | <option value="2" ${2 == item.gender ? 'selected' : ''}>女</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*支付方式:</label> |
| | | <div class="col-sm-9" id="payType"> |
| | | <input type="checkbox" item="free" value="0" ${null != item.cash || null != item.paiCoin || null != item.classHour ? '' : 'checked'} disabled>免费 |
| | | <input type="checkbox" item="cash" value="1" ${null == item.cash ? '' : 'checked'} disabled>现金支付 |
| | | <input type="checkbox" item="paiCoin" value="2" ${null == item.paiCoin ? '' : 'checked'} disabled>玩湃币支付 |
| | | <input type="checkbox" item="classHour" value="3" ${null == item.classHour ? '' : 'checked'} disabled>课时支付 |
| | | </div> |
| | | </div> |
| | | <div class="form-group cash" ${null == item.cash ? 'hidden' : ''}> |
| | | <label class="col-sm-3 control-label">*现金支付:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="cash" type="number" min="0" value="${item.cash}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group paiCoin" ${null == item.paiCoin ? 'hidden' : ''}> |
| | | <label class="col-sm-3 control-label">*玩湃币支付:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="paiCoin" type="number" min="0" value="${item.paiCoin}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group classHour" ${null == item.classHour ? 'hidden' : ''}> |
| | | <label class="col-sm-3 control-label">*课时支付:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="classHour" type="number" min="0" value="${item.classHour}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*报名人数:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="maxPeople" type="number" min="0" value="${item.maxPeople}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*基础报名人数:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="basePeople" type="number" min="0" value="${item.basePeople}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*参赛可获积分:</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="participationIntegral" type="number" min="0" value="${item.participationIntegral}" disabled> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">胜场可获积分</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="winIntegral" type="number" min="0" value="${item.winIntegral}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛地点:</label> |
| | | <div class="col-sm-7"> |
| | | <input class="form-control" id="address" onchange="WorldCupInfo.searchByStationName(this,1)" value="${item.address}" disabled> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*坐标选择:</label> |
| | | <div class="col-sm-7"> |
| | | <div id="container" style="height: 500px;" ></div> |
| | | </div> |
| | | <input type="hidden" id="longitude" value="${item.lon}"/> |
| | | <input type="hidden" id="latitude" value="${item.lat}"/> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">参与赛点:</label> |
| | | <div class="col-sm-7"> |
| | | <button onclick="WorldCupInfo.openStore()" disabled>选择门店</button> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label"></label> |
| | | <div class="col-sm-7"> |
| | | <table id="stores"> |
| | | <thead> |
| | | <tr> |
| | | <th>所在省市</th><th>所属运营商</th><th>门店名称</th><th>操作</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">赛事简介</label> |
| | | <div class="col-sm-7"> |
| | | <textarea class="form-control" id="intro" style="height:200px">${item.intro}</textarea> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label head-scu-label">比赛封面图</label> |
| | | <div class="col-sm-2"> |
| | | <div id="coverImgPreId"> |
| | | <div><img width="100px" height="100px" src="${item.coverImg}"></div> |
| | | </div> |
| | | </div> |
| | | <input type="hidden" id="coverImg" value="${item.coverImg}"/> |
| | | <label class="col-sm-1 control-label">首页默认背景图</label> |
| | | <div class="col-sm-2"> |
| | | <div id="homeBackdropImgPreId"> |
| | | <div><img width="100px" height="100px" src="${item.homeBackdropImg}"></div> |
| | | </div> |
| | | </div> |
| | | <input type="hidden" id="homeBackdropImg" value="${item.homeBackdropImg}"/> |
| | | </div> |
| | | <div class="row" id="app1"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label head-scu-label">*比赛图片(请上传不超过五张图片): </label> |
| | | <div class="col-sm-7"> |
| | | <el-upload |
| | | :limit="5" |
| | | class="avatar-uploader" |
| | | action="" |
| | | list-type="picture-card" |
| | | accept="." |
| | | :file-list="imageUrl2" |
| | | :on-remove="handleRemove"> |
| | | <i class="el-icon-plus"></i> |
| | | </el-upload> |
| | | <el-dialog :visible.sync="dialogVisible"> |
| | | <img width="100%" :src="imageUrl1" alt=""> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">比赛详情</label> |
| | | <div class="col-sm-7" style="padding: 0px;"> |
| | | <textarea id="content" style="height: 800px;width: 100%;">${item.content}</textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <script src="${ctxPath}/js/vue/vue.js"></script> |
| | | <script src="${ctxPath}/js/elementui/index.js"></script> |
| | | <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#registrationClosingTime' |
| | | }); |
| | | |
| | | |
| | | |
| | | let id = '${item.infoImg}' |
| | | let obj = [] |
| | | |
| | | var vue2 = new Vue({ |
| | | el: '#app1', |
| | | props: { |
| | | // 数量限制 |
| | | limit: { |
| | | type: Number, |
| | | default: 2 |
| | | }, |
| | | }, |
| | | data: { |
| | | autoUpload: true,//自动上传 |
| | | imageUrl1: '',//模型数据,用于上传图片完成后图片预览 |
| | | imageUrl2: JSON.parse(id), |
| | | dialogVisible: false |
| | | }, |
| | | methods: { |
| | | handleAvatarSuccess(res, file) { |
| | | WorldCupInfo.goodsPicArray1.push({ |
| | | 'name': file.name, |
| | | 'uuid': file.uuid, |
| | | 'url': file.response |
| | | }); |
| | | }, |
| | | changeImg(){ |
| | | var i = id.split(",") |
| | | for (let j = 0; j <i.length; j++) { |
| | | let obj={ |
| | | name:i[j], |
| | | uuid:i[j], |
| | | url:i[j], |
| | | } |
| | | this.imageUrl2.push(obj) |
| | | |
| | | } |
| | | }, |
| | | beforeAvatarUpload(file) { |
| | | const isLt2M = file.size / 1024 / 1024 < 10; |
| | | if (!isLt2M) { |
| | | this.$message.error('上传图片大小不能超过 10MB!'); |
| | | } |
| | | return isLt2M; |
| | | }, |
| | | handleRemove(file, fileList) { |
| | | WorldCupInfo.goodsPicArray1 = WorldCupInfo.goodsPicArray1.filter(item => { |
| | | return item.uid != file.uid; |
| | | }); |
| | | }, |
| | | }, |
| | | created() { |
| | | // this.changeImg() |
| | | WorldCupInfo.goodsPicArray1 = this.imageUrl2 |
| | | }, |
| | | }); |
| | | |
| | | </script> |
| | | @} |
| | |
| | | var editor_2 = null; |
| | | var editor_3 = null; |
| | | var editor_4 = null; |
| | | var editor_5 = null; |
| | | $(function () { |
| | | //初始化编辑器 |
| | | editor_1 = UE.getEditor('editor_1'); |
| | | editor_2 = UE.getEditor('editor_2'); |
| | | editor_3 = UE.getEditor('editor_3'); |
| | | editor_4 = UE.getEditor('editor_4'); |
| | | editor_5 = UE.getEditor('editor_5'); |
| | | }); |
| | | |
| | | function update_1(id){ |
| | |
| | | } |
| | | submitData(editor_4.getContent(),id); |
| | | } |
| | | function update_5(id){ |
| | | if (editor_5.getContentTxt() == ""){ |
| | | Feng.error("内容不能为空!"); |
| | | return; |
| | | } |
| | | submitData(editor_5.getContent(),id); |
| | | } |
| | | |
| | | function submitData(content,id) { |
| | | //提交信息 |
| | |
| | | var carPhoto7 = new $WebUpload("cover7"); |
| | | carPhoto7.setUploadBarId("progressBar"); |
| | | carPhoto7.init(); |
| | | var carPhoto = new $WebUpload("img"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | |
| | | var defaultColunms = TSite.initColumn(); |
| | | var table = new BSTable(TSite.id, "/advertisement/listAll", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TSite.table = table.init(); |
| | | var carPhoto = new $WebUpload("img"); |
| | | carPhoto.setUploadBarId("progressBar"); |
| | | carPhoto.init(); |
| | | |
| | | }); |
New file |
| | |
| | | /** |
| | | * 跨城站点管理管理初始化 |
| | | */ |
| | | var Referee = { |
| | | id: "RefereeTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1, |
| | | picture:"", |
| | | fileUrl:"", |
| | | img:"", |
| | | plan:"", |
| | | goodsPicArray:[], |
| | | validateFields: { |
| | | } |
| | | }; |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | Referee.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', checkbox: true}, |
| | | {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '裁判姓名', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',}, |
| | | {title: '手机号', field: 'phone', visible: true, align: 'center', valign: 'middle',}, |
| | | {title: '所在省市', field: 'province', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function (data) { |
| | | return {1:"正常",2:"冻结",3:"删除"}[data] |
| | | } |
| | | }, |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | Referee.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | Referee.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | /** |
| | | * 商户号认证 |
| | | */ |
| | | Referee.openAddReferee = function () { |
| | | let div = '<div class="ibox-content">\n' + |
| | | ' <div class="form-horizontal" id="carInfoForm1">\n' + |
| | | ' <div class="form-group" >\n' + |
| | | ' <label class="col-sm-3 control-label">*裁判姓名:</label>\n' + |
| | | ' <div class="col-sm-9" style="display: flex;">\n' + |
| | | ' <input class="form-control" id="addName" placeholder="请输入">\n' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' <div class="form-group" >\n' + |
| | | ' <label class="col-sm-3 control-label">*手机号:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <input class="form-control" id="addPhone" placeholder="请输入">' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' <div class="form-group" >\n' + |
| | | ' <label class="col-sm-3 control-label">*所在省:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <select class="form-control" id="addProvince" onchange="Referee.region(\'addCity\', this)"></select>' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' <div class="form-group" >\n' + |
| | | ' <label class="col-sm-3 control-label">*所在市:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <select class="form-control" id="addCity"></select>' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>'; |
| | | layer.open({ |
| | | type: 1 |
| | | ,title: '添加裁判' |
| | | ,area: ['500px', '350px'] |
| | | ,shade: 0 |
| | | ,content: div |
| | | ,btn: ['保存', '关闭'] //只是为了演示 |
| | | ,yes: function(){ |
| | | let addName = $('#addName').val(); |
| | | let addPhone = $('#addPhone').val(); |
| | | let addProvince = $('#addProvince').val(); |
| | | let addCity = $('#addCity').val(); |
| | | if(null == addName || '' == addName){ |
| | | Feng.info("裁判姓名不能为空"); |
| | | return |
| | | } |
| | | if(null == addPhone || '' == addPhone){ |
| | | Feng.info("手机号不能为空"); |
| | | return |
| | | } |
| | | if(null == addProvince || '' == addProvince){ |
| | | Feng.info("请选择所在省"); |
| | | return |
| | | } |
| | | if(null == addCity || '' == addCity){ |
| | | Feng.info("请选择所在市"); |
| | | return |
| | | } |
| | | var ajax = new $ax(Feng.ctxPath + "/referee/addReferee", function (res) { |
| | | if(res.code == 200){ |
| | | Feng.success("添加成功"); |
| | | layer.closeAll(); |
| | | Referee.table.refresh(); |
| | | }else{ |
| | | Feng.error(res.msg); |
| | | } |
| | | }, function (data) { |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.setData({ |
| | | 'name': addName, |
| | | 'phone': addPhone, |
| | | 'provinceCode': addProvince, |
| | | 'cityCode': addCity |
| | | }); |
| | | ajax.start(); |
| | | } |
| | | ,btn2: function(){ |
| | | layer.closeAll(); |
| | | } |
| | | ,success: function(){ |
| | | Referee.region('addProvince', null); |
| | | } |
| | | ,end: function(){ |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | }; |
| | | /** |
| | | * 编辑 |
| | | */ |
| | | Referee.openEditReferee = function () { |
| | | if(this.check()){ |
| | | let div = '<div class="ibox-content">\n' + |
| | | ' <div class="form-horizontal" id="carInfoForm1">\n' + |
| | | ' <input id="editId" type="hidden">' + |
| | | ' <div class="form-group" >\n' + |
| | | ' <label class="col-sm-3 control-label">*裁判姓名:</label>\n' + |
| | | ' <div class="col-sm-9" style="display: flex;">\n' + |
| | | ' <input class="form-control" id="addName" placeholder="请输入">\n' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' <div class="form-group" >\n' + |
| | | ' <label class="col-sm-3 control-label">*手机号:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <input class="form-control" id="addPhone" placeholder="请输入">' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' <div class="form-group" >\n' + |
| | | ' <label class="col-sm-3 control-label">*所在省:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <select class="form-control" id="addProvince" onchange="Referee.region(\'addCity\', this)"></select>' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' <div class="form-group" >\n' + |
| | | ' <label class="col-sm-3 control-label">*所在市:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <select class="form-control" id="addCity"></select>' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>'; |
| | | layer.open({ |
| | | type: 1 |
| | | , title: '编辑裁判' |
| | | , area: ['500px', '350px'] |
| | | , shade: 0 |
| | | , content: div |
| | | , btn: ['保存', '关闭'] //只是为了演示 |
| | | , yes: function () { |
| | | let editId = $('#editId').val(); |
| | | let addName = $('#addName').val(); |
| | | let addPhone = $('#addPhone').val(); |
| | | let addProvince = $('#addProvince').val(); |
| | | let addCity = $('#addCity').val(); |
| | | if (null == addName || '' == addName) { |
| | | Feng.info("裁判姓名不能为空"); |
| | | return |
| | | } |
| | | if (null == addPhone || '' == addPhone) { |
| | | Feng.info("手机号不能为空"); |
| | | return |
| | | } |
| | | if (null == addProvince || '' == addProvince) { |
| | | Feng.info("请选择所在省"); |
| | | return |
| | | } |
| | | if (null == addCity || '' == addCity) { |
| | | Feng.info("请选择所在市"); |
| | | return |
| | | } |
| | | var ajax = new $ax(Feng.ctxPath + "/referee/editReferee", function (res) { |
| | | if (res.code == 200) { |
| | | Feng.success("编辑成功"); |
| | | layer.closeAll(); |
| | | Referee.table.refresh(); |
| | | } else { |
| | | Feng.error(res.msg); |
| | | } |
| | | }, function (data) { |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.setData({ |
| | | 'id': editId, |
| | | 'name': addName, |
| | | 'phone': addPhone, |
| | | 'provinceCode': addProvince, |
| | | 'cityCode': addCity |
| | | }); |
| | | ajax.start(); |
| | | } |
| | | , btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | , success: function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/referee/getReferee", function (res) { |
| | | let referee = res.referee; |
| | | let province = res.province; |
| | | let city = res.city; |
| | | let html1 = '<option value="">请选择</option>'; |
| | | for (let i = 0; i < province.length; i++) { |
| | | html1 += '<option value="' + province[i].code + '">' + province[i].name + '</option>' |
| | | } |
| | | $('#addProvince').html(html1); |
| | | let html2 = '<option value="">请选择</option>'; |
| | | for (let i = 0; i < city.length; i++) { |
| | | html2 += '<option value="' + city[i].code + '">' + city[i].name + '</option>' |
| | | } |
| | | $('#addCity').html(html2); |
| | | |
| | | $('#editId').val(referee.id); |
| | | $('#addName').val(referee.name); |
| | | $('#addPhone').val(referee.phone); |
| | | $('#addProvince').val(referee.provinceCode); |
| | | $('#addCity').val(referee.cityCode); |
| | | }, function (data) { |
| | | Feng.error("获取失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.setData({ |
| | | 'id': Referee.seItem.id |
| | | }); |
| | | ajax.start(); |
| | | } |
| | | , end: function () { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | Referee.delReferee = function (){ |
| | | if(this.check()){ |
| | | var operation = function(){ |
| | | var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) { |
| | | if (res.code == 200) { |
| | | Feng.success("删除成功"); |
| | | layer.closeAll(); |
| | | Referee.table.refresh(); |
| | | } else { |
| | | Feng.error(res.msg); |
| | | } |
| | | }, function (data) { |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.setData({ |
| | | 'id': Referee.seItem.id, |
| | | 'state': 3 |
| | | }); |
| | | ajax.start(); |
| | | }; |
| | | Feng.confirm("是否删除裁判:" + Referee.seItem.name + "?",operation); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 上架 |
| | | */ |
| | | Referee.onShelf = function () { |
| | | if(this.check()){ |
| | | var operation = function(){ |
| | | var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) { |
| | | if (res.code == 200) { |
| | | Feng.success("删除成功"); |
| | | layer.closeAll(); |
| | | Referee.table.refresh(); |
| | | } else { |
| | | Feng.error(res.msg); |
| | | } |
| | | }, function (data) { |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.setData({ |
| | | 'id': Referee.seItem.id, |
| | | 'state': 1 |
| | | }); |
| | | ajax.start(); |
| | | }; |
| | | Feng.confirm("是否解冻裁判:" + Referee.seItem.name + "?",operation); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 下架 |
| | | */ |
| | | Referee.offShelf = function () { |
| | | if(this.check()){ |
| | | var operation = function(){ |
| | | var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) { |
| | | if (res.code == 200) { |
| | | Feng.success("删除成功"); |
| | | layer.closeAll(); |
| | | Referee.table.refresh(); |
| | | } else { |
| | | Feng.error(res.msg); |
| | | } |
| | | }, function (data) { |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.setData({ |
| | | 'id': Referee.seItem.id, |
| | | 'state': 2 |
| | | }); |
| | | ajax.start(); |
| | | }; |
| | | Feng.confirm("是否冻结裁判:" + Referee.seItem.name + "?",operation); |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | Referee.region = function (node, e){ |
| | | let pcode = null; |
| | | if(null != e){ |
| | | pcode = $(e).val(); |
| | | } |
| | | var ajax = new $ax(Feng.ctxPath + "/region/getRegion", function (res) { |
| | | let html = '<option value="">请选择</option>'; |
| | | for (let i = 0; i < res.length; i++) { |
| | | html += '<option value="' + res[i].code + '">' + res[i].name + '</option>'; |
| | | } |
| | | $('#' + node).html(html) |
| | | }, function (data) { |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.setData({ |
| | | 'pcode': pcode |
| | | }); |
| | | ajax.start(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | Referee.close = function() { |
| | | parent.layer.close(window.parent.Referee.layerIndex); |
| | | }; |
| | | |
| | | Referee.search = function () { |
| | | var queryData = {}; |
| | | queryData['userName'] = $("#name").val(); |
| | | queryData['phone'] =$("#phone").val(); |
| | | queryData['provinceCode'] =$("#provinceCode").val(); |
| | | queryData['cityCode'] =$("#cityCode").val(); |
| | | Referee.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | Referee.resetSearch = function () { |
| | | $("#name").val(""); |
| | | $("#phone").val(""); |
| | | $("#provinceCode").val(""); |
| | | $("#cityCode").val(""); |
| | | Referee.search(); |
| | | }; |
| | | |
| | | $(function () { |
| | | var defaultColunms = Referee.initColumn(); |
| | | var table = new BSTable(Referee.id, "/referee/listAll", defaultColunms); |
| | | table.setPaginationType("server"); |
| | | Referee.table = table.init(); |
| | | |
| | | Referee.region('provinceCode', null); |
| | | }); |
cloud-server-management/src/main/webapp/static/modular/system/tHonor/THonor.js
cloud-server-management/src/main/webapp/static/modular/system/worldCup/store.js
cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js
cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup_info.js
cloud-server-other/src/main/java/com/dsh/other/controller/BallController.java
cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java
cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java
cloud-server-other/src/main/java/com/dsh/other/controller/HomeModuleController.java
cloud-server-other/src/main/java/com/dsh/other/controller/HonorController.java
cloud-server-other/src/main/java/com/dsh/other/controller/HonorRulesController.java
cloud-server-other/src/main/java/com/dsh/other/controller/ProtocolController.java
cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java
cloud-server-other/src/main/java/com/dsh/other/controller/StoreController.java
cloud-server-other/src/main/java/com/dsh/other/entity/HomeModule.java
cloud-server-other/src/main/java/com/dsh/other/entity/HonorRules.java
cloud-server-other/src/main/java/com/dsh/other/entity/Site.java
cloud-server-other/src/main/java/com/dsh/other/entity/SiteBooking.java
cloud-server-other/src/main/java/com/dsh/other/feignclient/account/StudentHonorClient.java
cloud-server-other/src/main/java/com/dsh/other/feignclient/account/model/StudentHonor.java
cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/WorldCupStoreClient.java
cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/model/WorldCupStore.java
cloud-server-other/src/main/java/com/dsh/other/feignclient/model/StuMedalVo.java
cloud-server-other/src/main/java/com/dsh/other/mapper/HomeModuleMapper.java
cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java
cloud-server-other/src/main/java/com/dsh/other/model/vo/honorVo/EditHonorVO.java
cloud-server-other/src/main/java/com/dsh/other/service/IHomeModuleService.java
cloud-server-other/src/main/java/com/dsh/other/service/impl/HomeModuleServiceImpl.java
cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
cloud-server-other/src/main/java/com/dsh/other/util/TaskUtil.java
cloud-server-other/src/main/resources/mapper/GameMapper.xml
cloud-server-other/src/main/resources/mapper/HomeModuleMapper.xml
cloud-server-other/src/main/resources/mapper/SiteMapper.xml |